-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: navigating to extension page #1361
Conversation
Signed-off-by: Roman <ixrock@gmail.com>
Signed-off-by: Roman <ixrock@gmail.com>
@@ -45,11 +45,12 @@ export class LensExtension { | |||
} | |||
|
|||
getPageUrl(baseUrl = "") { | |||
return compile(this.routePrefix)({ name: this.name }) + baseUrl; | |||
const validUrlName = this.name.replace("@", "").replace("/", "-"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a uniqueness requirement for the name? This would have to be part of that because @foo
would clash with one already named foo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't clash since when package name with @
the format is @org/package-name
, not just @some-name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be OK because I don't think @fred
is a valid package name on NPM (and hopefully not on other registries like GH). You'd have to have a package name too, like @fred/fred
, which would become fred-fred
here, and wouldn't conflict with a package published as just fred
(without a scope).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see it is unlikely but it's theoretically possible to have mirantis-foo and @mirantis/foo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference now between getPageUrl
and getPageRoute
? To me they look identical 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are the same when no additional (suffix) route provided for the page:
export class PageRegistry<T extends PageRegistration> extends BaseRegistry<T> {
getItems() {
return super.getItems().map(item => {
item.routePath = item.extension.getPageRoute(item.routePath)
return item
});
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is baseRoute
of page-item, not baseRoute
of extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to me it looks like this.getPageUrl('foo')
returns the same as this.getPageRoute('foo')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, now I see what you mean.. Both functions are similar but for different purposes..
Will refactor..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jakolehm PTAL, also fixed proper sub-pages route-paths and sub-menus urls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried it out with lens-extension-cc repo, LGTM
Thanks for doing that, @jim-docker ! Glad to know it will work. 😄 |
Signed-off-by: Roman <ixrock@gmail.com>
Signed-off-by: Roman <ixrock@gmail.com>
Closing in favour #1364 |
Proper handling extension page base route.
Fixes:
/extension/lens-hello-world
@
removed,/
=>-
)Signed-off-by: Roman ixrock@gmail.com