xref: /openbmc/webui-vue/src/env/components/AppNavigation/ibm.js (revision de23ea23d88451a2fa2774ec72053772603c23ae)
1import IconDashboard from '@carbon/icons-vue/es/dashboard/16';
2import IconTextLinkAnalysis from '@carbon/icons-vue/es/text-link--analysis/16';
3import IconDataCheck from '@carbon/icons-vue/es/data--check/16';
4import IconSettingsAdjust from '@carbon/icons-vue/es/settings--adjust/16';
5import IconSettings from '@carbon/icons-vue/es/settings/16';
6import IconSecurity from '@carbon/icons-vue/es/security/16';
7import IconChevronUp from '@carbon/icons-vue/es/chevron--up/16';
8import IconDataBase from '@carbon/icons-vue/es/data--base--alt/16';
9import i18n from '@/i18n';
10
11const AppNavigationMixin = {
12  components: {
13    iconOverview: IconDashboard,
14    iconLogs: IconTextLinkAnalysis,
15    iconHealth: IconDataCheck,
16    iconControl: IconSettingsAdjust,
17    iconSettings: IconSettings,
18    iconSecurityAndAccess: IconSecurity,
19    iconExpand: IconChevronUp,
20    iconResourceManagement: IconDataBase,
21  },
22  data() {
23    return {
24      navigationItems: [
25        {
26          id: 'overview',
27          label: i18n.global.t('appNavigation.overview'),
28          route: '/',
29          icon: 'iconOverview',
30        },
31        {
32          id: 'logs',
33          label: i18n.global.t('appNavigation.logs'),
34          icon: 'iconLogs',
35          children: [
36            {
37              id: 'dumps',
38              label: i18n.global.t('appNavigation.dumps'),
39              route: '/logs/dumps',
40            },
41            {
42              id: 'event-logs',
43              label: i18n.global.t('appNavigation.eventLogs'),
44              route: '/logs/event-logs',
45            },
46            {
47              id: 'post-code-logs',
48              label: i18n.global.t('appNavigation.postCodeLogs'),
49              route: '/logs/post-code-logs',
50            },
51          ],
52        },
53        {
54          id: 'hardware-status',
55          label: i18n.global.t('appNavigation.hardwareStatus'),
56          icon: 'iconHealth',
57          children: [
58            {
59              id: 'inventory',
60              label: i18n.global.t('appNavigation.inventory'),
61              route: '/hardware-status/inventory',
62            },
63            {
64              id: 'sensors',
65              label: i18n.global.t('appNavigation.sensors'),
66              route: '/hardware-status/sensors',
67            },
68          ],
69        },
70        {
71          id: 'operations',
72          label: i18n.global.t('appNavigation.operations'),
73          icon: 'iconControl',
74          children: this.operationsNavigationItems(),
75        },
76        {
77          id: 'settings',
78          label: i18n.global.t('appNavigation.settings'),
79          icon: 'iconSettings',
80          children: [
81            {
82              id: 'date-time',
83              label: i18n.global.t('appNavigation.dateTime'),
84              route: '/settings/date-time',
85            },
86            {
87              id: 'network',
88              label: i18n.global.t('appNavigation.network'),
89              route: '/settings/network',
90            },
91            {
92              id: 'power-restore-policy',
93              label: i18n.global.t('appNavigation.powerRestorePolicy'),
94              route: '/settings/power-restore-policy',
95            },
96          ],
97        },
98        {
99          id: 'security-and-access',
100          label: i18n.global.t('appNavigation.securityAndAccess'),
101          icon: 'iconSecurityAndAccess',
102          children: [
103            {
104              id: 'sessions',
105              label: i18n.global.t('appNavigation.sessions'),
106              route: '/security-and-access/sessions',
107            },
108            {
109              id: 'ldap',
110              label: i18n.global.t('appNavigation.ldap'),
111              route: '/security-and-access/ldap',
112            },
113            {
114              id: 'user-management',
115              label: i18n.global.t('appNavigation.userManagement'),
116              route: '/security-and-access/user-management',
117            },
118            {
119              id: 'policies',
120              label: i18n.global.t('appNavigation.policies'),
121              route: '/security-and-access/policies',
122            },
123            {
124              id: 'certificates',
125              label: i18n.global.t('appNavigation.certificates'),
126              route: '/security-and-access/certificates',
127            },
128          ],
129        },
130        {
131          id: 'resource-management',
132          label: i18n.global.t('appNavigation.resourceManagement'),
133          icon: 'iconResourceManagement',
134          children: [
135            {
136              id: 'power',
137              label: i18n.global.t('appNavigation.power'),
138              route: '/resource-management/power',
139            },
140          ],
141        },
142      ],
143    };
144  },
145  methods: {
146    operationsNavigationItems() {
147      const username = this.$store.getters['global/username'];
148      let operationNavigationItems = [
149        {
150          id: 'factory-reset',
151          label: i18n.global.t('appNavigation.factoryReset'),
152          route: '/operations/factory-reset',
153        },
154        {
155          id: 'firmware',
156          label: i18n.global.t('appNavigation.firmware'),
157          route: '/operations/firmware',
158        },
159        {
160          id: 'reboot-bmc',
161          label: i18n.global.t('appNavigation.rebootBmc'),
162          route: '/operations/reboot-bmc',
163        },
164        {
165          id: 'serial-over-lan',
166          label: i18n.global.t('appNavigation.serialOverLan'),
167          route: '/operations/serial-over-lan',
168        },
169        {
170          id: 'server-power-operations',
171          label: i18n.global.t('appNavigation.serverPowerOperations'),
172          route: '/operations/server-power-operations',
173        },
174      ];
175      let pageKeyClear = {
176        id: 'key-clear',
177        label: i18n.global.t('appNavigation.keyClear'),
178        route: '/operations/key-clear',
179      };
180      if (username === 'service' || username === 'admin') {
181        operationNavigationItems.splice(2, 0, pageKeyClear);
182      }
183      return operationNavigationItems;
184    },
185  },
186};
187
188export default AppNavigationMixin;
189