bfg-common 1.4.16 → 1.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/localization/local_be.json +6 -0
- package/assets/localization/local_en.json +6 -0
- package/assets/localization/local_hy.json +6 -0
- package/assets/localization/local_kk.json +6 -0
- package/assets/localization/local_ru.json +6 -0
- package/assets/localization/local_zh.json +6 -0
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/Form.vue +4 -4
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/lib/config/dateForm.ts +1 -1
- package/components/common/pages/hardwareHealth/HardwareHealth.vue +43 -61
- package/components/common/pages/hardwareHealth/historyTestimony/Graph.vue +331 -0
- package/components/common/pages/hardwareHealth/historyTestimony/lib/models/interfaces.ts +9 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/Tools.vue +375 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/ChartOptionsModal.vue +469 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/Notification.vue +30 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/Actions.vue +157 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/SaveOptionsModal.vue +81 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/lib/utils/optionsActions.ts +25 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/Counters.vue +89 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/table/Table.vue +174 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/table/lib/config/tableConfig.ts +89 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/table/lib/models/types.ts +5 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/Timespan.vue +64 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/form/Form.vue +539 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/form/lib/config/dateForm.ts +115 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/config/optionsMetrics.ts +17 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/models/interfaces.ts +15 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/models/types.ts +1 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/metrics/Metrics.vue +31 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/lib/config/toolbar.ts +78 -0
- package/components/common/pages/hardwareHealth/historyTestimony/tools/lib/models/interfaces.ts +9 -0
- package/components/common/pages/hardwareHealth/tableView/TableView.vue +4 -10
- package/components/common/pages/hardwareHealth/tableView/lib/config/historyTestimonyTable.ts +128 -0
- package/components/common/pages/hardwareHealth/tableView/lib/config/sensorTable.ts +7 -11
- package/components/common/pages/hardwareHealth/tableView/lib/config/tableKeys.ts +6 -7
- package/components/common/pages/hardwareHealth/tableView/lib/models/interfaces.ts +2 -0
- package/components/common/pages/hardwareHealth/tableView/lib/models/types.ts +9 -4
- package/lib/models/interfaces.ts +1 -0
- package/lib/models/types.ts +1 -0
- package/package.json +1 -1
- package/components/common/pages/hardwareHealth/Graph.vue +0 -84
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="chart-options-modal">
|
|
3
|
+
<atoms-modal
|
|
4
|
+
width="1150px"
|
|
5
|
+
:show="true"
|
|
6
|
+
:title="localization.common.chartOptions"
|
|
7
|
+
:disabled-submit="isDisabledSubmit"
|
|
8
|
+
@hide="onHide"
|
|
9
|
+
@submit="onSubmit"
|
|
10
|
+
>
|
|
11
|
+
<template #modalBody>
|
|
12
|
+
<common-monitor-advanced-tools-chart-options-modal-notification
|
|
13
|
+
v-show="isShowAlerts"
|
|
14
|
+
:alerts="alerts"
|
|
15
|
+
@remove="onRemoveAlerts"
|
|
16
|
+
/>
|
|
17
|
+
<div>
|
|
18
|
+
<common-pages-hardware-health-history-testimony-tools-chart-options-modal-actions
|
|
19
|
+
:is-disabled-save="!currentSelectedRows.length"
|
|
20
|
+
:options-names="optionsNames"
|
|
21
|
+
:selected-chart-option-name="localSelectedChartOptionName"
|
|
22
|
+
@save="onSaveOptions"
|
|
23
|
+
@check-validation="checkValidations"
|
|
24
|
+
@select-local-option-name="onSelectLocalOptionName"
|
|
25
|
+
@delete-chart-name="onDeleteChartName"
|
|
26
|
+
/>
|
|
27
|
+
|
|
28
|
+
<div class="horizontal-flex-container chart-options-content">
|
|
29
|
+
<common-pages-hardware-health-history-testimony-tools-chart-options-modal-metrics
|
|
30
|
+
v-model:selected-metric="selectedMetric"
|
|
31
|
+
:metrics-items="metricsItems"
|
|
32
|
+
/>
|
|
33
|
+
<common-pages-hardware-health-history-testimony-tools-chart-options-modal-counters
|
|
34
|
+
:chart="selectedMetric"
|
|
35
|
+
:selected-power-keys="localSelectedPowerCountersKeys"
|
|
36
|
+
:selected-temperature-keys="localSelectedTemperatureCountersKeys"
|
|
37
|
+
:power-counters-table-data="props.powerCountersTableData"
|
|
38
|
+
:temperature-counters-table-data="
|
|
39
|
+
props.temperatureCountersTableData
|
|
40
|
+
"
|
|
41
|
+
:language="props.language"
|
|
42
|
+
:selected-chart-type="localSelectedChartType"
|
|
43
|
+
:selected-timespan-type="localSelectedTimespanType"
|
|
44
|
+
:units-count="localUnitsCount"
|
|
45
|
+
:period-type="localPeriodType"
|
|
46
|
+
:selected-custom-time="localCustomTime"
|
|
47
|
+
:custom-date-from="props.customDateFrom"
|
|
48
|
+
:custom-date-to="props.customDateTo"
|
|
49
|
+
:custom-time-from="props.customTimeFrom"
|
|
50
|
+
:custom-time-to="props.customTimeTo"
|
|
51
|
+
@select-power-row="onSelectPowerRow"
|
|
52
|
+
@select-temperature-row="onSelectTemperatureRow"
|
|
53
|
+
@update-chart-type="selectedChartTypeLocal = $event"
|
|
54
|
+
@update-custom-time="localCustomTime = $event"
|
|
55
|
+
@update-timespan-type="timespanType = $event"
|
|
56
|
+
@update-unit-count="unitCount = $event"
|
|
57
|
+
@update-period-type="localPeriodType = $event"
|
|
58
|
+
@update-custom-date-from="onUpdateCustomDateFrom"
|
|
59
|
+
@update-custom-date-to="onUpdateCustomDateTo"
|
|
60
|
+
@update-custom-time-from="onUpdateCustomTimeFrom"
|
|
61
|
+
@update-custom-time-to="onUpdateCustomTimeTo"
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</template>
|
|
66
|
+
</atoms-modal>
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script setup lang="ts">
|
|
71
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
72
|
+
import type { UI_I_VerticalTabs } from '~/components/atoms/tabs/lib/models/interfaces'
|
|
73
|
+
import type { UI_T_Chart } from '~/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/models/types'
|
|
74
|
+
import type { UI_I_OptionsForm } from '~/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/models/interfaces'
|
|
75
|
+
import type { UI_I_HardwareHealthSensorsGraph } from '~/components/common/pages/hardwareHealth/historyTestimony/lib/models/interfaces'
|
|
76
|
+
import { metricsFunc } from '~/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/config/optionsMetrics'
|
|
77
|
+
import { checkDateFunc } from '~/components/common/monitor/overview/filters/customIntervalModal/lib/config/dateChecker'
|
|
78
|
+
import { getValidDateByOptionFunc } from '~/components/common/monitor/lib/config/getValidDateByOption'
|
|
79
|
+
import { getCurrentOptionsStorageFunc } from '~/components/common/pages/hardwareHealth/historyTestimony/tools/lib/config/toolbar'
|
|
80
|
+
|
|
81
|
+
const props = defineProps<{
|
|
82
|
+
selectedChartOptionName: string
|
|
83
|
+
selectedMetric: UI_T_Chart
|
|
84
|
+
selectedPowerCountersKeys: number[]
|
|
85
|
+
powerSelectedRowsLocal: UI_I_HardwareHealthSensorsGraph[]
|
|
86
|
+
selectedTemperatureCountersKeys: number[]
|
|
87
|
+
temperatureSelectedRowsLocal: UI_I_HardwareHealthSensorsGraph[]
|
|
88
|
+
unitsCount: number
|
|
89
|
+
powerCountersTableData: UI_I_HardwareHealthSensorsGraph[]
|
|
90
|
+
temperatureCountersTableData: UI_I_HardwareHealthSensorsGraph[]
|
|
91
|
+
language: string
|
|
92
|
+
selectedTimespanType: string
|
|
93
|
+
customDateFrom: string
|
|
94
|
+
customDateTo: string
|
|
95
|
+
customTimeFrom: string
|
|
96
|
+
customTimeTo: string
|
|
97
|
+
}>()
|
|
98
|
+
|
|
99
|
+
const emits = defineEmits<{
|
|
100
|
+
(event: 'hide'): void
|
|
101
|
+
(event: 'select-metric-local', value: string): void
|
|
102
|
+
(
|
|
103
|
+
event: 'power-selected-rows-local',
|
|
104
|
+
value: UI_I_HardwareHealthSensorsGraph[]
|
|
105
|
+
): void
|
|
106
|
+
(
|
|
107
|
+
event: 'temperature-selected-rows-local',
|
|
108
|
+
value: UI_I_HardwareHealthSensorsGraph[]
|
|
109
|
+
): void
|
|
110
|
+
(event: 'update-chart-type', value: string): void
|
|
111
|
+
(event: 'update-timespan-type', value: string): void
|
|
112
|
+
(event: 'update-unit-count', value: number): void
|
|
113
|
+
(event: 'update-period-type', value: string): void
|
|
114
|
+
(event: 'update-custom-time', value: string): void
|
|
115
|
+
(event: 'delete-option'): void
|
|
116
|
+
(event: 'save-option-name'): void
|
|
117
|
+
(event: 'update-custom-date-from', value: string): void
|
|
118
|
+
(event: 'update-custom-date-to', value: string): void
|
|
119
|
+
(event: 'update-custom-time-from', value: string): void
|
|
120
|
+
(event: 'update-custom-time-to', value: string): void
|
|
121
|
+
(event: 'submit-options', value: UI_I_OptionsForm): void
|
|
122
|
+
}>()
|
|
123
|
+
|
|
124
|
+
const routeType = '' + useRoute().params.type
|
|
125
|
+
|
|
126
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
127
|
+
|
|
128
|
+
const localCustomDateFrom = ref<string>('')
|
|
129
|
+
const onUpdateCustomDateFrom = (value: string): void => {
|
|
130
|
+
localCustomDateFrom.value = value
|
|
131
|
+
}
|
|
132
|
+
const localCustomDateTo = ref<string>('')
|
|
133
|
+
const onUpdateCustomDateTo = (value: string): void => {
|
|
134
|
+
localCustomDateTo.value = value
|
|
135
|
+
}
|
|
136
|
+
const localCustomTimeFrom = ref<string>('')
|
|
137
|
+
const onUpdateCustomTimeFrom = (value: string): void => {
|
|
138
|
+
localCustomTimeFrom.value = value
|
|
139
|
+
}
|
|
140
|
+
const localCustomTimeTo = ref<string>('')
|
|
141
|
+
const onUpdateCustomTimeTo = (value: string): void => {
|
|
142
|
+
localCustomTimeTo.value = value
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const metricsItems = computed<UI_I_VerticalTabs[]>(() =>
|
|
146
|
+
metricsFunc(localization.value)
|
|
147
|
+
)
|
|
148
|
+
const selectedMetric = ref<UI_T_Chart>(
|
|
149
|
+
props.selectedMetric || '' + metricsItems.value[0]?.value
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
const localSelectedPowerCountersKeys = ref<number[]>([])
|
|
153
|
+
watch(
|
|
154
|
+
() => props.selectedPowerCountersKeys,
|
|
155
|
+
(newValue) => {
|
|
156
|
+
localSelectedPowerCountersKeys.value = newValue
|
|
157
|
+
},
|
|
158
|
+
{ immediate: true, deep: true }
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
const localSelectedTemperatureCountersKeys = ref<number[]>([])
|
|
162
|
+
watch(
|
|
163
|
+
() => props.selectedTemperatureCountersKeys,
|
|
164
|
+
(newValue) => {
|
|
165
|
+
localSelectedTemperatureCountersKeys.value = newValue
|
|
166
|
+
},
|
|
167
|
+
{ immediate: true, deep: true }
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
const localSelectedChartType = ref<string>('')
|
|
171
|
+
|
|
172
|
+
const localSelectedTimespanType = ref<string>('')
|
|
173
|
+
watch(
|
|
174
|
+
() => props.selectedTimespanType,
|
|
175
|
+
(newValue) => {
|
|
176
|
+
localSelectedTimespanType.value = newValue
|
|
177
|
+
},
|
|
178
|
+
{ immediate: true }
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
const localUnitsCount = ref<number>(0)
|
|
182
|
+
watch(
|
|
183
|
+
() => props.unitsCount,
|
|
184
|
+
(newValue) => {
|
|
185
|
+
localUnitsCount.value = newValue
|
|
186
|
+
},
|
|
187
|
+
{ immediate: true }
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
const localPeriodType = ref<string>('')
|
|
191
|
+
watch(
|
|
192
|
+
() => props.periodType,
|
|
193
|
+
(newValue) => {
|
|
194
|
+
localPeriodType.value = newValue
|
|
195
|
+
},
|
|
196
|
+
{ immediate: true }
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
const localCustomTime = ref<string>('')
|
|
200
|
+
|
|
201
|
+
const isShowAlerts = ref<boolean>(false)
|
|
202
|
+
const alerts = ref<string[]>([])
|
|
203
|
+
|
|
204
|
+
const onRemoveAlerts = (): void => {
|
|
205
|
+
isShowAlerts.value = false
|
|
206
|
+
alerts.value = []
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const onHide = (): void => {
|
|
210
|
+
emits('hide')
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const onSelectPowerRow = (data: UI_I_HardwareHealthSensorsGraph[]): void => {
|
|
214
|
+
emits('power-selected-rows-local', data)
|
|
215
|
+
}
|
|
216
|
+
const onSelectTemperatureRow = (
|
|
217
|
+
data: UI_I_HardwareHealthSensorsGraph[]
|
|
218
|
+
): void => {
|
|
219
|
+
emits('temperature-selected-rows-local', data)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const currentSelectedRows = computed<UI_I_HardwareHealthSensorsGraph[]>(() => {
|
|
223
|
+
let result: UI_I_HardwareHealthSensorsGraph[] = []
|
|
224
|
+
|
|
225
|
+
switch (selectedMetric.value) {
|
|
226
|
+
case 'power':
|
|
227
|
+
result = props.powerSelectedRowsLocal
|
|
228
|
+
break
|
|
229
|
+
case 'temperature':
|
|
230
|
+
result = props.temperatureSelectedRowsLocal
|
|
231
|
+
break
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return result
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
const selectedChartTypeLocal = ref<string>('')
|
|
238
|
+
|
|
239
|
+
const checkValidations = (): boolean => {
|
|
240
|
+
const checkDateResult = checkDateFunc(
|
|
241
|
+
localization.value,
|
|
242
|
+
localCustomDateFrom.value,
|
|
243
|
+
localCustomDateTo.value,
|
|
244
|
+
localCustomTimeFrom.value,
|
|
245
|
+
localCustomTimeTo.value
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
if (isDisabledSubmit.value) {
|
|
249
|
+
alerts.value = [localization.value.noCountersSelected]
|
|
250
|
+
isShowAlerts.value = true
|
|
251
|
+
return false
|
|
252
|
+
} else if (
|
|
253
|
+
timespanType.value === 'custom_interval' &&
|
|
254
|
+
localPeriodType.value === 'period' &&
|
|
255
|
+
checkDateResult !== '' &&
|
|
256
|
+
typeof checkDateResult === 'string'
|
|
257
|
+
) {
|
|
258
|
+
alerts.value = [checkDateResult]
|
|
259
|
+
isShowAlerts.value = true
|
|
260
|
+
return false
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return true
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const localSelectedChartOptionName = ref<string>('')
|
|
267
|
+
watch(
|
|
268
|
+
() => props.selectedChartOptionName,
|
|
269
|
+
(newValue) => {
|
|
270
|
+
localSelectedChartOptionName.value = newValue
|
|
271
|
+
},
|
|
272
|
+
{ immediate: true }
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
const selectedLocalOptionName = ref<string>('')
|
|
276
|
+
|
|
277
|
+
const currentFieldsByArray = (
|
|
278
|
+
data: UI_I_HardwareHealthSensorsGraph[]
|
|
279
|
+
): string => {
|
|
280
|
+
const result: string[] = []
|
|
281
|
+
data.forEach((item) => {
|
|
282
|
+
result.push(item.nameEn)
|
|
283
|
+
})
|
|
284
|
+
return result.join('>>')
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const onSubmit = (): void => {
|
|
288
|
+
if (!checkValidations()) return
|
|
289
|
+
|
|
290
|
+
if (['select_options', 'default'].includes(selectedLocalOptionName.value))
|
|
291
|
+
selectedLocalOptionName.value = 'custom'
|
|
292
|
+
|
|
293
|
+
onSaveOptions(selectedLocalOptionName.value)
|
|
294
|
+
|
|
295
|
+
const currentFields = currentFieldsByArray(currentSelectedRows.value)
|
|
296
|
+
|
|
297
|
+
const validPeriod = getValidDateByOptionFunc(
|
|
298
|
+
timespanType.value,
|
|
299
|
+
null,
|
|
300
|
+
unitCount.value,
|
|
301
|
+
localCustomTime.value
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
const savedObject = {
|
|
305
|
+
fields: currentFields,
|
|
306
|
+
optionName: selectedLocalOptionName.value,
|
|
307
|
+
metric: selectedMetric.value,
|
|
308
|
+
periodName: timespanType.value,
|
|
309
|
+
periodType: localPeriodType.value,
|
|
310
|
+
unitCount: unitCount.value,
|
|
311
|
+
localTimespanType: localCustomTime.value,
|
|
312
|
+
dateFrom: localCustomDateFrom.value,
|
|
313
|
+
timeFrom: localCustomTimeFrom.value,
|
|
314
|
+
dateTo: localCustomDateTo.value,
|
|
315
|
+
timeTo: localCustomTimeTo.value,
|
|
316
|
+
chartType: selectedChartTypeLocal.value,
|
|
317
|
+
period: validPeriod,
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
emits('submit-options', savedObject)
|
|
321
|
+
onHide()
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const timespanType = ref<string>('')
|
|
325
|
+
const unitCount = ref<number>(1)
|
|
326
|
+
|
|
327
|
+
const optionsNames = ref<string[]>([])
|
|
328
|
+
|
|
329
|
+
const onSaveOptions = (name: string): void => {
|
|
330
|
+
const counters = currentSelectedRows.value.map((item) => {
|
|
331
|
+
return {
|
|
332
|
+
id: item.id,
|
|
333
|
+
name: item.nameEn,
|
|
334
|
+
}
|
|
335
|
+
})
|
|
336
|
+
let chartType = 'line_graph'
|
|
337
|
+
if (selectedChartTypeLocal.value === 'spline') chartType = 'line_graph'
|
|
338
|
+
else if (selectedChartTypeLocal.value === 'area') chartType = 'stacked_graph'
|
|
339
|
+
|
|
340
|
+
const saveOptionsData = {
|
|
341
|
+
routeType,
|
|
342
|
+
chartType,
|
|
343
|
+
counters,
|
|
344
|
+
metric: selectedMetric.value,
|
|
345
|
+
timespan: {
|
|
346
|
+
periodType: localPeriodType.value,
|
|
347
|
+
units: localCustomTime.value,
|
|
348
|
+
unitsCount: unitCount.value,
|
|
349
|
+
type: timespanType.value,
|
|
350
|
+
},
|
|
351
|
+
}
|
|
352
|
+
useLocalStorage(`${name}ChartOptionsSensors`, saveOptionsData)
|
|
353
|
+
optionsNames.value = getCurrentOptionsStorageFunc()
|
|
354
|
+
localSelectedChartOptionName.value = name
|
|
355
|
+
emits('save-option-name')
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const setSelectOptions = (): void => {
|
|
359
|
+
selectedMetric.value = props.selectedMetric || metricsItems.value[0]?.value
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
const setDefaultOptions = (): void => {
|
|
363
|
+
selectedMetric.value = metricsItems.value[0]?.value
|
|
364
|
+
localSelectedPowerCountersKeys.value = []
|
|
365
|
+
localSelectedTemperatureCountersKeys.value = []
|
|
366
|
+
localSelectedChartType.value = 'spline'
|
|
367
|
+
localSelectedTimespanType.value = ''
|
|
368
|
+
localUnitsCount.value = 0
|
|
369
|
+
localPeriodType.value = ''
|
|
370
|
+
localCustomTime.value = ''
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
const setCustomOptions = (name: string): void => {
|
|
374
|
+
const selectedValue = useLocalStorage(name + 'ChartOptionsSensors', undefined)
|
|
375
|
+
|
|
376
|
+
if (selectedValue.routeType !== routeType) return
|
|
377
|
+
|
|
378
|
+
let currentChartType = ''
|
|
379
|
+
if (selectedValue.chartType === 'line_graph') currentChartType = 'spline'
|
|
380
|
+
else if (selectedValue.chartType === 'stacked_graph')
|
|
381
|
+
currentChartType = 'area'
|
|
382
|
+
|
|
383
|
+
selectedMetric.value = selectedValue.metric
|
|
384
|
+
if (selectedMetric.value === 'power')
|
|
385
|
+
localSelectedPowerCountersKeys.value = selectedValue.counters.map(
|
|
386
|
+
(item) => item.id
|
|
387
|
+
)
|
|
388
|
+
if (selectedMetric.value === 'temperature')
|
|
389
|
+
localSelectedTemperatureCountersKeys.value = selectedValue.counters.map(
|
|
390
|
+
(item) => item.id
|
|
391
|
+
)
|
|
392
|
+
localSelectedChartType.value = currentChartType
|
|
393
|
+
localSelectedTimespanType.value = selectedValue.timespan.type
|
|
394
|
+
localUnitsCount.value = selectedValue.timespan.unitsCount
|
|
395
|
+
localPeriodType.value = selectedValue.timespan.periodType
|
|
396
|
+
localCustomTime.value = selectedValue.timespan.units
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
const onSelectLocalOptionName = (name: string): void => {
|
|
400
|
+
selectedLocalOptionName.value = name
|
|
401
|
+
|
|
402
|
+
if (optionsNames.value.includes(name)) setCustomOptions(name)
|
|
403
|
+
else if (name === 'default') setDefaultOptions()
|
|
404
|
+
else if (name === 'select_options') setSelectOptions()
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
watch(
|
|
408
|
+
localSelectedChartOptionName,
|
|
409
|
+
(newValue) => {
|
|
410
|
+
if (!newValue) return
|
|
411
|
+
|
|
412
|
+
setCustomOptions(newValue)
|
|
413
|
+
},
|
|
414
|
+
{ immediate: true }
|
|
415
|
+
)
|
|
416
|
+
|
|
417
|
+
const onDeleteChartName = (name: string): void => {
|
|
418
|
+
window.localStorage.removeItem(name + 'ChartOptionsSensors')
|
|
419
|
+
optionsNames.value = getCurrentOptionsStorageFunc()
|
|
420
|
+
setSelectOptions()
|
|
421
|
+
emits('delete-option')
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const isDisabledSubmit = computed<boolean>(
|
|
425
|
+
() => !currentSelectedRows.value.length
|
|
426
|
+
)
|
|
427
|
+
|
|
428
|
+
watch(
|
|
429
|
+
selectedMetric,
|
|
430
|
+
(newValue) => {
|
|
431
|
+
emits('select-metric-local', newValue)
|
|
432
|
+
},
|
|
433
|
+
{ immediate: true }
|
|
434
|
+
)
|
|
435
|
+
|
|
436
|
+
onMounted(() => {
|
|
437
|
+
optionsNames.value = getCurrentOptionsStorageFunc(routeType)
|
|
438
|
+
})
|
|
439
|
+
</script>
|
|
440
|
+
|
|
441
|
+
<style scoped lang="scss">
|
|
442
|
+
.chart-options-modal {
|
|
443
|
+
.loader-on :deep(.modal-body) {
|
|
444
|
+
display: flex;
|
|
445
|
+
align-items: center;
|
|
446
|
+
justify-content: center;
|
|
447
|
+
}
|
|
448
|
+
:deep(.modal-title) {
|
|
449
|
+
text-transform: capitalize;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
#loader {
|
|
453
|
+
min-height: 90px;
|
|
454
|
+
text-align: center;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.chart-options-content {
|
|
458
|
+
display: flex;
|
|
459
|
+
flex-direction: row;
|
|
460
|
+
flex-basis: 90%;
|
|
461
|
+
overflow-y: hidden;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
@media (max-width: 1024px) {
|
|
465
|
+
.chart-options-content {
|
|
466
|
+
flex-direction: column !important;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<atoms-alert
|
|
3
|
+
v-show="props.alerts.length"
|
|
4
|
+
status="alert-danger"
|
|
5
|
+
:items="props.alerts"
|
|
6
|
+
class="notification"
|
|
7
|
+
test-id="notification-alert"
|
|
8
|
+
@remove="emits('remove')"
|
|
9
|
+
>
|
|
10
|
+
<template #default="{ item }">
|
|
11
|
+
<div class="flex-space-between flex-1">
|
|
12
|
+
<div class="flex-align-center">
|
|
13
|
+
<span>{{ item }}</span>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
</atoms-alert>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
const props = defineProps<{
|
|
22
|
+
alerts: string[]
|
|
23
|
+
}>()
|
|
24
|
+
|
|
25
|
+
const emits = defineEmits<{
|
|
26
|
+
(event: 'remove'): void
|
|
27
|
+
}>()
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<style scoped lang="scss"></style>
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="horizontal-flex-container">
|
|
3
|
+
<div class="horizontal-flex-container">
|
|
4
|
+
<label for="chartOptionsSelect" class="label-select"
|
|
5
|
+
>{{ localization.common.chartOptions }}:</label
|
|
6
|
+
>
|
|
7
|
+
<div class="select">
|
|
8
|
+
<select
|
|
9
|
+
id="chartOptionsSelect"
|
|
10
|
+
v-model="localSelectedChartOption"
|
|
11
|
+
data-id="chart-options-select"
|
|
12
|
+
>
|
|
13
|
+
<option
|
|
14
|
+
v-for="item in chartOptions"
|
|
15
|
+
:key="item.value"
|
|
16
|
+
:value="item.value"
|
|
17
|
+
>
|
|
18
|
+
{{ item.text }}
|
|
19
|
+
</option>
|
|
20
|
+
</select>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
<div>
|
|
24
|
+
<button
|
|
25
|
+
class="btn chart-options-save-button"
|
|
26
|
+
data-id="chart-options-save-button"
|
|
27
|
+
@click="onShowSaveOptionsModal"
|
|
28
|
+
>
|
|
29
|
+
{{ localization.common.saveOptionsAs }}...
|
|
30
|
+
</button>
|
|
31
|
+
<common-pages-hardware-health-history-testimony-tools-chart-options-modal-actions-save-options-modal
|
|
32
|
+
v-if="isShowSaveOptionsModal"
|
|
33
|
+
@hide="onHideSaveOptionsModal"
|
|
34
|
+
@save="onSaveOptions"
|
|
35
|
+
/>
|
|
36
|
+
<button
|
|
37
|
+
class="btn chart-options-delete-button"
|
|
38
|
+
:disabled="!disabledDeleteAction"
|
|
39
|
+
data-id="chart-options-delete-button"
|
|
40
|
+
@click="onDeleteAction"
|
|
41
|
+
>
|
|
42
|
+
{{ localization.common.deleteOptions }}
|
|
43
|
+
</button>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<common-modals-confirmation
|
|
48
|
+
v-if="isConfirmModal"
|
|
49
|
+
headline="localization.common.deletingSavedSettings"
|
|
50
|
+
:description="confirmModalDesc"
|
|
51
|
+
@hide-modal="isConfirmModal = false"
|
|
52
|
+
@confirm="onApplyDelete"
|
|
53
|
+
/>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script setup lang="ts">
|
|
57
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
58
|
+
import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
|
|
59
|
+
import { chartOptionItems } from '~/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/lib/utils/optionsActions'
|
|
60
|
+
|
|
61
|
+
const props = defineProps<{
|
|
62
|
+
isDisabledSave: boolean
|
|
63
|
+
optionsNames: string[]
|
|
64
|
+
selectedChartOptionName: string
|
|
65
|
+
}>()
|
|
66
|
+
|
|
67
|
+
const emits = defineEmits<{
|
|
68
|
+
(event: 'save', value: string): void
|
|
69
|
+
(event: 'check-validation'): void
|
|
70
|
+
(event: 'select-local-option-name', value: string): void
|
|
71
|
+
(event: 'delete-chart-name', value: string): void
|
|
72
|
+
}>()
|
|
73
|
+
|
|
74
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
75
|
+
|
|
76
|
+
const localSelectedChartOption = ref<string>('select_options')
|
|
77
|
+
const disabledDeleteAction = computed<boolean>(() => {
|
|
78
|
+
const chartOptionName = localSelectedChartOption.value
|
|
79
|
+
let result = false
|
|
80
|
+
|
|
81
|
+
if (chartOptionName !== 'select_options' && chartOptionName !== 'default')
|
|
82
|
+
result = true
|
|
83
|
+
|
|
84
|
+
return result
|
|
85
|
+
})
|
|
86
|
+
const chartOptions = computed<UI_I_OptionItem[]>(() =>
|
|
87
|
+
chartOptionItems(localization.value, props.optionsNames)
|
|
88
|
+
)
|
|
89
|
+
watch(
|
|
90
|
+
() => props.selectedChartOptionName,
|
|
91
|
+
(newValue) => {
|
|
92
|
+
localSelectedChartOption.value =
|
|
93
|
+
newValue || localSelectedChartOption.value || 'select_options'
|
|
94
|
+
},
|
|
95
|
+
{ immediate: true }
|
|
96
|
+
)
|
|
97
|
+
watch(
|
|
98
|
+
localSelectedChartOption,
|
|
99
|
+
(newValue) => {
|
|
100
|
+
emits('select-local-option-name', newValue)
|
|
101
|
+
},
|
|
102
|
+
{ immediate: true }
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
const isShowSaveOptionsModal = ref<boolean>(false)
|
|
106
|
+
const onShowSaveOptionsModal = (): void => {
|
|
107
|
+
if (!props.isDisabledSave) isShowSaveOptionsModal.value = true
|
|
108
|
+
|
|
109
|
+
emits('check-validation')
|
|
110
|
+
}
|
|
111
|
+
const onHideSaveOptionsModal = (): boolean =>
|
|
112
|
+
(isShowSaveOptionsModal.value = false)
|
|
113
|
+
const onSaveOptions = (name: string): void => {
|
|
114
|
+
onHideSaveOptionsModal()
|
|
115
|
+
emits('save', name)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const isConfirmModal = ref<boolean>(false)
|
|
119
|
+
const confirmModalDesc = ref<string>('')
|
|
120
|
+
|
|
121
|
+
const onDeleteAction = (): void => {
|
|
122
|
+
confirmModalDesc.value =
|
|
123
|
+
localization.value.common.deletingSavedSettingsDesc.replace(
|
|
124
|
+
'{0}',
|
|
125
|
+
localSelectedChartOption.value
|
|
126
|
+
)
|
|
127
|
+
isConfirmModal.value = true
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const onApplyDelete = (): void => {
|
|
131
|
+
isConfirmModal.value = false
|
|
132
|
+
emits('delete-chart-name', localSelectedChartOption.value)
|
|
133
|
+
localSelectedChartOption.value = 'select_options'
|
|
134
|
+
}
|
|
135
|
+
</script>
|
|
136
|
+
|
|
137
|
+
<style scoped lang="scss">
|
|
138
|
+
.horizontal-flex-container {
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: row;
|
|
141
|
+
align-items: center;
|
|
142
|
+
|
|
143
|
+
.chart-options-save-button,
|
|
144
|
+
.chart-options-delete-button {
|
|
145
|
+
border: none;
|
|
146
|
+
background: unset;
|
|
147
|
+
margin: 0;
|
|
148
|
+
font-size: 11px;
|
|
149
|
+
color: var(--action-icon-color);
|
|
150
|
+
box-shadow: unset;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.chart-options-delete-button {
|
|
154
|
+
text-transform: uppercase;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
</style>
|