blob: b2d29c958cb89a4ee40c5d0eec25dc025761f723 [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>
Derick Montaguee2fd1562019-12-20 13:26:53 -060039import 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 {
Derick Montaguee2fd1562019-12-20 13:26:53 -060043 name: 'AppHeader',
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080044 components: { IconAvatar, IconRenew, StatusIcon },
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080045 computed: {
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080046 hostStatus() {
Derick Montaguee2fd1562019-12-20 13:26:53 -060047 return this.$store.getters['global/hostStatus'];
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080048 },
49 hostStatusIcon() {
50 switch (this.hostStatus) {
Derick Montaguee2fd1562019-12-20 13:26:53 -060051 case 'on':
52 return 'success';
53 case 'error':
54 return 'danger';
55 case 'off':
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080056 default:
Derick Montaguee2fd1562019-12-20 13:26:53 -060057 return 'secondary';
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080058 }
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080059 }
60 },
Derick Montague09e45cd2020-01-23 15:45:57 -060061 created() {
62 this.getHostInfo();
63 },
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080064 methods: {
65 getHostInfo() {
Derick Montaguee2fd1562019-12-20 13:26:53 -060066 this.$store.dispatch('global/getHostStatus');
Derick Montaguee080a1a2019-12-04 16:30:08 -060067 },
68 logout() {
Derick Montaguee2fd1562019-12-20 13:26:53 -060069 this.$store.dispatch('authentication/logout').then(() => {
70 this.$router.push('/login');
Derick Montaguee080a1a2019-12-04 16:30:08 -060071 });
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>