1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
<template>
<div>
<a class="link-skip-nav btn btn-light" href="#main-content">
Skip to content
</a>
<header id="page-header">
<b-navbar toggleable="lg" variant="dark" type="dark">
<!-- Left aligned nav items -->
<b-navbar-nav>
<b-nav-text>BMC System Management</b-nav-text>
</b-navbar-nav>
<!-- Right aligned nav items -->
<b-navbar-nav class="ml-auto">
<b-nav>
<b-nav-item>
Health
<status-icon :status="healthStatusIcon" />
</b-nav-item>
<b-nav-item>
Power
<status-icon :status="hostStatusIcon" />
</b-nav-item>
<b-nav-item @click="refresh">
Refresh
<icon-renew />
</b-nav-item>
<b-nav-item @click="logout">
Logout
<icon-avatar />
</b-nav-item>
</b-nav>
</b-navbar-nav>
</b-navbar>
</header>
</div>
</template>
<script>
import IconAvatar from '@carbon/icons-vue/es/user--avatar/20';
import IconRenew from '@carbon/icons-vue/es/renew/20';
import StatusIcon from '../Global/StatusIcon';
export default {
name: 'AppHeader',
components: { IconAvatar, IconRenew, StatusIcon },
computed: {
hostStatus() {
return this.$store.getters['global/hostStatus'];
},
healthStatus() {
return this.$store.getters['eventLog/healthStatus'];
},
hostStatusIcon() {
switch (this.hostStatus) {
case 'on':
return 'success';
case 'error':
return 'danger';
case 'off':
default:
return 'secondary';
}
},
healthStatusIcon() {
switch (this.healthStatus) {
case 'good':
return 'success';
case 'warning':
return 'warning';
case 'critical':
return 'danger';
default:
return 'secondary';
}
}
},
created() {
this.getHostInfo();
this.getEvents();
},
methods: {
getHostInfo() {
this.$store.dispatch('global/getHostStatus');
},
getEvents() {
this.$store.dispatch('eventLog/getEventLogData');
},
refresh() {
this.$emit('refresh');
},
logout() {
this.$store.dispatch('authentication/logout');
}
}
};
</script>
<style lang="scss" scoped>
.link-skip-nav {
position: absolute;
top: -60px;
left: 0.5rem;
z-index: 10;
transition: 150ms cubic-bezier(0.4, 0.14, 1, 1);
&:focus {
top: 0.5rem;
transition-timing-function: cubic-bezier(0, 0, 0.3, 1);
}
}
.navbar-dark {
.navbar-text,
.nav-link {
color: $white !important;
}
}
.nav-item {
svg {
fill: $light;
}
}
</style>
|