summaryrefslogtreecommitdiff
path: root/src/views/Motherboard/DynamicInfo/MotherboardDynamicPage.vue
blob: c2c88ab6411d91c9a6fe4db607e84bf7d6851457 (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
<template>
  <b-container
    :style="{ display: 'flex', 'flex-direction': 'column' }"
    fluid="xxl pt-0 m-0"
  >
    <page-title />
    <date-switch :switch-time-scale="switchTimeScale" :time-scale="timeScale" />
    <div class="limit-container">
      <div class="trmperature-limt">
        <img src="@/assets/images/labels/warning.svg" />
        <span class="semi-bold-12px">{{
          $t('tablesDescription.temperatureWarning')
        }}</span>
        <b-form-input
          v-model="temperatureWarningInput"
          type="number"
          :min="0"
          :max="100"
          class="form-control medium-12px"
        >
        </b-form-input>
      </div>
      <b-button
        class="save-button"
        variant="primary"
        @click="updateTemperature"
      >
        {{ $t('global.action.save') }}
      </b-button>
    </div>
    <!-- Temperature Table -->
    <temperature-table
      :time-scale="timeScale"
      :warning="temperatureWarning"
      :non-normal="temperatureNonNormal"
      :critical-start="temperatureCriticalStart"
    />
    <accessory-table :records="accessoryData.temperatureTable" />
  </b-container>
</template>
<script>
import PageTitle from '@/components/Global/PageTitle';
import DateSwitch from '@/components/Global/SilaComponents/DateSwitch';
import TemperatureTable from './TemperatureTable';
import AccessoryTable from '@/components/Global/SilaComponents/Tables/AccessoryTableWithLabel';
import iconChevronUp from '@carbon/icons-vue/es/chevron--up/16';

import TableFilterMixin from '@/components/Mixins/TableFilterMixin';
import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';

import { AccessoryData } from './helpers';

export default {
  components: {
    PageTitle,
    DateSwitch,
    TemperatureTable,
    AccessoryTable,
  },
  mixins: [TableFilterMixin, LoadingBarMixin],
  data() {
    return {
      isBusy: true,
      timeScale: 'hour',
      temperatureWarning: 72,
      temperatureWarningInput: 72,
      notificationInput: 42,
      accessoryData: AccessoryData,
      iconChevronUp: iconChevronUp,
      activeFilters: [],
    };
  },

  computed: {
    allSensors() {
      let sensors = this.$store.getters['sensors/tempSensors'];
      return sensors;
    },
  },
  created() {
    this.startLoader();
    this.$store.dispatch('sensors/getTempSensors').finally(() => {
      this.endLoader();
      this.accessoryData.temperatureTable.items = this.getFilteredTableData(
        this.allSensors,
        this.activeFilters
      );
      this.isBusy = false;
    });
  },
  methods: {
    switchTimeScale(period) {
      this.timeScale = period;
    },
    updateTemperature() {
      this.temperatureWarning = +this.temperatureWarningInput;
    },
  },
};
</script>
<style lang="scss" scoped>
//nav items style
.nav-item,
.nav-link {
  padding: 0;
}
.nav-item {
  list-style-type: none;
}

a {
  color: $text-primary !important;
  &:hover {
    color: $text-primary !important;
  }
}

.notification-button {
  border: none;
  background: none;
}

.semi-bold-12px {
  z-index: 1001;
}

// temperature limit comtainer
.limit-container {
  height: 85px;
  width: 100%;
  padding: 0 32px 10px 32px;
  display: flex;
  flex-flow: row nowrap;
  justify-content: flex-start;
  align-items: flex-end;
  gap: 24px;
}

.trmperature-limt {
  height: 60px;
  width: 100%;
  max-width: 270px;
  display: flex;
  align-items: baseline;
  flex-flow: row wrap;
  gap: 8px;
}

.form-control {
  height: 36px;
  &.non-normal {
    width: 125px;
  }
}
.save-button {
  width: 151px;
  height: 36px;
}
</style>