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.
Files changed (40) hide show
  1. package/assets/localization/local_be.json +6 -0
  2. package/assets/localization/local_en.json +6 -0
  3. package/assets/localization/local_hy.json +6 -0
  4. package/assets/localization/local_kk.json +6 -0
  5. package/assets/localization/local_ru.json +6 -0
  6. package/assets/localization/local_zh.json +6 -0
  7. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/Form.vue +4 -4
  8. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/lib/config/dateForm.ts +1 -1
  9. package/components/common/pages/hardwareHealth/HardwareHealth.vue +43 -61
  10. package/components/common/pages/hardwareHealth/historyTestimony/Graph.vue +331 -0
  11. package/components/common/pages/hardwareHealth/historyTestimony/lib/models/interfaces.ts +9 -0
  12. package/components/common/pages/hardwareHealth/historyTestimony/tools/Tools.vue +375 -0
  13. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/ChartOptionsModal.vue +469 -0
  14. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/Notification.vue +30 -0
  15. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/Actions.vue +157 -0
  16. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/SaveOptionsModal.vue +81 -0
  17. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/lib/utils/optionsActions.ts +25 -0
  18. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/Counters.vue +89 -0
  19. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/table/Table.vue +174 -0
  20. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/table/lib/config/tableConfig.ts +89 -0
  21. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/table/lib/models/types.ts +5 -0
  22. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/Timespan.vue +64 -0
  23. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/form/Form.vue +539 -0
  24. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/form/lib/config/dateForm.ts +115 -0
  25. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/config/optionsMetrics.ts +17 -0
  26. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/models/interfaces.ts +15 -0
  27. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/models/types.ts +1 -0
  28. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/metrics/Metrics.vue +31 -0
  29. package/components/common/pages/hardwareHealth/historyTestimony/tools/lib/config/toolbar.ts +78 -0
  30. package/components/common/pages/hardwareHealth/historyTestimony/tools/lib/models/interfaces.ts +9 -0
  31. package/components/common/pages/hardwareHealth/tableView/TableView.vue +4 -10
  32. package/components/common/pages/hardwareHealth/tableView/lib/config/historyTestimonyTable.ts +128 -0
  33. package/components/common/pages/hardwareHealth/tableView/lib/config/sensorTable.ts +7 -11
  34. package/components/common/pages/hardwareHealth/tableView/lib/config/tableKeys.ts +6 -7
  35. package/components/common/pages/hardwareHealth/tableView/lib/models/interfaces.ts +2 -0
  36. package/components/common/pages/hardwareHealth/tableView/lib/models/types.ts +9 -4
  37. package/lib/models/interfaces.ts +1 -0
  38. package/lib/models/types.ts +1 -0
  39. package/package.json +1 -1
  40. package/components/common/pages/hardwareHealth/Graph.vue +0 -84
@@ -0,0 +1,375 @@
1
+ <template>
2
+ <div class="horizontal-flex-container">
3
+ <div class="chart-title-content">
4
+ <client-only>
5
+ <span v-if="props.chartTitle" class="chart-title"
6
+ >{{ props.chartTitle }},</span
7
+ >
8
+ <span v-if="chartTitleDate" class="chart-title uppercase">{{
9
+ chartTitleDate
10
+ }}</span>
11
+ </client-only>
12
+ </div>
13
+ <div class="horizontal-flex-container">
14
+ <label for="periodSelect" class="label-select"
15
+ >{{ localization.common.period }}:</label
16
+ >
17
+ <div class="select">
18
+ <select
19
+ id="periodSelect"
20
+ v-model="selectedPeriod"
21
+ data-id="period-select"
22
+ @change="onUpdateTools"
23
+ >
24
+ <option
25
+ v-for="(item, index) in periodOptions"
26
+ :key="index"
27
+ :value="item.value"
28
+ >
29
+ {{ item.text }}
30
+ </option>
31
+ </select>
32
+ </div>
33
+ <a
34
+ id="chart-options-button"
35
+ class="chart-options-button"
36
+ data-id="show-chart-options-button"
37
+ @click="onShowChartOptions"
38
+ >{{ localization.common.chartOptions }}</a
39
+ >
40
+ </div>
41
+ <div class="view-select-label horizontal-flex-container">
42
+ <label for="viewSelect" class="label-select"
43
+ >{{ localization.common.view }}:</label
44
+ >
45
+ <div class="select">
46
+ <select
47
+ id="viewSelect"
48
+ v-model="selectedView"
49
+ data-id="view-select"
50
+ @change="onUpdateTools"
51
+ >
52
+ <option
53
+ v-for="(item, index) in viewOptions"
54
+ :key="index"
55
+ :value="item.value"
56
+ >
57
+ {{ item.text }}
58
+ </option>
59
+ </select>
60
+ </div>
61
+ </div>
62
+ </div>
63
+
64
+ <common-pages-hardware-health-history-testimony-tools-chart-options-modal
65
+ v-if="props.isShowChartModal"
66
+ :selected-chart-option-name="props.selectedChartOptionName"
67
+ :selected-metric="props.selectedMetric"
68
+ :power-selected-rows-local="props.powerSelectedRowsLocal"
69
+ :temperature-selected-rows-local="props.temperatureSelectedRowsLocal"
70
+ :selected-power-counters-keys="props.selectedPowerCountersKeys"
71
+ :selected-temperature-counters-keys="props.selectedTemperatureCountersKeys"
72
+ :units-count="props.unitsCount"
73
+ :power-counters-table-data="props.powerCountersTableData"
74
+ :temperature-counters-table-data="props.temperatureCountersTableData"
75
+ :language="props.language"
76
+ :selected-timespan-type="props.selectedTimespanType"
77
+ :custom-date-from="props.customDateFrom"
78
+ :custom-date-to="props.customDateTo"
79
+ :custom-time-from="props.customTimeFrom"
80
+ :custom-time-to="props.customTimeTo"
81
+ @save-option-name="onSaveOptionName"
82
+ @delete-option="emits('delete-option')"
83
+ @power-selected-rows-local="emits('power-selected-rows-local', $event)"
84
+ @temperature-selected-rows-local="
85
+ emits('temperature-selected-rows-local', $event)
86
+ "
87
+ @submit-options="emits('submit-options', $event)"
88
+ @hide="onHideChartModal"
89
+ />
90
+ </template>
91
+
92
+ <script setup lang="ts">
93
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
94
+ import type { UI_I_HardwareHealthSensorsGraph } from '~/components/common/pages/hardwareHealth/historyTestimony/lib/models/interfaces'
95
+ import type { UI_I_SensorsGraphPayload } from '~/components/common/pages/hardwareHealth/historyTestimony/tools/lib/models/interfaces'
96
+ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
97
+ import type { UI_I_OptionsForm } from '~/components/common/monitor/advanced/tools/chartOptionsModal/lib/models/interfaces'
98
+ import type { UI_T_Chart } from '~/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/models/types'
99
+ import { getValidDateByOptionFunc } from '~/components/common/monitor/lib/config/getValidDateByOption'
100
+ import { checkDateFunc } from '~/components/common/monitor/overview/filters/customIntervalModal/lib/config/dateChecker'
101
+ import {
102
+ getCurrentOptionsStorageFunc,
103
+ periodFunc,
104
+ viewFunc,
105
+ } from '~/components/common/pages/hardwareHealth/historyTestimony/tools/lib/config/toolbar'
106
+
107
+ const props = defineProps<{
108
+ selectedChartOptionName: string
109
+ isShowChartModal: boolean
110
+ chartTitle: string
111
+ selectedMetric: UI_T_Chart
112
+ selectedPowerCountersKeys: number[]
113
+ powerSelectedRowsLocal: UI_I_HardwareHealthSensorsGraph[]
114
+ selectedTemperatureCountersKeys: number[]
115
+ temperatureSelectedRowsLocal: UI_I_HardwareHealthSensorsGraph[]
116
+ unitsCount: number
117
+ powerCountersTableData: UI_I_HardwareHealthSensorsGraph[]
118
+ temperatureCountersTableData: UI_I_HardwareHealthSensorsGraph[]
119
+ language: string
120
+ customDateFrom: string
121
+ customDateTo: string
122
+ customTimeFrom: string
123
+ customTimeTo: string
124
+ selectedTimespanType: string
125
+ startDate: number
126
+ periodType: string
127
+ }>()
128
+
129
+ const emits = defineEmits<{
130
+ (event: 'show-chart-modal'): void
131
+ (event: 'hide-chart-modal'): void
132
+ (event: 'update-tools', value: UI_I_SensorsGraphPayload): void
133
+ (event: 'exporting', value: string): void
134
+ (event: 'open-advanced-page'): void
135
+ (event: 'select-metric-local', value: string): void
136
+ (
137
+ event: 'power-selected-rows-local',
138
+ value: UI_I_HardwareHealthSensorsGraph[]
139
+ ): void
140
+ (
141
+ event: 'temperature-selected-rows-local',
142
+ value: UI_I_HardwareHealthSensorsGraph[]
143
+ ): void
144
+ (event: 'update-chart-type', value: string): void
145
+ (event: 'update-timespan-type', value: string): void
146
+ (event: 'update-unit-count', value: number): void
147
+ (event: 'update-period-type', value: string): void
148
+ (event: 'update-custom-time', value: string): void
149
+ (event: 'delete-option'): void
150
+ (event: 'update-custom-date-from', value: string): void
151
+ (event: 'update-custom-date-to', value: string): void
152
+ (event: 'update-custom-time-from', value: string): void
153
+ (event: 'update-custom-time-to', value: string): void
154
+ (event: 'submit-options', value: UI_I_OptionsForm): void
155
+ (event: 'update:selected-timespan-type', value: string): void
156
+ }>()
157
+
158
+ const localization = computed<UI_I_Localization>(() => useLocal())
159
+ const { $formattedDatetime } = useNuxtApp()
160
+
161
+ const periodOptions = computed<UI_I_OptionItem[]>(() =>
162
+ periodFunc(localization.value, props.selectedTimespanType)
163
+ )
164
+ const selectedPeriod = computed<string>({
165
+ get() {
166
+ return props.selectedTimespanType || periodOptions.value[0].value
167
+ },
168
+ set(newValue) {
169
+ emits('update:selected-timespan-type', newValue)
170
+ },
171
+ })
172
+
173
+ const optionsNames = ref<string[]>([])
174
+
175
+ const selectedView = ref<string>('power')
176
+ const viewOptions = computed<UI_I_OptionItem[]>(() =>
177
+ viewFunc(localization.value, optionsNames.value)
178
+ )
179
+
180
+ watch(
181
+ () => props.selectedChartOptionName,
182
+ (newValue) => {
183
+ let currentValue = ''
184
+
185
+ if (newValue) currentValue = newValue
186
+ else if (
187
+ selectedView.value &&
188
+ optionsNames.value.includes(selectedView.value)
189
+ )
190
+ currentValue = selectedView.value
191
+ else currentValue = selectedView.value || viewOptions.value[0]?.value
192
+
193
+ selectedView.value = currentValue
194
+ },
195
+ { immediate: true }
196
+ )
197
+
198
+ const onHideChartModal = (): void => {
199
+ emits('hide-chart-modal')
200
+ }
201
+
202
+ const onUpdateTools = (): void => {
203
+ const periodValue = selectedPeriod.value
204
+ const viewValue = selectedView.value
205
+ const selectedValue = useLocalStorage(
206
+ viewValue + 'ChartOptionsSensors',
207
+ undefined
208
+ )
209
+
210
+ const fields = selectedValue
211
+ ? selectedValue.counters.map((item) => item.name).join(', ')
212
+ : ''
213
+ const validPeriodData = getValidDateByOptionFunc(
214
+ periodValue,
215
+ null,
216
+ null,
217
+ null
218
+ )
219
+
220
+ const period = [
221
+ Math.round(validPeriodData[0] / 1000),
222
+ Math.round(validPeriodData[1] / 1000),
223
+ ]
224
+
225
+ if (periodValue === 'custom_interval' && props.periodType === 'period') {
226
+ const checkDateResult = checkDateFunc(
227
+ localization.value,
228
+ props.customDateFrom,
229
+ props.customDateTo,
230
+ props.customTimeFrom,
231
+ props.customTimeTo
232
+ )
233
+ if (Array.isArray(checkDateResult)) {
234
+ period[0] = Math.round(checkDateResult[0] / 1000)
235
+ period[1] = Math.round(checkDateResult[1] / 1000)
236
+ }
237
+ }
238
+
239
+ const tools: UI_I_SensorsGraphPayload = {
240
+ fields,
241
+ period,
242
+ periodName: periodValue,
243
+ view: viewValue,
244
+ }
245
+ if (selectedValue.metric) tools.metricType = selectedValue.metric
246
+
247
+ emits('update-timespan-type', selectedPeriod.value)
248
+ emits('update-tools', tools)
249
+ }
250
+
251
+ const chartTitleDate = computed<string>(() => {
252
+ if (!props.startDate) return ''
253
+
254
+ const start = $formattedDatetime(props.startDate, '', true)
255
+ const end = $formattedDatetime(new Date(), '', true)
256
+ return `${start} - ${end}`
257
+ })
258
+
259
+ const onShowChartOptions = (): void => {
260
+ emits('show-chart-modal')
261
+ }
262
+
263
+ const onSaveOptionName = (): void => {
264
+ optionsNames.value = getCurrentOptionsStorageFunc()
265
+ }
266
+
267
+ onMounted(() => {
268
+ optionsNames.value = getCurrentOptionsStorageFunc()
269
+ onUpdateTools()
270
+ })
271
+ </script>
272
+
273
+ <style scoped lang="scss">
274
+ .horizontal-flex-container {
275
+ display: flex;
276
+ flex-direction: row;
277
+ align-items: center;
278
+ line-height: 20px;
279
+ flex-shrink: 0;
280
+
281
+ .chart-title-content {
282
+ overflow: hidden;
283
+ text-overflow: ellipsis;
284
+ }
285
+
286
+ .select select {
287
+ height: 20px;
288
+ margin: 5px;
289
+ color: var(--global-font-color);
290
+ }
291
+ .single-option {
292
+ margin-left: 5px;
293
+ }
294
+
295
+ .chart-title {
296
+ color: var(--global-font-color);
297
+ text-overflow: ellipsis;
298
+ white-space: nowrap;
299
+ overflow: hidden;
300
+ margin: 6px;
301
+ font-weight: 700;
302
+ text-transform: capitalize;
303
+
304
+ &.uppercase {
305
+ text-transform: uppercase;
306
+ }
307
+ }
308
+
309
+ .view-select-label {
310
+ margin-left: auto;
311
+ padding-right: 7px;
312
+ padding-left: 7px;
313
+ text-overflow: ellipsis;
314
+ white-space: nowrap;
315
+ align-items: center;
316
+ }
317
+
318
+ .chart-options-button {
319
+ margin-left: 5px;
320
+ text-overflow: ellipsis;
321
+ white-space: nowrap;
322
+ text-transform: capitalize;
323
+ color: var(--dropdown-item-color);
324
+ cursor: pointer;
325
+ }
326
+
327
+ .chart-action-bar {
328
+ white-space: nowrap;
329
+
330
+ .menu-item {
331
+ padding-right: 4px;
332
+ display: inline-block;
333
+ list-style: none;
334
+ vertical-align: middle;
335
+
336
+ &:last-child {
337
+ padding-right: 0;
338
+ }
339
+
340
+ .item-link {
341
+ padding: 4px;
342
+ line-height: 22px;
343
+ border: 1px solid transparent;
344
+ display: inline-block;
345
+
346
+ &:hover {
347
+ text-decoration: none;
348
+ background-color: #e9f6fd;
349
+ border: 1px solid #c7e9ff;
350
+ }
351
+
352
+ .icon {
353
+ width: 16px;
354
+ height: 16px;
355
+ display: block;
356
+ min-width: 16px;
357
+ min-height: 16px;
358
+ background-size: 100% auto;
359
+ }
360
+ }
361
+
362
+ :deep(.dropdown-menu) {
363
+ min-width: auto;
364
+ padding: 0;
365
+ }
366
+ :deep(.user-menu-large) {
367
+ padding: 0;
368
+ }
369
+ :deep(.angle-icon) {
370
+ display: none;
371
+ }
372
+ }
373
+ }
374
+ }
375
+ </style>