bfg-common 1.4.9 → 1.4.10

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 (54) hide show
  1. package/assets/localization/local_be.json +0 -3
  2. package/assets/localization/local_en.json +0 -3
  3. package/assets/localization/local_hy.json +0 -3
  4. package/assets/localization/local_kk.json +0 -3
  5. package/assets/localization/local_ru.json +0 -3
  6. package/assets/localization/local_zh.json +2563 -2566
  7. package/components/atoms/modal/bySteps/BySteps.vue +253 -253
  8. package/components/common/browse/blocks/Title.vue +91 -91
  9. package/components/common/browse/blocks/info/Date.vue +21 -21
  10. package/components/common/context/recursion/Recursion.vue +86 -86
  11. package/components/common/context/recursion/RecursionNew.vue +198 -198
  12. package/components/common/context/recursion/RecursionOld.vue +212 -212
  13. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/lib/config/dateForm.ts +1 -1
  14. package/components/common/pages/hardwareHealth/Graph.vue +84 -0
  15. package/components/common/pages/hardwareHealth/HardwareHealth.vue +62 -45
  16. package/components/common/pages/hardwareHealth/tableView/TableView.vue +10 -4
  17. package/components/common/pages/hardwareHealth/tableView/lib/config/sensorTable.ts +11 -7
  18. package/components/common/pages/hardwareHealth/tableView/lib/config/tableKeys.ts +7 -6
  19. package/components/common/pages/hardwareHealth/tableView/lib/models/interfaces.ts +0 -2
  20. package/components/common/pages/hardwareHealth/tableView/lib/models/types.ts +4 -9
  21. package/components/common/split/horizontal/HorizontalNew.vue +321 -321
  22. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuHotPlug.vue +52 -52
  23. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Hv.vue +99 -99
  24. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/streamingMode/StreamingMode.vue +85 -85
  25. package/components/common/wizards/datastore/add/Add.vue +437 -437
  26. package/composables/productNameLocal.ts +30 -30
  27. package/lib/models/interfaces.ts +0 -1
  28. package/lib/models/types.ts +0 -1
  29. package/package.json +1 -1
  30. package/plugins/recursion.ts +311 -293
  31. package/public/spice-console/lib/images/bitmap.js +203 -203
  32. package/store/tasks/mappers/recentTasks.ts +45 -45
  33. package/components/common/pages/hardwareHealth/historyTestimony/Graph.vue +0 -332
  34. package/components/common/pages/hardwareHealth/historyTestimony/lib/models/interfaces.ts +0 -9
  35. package/components/common/pages/hardwareHealth/historyTestimony/tools/Tools.vue +0 -375
  36. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/ChartOptionsModal.vue +0 -469
  37. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/Notification.vue +0 -30
  38. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/Actions.vue +0 -157
  39. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/SaveOptionsModal.vue +0 -81
  40. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/lib/utils/optionsActions.ts +0 -25
  41. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/Counters.vue +0 -89
  42. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/table/Table.vue +0 -174
  43. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/table/lib/config/tableConfig.ts +0 -89
  44. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/table/lib/models/types.ts +0 -5
  45. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/Timespan.vue +0 -64
  46. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/form/Form.vue +0 -539
  47. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/form/lib/config/dateForm.ts +0 -115
  48. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/config/optionsMetrics.ts +0 -17
  49. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/models/interfaces.ts +0 -15
  50. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/lib/models/types.ts +0 -1
  51. package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/metrics/Metrics.vue +0 -31
  52. package/components/common/pages/hardwareHealth/historyTestimony/tools/lib/config/toolbar.ts +0 -78
  53. package/components/common/pages/hardwareHealth/historyTestimony/tools/lib/models/interfaces.ts +0 -9
  54. package/components/common/pages/hardwareHealth/tableView/lib/config/historyTestimonyTable.ts +0 -128
@@ -1,332 +0,0 @@
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_T_DateFormat } from '~/lib/models/plugins/date/types'
71
- import type { UI_I_HardwareHealthSensors } from '~/components/common/pages/hardwareHealth/tableView/lib/models/interfaces'
72
- import type { UI_I_HardwareHealthSensorsGraph } from '~/components/common/pages/hardwareHealth/historyTestimony/lib/models/interfaces'
73
- import type { UI_I_SensorsGraphPayload } from '~/components/common/pages/hardwareHealth/historyTestimony/tools/lib/models/interfaces'
74
-
75
- const props = defineProps<{
76
- powerData: I_SeriesLine | null
77
- temperatureData: I_SeriesLine | null
78
- countersTableData: UI_I_HardwareHealthSensors[]
79
- language: string
80
- powerLoading: boolean
81
- temperatureLoading: boolean
82
- formattedDatetime: any
83
- isDarkMode: boolean
84
- getDateFormat: UI_T_DateFormat
85
- mainSelectedRow: number[]
86
- }>()
87
-
88
- const emits = defineEmits<{
89
- (event: 'update:selected-timespan-type', value: string): void
90
- }>()
91
-
92
- const { $store }: any = useNuxtApp()
93
-
94
- const selectedChartOptionName = ref<string>('')
95
- const isShowChartModal = ref<boolean>(false)
96
- const selectedMetric = ref<UI_T_Chart>('power')
97
- const selectedPowerCountersKeys = ref<number[]>([])
98
- const selectedTemperatureCountersKeys = ref<number[]>([])
99
- const selectedTimespanType = ref<string>('')
100
- const customDateFrom = ref<string>('')
101
- const customDateTo = ref<string>('')
102
- const customTimeFrom = ref<string>('')
103
- const customTimeTo = ref<string>('')
104
-
105
- const unitsCount = ref<number>(0)
106
- const powerCountersTableData = ref<UI_I_HardwareHealthSensorsGraph[]>([])
107
- const temperatureCountersTableData = ref<UI_I_HardwareHealthSensorsGraph[]>([])
108
- const powerSelectedRowsLocal = ref<UI_I_HardwareHealthSensorsGraph[]>([])
109
- const temperatureSelectedRowsLocal = ref<UI_I_HardwareHealthSensorsGraph[]>([])
110
-
111
- watch(
112
- () => props.countersTableData,
113
- (newValue) => {
114
- if (!newValue.length) return
115
-
116
- powerCountersTableData.value = []
117
- temperatureCountersTableData.value = []
118
-
119
- newValue.forEach((item, key) => {
120
- const newData: UI_I_HardwareHealthSensorsGraph = {
121
- id: key,
122
- name: item.name,
123
- description: item.category,
124
- measurement: '',
125
- units: '',
126
- nameEn: item.mainName || '',
127
- testId: `counters-table-${item.name}-item`,
128
- }
129
- if (item.category.toLowerCase() === 'power')
130
- powerCountersTableData.value.push(newData)
131
- else if (item.category.toLowerCase() === 'temperature')
132
- temperatureCountersTableData.value.push(newData)
133
- })
134
- },
135
- { immediate: true, deep: true }
136
- )
137
-
138
- const selectAllCounters = (): void => {
139
- if (!powerCountersTableData.value)
140
- setTimeout(() => {
141
- selectAllCounters()
142
- }, 2000)
143
- else {
144
- powerCountersTableData.value.forEach((item) => {
145
- selectedPowerCountersKeys.value.push(item.id)
146
- })
147
- temperatureCountersTableData.value.forEach((item) => {
148
- selectedTemperatureCountersKeys.value.push(item.id)
149
- })
150
- }
151
- }
152
-
153
- onMounted(() => {
154
- selectAllCounters()
155
- })
156
-
157
- const localization = computed<UI_I_Localization>(() => useLocal())
158
-
159
- const powerDataLocal = ref<I_LineGraph | null>(null)
160
- const temperatureDataLocal = ref<I_LineGraph | null>(null)
161
- const updatePowerHelper = ref<number>(0)
162
- const updateTemperatureHelper = ref<number>(0)
163
- let dateFormat = ''
164
- const powerChart = ref<any>(null)
165
- const temperatureChart = ref<any>(null)
166
-
167
- const powerChartCallback = (newValue: any): void => {
168
- newValue && (powerChart.value = newValue)
169
- }
170
-
171
- const temperatureChartCallback = (newValue: any): void => {
172
- newValue && (temperatureChart.value = newValue)
173
- }
174
-
175
- const updatePowerChart = (): void => {
176
- if (!props.powerData) return
177
-
178
- powerDataLocal.value = graphDataFunc(
179
- props.powerData,
180
- props.isDarkMode,
181
- localization.value,
182
- () => {},
183
- false,
184
- false,
185
- true,
186
- 'spline',
187
- '',
188
- undefined,
189
- powerChartCallback,
190
- props.formattedDatetime,
191
- format,
192
- dateFormat
193
- )
194
-
195
- updatePowerHelper.value++
196
- }
197
-
198
- const updateTemperatureChart = (): void => {
199
- if (!props.temperatureData) return
200
-
201
- temperatureDataLocal.value = graphDataFunc(
202
- props.temperatureData,
203
- props.isDarkMode,
204
- localization.value,
205
- () => {},
206
- false,
207
- false,
208
- true,
209
- 'spline',
210
- '',
211
- undefined,
212
- temperatureChartCallback,
213
- props.formattedDatetime,
214
- format,
215
- dateFormat
216
- )
217
-
218
- updateTemperatureHelper.value++
219
- }
220
-
221
- watch(
222
- () => [props.powerData, props.isDarkMode, props.language],
223
- (newValue) => {
224
- dateFormat = props.getDateFormat(newValue[2])
225
- updatePowerChart()
226
- },
227
- { immediate: true, deep: true }
228
- )
229
-
230
- watch(
231
- () => [props.temperatureData, props.isDarkMode, props.language],
232
- (newValue) => {
233
- dateFormat = props.getDateFormat(newValue[2])
234
- updateTemperatureChart()
235
- },
236
- { immediate: true, deep: true }
237
- )
238
-
239
- const updateSelectedCountersKeys = (metricType: string): void => {
240
- if (metricType === 'power') {
241
- const newKeys: number[] = []
242
-
243
- powerSelectedRowsLocal.value.forEach((item) => {
244
- newKeys.push(item.id)
245
- })
246
- selectedPowerCountersKeys.value = newKeys
247
- } else if (metricType === 'temperature') {
248
- const newKeys: number[] = []
249
-
250
- temperatureSelectedRowsLocal.value.forEach((item) => {
251
- newKeys.push(item.id)
252
- })
253
- selectedTemperatureCountersKeys.value = newKeys
254
- }
255
- }
256
-
257
- const tools = {
258
- periodName: 'real_time',
259
- view: 'power',
260
- metricType: selectedMetric.value,
261
- period: [],
262
- }
263
-
264
- const onSubmitOptions = (data: UI_I_OptionsForm): void => {
265
- updateSelectedCountersKeys(data.metric)
266
- if (data.metric === 'power')
267
- $store.dispatch(
268
- 'monitor/A_GET_HARDWARE_HEALTH_HISTORY_TESTIMONY_POWER',
269
- data
270
- )
271
- if (data.metric === 'temperature')
272
- $store.dispatch(
273
- 'monitor/A_GET_HARDWARE_HEALTH_HISTORY_TESTIMONY_TEMPERATURE',
274
- data
275
- )
276
- }
277
-
278
- const getAllMetrics = (): void => {
279
- $store.dispatch(
280
- 'monitor/A_GET_HARDWARE_HEALTH_HISTORY_TESTIMONY_POWER',
281
- tools
282
- )
283
- $store.dispatch(
284
- 'monitor/A_GET_HARDWARE_HEALTH_HISTORY_TESTIMONY_TEMPERATURE',
285
- tools
286
- )
287
- }
288
-
289
- const onUpdateTools = (data: UI_I_SensorsGraphPayload): void => {
290
- const storageChartOptions = useLocalStorage(
291
- data.view + 'ChartOptionsSensors',
292
- undefined
293
- )
294
-
295
- selectedChartOptionName.value = ''
296
-
297
- if (storageChartOptions) {
298
- selectedChartOptionName.value = data.view
299
- } else {
300
- selectedMetric.value = 'power'
301
- }
302
-
303
- tools.periodName = data.periodName
304
- tools.view = data.view
305
- tools.period = data.period
306
- tools.metricType = data.metricType || selectedMetric.value
307
-
308
- getAllMetrics()
309
- }
310
-
311
- const onDeleteOption = (): void => {}
312
- </script>
313
-
314
- <style scoped lang="scss">
315
- .hardware-health-graph {
316
- display: grid;
317
- align-items: center;
318
- grid-template-columns: 1fr 1fr;
319
- grid-gap: 20px;
320
-
321
- .graphic-loader-block {
322
- height: inherit;
323
- display: flex;
324
- justify-content: center;
325
- align-items: center;
326
- min-height: 300px;
327
- }
328
- .empty-content {
329
- height: inherit;
330
- }
331
- }
332
- </style>
@@ -1,9 +0,0 @@
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
- }
@@ -1,375 +0,0 @@
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>