@@ -11,12 +11,14 @@ import ApplicationsPage from '../ApplicationsPage';
11
11
import { useWatchComponents } from '~/utilities/useWatchComponents' ;
12
12
import Metrics from './Metrics/Metrics' ;
13
13
import Resources from './Metrics/Resources' ;
14
+ import { useUser } from '~/redux/selectors' ;
14
15
15
16
const description = 'A Dashboard for Multi-Cluster App Dispatcher' ;
16
17
const subDescription =
17
18
'- MCAD is a Kubernetes controller providing mechanisms for applications to manage batch jobs in a single or multi-cluster environment' ;
18
19
19
20
export const MCADTabs : React . FunctionComponent = ( ) => {
21
+ const { isAdmin } = useUser ( ) ;
20
22
const { components, loaded, loadError } = useWatchComponents ( true ) ;
21
23
const isEmpty = ! components || components . length === 0 ;
22
24
const [ activeTabKey , setActiveTabKey ] = React . useState < string | number > ( 0 ) ;
@@ -59,81 +61,85 @@ export const MCADTabs: React.FunctionComponent = () => {
59
61
>
60
62
< MCADashboard />
61
63
</ Tab >
62
- < Tab
63
- eventKey = { 1 }
64
- title = {
65
- < >
66
- < TabTitleIcon >
67
- < BoxIcon />
68
- </ TabTitleIcon >
69
- < TabTitleText > Resources</ TabTitleText >
70
- </ >
71
- }
72
- aria-label = "resources-tab"
73
- >
74
- { /* Place holder */ }
75
- < Resources activeTabKey = { Number ( activeTabKey ) } />
76
- </ Tab >
77
- < Tab
78
- eventKey = { 2 }
79
- title = {
80
- < >
81
- < TabTitleIcon >
82
- < DatabaseIcon />
83
- </ TabTitleIcon >
84
- < TabTitleText > Metrics</ TabTitleText >
85
- </ >
86
- }
87
- aria-label = "metrics-tab"
88
- >
89
- { /* Place holder */ }
90
- < Metrics activeTabKey = { Number ( activeTabKey ) } />
91
- </ Tab >
92
- < Tab
93
- eventKey = { 3 }
94
- title = {
95
- < >
96
- < TabTitleIcon >
97
- < ServerIcon />
98
- </ TabTitleIcon >
99
- < TabTitleText > Server</ TabTitleText >
100
- </ >
101
- }
102
- aria-label = "server-tab"
103
- >
104
- { /* Place holder */ }
105
- Server
106
- </ Tab >
107
- < Tab
108
- eventKey = { 4 }
109
- title = {
110
- < >
111
- < TabTitleIcon >
112
- < LaptopIcon />
113
- </ TabTitleIcon >
114
- < TabTitleText > System</ TabTitleText >
115
- </ >
116
- }
117
- aria-label = "system-tab"
118
- >
119
- { /* Place holder */ }
120
- System
121
- </ Tab >
122
- < Tab
123
- eventKey = { 6 }
124
- title = {
125
- < >
126
- < TabTitleIcon >
127
- < ProjectDiagramIcon />
128
- </ TabTitleIcon >
129
- < TabTitleText > Stat</ TabTitleText >
130
- </ >
131
- }
132
- aria-label = "stat-tab"
133
- >
134
- { /* Place holder */ }
135
- Network
136
- </ Tab >
64
+ { isAdmin && (
65
+ < >
66
+ < Tab
67
+ eventKey = { 1 }
68
+ title = {
69
+ < >
70
+ < TabTitleIcon >
71
+ < BoxIcon />
72
+ </ TabTitleIcon >
73
+ < TabTitleText > Resources</ TabTitleText >
74
+ </ >
75
+ }
76
+ aria-label = "resources-tab"
77
+ >
78
+ { /* Place holder */ }
79
+ < Resources activeTabKey = { Number ( activeTabKey ) } />
80
+ </ Tab >
81
+ < Tab
82
+ eventKey = { 2 }
83
+ title = {
84
+ < >
85
+ < TabTitleIcon >
86
+ < DatabaseIcon />
87
+ </ TabTitleIcon >
88
+ < TabTitleText > Metrics</ TabTitleText >
89
+ </ >
90
+ }
91
+ aria-label = "metrics-tab"
92
+ >
93
+ { /* Place holder */ }
94
+ < Metrics activeTabKey = { Number ( activeTabKey ) } />
95
+ </ Tab >
96
+ < Tab
97
+ eventKey = { 3 }
98
+ title = {
99
+ < >
100
+ < TabTitleIcon >
101
+ < ServerIcon />
102
+ </ TabTitleIcon >
103
+ < TabTitleText > Server</ TabTitleText >
104
+ </ >
105
+ }
106
+ aria-label = "server-tab"
107
+ >
108
+ { /* Place holder */ }
109
+ Server
110
+ </ Tab >
111
+ < Tab
112
+ eventKey = { 4 }
113
+ title = {
114
+ < >
115
+ < TabTitleIcon >
116
+ < LaptopIcon />
117
+ </ TabTitleIcon >
118
+ < TabTitleText > System</ TabTitleText >
119
+ </ >
120
+ }
121
+ aria-label = "system-tab"
122
+ >
123
+ { /* Place holder */ }
124
+ System
125
+ </ Tab >
126
+ < Tab
127
+ eventKey = { 6 }
128
+ title = {
129
+ < >
130
+ < TabTitleIcon >
131
+ < ProjectDiagramIcon />
132
+ </ TabTitleIcon >
133
+ < TabTitleText > Stat</ TabTitleText >
134
+ </ >
135
+ }
136
+ aria-label = "stat-tab"
137
+ >
138
+ { /* Place holder */ }
139
+ Network
140
+ </ Tab >
141
+ </ >
142
+ ) }
137
143
</ Tabs >
138
144
</ ApplicationsPage >
139
145
) ;
0 commit comments