@@ -4,7 +4,7 @@ import styles from './commands.module.scss';
44import PageLayout from 'components/basic/PageLayout/PageLayout' ;
55import withPopup , { PopupContext } from 'contexts/withPopup/withPopup' ;
66import { V1PodList } from '@kubernetes/client-node' ;
7- import withDevSpaceConfig , { DevSpaceConfigContext } from 'contexts/withDevSpaceConfig/withDevSpaceConfig' ;
7+ import withDevSpaceConfig , { Command , DevSpaceConfigContext } from 'contexts/withDevSpaceConfig/withDevSpaceConfig' ;
88import withWarning , { WarningContext } from 'contexts/withWarning/withWarning' ;
99import CommandsLinkTabSelector from 'components/basic/LinkTabSelector/CommandsLinkTabSelector/CommandsLinkTabSelector' ;
1010import CommandsList , { getURLByName } from 'components/views/Commands/Commands/CommandsList/CommandsList' ;
@@ -83,14 +83,16 @@ class Commands extends React.PureComponent<Props, State> {
8383 ) ) ;
8484 } ;
8585
86- render ( ) {
87- let commands = this . props . devSpaceConfig . config . commands ;
86+ getVisibleCommands ( commands : { [ key : string ] : Command } ) {
8887 if ( this . state . showInternal === false ) {
89- commands = Object . fromEntries ( Object . entries ( commands ) . filter ( ( [ _key , config ] ) => {
88+ return Object . fromEntries ( Object . entries ( commands ) . filter ( ( [ _key , config ] ) => {
9089 return config . internal !== true
9190 } ) )
9291 }
92+ return commands ;
93+ }
9394
95+ render ( ) {
9496 return (
9597 < PageLayout className = { styles [ 'commands-component' ] } heading = { < CommandsLinkTabSelector /> } >
9698 { ! this . props . devSpaceConfig . config ||
@@ -123,7 +125,7 @@ class Commands extends React.PureComponent<Props, State> {
123125
124126 < div className = { styles [ 'info-part' ] } style = { { overflowY : 'auto' } } >
125127 < CommandsList
126- commandsList = { commands }
128+ commandsList = { this . getVisibleCommands ( this . props . devSpaceConfig . config . commands ) }
127129 running = { this . state . terminals . map ( ( terminal ) => terminal . url ) }
128130 selected = { this . state . selected }
129131 onSelect = { this . onSelectCommand }
0 commit comments