blob: 26ae3802b2fb81f0f6a0d65eab2012d77ca8aaff [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>
87 </b-collapse>
88 </li>
Yoshie Muranaka71ac2302019-12-26 11:43:36 -080089
Yoshie Muranaka74f86872020-02-10 12:28:37 -080090 <li class="nav-item">
Derick Montague2d589a72020-07-23 17:43:12 -050091 <b-button
92 v-b-toggle.configuration-menu
93 variant="link"
94 data-test-id="nav-button-configuration"
95 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -080096 <icon-configuration />
97 {{ $t('appNavigation.configuration') }}
Yoshie Muranaka74f86872020-02-10 12:28:37 -080098 <icon-expand class="icon-expand" />
99 </b-button>
100 <b-collapse id="configuration-menu" tag="ul" class="nav-item__nav">
Derick Montague2d589a72020-07-23 17:43:12 -0500101 <b-nav-item
102 to="/configuration/date-time-settings"
Derick Montague6534e582020-07-24 09:17:44 -0500103 data-test-id="nav-container-dateTimeSettings"
Derick Montague2d589a72020-07-23 17:43:12 -0500104 >
Dixsie Wolmers739e4592020-06-05 07:00:06 -0500105 {{ $t('appNavigation.dateTimeSettings') }}
106 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -0500107 <b-nav-item
108 href="javascript:void(0)"
109 data-test-id="nav-container-firmware"
110 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -0800111 {{ $t('appNavigation.firmware') }}
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800112 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -0500113 <b-nav-item
114 to="/configuration/network-settings"
Derick Montague6534e582020-07-24 09:17:44 -0500115 data-test-id="nav-container-networkSettings"
Derick Montague2d589a72020-07-23 17:43:12 -0500116 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -0800117 {{ $t('appNavigation.networkSettings') }}
118 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -0500119 <b-nav-item
120 href="javascript:void(0)"
121 data-test-id="nav-container-snmp"
122 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -0800123 {{ $t('appNavigation.snmpSettings') }}
124 </b-nav-item>
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800125 </b-collapse>
126 </li>
Derick Montague42c19892020-01-17 16:10:34 -0600127
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800128 <li class="nav-item">
Derick Montague2d589a72020-07-23 17:43:12 -0500129 <b-button
130 v-b-toggle.access-control-menu
131 variant="link"
Derick Montague6534e582020-07-24 09:17:44 -0500132 data-test-id="nav-button-accessControl"
Derick Montague2d589a72020-07-23 17:43:12 -0500133 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -0800134 <icon-access-control />
135 {{ $t('appNavigation.accessControl') }}
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800136 <icon-expand class="icon-expand" />
137 </b-button>
138 <b-collapse id="access-control-menu" tag="ul" class="nav-item__nav">
Derick Montague2d589a72020-07-23 17:43:12 -0500139 <b-nav-item
140 to="/access-control/ldap"
141 data-test-id="nav-container-ldap"
142 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -0800143 {{ $t('appNavigation.ldap') }}
144 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -0500145 <b-nav-item
146 to="/access-control/local-user-management"
Derick Montague6534e582020-07-24 09:17:44 -0500147 data-test-id="nav-container-localUserManagement"
Derick Montague2d589a72020-07-23 17:43:12 -0500148 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -0800149 {{ $t('appNavigation.localUserManagement') }}
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800150 </b-nav-item>
Derick Montague2d589a72020-07-23 17:43:12 -0500151 <b-nav-item
152 to="/access-control/ssl-certificates"
Derick Montague6534e582020-07-24 09:17:44 -0500153 data-test-id="nav-container-sslCertificates"
Derick Montague2d589a72020-07-23 17:43:12 -0500154 >
Yoshie Muranakae0b76c32020-02-28 14:18:20 -0800155 {{ $t('appNavigation.sslCertificates') }}
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800156 </b-nav-item>
157 </b-collapse>
158 </li>
159 </b-nav>
160 </nav>
161 </div>
162 <transition name="fade">
163 <div
164 v-if="isNavigationOpen"
Derick Montaguead2ceb62020-04-24 18:11:04 -0500165 id="nav-overlay"
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800166 class="nav-overlay"
167 @click="toggleIsOpen"
168 ></div>
169 </transition>
170 </div>
Derick Montaguea2988f42020-01-17 13:46:30 -0600171</template>
172
173<script>
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800174import IconAnalytics from '@carbon/icons-vue/es/analytics/16';
175import IconDataCheck from '@carbon/icons-vue/es/data--check/16';
176import IconSettingsAdjust from '@carbon/icons-vue/es/settings--adjust/16';
177import IconSettings from '@carbon/icons-vue/es/settings/16';
178import IconPassword from '@carbon/icons-vue/es/password/16';
179import IconChevronUp from '@carbon/icons-vue/es/chevron--up/16';
Derick Montaguea2988f42020-01-17 13:46:30 -0600180
181export default {
Derick Montaguee2fd1562019-12-20 13:26:53 -0600182 name: 'AppNavigation',
Derick Montague42c19892020-01-17 16:10:34 -0600183 components: {
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800184 iconOverview: IconAnalytics,
185 iconHealth: IconDataCheck,
186 iconControl: IconSettingsAdjust,
187 iconConfiguration: IconSettings,
188 iconAccessControl: IconPassword,
189 iconExpand: IconChevronUp
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800190 },
191 data() {
192 return {
193 isNavigationOpen: false
194 };
195 },
196 watch: {
197 $route: function() {
198 this.isNavigationOpen = false;
199 },
200 isNavigationOpen: function(isNavigationOpen) {
201 this.$root.$emit('change:isNavigationOpen', isNavigationOpen);
202 }
203 },
204 mounted() {
205 this.$root.$on('toggle:navigation', () => this.toggleIsOpen());
206 },
207 methods: {
208 toggleIsOpen() {
209 this.isNavigationOpen = !this.isNavigationOpen;
210 }
Derick Montague42c19892020-01-17 16:10:34 -0600211 }
Derick Montaguea2988f42020-01-17 13:46:30 -0600212};
213</script>
Derick Montague42c19892020-01-17 16:10:34 -0600214
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800215<style scoped lang="scss">
216svg {
Derick Montague66f903f2020-02-28 11:22:31 -0600217 fill: currentColor;
218 height: 1.2rem;
219 width: 1.2rem;
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800220 margin-left: 0 !important; //!important overriding button specificity
221 vertical-align: text-bottom;
222 &:not(.icon-expand) {
223 margin-right: $spacer;
224 }
225}
226
227.nav {
SurenNeware057232b2020-06-08 20:53:26 +0530228 padding-top: $spacer / 4;
229 @include media-breakpoint-up($responsive-layout-bp) {
230 padding-top: $spacer;
231 }
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800232}
233
234.nav-item__nav {
Derick Montague42c19892020-01-17 16:10:34 -0600235 list-style: none;
236 padding-left: 0;
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800237 margin-left: 0;
238
Yoshie Muranaka85358ed2020-05-18 10:05:36 -0700239 .nav-item {
240 outline: none;
241 }
242
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800243 .nav-link {
244 padding-left: $spacer * 4;
Yoshie Muranaka85358ed2020-05-18 10:05:36 -0700245 outline: none;
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800246
247 &:not(.nav-link--current) {
248 font-weight: normal;
249 }
250 }
251}
252
253.btn-link {
254 width: 100%;
255 text-align: left;
256 text-decoration: none !important;
257 border-radius: 0;
258
259 &.collapsed {
260 .icon-expand {
261 transform: rotate(180deg);
262 }
263 }
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800264}
265
266.icon-expand {
267 float: right;
268 margin-top: $spacer / 4;
269}
270
271.btn-link,
272.nav-link {
273 position: relative;
274 font-weight: $headings-font-weight;
275 padding-left: $spacer; // defining consistent padding for links and buttons
276 padding-right: $spacer;
Yoshie Muranaka01da8182020-07-08 15:46:43 -0700277 color: theme-color('secondary');
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800278
279 &:hover {
Yoshie Muranaka01da8182020-07-08 15:46:43 -0700280 background-color: gray('300');
281 color: theme-color('dark');
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800282 }
Yoshie Muranaka9f5cea82020-02-04 09:30:00 -0800283
284 &:focus {
285 box-shadow: $btn-focus-box-shadow;
Yoshie Muranaka01da8182020-07-08 15:46:43 -0700286 color: theme-color('dark');
Yoshie Muranaka9f5cea82020-02-04 09:30:00 -0800287 }
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800288}
289
Derick Montague66f903f2020-02-28 11:22:31 -0600290.nav-link--current,
291.nav-link--current:hover,
292.nav-link--current:focus {
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800293 font-weight: $headings-font-weight;
Yoshie Muranaka01da8182020-07-08 15:46:43 -0700294 background-color: theme-color('secondary');
295 color: theme-color('light');
Derick Montague66f903f2020-02-28 11:22:31 -0600296 cursor: default;
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800297
298 &::before {
299 content: '';
300 position: absolute;
301 top: 0;
302 bottom: 0;
303 left: 0;
304 width: 4px;
Yoshie Muranaka01da8182020-07-08 15:46:43 -0700305 background-color: theme-color('primary');
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800306 }
Derick Montague42c19892020-01-17 16:10:34 -0600307}
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800308
309.nav-container {
310 position: fixed;
311 width: $navigation-width;
312 top: $header-height;
313 bottom: 0;
314 left: 0;
315 z-index: $zindex-fixed;
316 overflow-y: auto;
Yoshie Muranaka01da8182020-07-08 15:46:43 -0700317 background-color: gray('200');
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800318 transform: translateX(-$navigation-width);
319 transition: transform $exit-easing--productive $duration--moderate-02;
SurenNeware057232b2020-06-08 20:53:26 +0530320 @include media-breakpoint-down(md) {
321 z-index: $zindex-fixed + 2;
322 }
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800323
Derick Montague74466b82020-06-28 10:17:32 -0500324 &.open,
325 &:focus-within {
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800326 transform: translateX(0);
327 transition-timing-function: $entrance-easing--productive;
328 }
329
330 @include media-breakpoint-up($responsive-layout-bp) {
331 transition-duration: $duration--fast-01;
332 transform: translateX(0);
333 }
334}
335
336.nav-overlay {
337 position: fixed;
338 top: $header-height;
339 bottom: 0;
340 left: 0;
341 right: 0;
SurenNeware057232b2020-06-08 20:53:26 +0530342 z-index: $zindex-fixed + 1;
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800343 background-color: $black;
344 opacity: 0.5;
345
346 &.fade-enter-active {
347 transition: opacity $duration--moderate-02 $entrance-easing--productive;
348 }
349
350 &.fade-leave-active {
351 transition: opacity $duration--fast-02 $exit-easing--productive;
352 }
353
354 &.fade-enter,
355 &.fade-leave-to {
356 opacity: 0;
357 }
358
359 @include media-breakpoint-up($responsive-layout-bp) {
360 display: none;
361 }
362}
Derick Montague42c19892020-01-17 16:10:34 -0600363</style>