-
Notifications
You must be signed in to change notification settings - Fork 593
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
Add optional rootWindow option to route plugin #5645
Conversation
Signed-off-by: yaacov <kobi.zamir@gmail.com>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yaacov The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@spadgett @vojtechszocs @glekner please review |
/test e2e-gcp-console |
@@ -187,6 +187,16 @@ const plugin: Plugin<ConsumedExtensions> = [ | |||
}, | |||
}, | |||
}, | |||
{ |
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.
Can you demonstrate this new functionality by migrating the /terminal
route instead of creating a test route?
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.
Nice 👍
For this PR I want to have smallest footprint, a simple route show how to use it while adding minimal code ... maybe we can do a variant of the VNC terminal PR that use this plugin option ?
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.
Agreed with @glekner - if we're introducing a mechanism to support "full screen" pages (rendered outside the standard Console <App>
layout) then we should also refactor existing code to utilize this mechanism for better consistency.
Right now, our React router has two top-level routes:
<Route path="/terminal" component={CloudShellTab} />
<Route path="/" component={App} />
@yaacov @spadgett @christianvogt Does it make sense to move "cloud shell" (<CloudShellExec>
/ xterm
based CLI) functionality to one of the existing Console packages?
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.
Yes let's convert the cloud shell to use this 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.
This is Great!
@@ -187,6 +187,16 @@ const plugin: Plugin<ConsumedExtensions> = [ | |||
}, | |||
}, | |||
}, | |||
{ |
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.
Agreed with @glekner - if we're introducing a mechanism to support "full screen" pages (rendered outside the standard Console <App>
layout) then we should also refactor existing code to utilize this mechanism for better consistency.
Right now, our React router has two top-level routes:
<Route path="/terminal" component={CloudShellTab} />
<Route path="/" component={App} />
@yaacov @spadgett @christianvogt Does it make sense to move "cloud shell" (<CloudShellExec>
/ xterm
based CLI) functionality to one of the existing Console packages?
@@ -63,6 +63,8 @@ namespace ExtensionProperties { | |||
path: string | string[]; | |||
/** Perspective id to which this page belongs to. */ | |||
perspective?: string; | |||
/** rootWindow indicate rendering as root window instead of layout content. */ |
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.
/** rootWindow indicate rendering as root window instead of layout content. */ | |
/** Whether to render this page outside the standard Console page layout. */ |
@@ -99,6 +100,15 @@ const getPluginPageRoutes = (activePerspective: string, flags: FlagsObject) => | |||
return <Component {...r.properties} key={Array.from(r.properties.path).join(',')} />; | |||
}); | |||
|
|||
const getPluginRootWindowRoutes = () => | |||
plugins.registry.getRoutePages().map((r) => { |
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.
plugins.registry.getRoutePages().map((r) => { | |
plugins.registry.getRoutePages() | |
.filter((r) => r.properties?.rootWindow) | |
.map((r) => { |
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.
Let's move to useExtensions
@@ -99,6 +100,15 @@ const getPluginPageRoutes = (activePerspective: string, flags: FlagsObject) => | |||
return <Component {...r.properties} key={Array.from(r.properties.path).join(',')} />; | |||
}); | |||
|
|||
const getPluginRootWindowRoutes = () => |
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.
const getPluginRootWindowRoutes = () => | |
const getPluginTopLevelRoutes = () => |
@@ -63,6 +63,8 @@ namespace ExtensionProperties { | |||
path: string | string[]; | |||
/** Perspective id to which this page belongs to. */ | |||
perspective?: string; | |||
/** rootWindow indicate rendering as root window instead of layout content. */ | |||
rootWindow?: boolean; |
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 rootWindow
is a bit ambiguous. Maybe noLayout
?
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.
Honestly i don't think a concise variable name will be descriptive enough.
IMO I'd suggest root?: boolean
as rootWindow
doesn't provide any more description than the other.
OR to make it even more useful for other uses, we could do context?: string
and let the consumer of the extension supply the context.
@@ -99,6 +100,15 @@ const getPluginPageRoutes = (activePerspective: string, flags: FlagsObject) => | |||
return <Component {...r.properties} key={Array.from(r.properties.path).join(',')} />; | |||
}); | |||
|
|||
const getPluginRootWindowRoutes = () => | |||
plugins.registry.getRoutePages().map((r) => { |
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.
Let's move to useExtensions
@@ -215,6 +215,7 @@ render( | |||
<Provider store={store}> | |||
<Router history={history} basename={window.SERVER_FLAGS.basePath}> | |||
<Switch> | |||
{getPluginRootWindowRoutes()} | |||
<Route path="/terminal" component={CloudShellTab} /> |
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.
Convert /terminal
to use this new extension.
@@ -63,6 +63,8 @@ namespace ExtensionProperties { | |||
path: string | string[]; | |||
/** Perspective id to which this page belongs to. */ | |||
perspective?: string; | |||
/** rootWindow indicate rendering as root window instead of layout content. */ | |||
rootWindow?: boolean; |
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.
Honestly i don't think a concise variable name will be descriptive enough.
IMO I'd suggest root?: boolean
as rootWindow
doesn't provide any more description than the other.
OR to make it even more useful for other uses, we could do context?: string
and let the consumer of the extension supply the context.
@@ -187,6 +187,16 @@ const plugin: Plugin<ConsumedExtensions> = [ | |||
}, | |||
}, | |||
}, | |||
{ |
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.
Yes let's convert the cloud shell to use this extension.
@yaacov: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This request was initiated to help with the VNC viewer PR, that is now low priority for us, |
Description
Add an optional option to render routes in root window instead of inside the layout.
Rational
Some plugin and currently internal views can benefit from "full screen" views.
Current use cases
For the
kubevirt-plugin
we want to render the VNC terminal using a detached window [1] [2] , having the possibility to add a "full screen" route in the plugin. will give us the option to maintaine the VNC console without the need to mange the hard coded route in the common app.We currently have a
/terminal
path hard-coded to the app root paths, this approach can give developers the option to move the terminal view into a plugin structure if they will want to.IMHO
oc terminal view
andVNC console view
are just examples for a common need, maybe other users can think of other use cases like a "full screen" topology or monitoring views ?Example
Route with
rootWindow: true
Screenshot
[1] RFE: https://bugzilla.redhat.com/show_bug.cgi?id=1837677
[2] #5593