Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat(CLI-terminal): Open terminal in new Tab
- Loading branch information
1 parent
61c0b63
commit c30f4f9
Showing
7 changed files
with
101 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
frontend/packages/console-app/src/components/cloud-shell/CloudShellTab.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.co-cloud-shell-tab { | ||
width: 100%; | ||
height: 100%; | ||
overflow: hidden; | ||
background-color: #000; | ||
&__header { | ||
height: var(--pf-global--target-size--MinHeight); | ||
background-color: var(--pf-global--palette--black-200); | ||
display: flex; | ||
align-items: center; | ||
padding-left: var(--pf-global--spacer--md); | ||
} | ||
&__restorelink { | ||
color: var(--pf-global--primary-color--100); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
frontend/packages/console-app/src/components/cloud-shell/CloudShellTab.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as React from 'react'; | ||
import CloudShellTerminal from './CloudShellTerminal'; | ||
import CloudShellTabHeader from './CloudShellTabHeader'; | ||
import './CloudShellTab.scss'; | ||
|
||
const CloudShellTab = () => { | ||
return ( | ||
<div className="co-cloud-shell-tab"> | ||
<div className="co-cloud-shell-tab__header"> | ||
<CloudShellTabHeader /> | ||
</div> | ||
<CloudShellTerminal /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CloudShellTab; |
32 changes: 32 additions & 0 deletions
32
frontend/packages/console-app/src/components/cloud-shell/CloudShellTabHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as React from 'react'; | ||
import { Flex, FlexItem, FlexModifiers, Button } from '@patternfly/react-core'; | ||
import { AngleLeftIcon } from '@patternfly/react-icons'; | ||
import './CloudShellTab.scss'; | ||
|
||
const CloudShellTabHeader = () => { | ||
const onClose = () => { | ||
window.opener = null; | ||
window.open('', '_self'); | ||
window.close(); | ||
}; | ||
return ( | ||
<Flex style={{ flexGrow: 1 }}> | ||
<FlexItem> | ||
<span data-test-id="terminal-tab-header">Openshift command Line Terminal</span> | ||
</FlexItem> | ||
<FlexItem breakpointMods={[{ modifier: FlexModifiers['align-right'] }]}> | ||
<Button | ||
variant="plain" | ||
aria-label="restore terminal in openshift console" | ||
onClick={onClose} | ||
> | ||
<span className="co-cloud-shell-tab__restorelink" data-test-id="restore-terminal-link"> | ||
<AngleLeftIcon /> Restore terminal in OpenShift Console | ||
</span> | ||
</Button> | ||
</FlexItem> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default CloudShellTabHeader; |
2 changes: 2 additions & 0 deletions
2
frontend/packages/console-app/src/components/cloud-shell/CloudShellTerminalFrame.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
frontend/packages/console-app/src/components/cloud-shell/__tests__/CloudShellTab.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { Provider } from 'react-redux'; | ||
import store from '@console/internal/redux'; | ||
import CloudShellTab from '../CloudShellTab'; | ||
import CloudShellTerminal from '../CloudShellTerminal'; | ||
|
||
describe('CloudShell Tab Test', () => { | ||
const cloudShellTabWrapper = mount(<CloudShellTab />, { | ||
wrappingComponent: ({ children }) => <Provider store={store}>{children}</Provider>, | ||
}); | ||
it('should render correct title', () => { | ||
expect(cloudShellTabWrapper.find('[data-test-id="terminal-tab-header"]').exists()).toBe(true); | ||
expect(cloudShellTabWrapper.find('[data-test-id="terminal-tab-header"]').text()).toEqual( | ||
'Openshift command Line Terminal', | ||
); | ||
}); | ||
it('should render restore button', () => { | ||
expect(cloudShellTabWrapper.find('[data-test-id="restore-terminal-link"]').exists()).toBe(true); | ||
expect(cloudShellTabWrapper.find('[data-test-id="restore-terminal-link"]').text()).toEqual( | ||
' Restore terminal in OpenShift Console', | ||
); | ||
}); | ||
it('should render cloudshellterminal', () => { | ||
expect(cloudShellTabWrapper.find(CloudShellTerminal).exists()).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters