1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

clean up test, deprecate page.routePath

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2020-11-16 14:05:16 +02:00
parent d45a289b4f
commit adc7f5f565
2 changed files with 6 additions and 9 deletions

View File

@ -82,14 +82,6 @@ describe("globalPageRegistry", () => {
expect(page.id).toEqual("test-page")
})
it("returns matching page", () => {
const page = globalPageRegistry.getByPageMenuTarget({
pageId: "test-page",
extensionId: ext.name
})
expect(page.id).toEqual("test-page")
})
it("returns null if target not found", () => {
const page = globalPageRegistry.getByPageMenuTarget({
pageId: "wrong-page",

View File

@ -15,6 +15,11 @@ export interface PageRegistration {
* When not provided, first registered page without "id" would be used for page-menus without target.pageId for same extension
*/
id?: string;
/**
* Alias to page ID which assume to be used as path with possible :param placeholders
* @deprecated
*/
routePath?: string;
/**
* Strict route matching to provided page-id, read also: https://reactrouter.com/web/api/NavLink/exact-bool
* In case when more than one page registered at same extension "pageId" is required to identify different pages,
@ -62,7 +67,7 @@ export class PageRegistry extends BaseRegistry<PageRegistration, RegisteredPage>
registeredPages = items.map(page => ({
...page,
extensionId: ext.name,
routePath: getExtensionPageUrl({ extensionId: ext.name, pageId: page.id }),
routePath: getExtensionPageUrl({ extensionId: ext.name, pageId: page.id ?? page.routePath }),
}))
} catch (err) {
logger.error(`[EXTENSION]: page-registration failed`, {