@@ -5,35 +5,91 @@ import IconSettingsAdjust from '@carbon/icons-vue/es/settings--adjust/16';
5
5
import IconSettings from '@carbon/icons-vue/es/settings/16' ;
6
6
import IconSecurity from '@carbon/icons-vue/es/security/16' ;
7
7
import IconDataBase from '@carbon/icons-vue/es/data--base--alt/16' ;
8
+ import IconDocument from '@carbon/icons-vue/es/document/16' ;
8
9
import i18n from '@/i18n' ;
10
+ import stores from '@/store'
11
+
12
+ import { ref , computed , onMounted } from 'vue' ;
9
13
10
14
const AppNavigationData = ( ) => {
11
- const navigationItems = [
15
+ const navigationData = ref ( [
12
16
{
13
17
id : 'overview' ,
14
18
label : i18n . global . t ( 'appNavigation.overview' ) ,
15
19
route : '/' ,
16
20
icon : IconDashboard ,
17
21
} ,
18
22
{
19
- id : 'logs ' ,
20
- label : i18n . global . t ( 'appNavigation.logs ' ) ,
21
- icon : IconTextLinkAnalysis ,
23
+ id : 'operations ' ,
24
+ label : i18n . global . t ( 'appNavigation.operations ' ) ,
25
+ icon : IconSettingsAdjust ,
22
26
children : [
23
27
{
24
- id : 'event-logs' ,
25
- label : i18n . global . t ( 'appNavigation.eventLogs' ) ,
26
- route : '/logs/event-logs' ,
28
+ id : 'server-power-operations' ,
29
+ label : i18n . global . t ( 'appNavigation.serverPowerOperations' ) ,
30
+ route : '/operations/server-power-operations' ,
31
+ restrictTo : [ ] ,
27
32
} ,
28
33
{
29
- id : 'audit-logs' ,
30
- label : i18n . global . t ( 'appNavigation.auditLogs' ) ,
31
- route : '/logs/audit-logs' ,
34
+ id : 'host-console' ,
35
+ label : i18n . global . t ( 'appNavigation.hostConsole' ) ,
36
+ route : '/operations/host-console' ,
37
+ restrictTo : [ 'Administrator' , 'OemIBMServiceAgent' ] ,
32
38
} ,
33
39
{
34
- id : 'post-code-logs' ,
35
- label : i18n . global . t ( 'appNavigation.postCodeLogs' ) ,
36
- route : '/logs/post-code-logs' ,
40
+ id : 'service-login' ,
41
+ label : i18n . global . t ( 'appPageTitle.serviceLogin' ) ,
42
+ route : '/operations/service-login' ,
43
+ restrictTo : [ 'OemIBMServiceAgent' ] ,
44
+ } ,
45
+ {
46
+ id : 'firmware' ,
47
+ label : i18n . global . t ( 'appNavigation.firmware' ) ,
48
+ route : '/operations/firmware' ,
49
+ restrictTo : [ ] ,
50
+ } ,
51
+ {
52
+ id : 'reboot-bmc' ,
53
+ label : i18n . global . t ( 'appNavigation.rebootBmc' ) ,
54
+ route : '/operations/reboot-bmc' ,
55
+ restrictTo : [ ] ,
56
+ } ,
57
+ ] ,
58
+ } ,
59
+ {
60
+ id : 'resource-management' ,
61
+ label : i18n . global . t ( 'appNavigation.resourceManagement' ) ,
62
+ icon : IconDataBase ,
63
+ children : [
64
+ {
65
+ id : 'memory' ,
66
+ label : i18n . global . t ( 'appNavigation.memory' ) ,
67
+ route : '/resource-management/memory' ,
68
+ restrictTo : [ ] ,
69
+ } ,
70
+ {
71
+ id : 'power' ,
72
+ label : i18n . global . t ( 'appNavigation.power' ) ,
73
+ route : '/resource-management/power' ,
74
+ restrictTo : [ ] ,
75
+ } ,
76
+ {
77
+ id : 'capacity-on-demand' ,
78
+ label : i18n . global . t ( 'appNavigation.capacityOnDemand' ) ,
79
+ route : '/resource-management/capacity-on-demand' ,
80
+ restrictTo : [ ] ,
81
+ } ,
82
+ {
83
+ id : 'field-core-override' ,
84
+ label : i18n . global . t ( 'appNavigation.fieldCoreOverride' ) ,
85
+ route : '/resource-management/field-core-override' ,
86
+ restrictTo : [ ] ,
87
+ } ,
88
+ {
89
+ id : 'system-parameters' ,
90
+ label : i18n . global . t ( 'appNavigation.systemParameters' ) ,
91
+ route : '/resource-management/system-parameters' ,
92
+ restrictTo : [ ] ,
37
93
} ,
38
94
] ,
39
95
} ,
@@ -46,73 +102,74 @@ const AppNavigationData = () => {
46
102
id : 'inventory' ,
47
103
label : i18n . global . t ( 'appNavigation.inventory' ) ,
48
104
route : '/hardware-status/inventory' ,
105
+ restrictTo : [ ] ,
49
106
} ,
50
107
{
51
108
id : 'sensors' ,
52
109
label : i18n . global . t ( 'appNavigation.sensors' ) ,
53
110
route : '/hardware-status/sensors' ,
111
+ restrictTo : [ ] ,
112
+ } ,
113
+ {
114
+ id : 'hardware-deconfiguration' ,
115
+ label : i18n . global . t ( 'appNavigation.deconfigurationHardware' ) ,
116
+ route : '/settings/hardware-deconfiguration' ,
117
+ restrictTo : [ ] ,
54
118
} ,
55
119
{
56
120
id : 'pcie-topology' ,
57
121
label : i18n . global . t ( 'appNavigation.pcieTopology' ) ,
58
122
route : '/hardware-status/pcie-topology' ,
123
+ restrictTo : [ ] ,
59
124
} ,
60
125
{
61
126
id : 'concurrent-maintenance' ,
62
127
label : i18n . global . t ( 'appNavigation.concurrentMaintenance' ) ,
63
128
route : '/hardware-status/concurrent-maintenance' ,
129
+ restrictTo : [ 'Everest' ] ,
64
130
} ,
65
131
] ,
66
132
} ,
67
133
{
68
- id : 'operations ' ,
69
- label : i18n . global . t ( 'appNavigation.operations ' ) ,
70
- icon : IconSettingsAdjust ,
134
+ id : 'logs ' ,
135
+ label : i18n . global . t ( 'appNavigation.logs ' ) ,
136
+ icon : IconTextLinkAnalysis ,
71
137
children : [
72
138
{
73
- id : 'factory-reset' ,
74
- label : i18n . global . t ( 'appNavigation.factoryReset' ) ,
75
- route : '/operations/factory-reset' ,
76
- } ,
77
- {
78
- id : 'kvm' ,
79
- label : i18n . global . t ( 'appNavigation.kvm' ) ,
80
- route : '/operations/kvm' ,
81
- } ,
82
- {
83
- id : 'key-clear' ,
84
- label : i18n . global . t ( 'appNavigation.keyClear' ) ,
85
- route : '/operations/key-clear' ,
86
- } ,
87
- {
88
- id : 'firmware' ,
89
- label : i18n . global . t ( 'appNavigation.firmware' ) ,
90
- route : '/operations/firmware' ,
139
+ id : 'post-code-logs' ,
140
+ label : i18n . global . t ( 'appNavigation.postCodeLogs' ) ,
141
+ route : '/logs/post-code-logs' ,
142
+ restrictTo : [ ] ,
91
143
} ,
92
144
{
93
- id : 'reboot-bmc' ,
94
- label : i18n . global . t ( 'appNavigation.rebootBmc' ) ,
95
- route : '/operations/reboot-bmc' ,
145
+ id : 'event-logs' ,
146
+ label : i18n . global . t ( 'appNavigation.eventLogs' ) ,
147
+ route : '/logs/event-logs' ,
148
+ restrictTo : [ ] ,
96
149
} ,
97
150
{
98
- id : 'service-login' ,
99
- label : i18n . global . t ( 'appNavigation.serviceLogin' ) ,
100
- route : '/operations/service-login' ,
151
+ id : 'audit-logs' ,
152
+ label : i18n . global . t ( 'appNavigation.auditLogs' ) ,
153
+ route : '/logs/audit-logs' ,
154
+ restrictTo : [ ] ,
101
155
} ,
102
156
{
103
- id : 'host-console' ,
104
- label : i18n . global . t ( 'appNavigation.hostConsole' ) ,
105
- route : '/operations/host-console' ,
157
+ id : 'dumps' ,
158
+ label : i18n . global . t ( 'appNavigation.dumps' ) ,
159
+ route : '/logs/dumps' ,
160
+ restrictTo : [ ] ,
106
161
} ,
107
162
{
108
- id : 'server-power-operations' ,
109
- label : i18n . global . t ( 'appNavigation.serverPowerOperations' ) ,
110
- route : '/operations/server-power-operations' ,
163
+ id : 'ibmi-service-functions' ,
164
+ label : i18n . global . t ( 'appNavigation.ibmiServiceFunctions' ) ,
165
+ route : '/logs/ibmi-service-functions' ,
166
+ restrictTo : [ 'NonHMCManaged' ] ,
111
167
} ,
112
168
{
113
- id : 'virtual-media' ,
114
- label : i18n . global . t ( 'appNavigation.virtualMedia' ) ,
115
- route : '/operations/virtual-media' ,
169
+ id : 'deconfiguration-records' ,
170
+ label : i18n . global . t ( 'appNavigation.deconfigurationRecords' ) ,
171
+ route : '/logs/deconfiguration-records' ,
172
+ restrictTo : [ ] ,
116
173
} ,
117
174
] ,
118
175
} ,
@@ -125,26 +182,31 @@ const AppNavigationData = () => {
125
182
id : 'date-time' ,
126
183
label : i18n . global . t ( 'appNavigation.dateTime' ) ,
127
184
route : '/settings/date-time' ,
128
- } ,
129
- {
130
- id : 'hardware-deconfiguration' ,
131
- label : i18n . global . t ( 'appNavigation.deconfigurationHardware' ) ,
132
- route : '/settings/hardware-deconfiguration' ,
185
+ restrictTo : [ ] ,
133
186
} ,
134
187
{
135
188
id : 'network' ,
136
189
label : i18n . global . t ( 'appNavigation.network' ) ,
137
190
route : '/settings/network' ,
191
+ restrictTo : [ ] ,
138
192
} ,
139
193
{
140
194
id : 'power-restore-policy' ,
141
195
label : i18n . global . t ( 'appNavigation.powerRestorePolicy' ) ,
142
196
route : '/settings/power-restore-policy' ,
197
+ restrictTo : [ ] ,
143
198
} ,
144
199
{
145
200
id : 'snmp-alerts' ,
146
201
label : i18n . global . t ( 'appNavigation.snmpAlerts' ) ,
147
202
route : '/settings/snmp-alerts' ,
203
+ restrictTo : [ ] ,
204
+ } ,
205
+ {
206
+ id : 'factory-reset' ,
207
+ label : i18n . global . t ( 'appNavigation.factoryReset' ) ,
208
+ route : '/operations/factory-reset' ,
209
+ restrictTo : [ ] ,
148
210
} ,
149
211
] ,
150
212
} ,
@@ -157,54 +219,96 @@ const AppNavigationData = () => {
157
219
id : 'sessions' ,
158
220
label : i18n . global . t ( 'appNavigation.sessions' ) ,
159
221
route : '/security-and-access/sessions' ,
160
- } ,
161
- {
162
- id : 'ldap' ,
163
- label : i18n . global . t ( 'appNavigation.ldap' ) ,
164
- route : '/security-and-access/ldap' ,
222
+ restrictTo : [ ] ,
165
223
} ,
166
224
{
167
225
id : 'user-management' ,
168
226
label : i18n . global . t ( 'appNavigation.userManagement' ) ,
169
227
route : '/security-and-access/user-management' ,
228
+ restrictTo : [ ] ,
170
229
} ,
171
230
{
172
- id : 'policies' ,
173
- label : i18n . global . t ( 'appNavigation.policies' ) ,
174
- route : '/security-and-access/policies' ,
231
+ id : 'ldap' ,
232
+ label : i18n . global . t ( 'appNavigation.ldap' ) ,
233
+ route : '/security-and-access/ldap' ,
234
+ restrictTo : [ ] ,
175
235
} ,
176
236
{
177
237
id : 'certificates' ,
178
238
label : i18n . global . t ( 'appNavigation.certificates' ) ,
179
239
route : '/security-and-access/certificates' ,
240
+ restrictTo : [ ] ,
180
241
} ,
181
- ] ,
182
- } ,
183
- {
184
- id : 'resource-management' ,
185
- label : i18n . global . t ( 'appNavigation.resourceManagement' ) ,
186
- icon : IconDataBase ,
187
- children : [
188
242
{
189
- id : 'system-parameters' ,
190
- label : i18n . global . t ( 'appNavigation.systemParameters' ) ,
191
- route : '/resource-management/system-parameters' ,
192
- } ,
193
- {
194
- id : 'memory' ,
195
- label : i18n . global . t ( 'appNavigation.memory' ) ,
196
- route : '/resource-management/memory' ,
243
+ id : 'policies' ,
244
+ label : i18n . global . t ( 'appNavigation.policies' ) ,
245
+ route : '/security-and-access/policies' ,
246
+ restrictTo : [ ] ,
197
247
} ,
198
248
{
199
- id : 'power' ,
200
- label : i18n . global . t ( 'appNavigation.power' ) ,
201
- route : '/resource-management/power' ,
249
+ id : 'key-clear' ,
250
+ label : i18n . global . t ( 'appNavigation.keyClear' ) ,
251
+ route : '/operations/key-clear' ,
252
+ restrictTo : [ 'Administrator' , 'OemIBMServiceAgent' ] ,
202
253
} ,
203
254
] ,
204
255
} ,
205
- ]
256
+ {
257
+ id : 'notices' ,
258
+ label : i18n . global . t ( 'appNavigation.notices' ) ,
259
+ route : '/notices' ,
260
+ icon : IconDocument ,
261
+ } ,
262
+ ] ) ;
263
+
264
+ const globalStore = stores . GlobalStore ( ) ;
265
+ const roleId = computed (
266
+ ( ) => globalStore . currentUserGetter ?. RoleId ,
267
+ ) ;
268
+ const systemInfo = computed ( ( ) => globalStore . modelTypeGetter ) ;
269
+ const hmcInfo = computed ( ( ) => globalStore . hmcManagedGetter ) ;
270
+
271
+ const model = computed ( ( ) =>
272
+ systemInfo . value ?. startsWith ( '9043' ) ? 'Everest' : 'NotEverest' ,
273
+ ) ;
274
+ const isHmcManged = computed ( ( ) =>
275
+ hmcInfo . value === 'Enabled' ? 'HMCManaged' : 'NonHMCManaged' ,
276
+ ) ;
277
+
278
+ const navigationItems = computed ( ( ) => {
279
+ return navigationData . value . map ( ( section ) => {
280
+ const restrictedPages = [ ] ;
281
+ section . children ?. forEach ( ( page ) => {
282
+ if ( page . restrictTo . length > 0 ) {
283
+ const isPageNeeded = page . restrictTo . some (
284
+ ( requiredRole ) =>
285
+ requiredRole === roleId . value ||
286
+ requiredRole === model . value ||
287
+ requiredRole === isHmcManged . value ,
288
+ ) ;
289
+ if ( ! isPageNeeded ) restrictedPages . push ( page ) ;
290
+ }
291
+ } ) ;
292
+ if ( section ?. children && section ?. children . length > 0 ) {
293
+ const finalSection = section . children . filter (
294
+ ( item ) => ! restrictedPages . includes ( item ) ,
295
+ ) ;
296
+ section . children = finalSection ;
297
+ }
298
+ return section ;
299
+ } ) ;
300
+ } ) ;
301
+
302
+ onMounted ( ( ) => {
303
+ globalStore . getHmcManaged ( ) ;
304
+ } ) ;
305
+
206
306
return {
207
307
navigationItems,
308
+ roleId,
309
+ model,
310
+ systemInfo,
311
+ isHmcManged,
208
312
} ;
209
313
}
210
314
export default AppNavigationData ;
0 commit comments