blob: 244eeb32bbdcf72525532e72f19bc72d4b4aae2e [file] [log] [blame]
Derick Montaguea2988f42020-01-17 13:46:30 -06001<template>
2 <div>
Yoshie Muranakadc04feb2019-12-04 08:41:22 -08003 <a class="link-skip-nav btn btn-light" href="#main-content">
4 Skip to content
5 </a>
Derick Montague75b48322019-12-06 01:24:41 -06006 <header id="page-header">
Yoshie Muranakab8b6f792019-12-03 14:47:32 -08007 <b-navbar toggleable="lg" variant="dark" type="dark">
Yoshie Muranakadc04feb2019-12-04 08:41:22 -08008 <!-- Left aligned nav items -->
9 <b-navbar-nav>
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080010 <b-nav-text>BMC System Management</b-nav-text>
11 </b-navbar-nav>
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080012 <!-- Right aligned nav items -->
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080013 <b-navbar-nav class="ml-auto">
14 <b-nav>
15 <b-nav-item>
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080016 Health
17 <status-icon :status="'danger'" />
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080018 </b-nav-item>
19 <b-nav-item>
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080020 Power
21 <status-icon :status="hostStatusIcon" />
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080022 </b-nav-item>
23 <b-nav-item>
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080024 Refresh
25 <icon-renew />
26 </b-nav-item>
27 <b-nav-item @click="logout">
28 Logout
29 <icon-avatar />
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080030 </b-nav-item>
31 </b-nav>
32 </b-navbar-nav>
Derick Montaguea2988f42020-01-17 13:46:30 -060033 </b-navbar>
34 </header>
35 </div>
36</template>
37
38<script>
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080039import IconAvatar from "@carbon/icons-vue/es/user--avatar/20";
40import IconRenew from "@carbon/icons-vue/es/renew/20";
41import StatusIcon from "../Global/StatusIcon";
Derick Montaguea2988f42020-01-17 13:46:30 -060042export default {
43 name: "AppHeader",
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080044 components: { IconAvatar, IconRenew, StatusIcon },
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080045 created() {
46 this.getHostInfo();
47 },
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080048 computed: {
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080049 hostStatus() {
50 return this.$store.getters["global/hostStatus"];
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080051 },
52 hostStatusIcon() {
53 switch (this.hostStatus) {
54 case "on":
55 return "success";
56 case "error":
57 return "danger";
58 case "off":
59 default:
60 return "secondary";
61 }
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080062 }
63 },
64 methods: {
65 getHostInfo() {
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080066 this.$store.dispatch("global/getHostStatus");
Derick Montaguee080a1a2019-12-04 16:30:08 -060067 },
68 logout() {
69 this.$store.dispatch("authentication/logout").then(() => {
70 this.$router.push("/login");
71 });
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080072 }
Derick Montaguea2988f42020-01-17 13:46:30 -060073 }
74};
75</script>
76
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080077<style lang="scss" scoped>
Derick Montague75b48322019-12-06 01:24:41 -060078.link-skip-nav {
79 position: absolute;
80 top: -60px;
81 left: 0.5rem;
82 z-index: 10;
83 transition: 150ms cubic-bezier(0.4, 0.14, 1, 1);
Derick Montague75b48322019-12-06 01:24:41 -060084 &:focus {
85 top: 0.5rem;
86 transition-timing-function: cubic-bezier(0, 0, 0.3, 1);
87 }
88}
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080089.nav-item {
90 svg {
91 fill: $light;
92 }
93}
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080094</style>