blob: d411c1f19fd158a326a15e94b992873a71213dac [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
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080017 <status-icon :status="healthStatusIcon" />
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 },
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080049 healthStatus() {
50 return this.$store.getters['eventLog/healthStatus'];
51 },
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080052 hostStatusIcon() {
53 switch (this.hostStatus) {
Derick Montaguee2fd1562019-12-20 13:26:53 -060054 case 'on':
55 return 'success';
56 case 'error':
57 return 'danger';
58 case 'off':
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080059 default:
Derick Montaguee2fd1562019-12-20 13:26:53 -060060 return 'secondary';
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080061 }
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080062 },
63 healthStatusIcon() {
64 switch (this.healthStatus) {
65 case 'good':
66 return 'success';
67 case 'warning':
68 return 'warning';
69 case 'critical':
70 return 'danger';
71 default:
72 return 'secondary';
73 }
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080074 }
75 },
Derick Montague09e45cd2020-01-23 15:45:57 -060076 created() {
77 this.getHostInfo();
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080078 this.getEvents();
Derick Montague09e45cd2020-01-23 15:45:57 -060079 },
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080080 methods: {
81 getHostInfo() {
Derick Montaguee2fd1562019-12-20 13:26:53 -060082 this.$store.dispatch('global/getHostStatus');
Derick Montaguee080a1a2019-12-04 16:30:08 -060083 },
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080084 getEvents() {
85 this.$store.dispatch('eventLog/getEventLogData');
86 },
Derick Montaguee080a1a2019-12-04 16:30:08 -060087 logout() {
Derick Montaguec031b692020-02-12 15:55:42 -060088 this.$store.dispatch('authentication/logout');
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080089 }
Derick Montaguea2988f42020-01-17 13:46:30 -060090 }
91};
92</script>
93
Yoshie Muranakab8b6f792019-12-03 14:47:32 -080094<style lang="scss" scoped>
Derick Montague75b48322019-12-06 01:24:41 -060095.link-skip-nav {
96 position: absolute;
97 top: -60px;
98 left: 0.5rem;
99 z-index: 10;
100 transition: 150ms cubic-bezier(0.4, 0.14, 1, 1);
Derick Montague75b48322019-12-06 01:24:41 -0600101 &:focus {
102 top: 0.5rem;
103 transition-timing-function: cubic-bezier(0, 0, 0.3, 1);
104 }
105}
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -0800106.navbar-dark {
107 .navbar-text,
108 .nav-link {
109 color: $white !important;
110 }
111}
Yoshie Muranakadc04feb2019-12-04 08:41:22 -0800112.nav-item {
113 svg {
114 fill: $light;
115 }
116}
Yoshie Muranakab8b6f792019-12-03 14:47:32 -0800117</style>