blob: ef689d5fe0e531ec8209adb38a5df4aaaaf66f8b [file] [log] [blame]
Derick Montaguea2988f42020-01-17 13:46:30 -06001<template>
Yoshie Muranaka74f86872020-02-10 12:28:37 -08002 <div>
3 <div class="nav-container" :class="{ open: isNavigationOpen }">
Derick Montague68592032020-04-04 14:02:34 -05004 <nav ref="nav" :aria-label="$t('appNavigation.primaryNavigation')">
Yoshie Muranaka7d044352020-07-24 10:45:14 -07005 <b-nav vertical class="mb-4">
Derick Montague2d589a72020-07-23 17:43:12 -05006 <b-nav-item to="/" data-test-id="nav-container-overview">
Yoshie Muranakae0b76c32020-02-28 14:18:20 -08007 <icon-overview />
8 {{ $t('appNavigation.overview') }}
9 </b-nav-item>
Derick Montague42c19892020-01-17 16:10:34 -060010
Yoshie Muranaka74f86872020-02-10 12:28:37 -080011 <li class="nav-item">
Derick Montague2d589a72020-07-23 17:43:12 -050012 <b-button
13 v-b-toggle.health-menu
14 variant="link"
15 data-test-id="nav-button-health"
16 >
Yoshie Muranaka9fc3f902020-03-04 10:36:57 -080017 <icon-health />
18 {{ $t('appNavigation.health') }}
Yoshie Muranaka74f86872020-02-10 12:28:37 -080019 <icon-expand class="icon-expand" />
20 </b-button>
21 <b-collapse id="health-menu" tag="ul" class="nav-item__nav">
Derick Montague2d589a72020-07-23 17:43:12 -050022 <b-nav-item
23 to="/health/event-logs"
24 data-test-id="nav-container-event-logs"
25 >
Yoshie Muranaka6f102342020-05-05 09:45:39 -070026 {{ $t('appNavigation.eventLogs') }}
Yoshie Muranakae0b76c32020-02-28 14:18:20 -080027 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -050028 <b-nav-item
29 to="/health/hardware-status"
30 data-test-id="nav-container-hardware-status"
31 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -080032 {{ $t('appNavigation.hardwareStatus') }}
33 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -050034 <b-nav-item
35 to="/health/sensors"
36 data-test-id="nav-container-sensors"
37 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -080038 {{ $t('appNavigation.sensors') }}
39 </b-nav-item>
Yoshie Muranaka74f86872020-02-10 12:28:37 -080040 </b-collapse>
41 </li>
Derick Montague42c19892020-01-17 16:10:34 -060042
Yoshie Muranaka74f86872020-02-10 12:28:37 -080043 <li class="nav-item">
Derick Montague2d589a72020-07-23 17:43:12 -050044 <b-button
45 v-b-toggle.control-menu
46 variant="link"
47 data-test-id="nav-button-control"
48 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -080049 <icon-control />
50 {{ $t('appNavigation.control') }}
Yoshie Muranaka74f86872020-02-10 12:28:37 -080051 <icon-expand class="icon-expand" />
52 </b-button>
53 <b-collapse id="control-menu" tag="ul" class="nav-item__nav">
Derick Montague2d589a72020-07-23 17:43:12 -050054 <b-nav-item to="/control/kvm" data-test-id="nav-container-kvm">
Mateusz Gapski632de222020-07-09 09:21:33 +020055 {{ $t('appNavigation.kvm') }}
56 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -050057 <b-nav-item
58 to="/control/manage-power-usage"
Derick Montague6534e582020-07-24 09:17:44 -050059 data-test-id="nav-container-managePowerUsage"
Derick Montague2d589a72020-07-23 17:43:12 -050060 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -080061 {{ $t('appNavigation.managePowerUsage') }}
Yoshie Muranaka74f86872020-02-10 12:28:37 -080062 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -050063 <b-nav-item
64 to="/control/reboot-bmc"
Derick Montague6534e582020-07-24 09:17:44 -050065 data-test-id="nav-container-rebootBmc"
Derick Montague2d589a72020-07-23 17:43:12 -050066 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -080067 {{ $t('appNavigation.rebootBmc') }}
68 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -050069 <b-nav-item
70 to="/control/serial-over-lan"
71 data-test-id="nav-container-sol"
72 >
Sukanya Pandey96f69ca2020-05-20 15:32:57 +053073 {{ $t('appNavigation.serialOverLan') }}
74 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -050075 <b-nav-item
76 to="/control/server-led"
Derick Montague6534e582020-07-24 09:17:44 -050077 data-test-id="nav-container-serverLed"
Derick Montague2d589a72020-07-23 17:43:12 -050078 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -080079 {{ $t('appNavigation.serverLed') }}
80 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -050081 <b-nav-item
82 to="/control/server-power-operations"
Derick Montague6534e582020-07-24 09:17:44 -050083 data-test-id="nav-container-serverPowerOperations"
Derick Montague2d589a72020-07-23 17:43:12 -050084 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -080085 {{ $t('appNavigation.serverPowerOperations') }}
Yoshie Muranaka74f86872020-02-10 12:28:37 -080086 </b-nav-item>
Mateusz Gapski75100462020-07-30 11:01:29 +020087 <b-nav-item to="/control/virtual-media">
88 {{ $t('appNavigation.virtualMedia') }}
89 </b-nav-item>
Yoshie Muranaka74f86872020-02-10 12:28:37 -080090 </b-collapse>
91 </li>
Yoshie Muranaka71ac2302019-12-26 11:43:36 -080092
Yoshie Muranaka74f86872020-02-10 12:28:37 -080093 <li class="nav-item">
Derick Montague2d589a72020-07-23 17:43:12 -050094 <b-button
95 v-b-toggle.configuration-menu
96 variant="link"
97 data-test-id="nav-button-configuration"
98 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -080099 <icon-configuration />
100 {{ $t('appNavigation.configuration') }}
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800101 <icon-expand class="icon-expand" />
102 </b-button>
103 <b-collapse id="configuration-menu" tag="ul" class="nav-item__nav">
Derick Montague2d589a72020-07-23 17:43:12 -0500104 <b-nav-item
105 to="/configuration/date-time-settings"
Derick Montague6534e582020-07-24 09:17:44 -0500106 data-test-id="nav-container-dateTimeSettings"
Derick Montague2d589a72020-07-23 17:43:12 -0500107 >
Dixsie Wolmers739e4592020-06-05 07:00:06 -0500108 {{ $t('appNavigation.dateTimeSettings') }}
109 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -0500110 <b-nav-item
Yoshie Muranaka92a0a4a2020-07-15 10:30:31 -0700111 to="/configuration/firmware"
Derick Montague2d589a72020-07-23 17:43:12 -0500112 data-test-id="nav-container-firmware"
113 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -0800114 {{ $t('appNavigation.firmware') }}
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800115 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -0500116 <b-nav-item
117 to="/configuration/network-settings"
Derick Montague6534e582020-07-24 09:17:44 -0500118 data-test-id="nav-container-networkSettings"
Derick Montague2d589a72020-07-23 17:43:12 -0500119 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -0800120 {{ $t('appNavigation.networkSettings') }}
121 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -0500122 <b-nav-item
123 href="javascript:void(0)"
124 data-test-id="nav-container-snmp"
125 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -0800126 {{ $t('appNavigation.snmpSettings') }}
127 </b-nav-item>
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800128 </b-collapse>
129 </li>
Derick Montague42c19892020-01-17 16:10:34 -0600130
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800131 <li class="nav-item">
Derick Montague2d589a72020-07-23 17:43:12 -0500132 <b-button
133 v-b-toggle.access-control-menu
134 variant="link"
Derick Montague6534e582020-07-24 09:17:44 -0500135 data-test-id="nav-button-accessControl"
Derick Montague2d589a72020-07-23 17:43:12 -0500136 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -0800137 <icon-access-control />
138 {{ $t('appNavigation.accessControl') }}
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800139 <icon-expand class="icon-expand" />
140 </b-button>
141 <b-collapse id="access-control-menu" tag="ul" class="nav-item__nav">
Derick Montague2d589a72020-07-23 17:43:12 -0500142 <b-nav-item
143 to="/access-control/ldap"
144 data-test-id="nav-container-ldap"
145 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -0800146 {{ $t('appNavigation.ldap') }}
147 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -0500148 <b-nav-item
149 to="/access-control/local-user-management"
Derick Montague6534e582020-07-24 09:17:44 -0500150 data-test-id="nav-container-localUserManagement"
Derick Montague2d589a72020-07-23 17:43:12 -0500151 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -0800152 {{ $t('appNavigation.localUserManagement') }}
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800153 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -0500154 <b-nav-item
155 to="/access-control/ssl-certificates"
Derick Montague6534e582020-07-24 09:17:44 -0500156 data-test-id="nav-container-sslCertificates"
Derick Montague2d589a72020-07-23 17:43:12 -0500157 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -0800158 {{ $t('appNavigation.sslCertificates') }}
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800159 </b-nav-item>
160 </b-collapse>
161 </li>
162 </b-nav>
163 </nav>
164 </div>
165 <transition name="fade">
166 <div
167 v-if="isNavigationOpen"
Derick Montaguead2ceb62020-04-24 18:11:04 -0500168 id="nav-overlay"
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800169 class="nav-overlay"
170 @click="toggleIsOpen"
171 ></div>
172 </transition>
173 </div>
Derick Montaguea2988f42020-01-17 13:46:30 -0600174</template>
175
176<script>
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800177import IconAnalytics from '@carbon/icons-vue/es/analytics/16';
178import IconDataCheck from '@carbon/icons-vue/es/data--check/16';
179import IconSettingsAdjust from '@carbon/icons-vue/es/settings--adjust/16';
180import IconSettings from '@carbon/icons-vue/es/settings/16';
181import IconPassword from '@carbon/icons-vue/es/password/16';
182import IconChevronUp from '@carbon/icons-vue/es/chevron--up/16';
Derick Montaguea2988f42020-01-17 13:46:30 -0600183
184export default {
Derick Montaguee2fd1562019-12-20 13:26:53 -0600185 name: 'AppNavigation',
Derick Montague42c19892020-01-17 16:10:34 -0600186 components: {
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800187 iconOverview: IconAnalytics,
188 iconHealth: IconDataCheck,
189 iconControl: IconSettingsAdjust,
190 iconConfiguration: IconSettings,
191 iconAccessControl: IconPassword,
192 iconExpand: IconChevronUp
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800193 },
194 data() {
195 return {
196 isNavigationOpen: false
197 };
198 },
199 watch: {
200 $route: function() {
201 this.isNavigationOpen = false;
202 },
203 isNavigationOpen: function(isNavigationOpen) {
204 this.$root.$emit('change:isNavigationOpen', isNavigationOpen);
205 }
206 },
207 mounted() {
208 this.$root.$on('toggle:navigation', () => this.toggleIsOpen());
209 },
210 methods: {
211 toggleIsOpen() {
212 this.isNavigationOpen = !this.isNavigationOpen;
213 }
Derick Montague42c19892020-01-17 16:10:34 -0600214 }
Derick Montaguea2988f42020-01-17 13:46:30 -0600215};
216</script>
Derick Montague42c19892020-01-17 16:10:34 -0600217
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800218<style scoped lang="scss">
219svg {
Derick Montague66f903f2020-02-28 11:22:31 -0600220 fill: currentColor;
221 height: 1.2rem;
222 width: 1.2rem;
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800223 margin-left: 0 !important; //!important overriding button specificity
224 vertical-align: text-bottom;
225 &:not(.icon-expand) {
226 margin-right: $spacer;
227 }
228}
229
230.nav {
SurenNeware057232b2020-06-08 20:53:26 +0530231 padding-top: $spacer / 4;
232 @include media-breakpoint-up($responsive-layout-bp) {
233 padding-top: $spacer;
234 }
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800235}
236
237.nav-item__nav {
Derick Montague42c19892020-01-17 16:10:34 -0600238 list-style: none;
239 padding-left: 0;
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800240 margin-left: 0;
241
Yoshie Muranaka85358ed2020-05-18 10:05:36 -0700242 .nav-item {
243 outline: none;
244 }
245
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800246 .nav-link {
247 padding-left: $spacer * 4;
Yoshie Muranaka85358ed2020-05-18 10:05:36 -0700248 outline: none;
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800249
250 &:not(.nav-link--current) {
251 font-weight: normal;
252 }
253 }
254}
255
256.btn-link {
257 width: 100%;
258 text-align: left;
259 text-decoration: none !important;
260 border-radius: 0;
261
262 &.collapsed {
263 .icon-expand {
264 transform: rotate(180deg);
265 }
266 }
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800267}
268
269.icon-expand {
270 float: right;
271 margin-top: $spacer / 4;
272}
273
274.btn-link,
275.nav-link {
276 position: relative;
277 font-weight: $headings-font-weight;
278 padding-left: $spacer; // defining consistent padding for links and buttons
279 padding-right: $spacer;
Yoshie Muranaka01da8182020-07-08 15:46:43 -0700280 color: theme-color('secondary');
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800281
282 &:hover {
Yoshie Muranaka01da8182020-07-08 15:46:43 -0700283 background-color: gray('300');
284 color: theme-color('dark');
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800285 }
Yoshie Muranaka9f5cea82020-02-04 09:30:00 -0800286
287 &:focus {
288 box-shadow: $btn-focus-box-shadow;
Yoshie Muranaka01da8182020-07-08 15:46:43 -0700289 color: theme-color('dark');
Yoshie Muranaka9f5cea82020-02-04 09:30:00 -0800290 }
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800291}
292
Derick Montague66f903f2020-02-28 11:22:31 -0600293.nav-link--current,
294.nav-link--current:hover,
295.nav-link--current:focus {
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800296 font-weight: $headings-font-weight;
Yoshie Muranaka01da8182020-07-08 15:46:43 -0700297 background-color: theme-color('secondary');
298 color: theme-color('light');
Derick Montague66f903f2020-02-28 11:22:31 -0600299 cursor: default;
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800300
301 &::before {
302 content: '';
303 position: absolute;
304 top: 0;
305 bottom: 0;
306 left: 0;
307 width: 4px;
Yoshie Muranaka01da8182020-07-08 15:46:43 -0700308 background-color: theme-color('primary');
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800309 }
Derick Montague42c19892020-01-17 16:10:34 -0600310}
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800311
312.nav-container {
313 position: fixed;
314 width: $navigation-width;
315 top: $header-height;
316 bottom: 0;
317 left: 0;
318 z-index: $zindex-fixed;
319 overflow-y: auto;
Dixsie Wolmers5a909422020-07-21 11:24:05 -0500320 background-color: gray('100');
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800321 transform: translateX(-$navigation-width);
322 transition: transform $exit-easing--productive $duration--moderate-02;
SurenNeware057232b2020-06-08 20:53:26 +0530323 @include media-breakpoint-down(md) {
324 z-index: $zindex-fixed + 2;
325 }
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800326
Derick Montague74466b82020-06-28 10:17:32 -0500327 &.open,
328 &:focus-within {
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800329 transform: translateX(0);
330 transition-timing-function: $entrance-easing--productive;
331 }
332
333 @include media-breakpoint-up($responsive-layout-bp) {
334 transition-duration: $duration--fast-01;
335 transform: translateX(0);
336 }
337}
338
339.nav-overlay {
340 position: fixed;
341 top: $header-height;
342 bottom: 0;
343 left: 0;
344 right: 0;
SurenNeware057232b2020-06-08 20:53:26 +0530345 z-index: $zindex-fixed + 1;
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800346 background-color: $black;
347 opacity: 0.5;
348
349 &.fade-enter-active {
350 transition: opacity $duration--moderate-02 $entrance-easing--productive;
351 }
352
353 &.fade-leave-active {
354 transition: opacity $duration--fast-02 $exit-easing--productive;
355 }
356
357 &.fade-enter,
358 &.fade-leave-to {
359 opacity: 0;
360 }
361
362 @include media-breakpoint-up($responsive-layout-bp) {
363 display: none;
364 }
365}
Derick Montague42c19892020-01-17 16:10:34 -0600366</style>