summaryrefslogtreecommitdiff
path: root/src/views/_sila/Overview/OverviewQuickLinks.vue
blob: 9c4afab66bc9d5e281acf0e3fd0528de20ca1f29 (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
<template>
  <b-card bg-variant="light" border-variant="light">
    <b-row class="d-flex justify-content-between align-items-center">
      <b-col sm="6" lg="9" class="mb-2 mt-2">
        <dl>
          <dt>{{ $t('pageOverview.bmcTime') }}</dt>
          <dd
            v-if="liveDate && liveTime"
            data-test-id="overviewQuickLinks-text-bmcTime"
          >
            {{ liveDate }} {{ liveTime }}
            <!--{{ isUtcDisplay ? $t('pageProfileSettings.UTC') : timezone }}-->
          </dd>
          <dd v-else>--</dd>
        </dl>
      </b-col>
      <b-col sm="6" lg="3" class="mb-2 mt-2">
        <b-button
          to="/operations/serial-over-lan"
          variant="secondary"
          data-test-id="overviewQuickLinks-button-solConsole"
          class="d-flex justify-content-between align-items-center"
        >
          {{ $t('pageOverview.solConsole') }}
          <icon-arrow-right />
        </b-button>
      </b-col>
    </b-row>
  </b-card>
</template>

<script>
import ArrowRight16 from '@carbon/icons-vue/es/arrow--right/16';
import BVToastMixin from '@/components/_sila/Mixins/BVToastMixin';
import LocalTimezoneLabelMixin from '@/components/_sila/Mixins/LocalTimezoneLabelMixin';

export default {
  name: 'QuickLinks',
  components: {
    IconArrowRight: ArrowRight16,
  },
  mixins: [BVToastMixin, LocalTimezoneLabelMixin],
  computed: {
    timeZone() {
      return this.$store.getters['global/timeZone'];
    },
    liveDate() {
      return this.$store.getters['global/liveDate'];
    },
    liveClock() {
      return this.$store.getters['global/liveClock'];
    },
    liveTime() {
      if (!this.liveClock || !this.timeZone) {
        return;
      }

      return (
        this.$store.getters['global/liveClock'] +
        ' ' +
        this.timeZone.split(' ')[0]
      );
    },
    timezone() {
      return this.localOffset();
    },
    /*isUtcDisplay() {
      return this.$store.getters['global/isUtcDisplay'];
    },*/
  },
  created() {
    Promise.all([this.$store.dispatch('global/getBmcTime')]).finally(() => {
      this.$root.$emit('overview-quicklinks-complete');
    });
  },
};
</script>

<style lang="scss" scoped>
dd,
dl {
  margin: 0;
}
</style>