summaryrefslogtreecommitdiff
path: root/src/components/_sila/SubHeader/SubHeader.vue
blob: 086fc7b88ca6fc824dcb33c955ed063d225438f9 (plain)
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<template>
  <div>
    <section id="sub-header">
      <b-navbar type="dark" :aria-label="$t('appHeader.applicationHeader')">
        <!-- top navigation menu -->
        <b-navbar-nav>
          <b-nav-item
            to="/hardware-status/inventory"
            data-test-id="appHeader-container-health"
            class="subheader-button"
            :class="{
              'active-route-top': ![
                'profile-settings',
                'information-and-faq',
                'support',
                'console-settings',
                'console',
                'operations',
                'security-and-access',
              ].includes($route.path.split('/')[1]),
            }"
          >
            {{ $t('subHeader.serverInfo') }}
          </b-nav-item>

          <b-nav-item
            to="/operations/kvm"
            data-test-id="appHeader-container-health"
            class="subheader-button"
            :class="{
              'active-route-top':
                ''.includes($route.path.split('/console/settings')[1]) ||
                ''.includes(
                  $route.path.split('/operations/serial-over-lan')[1]
                ) ||
                ''.includes($route.path.split('/operations/kvm')[1]),
            }"
          >
            {{ $t('subHeader.console') }}
          </b-nav-item>

          <b-nav-item
            to="/security-and-access/user-management"
            data-test-id="appHeader-container-power"
            class="subheader-button"
            :class="{
              'active-route-top': ''.includes(
                $route.path.split('security-and-access/user-management')[1]
              ),
            }"
          >
            {{ $t('subHeader.administration') }}
          </b-nav-item>
          <!-- Using LI elements instead of b-nav-item to support semantic button elements -->
        </b-navbar-nav>
      </b-navbar>
    </section>
    <loading-bar />
  </div>
</template>

<script>
import BVToastMixin from '@/components/_sila/Mixins/BVToastMixin';
import LoadingBar from '@/components/_sila/Global/LoadingBar';

export default {
  name: 'AppHeader',
  components: {
    LoadingBar,
  },
  mixins: [BVToastMixin],
  props: {
    routerKey: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      isNavigationOpen: false,
    };
  },
  computed: {
    isNavTagPresent() {
      return this.assetTag || this.modelType || this.serialNumber;
    },
  },
  mounted() {
    this.$root.$on(
      'change-is-navigation-open',
      (isNavigationOpen) => (this.isNavigationOpen = isNavigationOpen)
    );
  },
  methods: {
    toggleNavigation() {
      this.$root.$emit('toggle-navigation');
    },
    setFocus(event) {
      event.preventDefault();
      this.$root.$emit('skip-navigation');
    },
  },
};
</script>

<style lang="scss">
@mixin focus-box-shadow($padding-color: $navbar-color, $outline-color: $white) {
  box-shadow: inset 0 0 0 3px $padding-color, inset 0 0 0 5px $outline-color;
}
.sub-header {
  height: $second-header-height;

  .subheader-button {
    margin-left: 10px;
  }

  .navbar-text,
  .nav-link,
  .btn-link {
    border-radius: 14% 14% 0px 0px;
    padding: 0.68rem 1rem !important;

    &:hover {
      background-color: $white;
      color: #1a3e5b !important;
      border-radius: 14% 14% 0px 0px;
    }
    &:active {
      background-color: $white;
      color: #1a3e5b !important;
      border-radius: 14% 14% 0px 0px;
    }
  }

  .navbar {
    padding: 0;
    background-color: $navbar-color;
    @include media-breakpoint-up($responsive-layout-bp) {
      height: $second-header-height;
    }

    .helper-menu {
      @include media-breakpoint-down(sm) {
        width: 100%;
        justify-content: flex-end;
        .nav-link,
        .btn {
          padding: $spacer / 1.125 $spacer / 2;
          margin-left: 10px;
        }
      }
    }
  }

  .navbar-nav {
    align-items: baseline;
    padding-left: 24px;
    .nav-tags {
      @include media-breakpoint-down(xs) {
        @include sr-only;
      }
      .asset-tag {
        @include media-breakpoint-down($responsive-layout-bp) {
          @include sr-only;
        }
      }
    }
  }
}
#sub-header .nav-item.active-route-top > a {
  background-color: $white;
  color: #1a3e5b;
  border-radius: 14% 14% 0px 0px;
}

.navbar-dark .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 1);
}
</style>