Skip to content
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

Merged

Conversation

abhinandan13jan
Copy link
Contributor

@abhinandan13jan abhinandan13jan commented Apr 7, 2020

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:

  1. Creates a new Route /cloudshell to load Terminal as a full page component at this URL.
  2. Creates a new CloudshellTab component with holds the Terminal and exposes it over the given route.

To Do

  1. Add Unit tests ✔️
  2. Comment out CloudShellIcon from mastheadToolbar. ✔️

ScreenShots

cst1
cst2

Unit Test

CloudShellTab.spec.tsx

Broswer conformance

Chrome 73

How to Review

  • Setup che-workspace-controller on cluster
  1. clone repo https://github.com/che-incubator/che-workspace-operator
    Run the following commands from repo root
  2. export IMG=quay.io/che-incubator/che-workspace-controller:nightly
  3. export TOOL=oc # Use 'export TOOL=kubectl' for kubernetes
  4. make deploy
  • Uncomment the import and addition of CloudShellMastHeadIcon in masthead-toolbar.jsx at line 27 and 578

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. component/core Related to console core functionality labels Apr 7, 2020
@abhinandan13jan abhinandan13jan changed the title [WIP] Feat(CLI-terminal): Open terminal in new Tab Feat(CLI-terminal): Open terminal in new Tab Apr 8, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 8, 2020
@abhinandan13jan abhinandan13jan force-pushed the terminal-tab branch 2 times, most recently from c30f4f9 to 2058a46 Compare April 13, 2020 10:01
@@ -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
Copy link
Contributor

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 = () => {
Copy link
Contributor

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';
Copy link
Contributor

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 }}>
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

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}]} ?

Copy link
Contributor Author

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'] }]}>
Copy link
Contributor

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', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comments.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this

@abhinandan13jan abhinandan13jan force-pushed the terminal-tab branch 3 times, most recently from a934b61 to 1b375d6 Compare April 13, 2020 14:25
return (
<Flex breakpointMods={[{ modifier: FlexModifiers.grow }]}>
<FlexItem>
<span data-test-id="terminal-tab-header">Openshift command Line Terminal</span>
Copy link
Contributor

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?

Copy link
Contributor Author

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.

width: 100%;
height: 100%;
overflow: hidden;
background-color: #000;
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Comment on lines 6 to 7
const CloudShellTab = () => {
return (
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Comment on lines 5 to 6
const CloudShellTabHeader = () => {
return (
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@andrewballantyne
Copy link
Contributor

/kind feature

@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 16, 2020
@@ -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} />
Copy link
Contributor

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:

Suggested change
<Route path="/cloudshell" component={CloudShellTab} />
<Route path="/terminal" component={CloudShellTab} />

@@ -0,0 +1,16 @@
.co-cloud-shell-tab {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.co-cloud-shell-tab {
.co-cloud-shell-tab {
display: flex;
flex-direction: column;

Copy link
Contributor Author

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 {
Copy link
Contributor

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.

Suggested change
&__header {
&__header {
flex-shrink: 0;

Copy link
Contributor Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
padding-left: var(--pf-global--spacer--md);
padding: 0 var(--pf-global--spacer--md);

Copy link
Contributor Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
height: var(--pf-global--target-size--MinHeight);
min-height: var(--pf-global--target-size--MinHeight);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Comment on lines 13 to 15
&__restorelink {
color: var(--pf-global--primary-color--100);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Comment on lines 8 to 10
<div className="co-cloud-shell-tab__header">
<CloudShellTabHeader />
</div>
Copy link
Contributor

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.

Suggested change
<div className="co-cloud-shell-tab__header">
<CloudShellTabHeader />
</div>
<div className="co-cloud-shell-tab__header">OpenShift command line terminal</div>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@christianvogt
Copy link
Contributor

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 17, 2020
@openshift-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 17, 2020
@spadgett
Copy link
Member

/hold
for #5100

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 17, 2020
@spadgett
Copy link
Member

/hold cancel
/retest

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 17, 2020
@openshift-merge-robot openshift-merge-robot merged commit b1729dd into openshift:master Apr 18, 2020
@spadgett spadgett added this to the v4.5 milestone Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants