bfg-common 1.4.734 → 1.4.799

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