blob: 2847e6649615f07df07cd64a63e403b59dd8b6ac [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 }">
4 <nav ref="nav">
5 <b-nav vertical>
6 <b-nav-item to="/"><icon-overview />Overview</b-nav-item>
Derick Montague42c19892020-01-17 16:10:34 -06007
Yoshie Muranaka74f86872020-02-10 12:28:37 -08008 <li class="nav-item">
9 <b-button v-b-toggle.health-menu variant="link">
10 <icon-health />Health
11 <icon-expand class="icon-expand" />
12 </b-button>
13 <b-collapse id="health-menu" tag="ul" class="nav-item__nav">
14 <b-nav-item href="javascript:void(0)">Event Log</b-nav-item>
15 <b-nav-item href="javascript:void(0)">Hardware Status</b-nav-item>
16 <b-nav-item href="javascript:void(0)">Sensors</b-nav-item>
17 </b-collapse>
18 </li>
Derick Montague42c19892020-01-17 16:10:34 -060019
Yoshie Muranaka74f86872020-02-10 12:28:37 -080020 <li class="nav-item">
21 <b-button v-b-toggle.control-menu variant="link">
22 <icon-control />Control
23 <icon-expand class="icon-expand" />
24 </b-button>
25 <b-collapse id="control-menu" tag="ul" class="nav-item__nav">
26 <b-nav-item href="javascript:void(0)">
27 Manage power usage
28 </b-nav-item>
29 <b-nav-item href="javascript:void(0)">Server LED</b-nav-item>
30 <b-nav-item href="javascript:void(0)">
31 Server power operations
32 </b-nav-item>
33 </b-collapse>
34 </li>
Yoshie Muranaka71ac2302019-12-26 11:43:36 -080035
Yoshie Muranaka74f86872020-02-10 12:28:37 -080036 <li class="nav-item">
37 <b-button v-b-toggle.configuration-menu variant="link">
38 <icon-configuration />Configuration
39 <icon-expand class="icon-expand" />
40 </b-button>
41 <b-collapse id="configuration-menu" tag="ul" class="nav-item__nav">
42 <b-nav-item href="javascript:void(0)">Firmware</b-nav-item>
43 <b-nav-item href="javascript:void(0)">
44 Network settings
45 </b-nav-item>
46 <b-nav-item href="javascript:void(0)">SNMP settings</b-nav-item>
47 </b-collapse>
48 </li>
Derick Montague42c19892020-01-17 16:10:34 -060049
Yoshie Muranaka74f86872020-02-10 12:28:37 -080050 <li class="nav-item">
51 <b-button v-b-toggle.access-control-menu variant="link">
52 <icon-access-control />Access Control
53 <icon-expand class="icon-expand" />
54 </b-button>
55 <b-collapse id="access-control-menu" tag="ul" class="nav-item__nav">
56 <b-nav-item href="javascript:void(0)">LDAP</b-nav-item>
57 <b-nav-item to="/access-control/local-user-management">
58 Local user management
59 </b-nav-item>
60 <b-nav-item href="javascript:void(0)">
61 SSL Certificates
62 </b-nav-item>
63 </b-collapse>
64 </li>
65 </b-nav>
66 </nav>
67 </div>
68 <transition name="fade">
69 <div
70 v-if="isNavigationOpen"
71 class="nav-overlay"
72 @click="toggleIsOpen"
73 ></div>
74 </transition>
75 </div>
Derick Montaguea2988f42020-01-17 13:46:30 -060076</template>
77
78<script>
Yoshie Muranaka71ac2302019-12-26 11:43:36 -080079import IconAnalytics from '@carbon/icons-vue/es/analytics/16';
80import IconDataCheck from '@carbon/icons-vue/es/data--check/16';
81import IconSettingsAdjust from '@carbon/icons-vue/es/settings--adjust/16';
82import IconSettings from '@carbon/icons-vue/es/settings/16';
83import IconPassword from '@carbon/icons-vue/es/password/16';
84import IconChevronUp from '@carbon/icons-vue/es/chevron--up/16';
Derick Montaguea2988f42020-01-17 13:46:30 -060085
86export default {
Derick Montaguee2fd1562019-12-20 13:26:53 -060087 name: 'AppNavigation',
Derick Montague42c19892020-01-17 16:10:34 -060088 components: {
Yoshie Muranaka71ac2302019-12-26 11:43:36 -080089 iconOverview: IconAnalytics,
90 iconHealth: IconDataCheck,
91 iconControl: IconSettingsAdjust,
92 iconConfiguration: IconSettings,
93 iconAccessControl: IconPassword,
94 iconExpand: IconChevronUp
Yoshie Muranaka74f86872020-02-10 12:28:37 -080095 },
96 data() {
97 return {
98 isNavigationOpen: false
99 };
100 },
101 watch: {
102 $route: function() {
103 this.isNavigationOpen = false;
104 },
105 isNavigationOpen: function(isNavigationOpen) {
106 this.$root.$emit('change:isNavigationOpen', isNavigationOpen);
107 }
108 },
109 mounted() {
110 this.$root.$on('toggle:navigation', () => this.toggleIsOpen());
111 },
112 methods: {
113 toggleIsOpen() {
114 this.isNavigationOpen = !this.isNavigationOpen;
115 }
Derick Montague42c19892020-01-17 16:10:34 -0600116 }
Derick Montaguea2988f42020-01-17 13:46:30 -0600117};
118</script>
Derick Montague42c19892020-01-17 16:10:34 -0600119
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800120<style scoped lang="scss">
121svg {
122 fill: $gray-900;
123 margin-left: 0 !important; //!important overriding button specificity
124 vertical-align: text-bottom;
125 &:not(.icon-expand) {
126 margin-right: $spacer;
127 }
128}
129
130.nav {
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800131 padding-top: $spacer;
132}
133
134.nav-item__nav {
Derick Montague42c19892020-01-17 16:10:34 -0600135 list-style: none;
136 padding-left: 0;
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800137 margin-left: 0;
138
139 .nav-link {
140 padding-left: $spacer * 4;
141
142 &:not(.nav-link--current) {
143 font-weight: normal;
144 }
145 }
146}
147
148.btn-link {
149 width: 100%;
150 text-align: left;
151 text-decoration: none !important;
152 border-radius: 0;
153
154 &.collapsed {
155 .icon-expand {
156 transform: rotate(180deg);
157 }
158 }
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800159}
160
161.icon-expand {
162 float: right;
163 margin-top: $spacer / 4;
164}
165
166.btn-link,
167.nav-link {
168 position: relative;
169 font-weight: $headings-font-weight;
170 padding-left: $spacer; // defining consistent padding for links and buttons
171 padding-right: $spacer;
172 color: $gray-900 !important; //using important to avoid styling states
173
174 &:hover {
175 background-color: $gray-300;
176 }
Yoshie Muranaka9f5cea82020-02-04 09:30:00 -0800177
178 &:focus {
179 box-shadow: $btn-focus-box-shadow;
180 }
Yoshie Muranaka71ac2302019-12-26 11:43:36 -0800181}
182
183.nav-link--current {
184 font-weight: $headings-font-weight;
185 background-color: $gray-300;
186
187 &::before {
188 content: '';
189 position: absolute;
190 top: 0;
191 bottom: 0;
192 left: 0;
193 width: 4px;
194 background-color: $primary;
195 }
Derick Montague42c19892020-01-17 16:10:34 -0600196}
Yoshie Muranaka74f86872020-02-10 12:28:37 -0800197
198.nav-container {
199 position: fixed;
200 width: $navigation-width;
201 top: $header-height;
202 bottom: 0;
203 left: 0;
204 z-index: $zindex-fixed;
205 overflow-y: auto;
206 background-color: $gray-200;
207 transform: translateX(-$navigation-width);
208 transition: transform $exit-easing--productive $duration--moderate-02;
209
210 &.open {
211 transform: translateX(0);
212 transition-timing-function: $entrance-easing--productive;
213 }
214
215 @include media-breakpoint-up($responsive-layout-bp) {
216 transition-duration: $duration--fast-01;
217 transform: translateX(0);
218 }
219}
220
221.nav-overlay {
222 position: fixed;
223 top: $header-height;
224 bottom: 0;
225 left: 0;
226 right: 0;
227 z-index: $zindex-fixed - 1;
228 background-color: $black;
229 opacity: 0.5;
230
231 &.fade-enter-active {
232 transition: opacity $duration--moderate-02 $entrance-easing--productive;
233 }
234
235 &.fade-leave-active {
236 transition: opacity $duration--fast-02 $exit-easing--productive;
237 }
238
239 &.fade-enter,
240 &.fade-leave-to {
241 opacity: 0;
242 }
243
244 @include media-breakpoint-up($responsive-layout-bp) {
245 display: none;
246 }
247}
Derick Montague42c19892020-01-17 16:10:34 -0600248</style>