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
|
<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="'danger'" />
</b-nav-item>
<b-nav-item>
Power
<status-icon :status="hostStatusIcon" />
</b-nav-item>
<b-nav-item>
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 },
created() {
this.getHostInfo();
},
computed: {
hostStatus() {
return this.$store.getters["global/hostStatus"];
},
hostStatusIcon() {
switch (this.hostStatus) {
case "on":
return "success";
case "error":
return "danger";
case "off":
default:
return "secondary";
}
}
},
methods: {
getHostInfo() {
this.$store.dispatch("global/getHostStatus");
},
logout() {
this.$store.dispatch("authentication/logout").then(() => {
this.$router.push("/login");
});
}
}
};
</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);
}
}
.nav-item {
svg {
fill: $light;
}
}
</style>
|