1- import { Container , Segment , Message } from 'semantic-ui-react' ;
1+ import { Container , Segment , Menu , Message } from 'semantic-ui-react' ;
22import React , { Component } from 'react' ;
33import ReactTimeout from 'react-timeout' ;
44
@@ -19,7 +19,14 @@ const PodInfoView = ({pod, namespace}) => (
1919 </ Segment >
2020) ;
2121
22- const OperatorsView = ( { error, deployment, deploymentReplication, storage, pod, namespace} ) => {
22+ const OperatorsView = ( { error, deployment, deploymentReplication, storage, pod, namespace, otherOperators} ) => {
23+ let commonMenuItems = otherOperators . map ( ( item ) => < Menu . Item > < a href = { item . url } > { operatorType2Name ( item . type ) } </ a > </ Menu . Item > ) ;
24+ if ( commonMenuItems . length > 0 ) {
25+ commonMenuItems = ( < Menu . Item >
26+ < Menu . Header > Other operators</ Menu . Header >
27+ < Menu . Menu > { commonMenuItems } </ Menu . Menu >
28+ </ Menu . Item > ) ;
29+ }
2330 let Operator = NoOperator ;
2431 if ( deployment )
2532 Operator = DeploymentOperator ;
@@ -30,11 +37,25 @@ const OperatorsView = ({error, deployment, deploymentReplication, storage, pod,
3037 return (
3138 < Operator
3239 podInfoView = { < PodInfoView pod = { pod } namespace = { namespace } /> }
40+ commonMenuItems = { commonMenuItems }
3341 error = { error }
3442 />
3543 ) ;
3644}
3745
46+ const operatorType2Name = ( oType ) => {
47+ switch ( oType ) {
48+ case "deployment" :
49+ return "Deployments" ;
50+ case "deployment_replication" :
51+ return "Deployment replications" ;
52+ case "storage" :
53+ return "Storage" ;
54+ default :
55+ return "" ;
56+ }
57+ } ;
58+
3859const LoadingView = ( ) => (
3960 < Container >
4061 < Loading />
@@ -76,6 +97,7 @@ class App extends Component {
7697 deployment = { this . state . operators . deployment }
7798 deploymentReplication = { this . state . operators . deployment_replication }
7899 storage = { this . state . operators . storage }
100+ otherOperators = { this . state . operators . other || [ ] }
79101 pod = { this . state . operators . pod }
80102 namespace = { this . state . operators . namespace }
81103 /> ;
0 commit comments