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
Feat(CLI-terminal): Open terminal in new Tab #4946
Feat(CLI-terminal): Open terminal in new Tab #4946
Conversation
5c62097
to
575dab1
Compare
c30f4f9
to
2058a46
Compare
@@ -35,8 +35,8 @@ const CloudShellDrawer: React.FC<CloudShellDrawerProps> = ({ children, onClose } | |||
<Button | |||
variant="plain" | |||
component="a" | |||
href="/cloudshell" | |||
// change this once we can open terminal in new tab |
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.
Remove this comment.
import './CloudShellTab.scss'; | ||
|
||
const CloudShellTabHeader = () => { | ||
// const onClose = () => { |
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.
Remove comments.
@@ -0,0 +1,33 @@ | |||
import * as React from 'react'; | |||
import { Flex, FlexItem } from '@patternfly/react-core'; | |||
// import { FlexModifiers, Button } from '@patternfly/react-core'; |
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.
Remove comments.
// window.close(); | ||
// }; | ||
return ( | ||
<Flex style={{ flexGrow: 1 }}> |
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.
Use flex modifiers prop instead of style - https://www.patternfly.org/v4/documentation/react/layouts/flex
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.
@rohitkrai03 This portion is same as that in the CloudShellDrawerHeader
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.
@abhinandan13jan What is the need to specify the style like this in both the cases? Wouldn't this work - breakpointMods={[{modifier: FlexModifiers.grow}]}
?
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, it works...updated..thanks
<FlexItem> | ||
<span data-test-id="terminal-tab-header">Openshift command Line Terminal</span> | ||
</FlexItem> | ||
{/* <FlexItem breakpointMods={[{ modifier: FlexModifiers['align-right'] }]}> |
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.
Remove comments.
'Openshift command Line Terminal', | ||
); | ||
}); | ||
// it('should render restore button', () => { |
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.
Remove comments.
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.
All the commented out portions are to be brought back.. these are being temporarily hidden till we work on the session thing.
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'll update the comments with the note
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.
Well, I would prefer no code instead of commented out code anyways. You can easily go back in git history and get the code back when needed.
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.
Updated this
a934b61
to
1b375d6
Compare
return ( | ||
<Flex breakpointMods={[{ modifier: FlexModifiers.grow }]}> | ||
<FlexItem> | ||
<span data-test-id="terminal-tab-header">Openshift command Line Terminal</span> |
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.
Casing isn't consistent. Also it's spelt OpenShift.
Why a flex when there is only a single piece of text?
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'll correct the Case of the text,
The Flex is there as it had a RestoreLink
FlexItem to the right. Also, we'll have to add it back again.
1b375d6
to
472ed96
Compare
width: 100%; | ||
height: 100%; | ||
overflow: hidden; | ||
background-color: #000; |
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 we use pf variables for background-color
as well
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.
updated
const CloudShellTab = () => { | ||
return ( |
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 we avoid explicit return statement
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.
updated
const CloudShellTabHeader = () => { | ||
return ( |
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 we avoid explicit return statement and have type React.FC
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.
updated
472ed96
to
8632b63
Compare
/kind feature |
frontend/public/components/app.jsx
Outdated
@@ -227,7 +227,10 @@ if ('serviceWorker' in navigator) { | |||
render( | |||
<Provider store={store}> | |||
<Router history={history} basename={window.SERVER_FLAGS.basePath}> | |||
<Route path="/" component={App} /> | |||
<Switch> | |||
<Route path="/cloudshell" 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.
UX doesn't want terminology of cloud shell used anywhere. Use terminal instead:
<Route path="/cloudshell" component={CloudShellTab} /> | |
<Route path="/terminal" component={CloudShellTab} /> |
@@ -0,0 +1,16 @@ | |||
.co-cloud-shell-tab { |
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.
.co-cloud-shell-tab { | |
.co-cloud-shell-tab { | |
display: flex; | |
flex-direction: column; |
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.
updated
height: 100%; | ||
overflow: hidden; | ||
background-color: var(--pf-global--Color--dark-100); | ||
&__header { |
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 styling should be applied to the CloudShellTabHeader
instead of here.
&__header { | |
&__header { | |
flex-shrink: 0; |
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.
updated..Removed CloudShellheader
background-color: var(--pf-global--palette--black-200); | ||
display: flex; | ||
align-items: center; | ||
padding-left: var(--pf-global--spacer--md); |
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.
padding-left: var(--pf-global--spacer--md); | |
padding: 0 var(--pf-global--spacer--md); |
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.
updated
overflow: hidden; | ||
background-color: var(--pf-global--Color--dark-100); | ||
&__header { | ||
height: var(--pf-global--target-size--MinHeight); |
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.
height: var(--pf-global--target-size--MinHeight); | |
min-height: var(--pf-global--target-size--MinHeight); |
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.
updated
&__restorelink { | ||
color: var(--pf-global--primary-color--100); | ||
} |
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.
Remove.
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.
updated
<div className="co-cloud-shell-tab__header"> | ||
<CloudShellTabHeader /> | ||
</div> |
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 you can simplify the header to the following and remove CloudShellTabHeader
.
<div className="co-cloud-shell-tab__header"> | |
<CloudShellTabHeader /> | |
</div> | |
<div className="co-cloud-shell-tab__header">OpenShift command line terminal</div> |
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.
updated
8632b63
to
ff7293a
Compare
ff7293a
to
8df6980
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abhinandan13jan, christianvogt The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold |
/hold cancel |
Feature:
https://issues.redhat.com/browse/ODC-3056
The restore link has been removed after discussion with UX
This PR doesn't handle the session management for cloudshell terminal
Analysis / Root cause:
Launch Cloudshell in new Tab
Solution Description:
/cloudshell
to load Terminal as a full page component at this URL.CloudshellTab
component with holds the Terminal and exposes it over the given route.To Do
ScreenShots
Unit Test
CloudShellTab.spec.tsx
Broswer conformance
Chrome 73
How to Review
Run the following commands from repo root