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
|
<template>
<b-container fluid="xl">
<page-title :description="$t('appPageTitle.dynamicInformation')" />
<chart
type="memory"
:colors="colors"
:data="filteredSensors"
:warning="temperatureWarning"
:non-normal="temperatureNonNormal"
:critical-start="temperatureCriticalStart"
></chart>
<b-table
v-if="items && items.length > 0"
responsive="md"
show-empty
table-variant="accessory"
hover
:items="items"
:fields="fields"
:empty-text="$t('global.table.emptyMessage')"
>
<template #cell(name)="{ value, index }">
<div
class="item-color"
:style="`background-color: ${colors[index]}`"
></div>
{{ value }}
</template>
<template #cell(minDate)="{ value }">
<span style="color: rgb(12, 28, 41)">
{{ value.time }}
</span>
<span>
{{ value.date }}
</span>
</template>
<template #cell(maxDate)="{ value }">
<span style="color: rgb(12, 28, 41)">
{{ value.time }}
</span>
<span>
{{ value.date }}
</span>
</template>
</b-table>
</b-container>
</template>
<script>
import PageTitle from '@/components/_sila/Global/PageTitle';
import Chart from '@/components/_sila/Global/Chart';
import DataFormatterMixin from '@/components/_sila/Mixins/DataFormatterMixin';
import LoadingBarMixin from '@/components/_sila/Mixins/LoadingBarMixin';
import TableFilterMixin from '@/components/_sila/Mixins/TableFilterMixin';
import { getItems } from '@/utilities/_sila/metricProperties';
export default {
components: { PageTitle, Chart },
mixins: [DataFormatterMixin, LoadingBarMixin, TableFilterMixin],
data() {
return {
activeFilters: [],
temperatureWarning: 72,
temperatureNonNormal: 44,
temperatureCriticalStart: 55,
fields: [
{
key: 'name',
label: this.$t('pageMemory.table.name'),
},
{
key: 'current',
label: this.$t('pageMemory.table.currentTemperature'),
},
{
key: 'middle',
label: this.$t('pageMemory.table.middleTemperature'),
},
{
key: 'min',
label: this.$t('pageMemory.table.minTemperature'),
},
{
key: 'minDate',
label: this.$t('pageMemory.table.minDate'),
},
{
key: 'max',
label: this.$t('pageMemory.table.maxTemperature'),
},
{
key: 'maxDate',
label: this.$t('pageMemory.table.maxDate'),
},
],
items: [],
};
},
computed: {
allSensors() {
let sensors = this.$store.getters['memory/dimms'];
return sensors;
},
filteredSensors() {
return this.getFilteredTableData(this.allSensors, this.activeFilters);
},
colors() {
return this.$randomColor({
count: this.items?.length,
hue: 'random',
luminosity: 'random',
});
},
},
watch: {
filteredSensors(data) {
this.items = getItems(data);
},
},
created() {
this.startLoader();
this.$store.dispatch('memory/getMemoryDynamic').finally(() => {
this.endLoader();
});
},
};
</script>
|