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:
parent
d45a289b4f
commit
adc7f5f565
@ -82,14 +82,6 @@ describe("globalPageRegistry", () => {
|
|||||||
expect(page.id).toEqual("test-page")
|
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", () => {
|
it("returns null if target not found", () => {
|
||||||
const page = globalPageRegistry.getByPageMenuTarget({
|
const page = globalPageRegistry.getByPageMenuTarget({
|
||||||
pageId: "wrong-page",
|
pageId: "wrong-page",
|
||||||
|
|||||||
@ -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
|
* When not provided, first registered page without "id" would be used for page-menus without target.pageId for same extension
|
||||||
*/
|
*/
|
||||||
id?: string;
|
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
|
* 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,
|
* 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 => ({
|
registeredPages = items.map(page => ({
|
||||||
...page,
|
...page,
|
||||||
extensionId: ext.name,
|
extensionId: ext.name,
|
||||||
routePath: getExtensionPageUrl({ extensionId: ext.name, pageId: page.id }),
|
routePath: getExtensionPageUrl({ extensionId: ext.name, pageId: page.id ?? page.routePath }),
|
||||||
}))
|
}))
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(`[EXTENSION]: page-registration failed`, {
|
logger.error(`[EXTENSION]: page-registration failed`, {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user