bfg-common 1.4.15 → 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 (41) 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/atoms/wizard/Wizard.vue +10 -2
  8. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/Form.vue +4 -4
  9. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/lib/config/dateForm.ts +1 -1
  10. package/components/common/pages/hardwareHealth/HardwareHealth.vue +43 -61
  11. package/components/common/pages/hardwareHealth/historyTestimony/Graph.vue +331 -0
  12. package/components/common/pages/hardwareHealth/historyTestimony/lib/models/interfaces.ts +9 -0
  13. package/components/common/pages/hardwareHealth/historyTestimony/tools/Tools.vue +375 -0
  14. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/ChartOptionsModal.vue +469 -0
  15. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/Notification.vue +30 -0
  16. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/Actions.vue +157 -0
  17. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/SaveOptionsModal.vue +81 -0
  18. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/lib/utils/optionsActions.ts +25 -0
  19. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/Counters.vue +89 -0
  20. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/table/Table.vue +174 -0
  21. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/table/lib/config/tableConfig.ts +89 -0
  22. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/table/lib/models/types.ts +5 -0
  23. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/Timespan.vue +64 -0
  24. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/form/Form.vue +539 -0
  25. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/form/lib/config/dateForm.ts +115 -0
  26. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/config/optionsMetrics.ts +17 -0
  27. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/models/interfaces.ts +15 -0
  28. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/models/types.ts +1 -0
  29. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/metrics/Metrics.vue +31 -0
  30. package/components/common/pages/hardwareHealth/historyTestimony/tools/lib/config/toolbar.ts +78 -0
  31. package/components/common/pages/hardwareHealth/historyTestimony/tools/lib/models/interfaces.ts +9 -0
  32. package/components/common/pages/hardwareHealth/tableView/TableView.vue +4 -10
  33. package/components/common/pages/hardwareHealth/tableView/lib/config/historyTestimonyTable.ts +128 -0
  34. package/components/common/pages/hardwareHealth/tableView/lib/config/sensorTable.ts +7 -11
  35. package/components/common/pages/hardwareHealth/tableView/lib/config/tableKeys.ts +6 -7
  36. package/components/common/pages/hardwareHealth/tableView/lib/models/interfaces.ts +2 -0
  37. package/components/common/pages/hardwareHealth/tableView/lib/models/types.ts +9 -4
  38. package/lib/models/interfaces.ts +1 -0
  39. package/lib/models/types.ts +1 -0
  40. package/package.json +1 -1
  41. package/components/common/pages/hardwareHealth/Graph.vue +0 -84
@@ -2535,6 +2535,9 @@
2535
2535
  "inventory": {
2536
2536
  "activeMemory": "Актыўная памяць"
2537
2537
  },
2538
+ "inventoryMonitor": {
2539
+ "temperature": "Тэмпература"
2540
+ },
2538
2541
  "inventoryTabs": {
2539
2542
  "summary": "Рэзюмэ",
2540
2543
  "monitor": "Манітор",
@@ -2557,5 +2560,8 @@
2557
2560
  "revertToSelectedSnapshot": "Вярнуцца да абранага здымку",
2558
2561
  "deleteSnapshot": "Выдаліць маментальны здымак",
2559
2562
  "deleteSnapshotDescription": "Гэта дзеянне з'яўляецца сталым і не можа быць адноўлена. Вы хочаце выдаліць '{0}'?"
2563
+ },
2564
+ "importVms": {
2565
+ "selectSourceTooltipDesc": "Правы карыстальніка esxi павінны адпавядаць ролях Administrator"
2560
2566
  }
2561
2567
  }
@@ -2539,6 +2539,9 @@
2539
2539
  "inventory": {
2540
2540
  "activeMemory": "Active Memory"
2541
2541
  },
2542
+ "inventoryMonitor": {
2543
+ "temperature": "Temperature"
2544
+ },
2542
2545
  "inventoryTabs": {
2543
2546
  "summary": "Summary",
2544
2547
  "monitor": "Monitor",
@@ -2561,5 +2564,8 @@
2561
2564
  "revertToSelectedSnapshot": "Revert to selected snapshot",
2562
2565
  "deleteSnapshot": "Delete snapshot",
2563
2566
  "deleteSnapshotDescription": "This action is permanent and cannot be recovered. Are you sure you want to delete '{0}'?"
2567
+ },
2568
+ "importVms": {
2569
+ "selectSourceTooltipDesc": "No Trusted infrastructure Administrator"
2564
2570
  }
2565
2571
  }
@@ -2539,6 +2539,9 @@
2539
2539
  "inventory": {
2540
2540
  "activeMemory": "Ակտիվ հիշողություն"
2541
2541
  },
2542
+ "inventoryMonitor": {
2543
+ "temperature": "Ջերմաստիճանը"
2544
+ },
2542
2545
  "inventoryTabs": {
2543
2546
  "summary": "Ամփոփում",
2544
2547
  "monitor": "Մոնիտոր",
@@ -2561,5 +2564,8 @@
2561
2564
  "revertToSelectedSnapshot": "Վերադառնալ ընտրված Snap-ին",
2562
2565
  "deleteSnapshot": "Ջնջել նկարը",
2563
2566
  "deleteSnapshotDescription": "Այս գործողությունը մշտական է և չի կարող վերականգնվել: Համոզված եք, որ ցանկանում եք ջնջել '{0}'?"
2567
+ },
2568
+ "importVms": {
2569
+ "selectSourceTooltipDesc": "Esxi օգտագործողի իրավունքները պետք է համապատասխանեն Administrator-ի դերերին"
2564
2570
  }
2565
2571
  }
@@ -2538,6 +2538,9 @@
2538
2538
  "inventory": {
2539
2539
  "activeMemory": "Белсенді есте сақтау"
2540
2540
  },
2541
+ "inventoryMonitor": {
2542
+ "temperature": "Температура"
2543
+ },
2541
2544
  "inventoryTabs": {
2542
2545
  "summary": "Түйіндеме",
2543
2546
  "monitor": "Монитор",
@@ -2560,5 +2563,8 @@
2560
2563
  "revertToSelectedSnapshot": "Таңдалған суретке оралу",
2561
2564
  "deleteSnapshot": "Суретті жою",
2562
2565
  "deleteSnapshotDescription": "Бұл әрекет тұрақты және оны қалпына келтіру мүмкін емес. Сіз жойғыңыз келетініне сенімдісіз '{0}'?"
2566
+ },
2567
+ "importVms": {
2568
+ "selectSourceTooltipDesc": "Esxi пайдаланушы құқықтары әкімші рөлдеріне сәйкес келуі керек"
2563
2569
  }
2564
2570
  }
@@ -2541,6 +2541,9 @@
2541
2541
  "inventory": {
2542
2542
  "activeMemory": "Активная память"
2543
2543
  },
2544
+ "inventoryMonitor": {
2545
+ "temperature": "Температура"
2546
+ },
2544
2547
  "inventoryTabs": {
2545
2548
  "summary": "Сводка",
2546
2549
  "monitor": "Монитор",
@@ -2563,5 +2566,8 @@
2563
2566
  "revertToSelectedSnapshot": "Вернуться к выбранному снимку",
2564
2567
  "deleteSnapshot": "Удалить моментальный снимок",
2565
2568
  "deleteSnapshotDescription": "Это действие является постоянным и не может быть восстановлено. Вы уверены, что хотите удалить '{0}'?"
2569
+ },
2570
+ "importVms": {
2571
+ "selectSourceTooltipDesc": "Права пользователя esxi дожны соответствовать ролям Administrator"
2566
2572
  }
2567
2573
  }
@@ -2537,6 +2537,9 @@
2537
2537
  "inventory": {
2538
2538
  "activeMemory": "主动记忆"
2539
2539
  },
2540
+ "inventoryMonitor": {
2541
+ "temperature": "温度"
2542
+ },
2540
2543
  "inventoryTabs": {
2541
2544
  "summary": "概括",
2542
2545
  "monitor": "监视器",
@@ -2559,5 +2562,8 @@
2559
2562
  "revertToSelectedSnapshot": "恢复到选定的快照",
2560
2563
  "deleteSnapshot": "删除快照",
2561
2564
  "deleteSnapshotDescription": "此操作是永久性的,无法恢复。 你确定你要删除 '{0}'?"
2565
+ },
2566
+ "importVms": {
2567
+ "selectSourceTooltipDesc": "Esxi用户权限必须对应于管理员角色"
2562
2568
  }
2563
2569
  }
@@ -43,7 +43,12 @@
43
43
  <div
44
44
  v-if="props.wizard.selectedStepCom.value.subTitle !== 'border'"
45
45
  >
46
- <h2>{{ props.wizard.selectedStepCom.value.subTitle }}</h2>
46
+ <slot
47
+ name="description"
48
+ :selected-step="props.wizard.selectedStepCom.value"
49
+ >
50
+ <h2>{{ props.wizard.selectedStepCom.value.subTitle }}</h2>
51
+ </slot>
47
52
  </div>
48
53
  </div>
49
54
  <slot
@@ -84,7 +89,10 @@
84
89
  v-else
85
90
  :id="`${props.testId}-next-button`"
86
91
  :data-id="`${props.testId}-next-button`"
87
- :disabled="props.isDisabledFinish || props.wizard.isDisabledNextButton.value"
92
+ :disabled="
93
+ props.isDisabledFinish ||
94
+ props.wizard.isDisabledNextButton.value
95
+ "
88
96
  class="btn btn-primary"
89
97
  @click="onNextStep"
90
98
  >
@@ -342,20 +342,20 @@ const periodTypeText = computed<string>(() => {
342
342
  const lang = useLocalStorage('lang')
343
343
 
344
344
  if (lang !== 'ru_RU') text = localization.value.common.last
345
- else text = getCorrectPeriodTypeText(localLast.value)
345
+ else text = getCorrectRuPeriodTypeText(localLast.value)
346
346
 
347
347
  return text
348
348
  })
349
349
 
350
- const getCorrectPeriodTypeText = (hours: number): string => {
350
+ const getCorrectRuPeriodTypeText = (hours: number): string => {
351
351
  let prefix: string
352
352
 
353
- if (!hours) return getCorrectPeriodTypeText.prefix
353
+ if (!hours) return getCorrectRuPeriodTypeText.prefix
354
354
 
355
355
  if (hours % 10 === 1 && hours % 100 !== 11) prefix = 'Последний'
356
356
  else prefix = 'Последние'
357
357
 
358
- getCorrectPeriodTypeText.prefix = prefix
358
+ getCorrectRuPeriodTypeText.prefix = prefix
359
359
  return prefix
360
360
  }
361
361
 
@@ -1,6 +1,6 @@
1
1
  import type { UI_I_Localization } from '~/lib/models/interfaces'
2
- import type { UI_I_ArbitraryObject } from '~/lib/models/interfaces'
3
2
  import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
3
+ import type { UI_I_ArbitraryObject } from '~/lib/models/interfaces'
4
4
 
5
5
  export const timespanFunc = (
6
6
  localization: UI_I_Localization
@@ -37,60 +37,68 @@
37
37
 
38
38
  <common-pages-hardware-health-tools-panel :selected-tab="activeTab" />
39
39
 
40
- <common-pages-hardware-health-graph
41
- v-if="activeTab === 'history-testimony'"
42
- :data="props.historyTestimony"
43
- :loading="props.loadingHistoryTestimony"
44
- :is-dark-mode="props.isDarkMode"
45
- :formatted-datetime="props.formattedDatetime"
46
- :get-date-format="props.getDateFormat"
47
- :language="props.language"
48
- />
49
-
50
- <common-pages-hardware-health-table-view
51
- :key="uniqueKey"
52
- v-model:selected="selectedRow"
53
- :data-table="hardwareHealth"
54
- :total-items="hardwareHealth.length"
55
- :total-pages="1"
56
- :table-mode="activeTab"
57
- :loading="props.loading"
58
- />
40
+ <div
41
+ :class="[
42
+ 'bottom-container',
43
+ { 'history-testimony': activeTab === 'history-testimony' },
44
+ ]"
45
+ >
46
+ <common-pages-hardware-health-history-testimony-graph
47
+ v-if="activeTab === 'history-testimony'"
48
+ :power-data="props.historyTestimonyPower"
49
+ :temperature-data="props.historyTestimonyTemperature"
50
+ :counters-table-data="hardwareHealth"
51
+ :language="props.language"
52
+ :power-loading="props.loadingPowerData"
53
+ :temperature-loading="props.loadingTemperatureData"
54
+ :formatted-datetime="props.formattedDatetime"
55
+ :is-dark-mode="props.isDarkMode"
56
+ :get-date-format="props.getDateFormat"
57
+ :main-selected-row="selectedRow"
58
+ />
59
+
60
+ <common-pages-hardware-health-table-view
61
+ :key="uniqueKey"
62
+ v-model:selected="selectedRow"
63
+ :data-table="hardwareHealth"
64
+ :total-items="hardwareHealth.length"
65
+ :total-pages="1"
66
+ :table-mode="activeTab"
67
+ :loading="props.loading"
68
+ />
69
+ </div>
59
70
  </div>
60
71
  </template>
61
72
 
62
73
  <script lang="ts" setup>
63
74
  import type { I_SeriesLine } from '~/node_modules/bfg-nuxt-3-graph/graph/lib/models/interfaces'
64
75
  import type { UI_I_Localization } from '~/lib/models/interfaces'
76
+ import type { UI_I_HardwareHealthSensors } from '~/components/common/pages/hardwareHealth/tableView/lib/models/interfaces'
65
77
  import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
66
- import type { UI_T_HardwareHealthTabMode } from '~/components/common/pages/hardwareHealth/lib/models/types'
67
78
  import type { UI_I_StorageSensorsAlert } from '~/components/common/pages/hardwareHealth/lib/models/interfaces'
68
- import type { UI_I_HardwareHealthSensors } from '~/components/common/pages/hardwareHealth/tableView/lib/models/interfaces'
69
- import type { UI_T_SelectedRow } from '~/components/atoms/table/dataGrid/lib/models/types'
79
+ import type { UI_T_HardwareHealthTabMode } from '~/components/common/pages/hardwareHealth/lib/models/types'
70
80
  import { hardwareHealthTabsFunc } from '~/components/common/pages/hardwareHealth/lib/config/tabsPannel'
71
81
 
72
82
  const props = defineProps<{
73
83
  data: UI_I_HardwareHealthSensors[]
74
84
  loading: boolean
75
- historyTestimony: I_SeriesLine | null
76
- loadingHistoryTestimony: boolean
85
+ historyTestimonyPower: I_SeriesLine | null
86
+ historyTestimonyTemperature: I_SeriesLine | null
87
+ loadingPowerData: boolean
88
+ loadingTemperatureData: boolean
77
89
  isDarkMode: boolean
78
90
  formattedDatetime: any
79
91
  getDateFormat: any
80
92
  language: string
81
93
  }>()
82
94
 
83
- const emits = defineEmits<{
84
- (event: 'update-chart-data', value: string): void
85
- }>()
86
-
87
95
  const localization = computed<UI_I_Localization>(() => useLocal())
88
96
  const { $store }: any = useNuxtApp()
89
97
 
90
98
  const activeTab = ref<UI_T_HardwareHealthTabMode>('sensor')
91
99
  const uniqueKey = ref<number>(0)
92
100
 
93
- const selectedRow = ref<UI_T_SelectedRow>([])
101
+ const selectedRow = ref<number[]>([])
94
102
 
95
103
  const hardwareHealthTabs = computed<UI_I_CollapseNavItem[]>(() =>
96
104
  hardwareHealthTabsFunc(localization.value)
@@ -151,42 +159,10 @@ const generateAlertTextWithLink = computed<UI_I_StorageSensorsAlert>(() => {
151
159
  }
152
160
  })
153
161
 
154
- const updateChartData = (isSendAll: boolean = false): void => {
155
- const selectedNames: string[] = []
156
- hardwareHealth.value.forEach((item, key) => {
157
- if (isSendAll) {
158
- if (['power', 'temperature'].includes(item.category.toLowerCase()))
159
- selectedNames.push(item.name)
160
- } else if (
161
- ['power', 'temperature'].includes(item.category.toLowerCase()) &&
162
- selectedRow.value.includes(key)
163
- ) {
164
- selectedNames.push(item.name)
165
- }
166
- })
167
- emits('update-chart-data', selectedNames.join(','))
168
- }
169
-
170
- watch(selectedRow, (newValue) => {
171
- newValue.length &&
172
- activeTab.value === 'history-testimony' &&
173
- updateChartData()
174
- })
175
-
176
162
  watch(activeTab, () => {
177
163
  uniqueKey.value++
178
164
  })
179
165
 
180
- watch(
181
- [hardwareHealth, activeTab],
182
- (newValue) => {
183
- newValue[0].length &&
184
- newValue[1] === 'history-testimony' &&
185
- updateChartData(true)
186
- },
187
- { immediate: true }
188
- )
189
-
190
166
  onMounted(() => {
191
167
  $store.dispatch('main/A_CONTINUE_GLOBAL_REFRESH', 'hardwareHealth')
192
168
  })
@@ -206,5 +182,11 @@ onUnmounted(() => {
206
182
  margin-top: 0;
207
183
  }
208
184
  }
185
+ .bottom-container {
186
+ &.history-testimony {
187
+ overflow: hidden;
188
+ overflow-y: auto;
189
+ }
190
+ }
209
191
  }
210
192
  </style>
@@ -0,0 +1,331 @@
1
+ <template>
2
+ <common-pages-hardware-health-history-testimony-tools
3
+ v-model:selected-timespan-type="selectedTimespanType"
4
+ :selected-chart-option-name="selectedChartOptionName"
5
+ :is-show-chart-modal="isShowChartModal"
6
+ :chart-title="props.powerData?.groupName || ''"
7
+ :selected-metric="selectedMetric"
8
+ :selected-power-counters-keys="selectedPowerCountersKeys"
9
+ :power-selected-rows-local="powerSelectedRowsLocal"
10
+ :selected-temperature-counters-keys="selectedTemperatureCountersKeys"
11
+ :temperature-selected-rows-local="temperatureSelectedRowsLocal"
12
+ :units-count="unitsCount"
13
+ :power-counters-table-data="powerCountersTableData"
14
+ :temperature-counters-table-data="temperatureCountersTableData"
15
+ :language="props.language"
16
+ :custom-date-from="customDateFrom"
17
+ :custom-date-to="customDateTo"
18
+ :custom-time-from="customTimeFrom"
19
+ :custom-time-to="customTimeTo"
20
+ :start-date="props.powerData?.pointStart || 0"
21
+ :period-type="tools.periodName"
22
+ @power-selected-rows-local="powerSelectedRowsLocal = $event"
23
+ @temperature-selected-rows-local="temperatureSelectedRowsLocal = $event"
24
+ @show-chart-modal="isShowChartModal = true"
25
+ @hide-chart-modal="isShowChartModal = false"
26
+ @update-tools="onUpdateTools"
27
+ @delete-option="onDeleteOption"
28
+ @submit-options="onSubmitOptions"
29
+ />
30
+ <div class="hardware-health-graph">
31
+ <div class="power-container">
32
+ <common-graph
33
+ v-if="powerDataLocal && !props.powerLoading"
34
+ :data="powerDataLocal"
35
+ :update="updatePowerHelper"
36
+ :chart="powerChart"
37
+ :selected-row="props.mainSelectedRow"
38
+ />
39
+ <div v-else-if="props.powerLoading" class="graphic-loader-block">
40
+ <div class="spinner"></div>
41
+ </div>
42
+ <div v-else class="empty-content"></div>
43
+ </div>
44
+ <div class="temperature-container">
45
+ <common-graph
46
+ v-if="temperatureDataLocal && !props.temperatureLoading"
47
+ :data="temperatureDataLocal"
48
+ :update="updateTemperatureHelper"
49
+ :chart="temperatureChart"
50
+ :selected-row="props.mainSelectedRow"
51
+ />
52
+ <div v-else-if="props.temperatureLoading" class="graphic-loader-block">
53
+ <div class="spinner"></div>
54
+ </div>
55
+ <div v-else class="empty-content"></div>
56
+ </div>
57
+ </div>
58
+ </template>
59
+
60
+ <script setup lang="ts">
61
+ import { format } from 'date-fns'
62
+ import type {
63
+ I_SeriesLine,
64
+ I_LineGraph,
65
+ } from '~/node_modules/bfg-nuxt-3-graph/graph/lib/models/interfaces'
66
+ import { graphDataFunc } from '~/node_modules/bfg-nuxt-3-graph/graph/lib/utils/renderGraph'
67
+ import type { UI_I_OptionsForm } from '~/components/common/monitor/advanced/tools/chartOptionsModal/lib/models/interfaces'
68
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
69
+ import type { UI_T_Chart } from '~/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/models/types'
70
+ import type { UI_I_HardwareHealthSensors } from '~/components/common/pages/hardwareHealth/tableView/lib/models/interfaces'
71
+ import type { UI_I_HardwareHealthSensorsGraph } from '~/components/common/pages/hardwareHealth/historyTestimony/lib/models/interfaces'
72
+ import type { UI_I_SensorsGraphPayload } from '~/components/common/pages/hardwareHealth/historyTestimony/tools/lib/models/interfaces'
73
+
74
+ const props = defineProps<{
75
+ powerData: I_SeriesLine | null
76
+ temperatureData: I_SeriesLine | null
77
+ countersTableData: UI_I_HardwareHealthSensors[]
78
+ language: string
79
+ powerLoading: boolean
80
+ temperatureLoading: boolean
81
+ formattedDatetime: any
82
+ isDarkMode: boolean
83
+ getDateFormat: any
84
+ mainSelectedRow: number[]
85
+ }>()
86
+
87
+ const emits = defineEmits<{
88
+ (event: 'update:selected-timespan-type', value: string): void
89
+ }>()
90
+
91
+ const { $store }: any = useNuxtApp()
92
+
93
+ const selectedChartOptionName = ref<string>('')
94
+ const isShowChartModal = ref<boolean>(false)
95
+ const selectedMetric = ref<UI_T_Chart>('power')
96
+ const selectedPowerCountersKeys = ref<number[]>([])
97
+ const selectedTemperatureCountersKeys = ref<number[]>([])
98
+ const selectedTimespanType = ref<string>('')
99
+ const customDateFrom = ref<string>('')
100
+ const customDateTo = ref<string>('')
101
+ const customTimeFrom = ref<string>('')
102
+ const customTimeTo = ref<string>('')
103
+
104
+ const unitsCount = ref<number>(0)
105
+ const powerCountersTableData = ref<UI_I_HardwareHealthSensorsGraph[]>([])
106
+ const temperatureCountersTableData = ref<UI_I_HardwareHealthSensorsGraph[]>([])
107
+ const powerSelectedRowsLocal = ref<UI_I_HardwareHealthSensorsGraph[]>([])
108
+ const temperatureSelectedRowsLocal = ref<UI_I_HardwareHealthSensorsGraph[]>([])
109
+
110
+ watch(
111
+ () => props.countersTableData,
112
+ (newValue) => {
113
+ if (!newValue.length) return
114
+
115
+ powerCountersTableData.value = []
116
+ temperatureCountersTableData.value = []
117
+
118
+ newValue.forEach((item, key) => {
119
+ const newData: UI_I_HardwareHealthSensorsGraph = {
120
+ id: key,
121
+ name: item.name,
122
+ description: item.category,
123
+ measurement: '',
124
+ units: '',
125
+ nameEn: item.mainName || '',
126
+ testId: `counters-table-${item.name}-item`,
127
+ }
128
+ if (item.category.toLowerCase() === 'power')
129
+ powerCountersTableData.value.push(newData)
130
+ else if (item.category.toLowerCase() === 'temperature')
131
+ temperatureCountersTableData.value.push(newData)
132
+ })
133
+ },
134
+ { immediate: true, deep: true }
135
+ )
136
+
137
+ const selectAllCounters = (): void => {
138
+ if (!powerCountersTableData.value)
139
+ setTimeout(() => {
140
+ selectAllCounters()
141
+ }, 2000)
142
+ else {
143
+ powerCountersTableData.value.forEach((item) => {
144
+ selectedPowerCountersKeys.value.push(item.id)
145
+ })
146
+ temperatureCountersTableData.value.forEach((item) => {
147
+ selectedTemperatureCountersKeys.value.push(item.id)
148
+ })
149
+ }
150
+ }
151
+
152
+ onMounted(() => {
153
+ selectAllCounters()
154
+ })
155
+
156
+ const localization = computed<UI_I_Localization>(() => useLocal())
157
+
158
+ const powerDataLocal = ref<I_LineGraph | null>(null)
159
+ const temperatureDataLocal = ref<I_LineGraph | null>(null)
160
+ const updatePowerHelper = ref<number>(0)
161
+ const updateTemperatureHelper = ref<number>(0)
162
+ let dateFormat = ''
163
+ const powerChart = ref<any>(null)
164
+ const temperatureChart = ref<any>(null)
165
+
166
+ const powerChartCallback = (newValue: any): void => {
167
+ newValue && (powerChart.value = newValue)
168
+ }
169
+
170
+ const temperatureChartCallback = (newValue: any): void => {
171
+ newValue && (temperatureChart.value = newValue)
172
+ }
173
+
174
+ const updatePowerChart = (): void => {
175
+ if (!props.powerData) return
176
+
177
+ powerDataLocal.value = graphDataFunc(
178
+ props.powerData,
179
+ props.isDarkMode,
180
+ localization.value,
181
+ () => {},
182
+ false,
183
+ false,
184
+ true,
185
+ 'spline',
186
+ '',
187
+ undefined,
188
+ powerChartCallback,
189
+ props.formattedDatetime,
190
+ format,
191
+ dateFormat
192
+ )
193
+
194
+ updatePowerHelper.value++
195
+ }
196
+
197
+ const updateTemperatureChart = (): void => {
198
+ if (!props.temperatureData) return
199
+
200
+ temperatureDataLocal.value = graphDataFunc(
201
+ props.temperatureData,
202
+ props.isDarkMode,
203
+ localization.value,
204
+ () => {},
205
+ false,
206
+ false,
207
+ true,
208
+ 'spline',
209
+ '',
210
+ undefined,
211
+ temperatureChartCallback,
212
+ props.formattedDatetime,
213
+ format,
214
+ dateFormat
215
+ )
216
+
217
+ updateTemperatureHelper.value++
218
+ }
219
+
220
+ watch(
221
+ () => [props.powerData, props.isDarkMode, props.language],
222
+ (newValue) => {
223
+ dateFormat = props.getDateFormat(newValue[2])
224
+ updatePowerChart()
225
+ },
226
+ { immediate: true, deep: true }
227
+ )
228
+
229
+ watch(
230
+ () => [props.temperatureData, props.isDarkMode, props.language],
231
+ (newValue) => {
232
+ dateFormat = props.getDateFormat(newValue[2])
233
+ updateTemperatureChart()
234
+ },
235
+ { immediate: true, deep: true }
236
+ )
237
+
238
+ const updateSelectedCountersKeys = (metricType: string): void => {
239
+ if (metricType === 'power') {
240
+ const newKeys: number[] = []
241
+
242
+ powerSelectedRowsLocal.value.forEach((item) => {
243
+ newKeys.push(item.id)
244
+ })
245
+ selectedPowerCountersKeys.value = newKeys
246
+ } else if (metricType === 'temperature') {
247
+ const newKeys: number[] = []
248
+
249
+ temperatureSelectedRowsLocal.value.forEach((item) => {
250
+ newKeys.push(item.id)
251
+ })
252
+ selectedTemperatureCountersKeys.value = newKeys
253
+ }
254
+ }
255
+
256
+ const tools = {
257
+ periodName: 'real_time',
258
+ view: 'power',
259
+ metricType: selectedMetric.value,
260
+ period: [],
261
+ }
262
+
263
+ const onSubmitOptions = (data: UI_I_OptionsForm): void => {
264
+ updateSelectedCountersKeys(data.metric)
265
+ if (data.metric === 'power')
266
+ $store.dispatch(
267
+ 'monitor/A_GET_HARDWARE_HEALTH_HISTORY_TESTIMONY_POWER',
268
+ data
269
+ )
270
+ if (data.metric === 'temperature')
271
+ $store.dispatch(
272
+ 'monitor/A_GET_HARDWARE_HEALTH_HISTORY_TESTIMONY_TEMPERATURE',
273
+ data
274
+ )
275
+ }
276
+
277
+ const getAllMetrics = (): void => {
278
+ $store.dispatch(
279
+ 'monitor/A_GET_HARDWARE_HEALTH_HISTORY_TESTIMONY_POWER',
280
+ tools
281
+ )
282
+ $store.dispatch(
283
+ 'monitor/A_GET_HARDWARE_HEALTH_HISTORY_TESTIMONY_TEMPERATURE',
284
+ tools
285
+ )
286
+ }
287
+
288
+ const onUpdateTools = (data: UI_I_SensorsGraphPayload): void => {
289
+ const storageChartOptions = useLocalStorage(
290
+ data.view + 'ChartOptionsSensors',
291
+ undefined
292
+ )
293
+
294
+ selectedChartOptionName.value = ''
295
+
296
+ if (storageChartOptions) {
297
+ selectedChartOptionName.value = data.view
298
+ } else {
299
+ selectedMetric.value = 'power'
300
+ }
301
+
302
+ tools.periodName = data.periodName
303
+ tools.view = data.view
304
+ tools.period = data.period
305
+ tools.metricType = data.metricType || selectedMetric.value
306
+
307
+ getAllMetrics()
308
+ }
309
+
310
+ const onDeleteOption = (): void => {}
311
+ </script>
312
+
313
+ <style scoped lang="scss">
314
+ .hardware-health-graph {
315
+ display: grid;
316
+ align-items: center;
317
+ grid-template-columns: 1fr 1fr;
318
+ grid-gap: 20px;
319
+
320
+ .graphic-loader-block {
321
+ height: inherit;
322
+ display: flex;
323
+ justify-content: center;
324
+ align-items: center;
325
+ min-height: 300px;
326
+ }
327
+ .empty-content {
328
+ height: inherit;
329
+ }
330
+ }
331
+ </style>
@@ -0,0 +1,9 @@
1
+ export interface UI_I_HardwareHealthSensorsGraph {
2
+ id: number
3
+ name: string
4
+ description: string
5
+ measurement: string
6
+ units: string
7
+ nameEn: string
8
+ testId: string
9
+ }