bfg-common 1.2.108 → 1.2.109

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 +5 -1
  2. package/assets/localization/local_en.json +5 -1
  3. package/assets/localization/local_hy.json +5 -1
  4. package/assets/localization/local_kk.json +5 -1
  5. package/assets/localization/local_ru.json +5 -1
  6. package/assets/localization/local_zh.json +5 -1
  7. package/components/atoms/modal/bySteps/BySteps.vue +1 -1
  8. package/components/atoms/modal/byStepsSecond/ByStepsSecond.vue +2 -2
  9. package/components/atoms/step/VerticalStep.vue +1 -1
  10. package/components/common/monitor/advanced/tools/Tools.vue +428 -428
  11. package/components/common/wizards/datastore/add/config/stepItems.ts +3 -3
  12. package/components/common/wizards/vm/common/Tooltip.vue +74 -0
  13. package/components/common/wizards/vm/common/readyComplete/ReadyComplete.vue +15 -0
  14. package/components/common/wizards/vm/migrate/Migrate.vue +204 -0
  15. package/components/common/wizards/vm/migrate/config/constructDataReady.ts +82 -0
  16. package/components/common/wizards/vm/migrate/contentHeading/ContentHeading.vue +31 -0
  17. package/components/common/wizards/vm/migrate/models/enums.ts +6 -0
  18. package/components/common/wizards/vm/migrate/models/interfaces.ts +13 -0
  19. package/components/common/wizards/vm/migrate/models/types.ts +5 -0
  20. package/components/common/wizards/vm/migrate/select/storage/Storage.vue +136 -0
  21. package/components/common/wizards/vm/migrate/select/storage/config/tabsPannel.ts +18 -0
  22. package/components/common/wizards/vm/migrate/select/storage/configure/batch/Batch.vue +61 -0
  23. package/components/common/wizards/vm/migrate/select/storage/configure/disk/Disk.vue +73 -0
  24. package/components/common/wizards/vm/migrate/select/storage/diskFormat/DiskFormat.vue +68 -0
  25. package/components/common/wizards/vm/migrate/select/storage/diskFormat/config/formatOptions.ts +22 -0
  26. package/components/common/wizards/vm/migrate/select/storage/models/interfaces.ts +14 -0
  27. package/components/common/wizards/vm/migrate/select/storage/models/types.ts +3 -0
  28. package/components/common/wizards/vm/migrate/select/storage/policy/Policy.vue +83 -0
  29. package/components/common/wizards/vm/migrate/select/storage/selectedPerDisk/SelectedPerDisk.vue +84 -0
  30. package/components/common/wizards/vm/migrate/select/storage/table/datastore/Datastore.vue +105 -0
  31. package/components/common/wizards/vm/migrate/select/storage/table/datastore/config/config.ts +154 -0
  32. package/components/common/wizards/vm/migrate/select/storage/table/datastore/models/types.ts +15 -0
  33. package/components/common/wizards/vm/migrate/select/storage/table/disk/Disk.vue +73 -0
  34. package/components/common/wizards/vm/migrate/select/storage/table/disk/config/config.ts +102 -0
  35. package/components/common/wizards/vm/migrate/select/storage/table/disk/models/interfaces.ts +9 -0
  36. package/components/common/wizards/vm/migrate/select/storage/table/disk/models/types.ts +9 -0
  37. package/components/common/wizards/vm/migrate/select/type/Type.vue +38 -0
  38. package/components/common/wizards/vm/migrate/select/type/config/typeOptions.ts +41 -0
  39. package/components/common/wizards/vm/migrate/select/type/models/interfaces.ts +5 -0
  40. package/components/common/wizards/vm/migrate/utils.ts +125 -0
  41. package/package.json +1 -1
@@ -1,428 +1,428 @@
1
- <template>
2
- <div class="horizontal-flex-container overview-chart-title-bar">
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.period }}:</label
16
- >
17
- <div class="select">
18
- <select
19
- id="periodSelect"
20
- v-model="selectedPeriod"
21
- :disabled="props.disabledPeriod"
22
- @change="onChangePeriod"
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
- @click="onShowChartOptions"
37
- >{{ localization.chartOptions }}</a
38
- >
39
- </div>
40
- <div class="view-select-label horizontal-flex-container">
41
- <label for="viewSelect" class="label-select"
42
- >{{ localization.view }}:</label
43
- >
44
- <div class="select">
45
- <select
46
- id="viewSelect"
47
- v-model="selectedView"
48
- :disabled="props.disabledView"
49
- @change="onChangeView"
50
- >
51
- <option
52
- v-for="(item, index) in viewOptions"
53
- :key="index"
54
- :value="item.value"
55
- >
56
- {{ item.text }}
57
- </option>
58
- </select>
59
- </div>
60
- </div>
61
- <div class="chart-action-bar vui-action-bar">
62
- <ul>
63
- <li class="menu-item">
64
- <a
65
- id="advanced-page-link"
66
- class="item-link"
67
- @click="onOpenAdvancedPage"
68
- >
69
- <span class="vx-icon-window-popout icon"></span>
70
- </a>
71
- </li>
72
- <li class="menu-item">
73
- <atoms-dropdown :drop-menu="exportMenu" @select="onExportMenuItem">
74
- <template #icon>
75
- <a id="export-link" href="#" class="item-link">
76
- <span class="vx-icon-export icon"></span>
77
- </a>
78
- </template>
79
- </atoms-dropdown>
80
- </li>
81
- </ul>
82
- </div>
83
- </div>
84
-
85
- <common-monitor-advanced-tools-chart-options-modal
86
- v-if="isShowModal"
87
- :type="props.type"
88
- :language="props.language"
89
- :selected-counters-keys="props.selectedCountersKeys"
90
- :selected-metric="props.selectedMetric"
91
- :selected-chart-type="props.selectedChartType"
92
- :selected-timespan-type="props.selectedTimespanType"
93
- :units-count="props.unitsCount"
94
- :period-type="props.periodType"
95
- :selected-custom-time="props.selectedCustomTime"
96
- :selected-chart-option-name="props.selectedChartOptionName"
97
- :custom-date-from="props.customDateFrom"
98
- :custom-date-to="props.customDateTo"
99
- :custom-time-from="props.customTimeFrom"
100
- :custom-time-to="props.customTimeTo"
101
- :total-cores="props.totalCores"
102
- :host-id="props.hostId"
103
- :selected-objects="props.selectedObjects"
104
- @hide="isShowModal = false"
105
- @select-row="emits('select-row', $event)"
106
- @select-metric="emits('select-metric', $event)"
107
- @update-chart-type="emits('update-chart-type', $event)"
108
- @update-timespan-type="emits('update-timespan-type', $event)"
109
- @update-unit-count="emits('update-unit-count', $event)"
110
- @update-period-type="emits('update-period-type', $event)"
111
- @update-custom-time="emits('update-custom-time', $event)"
112
- @delete-option="onDeleteOption"
113
- @save-option-name="onSaveOptionName"
114
- @update-custom-date-from="emits('update-custom-date-from', $event)"
115
- @update-custom-date-to="emits('update-custom-date-to', $event)"
116
- @update-custom-time-from="emits('update-custom-time-from', $event)"
117
- @update-custom-time-to="emits('update-custom-time-to', $event)"
118
- @submit-options="emits('submit-options', $event)"
119
- />
120
- </template>
121
-
122
- <script setup lang="ts">
123
- import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
124
- import { UI_I_Localization } from '~/models/interfaces'
125
- import { UI_I_MonitorGraphPayload } from '~/components/common/monitor/models/interfaces'
126
- import { UI_I_DropMenu } from '~/components/common/monitor/advanced/tools/models/interfaces'
127
- import { UI_T_AdvancedType } from '~/components/common/monitor/advanced/models/types'
128
- import {
129
- T_ChartHost,
130
- T_ChartVm,
131
- } from '~/components/common/monitor/advanced/tools/chartOptionsModal/models/types'
132
- import { UI_I_OptionsForm } from '~/components/common/monitor/advanced/tools/chartOptionsModal/models/interfaces'
133
- import { UI_I_AdvancedCounterItem } from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/models/interfaces'
134
- import { getValidDateByOptionFunc } from '~/components/common/monitor/config/getValidDateByOption'
135
- import {
136
- periodFunc,
137
- viewFunc,
138
- exportFunc,
139
- getCurrentOptionsStorageFunc,
140
- } from '~/components/common/monitor/advanced/tools/config/advancedToolbar'
141
- import { checkDateFunc } from '~/components/common/monitor/overview/filters/customIntervalModal/config/dateChecker'
142
-
143
- const props = defineProps<{
144
- type: UI_T_AdvancedType
145
- startDate: number
146
- chartTitle: string
147
- language: string
148
- selectedCountersKeys: number[]
149
- selectedMetric: T_ChartHost | T_ChartVm
150
- selectedChartType: string
151
- selectedTimespanType: string
152
- unitsCount: number
153
- periodType: string
154
- selectedCustomTime: string
155
- selectedChartOptionName: string
156
- customDateFrom: string
157
- customDateTo: string
158
- customTimeFrom: string
159
- customTimeTo: string
160
- totalCores: number
161
- hostId: string
162
- selectedObjects: string
163
- disabledPeriod?: boolean
164
- disabledView?: boolean
165
- }>()
166
-
167
- const emits = defineEmits<{
168
- (event: 'update-tools', value: UI_I_MonitorGraphPayload): void
169
- (event: 'exporting', value: string): void
170
- (event: 'open-advanced-page'): void
171
- (event: 'select-row', value: UI_I_AdvancedCounterItem[]): void
172
- (event: 'select-metric', value: string): void
173
- (event: 'update-chart-type', value: string): void
174
- (event: 'update-timespan-type', value: string): void
175
- (event: 'update-unit-count', value: number): void
176
- (event: 'update-period-type', value: string): void
177
- (event: 'update-custom-time', value: string): void
178
- (event: 'delete-option'): void
179
- (event: 'update-custom-date-from', value: string): void
180
- (event: 'update-custom-date-to', value: string): void
181
- (event: 'update-custom-time-from', value: string): void
182
- (event: 'update-custom-time-to', value: string): void
183
- (event: 'submit-options', value: UI_I_OptionsForm): void
184
- (event: 'update:selected-timespan-type', value: string): void
185
- }>()
186
-
187
- const routeType = '' + useRoute().params.type
188
-
189
- const localization = computed<UI_I_Localization>(() => useLocal())
190
- const { $formattedDatetime } = useNuxtApp()
191
-
192
- const selectedView = ref<string>('')
193
- const optionsNames = ref<string[]>([])
194
- const viewOptions = computed<UI_I_OptionItem[]>(() =>
195
- viewFunc(localization.value, props.type, optionsNames.value)
196
- )
197
-
198
- watch(
199
- () => props.selectedChartOptionName,
200
- (newValue) => {
201
- let currentValue = ''
202
-
203
- if (newValue) currentValue = newValue
204
- else if (
205
- selectedView.value &&
206
- optionsNames.value.includes(selectedView.value)
207
- )
208
- currentValue = selectedView.value
209
- else currentValue = selectedView.value || viewOptions.value[0].value
210
-
211
- selectedView.value = currentValue
212
- },
213
- { immediate: true }
214
- )
215
-
216
- const onDeleteOption = (): void => {
217
- emits('delete-option')
218
- optionsNames.value = getCurrentOptionsStorageFunc(routeType)
219
- }
220
-
221
- const periodOptions = computed<UI_I_OptionItem[]>(() =>
222
- periodFunc(localization.value, props.selectedTimespanType)
223
- )
224
- const selectedPeriod = computed<string>({
225
- get() {
226
- return props.selectedTimespanType || periodOptions.value[0].value
227
- },
228
- set(newValue) {
229
- emits('update:selected-timespan-type', newValue)
230
- },
231
- })
232
-
233
- const isShowModal = ref<boolean>(false)
234
- watch(isShowModal, (newValue) => {
235
- if (!newValue && !selectedView.value)
236
- selectedView.value = viewOptions.value[0].value
237
- })
238
-
239
- const updateTools = (): void => {
240
- const periodValue = selectedPeriod.value
241
- const viewValue = selectedView.value
242
- const selectedValue = useLocalStorage(
243
- viewValue + 'ChartOptions',
244
- undefined,
245
- false
246
- )
247
-
248
- const fields = selectedValue
249
- ? selectedValue.counters.map((item) => item.name).join(', ')
250
- : ''
251
- const validPeriodData = getValidDateByOptionFunc(
252
- periodValue,
253
- selectedValue,
254
- props.unitsCount,
255
- props.selectedCustomTime
256
- )
257
-
258
- const period = [
259
- Math.round(validPeriodData[0] / 1000),
260
- Math.round(validPeriodData[1] / 1000),
261
- ]
262
-
263
- if (periodValue === 'custom_interval' && props.periodType === 'period') {
264
- const checkDateResult = checkDateFunc(
265
- localization.value,
266
- props.customDateFrom,
267
- props.customDateTo,
268
- props.customTimeFrom,
269
- props.customTimeTo
270
- )
271
- if (Array.isArray(checkDateResult)) {
272
- period[0] = Math.round(checkDateResult[0] / 1000)
273
- period[1] = Math.round(checkDateResult[1] / 1000)
274
- }
275
- }
276
-
277
- const tools: UI_I_MonitorGraphPayload = {
278
- fields,
279
- period,
280
- periodType: periodValue,
281
- view: viewValue,
282
- }
283
- if (selectedValue.metric) tools.metricType = selectedValue.metric
284
-
285
- emits('update-timespan-type', selectedPeriod.value)
286
- emits('update-tools', tools)
287
- }
288
-
289
- const onChangePeriod = (): void => {
290
- updateTools()
291
- }
292
-
293
- const onChangeView = (): void => {
294
- updateTools()
295
- }
296
-
297
- const chartTitleDate = computed<string>(() => {
298
- if (!props.startDate) return ''
299
-
300
- const start = $formattedDatetime(props.startDate, '', true)
301
- const end = $formattedDatetime(new Date(), '', true)
302
- return `${start} - ${end}`
303
- })
304
-
305
- const onOpenAdvancedPage = (): void => emits('open-advanced-page')
306
-
307
- const exportMenu = ref<UI_I_DropMenu<string>[]>(exportFunc(localization.value))
308
-
309
- const onExportMenuItem = (item: UI_I_DropMenu<any>): void =>
310
- emits('exporting', item.action)
311
-
312
- const onShowChartOptions = (): void => {
313
- isShowModal.value = true
314
- }
315
-
316
- const onSaveOptionName = (): void => {
317
- optionsNames.value = getCurrentOptionsStorageFunc(routeType)
318
- }
319
-
320
- onMounted(() => {
321
- optionsNames.value = getCurrentOptionsStorageFunc(routeType)
322
- updateTools()
323
- })
324
- </script>
325
-
326
- <style scoped lang="scss">
327
- .horizontal-flex-container {
328
- display: flex;
329
- flex-direction: row;
330
- align-items: center;
331
- line-height: 20px;
332
- flex-shrink: 0;
333
-
334
- .chart-title-content {
335
- overflow: hidden;
336
- text-overflow: ellipsis;
337
- }
338
-
339
- .select select {
340
- height: 20px;
341
- margin: 5px;
342
- color: var(--global-font-color);
343
- }
344
- .single-option {
345
- margin-left: 5px;
346
- }
347
-
348
- .chart-title {
349
- color: var(--global-font-color);
350
- text-overflow: ellipsis;
351
- white-space: nowrap;
352
- overflow: hidden;
353
- margin: 6px;
354
- font-weight: 700;
355
- text-transform: capitalize;
356
-
357
- &.uppercase {
358
- text-transform: uppercase;
359
- }
360
- }
361
-
362
- .view-select-label {
363
- margin-left: auto;
364
- padding-right: 7px;
365
- padding-left: 7px;
366
- text-overflow: ellipsis;
367
- white-space: nowrap;
368
- align-items: center;
369
- }
370
-
371
- .chart-options-button {
372
- margin-left: 5px;
373
- text-overflow: ellipsis;
374
- white-space: nowrap;
375
- text-transform: capitalize;
376
- color: var(--dropdown-item-color);
377
- cursor: pointer;
378
- }
379
-
380
- .chart-action-bar {
381
- white-space: nowrap;
382
-
383
- .menu-item {
384
- padding-right: 4px;
385
- display: inline-block;
386
- list-style: none;
387
- vertical-align: middle;
388
-
389
- &:last-child {
390
- padding-right: 0;
391
- }
392
-
393
- .item-link {
394
- padding: 4px;
395
- line-height: 22px;
396
- border: 1px solid transparent;
397
- display: inline-block;
398
-
399
- &:hover {
400
- text-decoration: none;
401
- background-color: #e9f6fd;
402
- border: 1px solid #c7e9ff;
403
- }
404
-
405
- .icon {
406
- width: 16px;
407
- height: 16px;
408
- display: block;
409
- min-width: 16px;
410
- min-height: 16px;
411
- background-size: 100% auto;
412
- }
413
- }
414
-
415
- :deep(.dropdown-menu) {
416
- min-width: auto;
417
- padding: 0;
418
- }
419
- :deep(.user-menu-large) {
420
- padding: 0;
421
- }
422
- :deep(.angle-icon) {
423
- display: none;
424
- }
425
- }
426
- }
427
- }
428
- </style>
1
+ <template>
2
+ <div class="horizontal-flex-container overview-chart-title-bar">
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.period }}:</label
16
+ >
17
+ <div class="select">
18
+ <select
19
+ id="periodSelect"
20
+ v-model="selectedPeriod"
21
+ :disabled="props.disabledPeriod"
22
+ @change="onChangePeriod"
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
+ @click="onShowChartOptions"
37
+ >{{ localization.chartOptions }}</a
38
+ >
39
+ </div>
40
+ <div class="view-select-label horizontal-flex-container">
41
+ <label for="viewSelect" class="label-select"
42
+ >{{ localization.view }}:</label
43
+ >
44
+ <div class="select">
45
+ <select
46
+ id="viewSelect"
47
+ v-model="selectedView"
48
+ :disabled="props.disabledView"
49
+ @change="onChangeView"
50
+ >
51
+ <option
52
+ v-for="(item, index) in viewOptions"
53
+ :key="index"
54
+ :value="item.value"
55
+ >
56
+ {{ item.text }}
57
+ </option>
58
+ </select>
59
+ </div>
60
+ </div>
61
+ <div class="chart-action-bar vui-action-bar">
62
+ <ul>
63
+ <li class="menu-item">
64
+ <a
65
+ id="advanced-page-link"
66
+ class="item-link"
67
+ @click="onOpenAdvancedPage"
68
+ >
69
+ <span class="vx-icon-window-popout icon"></span>
70
+ </a>
71
+ </li>
72
+ <li class="menu-item">
73
+ <atoms-dropdown :drop-menu="exportMenu" @select="onExportMenuItem">
74
+ <template #icon>
75
+ <a id="export-link" href="#" class="item-link">
76
+ <span class="vx-icon-export icon"></span>
77
+ </a>
78
+ </template>
79
+ </atoms-dropdown>
80
+ </li>
81
+ </ul>
82
+ </div>
83
+ </div>
84
+
85
+ <common-monitor-advanced-tools-chart-options-modal
86
+ v-if="isShowModal"
87
+ :type="props.type"
88
+ :language="props.language"
89
+ :selected-counters-keys="props.selectedCountersKeys"
90
+ :selected-metric="props.selectedMetric"
91
+ :selected-chart-type="props.selectedChartType"
92
+ :selected-timespan-type="props.selectedTimespanType"
93
+ :units-count="props.unitsCount"
94
+ :period-type="props.periodType"
95
+ :selected-custom-time="props.selectedCustomTime"
96
+ :selected-chart-option-name="props.selectedChartOptionName"
97
+ :custom-date-from="props.customDateFrom"
98
+ :custom-date-to="props.customDateTo"
99
+ :custom-time-from="props.customTimeFrom"
100
+ :custom-time-to="props.customTimeTo"
101
+ :total-cores="props.totalCores"
102
+ :host-id="props.hostId"
103
+ :selected-objects="props.selectedObjects"
104
+ @hide="isShowModal = false"
105
+ @select-row="emits('select-row', $event)"
106
+ @select-metric="emits('select-metric', $event)"
107
+ @update-chart-type="emits('update-chart-type', $event)"
108
+ @update-timespan-type="emits('update-timespan-type', $event)"
109
+ @update-unit-count="emits('update-unit-count', $event)"
110
+ @update-period-type="emits('update-period-type', $event)"
111
+ @update-custom-time="emits('update-custom-time', $event)"
112
+ @delete-option="onDeleteOption"
113
+ @save-option-name="onSaveOptionName"
114
+ @update-custom-date-from="emits('update-custom-date-from', $event)"
115
+ @update-custom-date-to="emits('update-custom-date-to', $event)"
116
+ @update-custom-time-from="emits('update-custom-time-from', $event)"
117
+ @update-custom-time-to="emits('update-custom-time-to', $event)"
118
+ @submit-options="emits('submit-options', $event)"
119
+ />
120
+ </template>
121
+
122
+ <script setup lang="ts">
123
+ import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
124
+ import { UI_I_Localization } from '~/models/interfaces'
125
+ import { UI_I_MonitorGraphPayload } from '~/components/common/monitor/models/interfaces'
126
+ import { UI_I_DropMenu } from '~/components/common/monitor/advanced/tools/models/interfaces'
127
+ import { UI_T_AdvancedType } from '~/components/common/monitor/advanced/models/types'
128
+ import {
129
+ T_ChartHost,
130
+ T_ChartVm,
131
+ } from '~/components/common/monitor/advanced/tools/chartOptionsModal/models/types'
132
+ import { UI_I_OptionsForm } from '~/components/common/monitor/advanced/tools/chartOptionsModal/models/interfaces'
133
+ import { UI_I_AdvancedCounterItem } from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/models/interfaces'
134
+ import { getValidDateByOptionFunc } from '~/components/common/monitor/config/getValidDateByOption'
135
+ import {
136
+ periodFunc,
137
+ viewFunc,
138
+ exportFunc,
139
+ getCurrentOptionsStorageFunc,
140
+ } from '~/components/common/monitor/advanced/tools/config/advancedToolbar'
141
+ import { checkDateFunc } from '~/components/common/monitor/overview/filters/customIntervalModal/config/dateChecker'
142
+
143
+ const props = defineProps<{
144
+ type: UI_T_AdvancedType
145
+ startDate: number
146
+ chartTitle: string
147
+ language: string
148
+ selectedCountersKeys: number[]
149
+ selectedMetric: T_ChartHost | T_ChartVm
150
+ selectedChartType: string
151
+ selectedTimespanType: string
152
+ unitsCount: number
153
+ periodType: string
154
+ selectedCustomTime: string
155
+ selectedChartOptionName: string
156
+ customDateFrom: string
157
+ customDateTo: string
158
+ customTimeFrom: string
159
+ customTimeTo: string
160
+ totalCores: number
161
+ hostId: string
162
+ selectedObjects: string
163
+ disabledPeriod?: boolean
164
+ disabledView?: boolean
165
+ }>()
166
+
167
+ const emits = defineEmits<{
168
+ (event: 'update-tools', value: UI_I_MonitorGraphPayload): void
169
+ (event: 'exporting', value: string): void
170
+ (event: 'open-advanced-page'): void
171
+ (event: 'select-row', value: UI_I_AdvancedCounterItem[]): void
172
+ (event: 'select-metric', value: string): void
173
+ (event: 'update-chart-type', value: string): void
174
+ (event: 'update-timespan-type', value: string): void
175
+ (event: 'update-unit-count', value: number): void
176
+ (event: 'update-period-type', value: string): void
177
+ (event: 'update-custom-time', value: string): void
178
+ (event: 'delete-option'): void
179
+ (event: 'update-custom-date-from', value: string): void
180
+ (event: 'update-custom-date-to', value: string): void
181
+ (event: 'update-custom-time-from', value: string): void
182
+ (event: 'update-custom-time-to', value: string): void
183
+ (event: 'submit-options', value: UI_I_OptionsForm): void
184
+ (event: 'update:selected-timespan-type', value: string): void
185
+ }>()
186
+
187
+ const routeType = '' + useRoute().params.type
188
+
189
+ const localization = computed<UI_I_Localization>(() => useLocal())
190
+ const { $formattedDatetime } = useNuxtApp()
191
+
192
+ const selectedView = ref<string>('')
193
+ const optionsNames = ref<string[]>([])
194
+ const viewOptions = computed<UI_I_OptionItem[]>(() =>
195
+ viewFunc(localization.value, props.type, optionsNames.value)
196
+ )
197
+
198
+ watch(
199
+ () => props.selectedChartOptionName,
200
+ (newValue) => {
201
+ let currentValue = ''
202
+
203
+ if (newValue) currentValue = newValue
204
+ else if (
205
+ selectedView.value &&
206
+ optionsNames.value.includes(selectedView.value)
207
+ )
208
+ currentValue = selectedView.value
209
+ else currentValue = selectedView.value || viewOptions.value[0].value
210
+
211
+ selectedView.value = currentValue
212
+ },
213
+ { immediate: true }
214
+ )
215
+
216
+ const onDeleteOption = (): void => {
217
+ emits('delete-option')
218
+ optionsNames.value = getCurrentOptionsStorageFunc(routeType)
219
+ }
220
+
221
+ const periodOptions = computed<UI_I_OptionItem[]>(() =>
222
+ periodFunc(localization.value, props.selectedTimespanType)
223
+ )
224
+ const selectedPeriod = computed<string>({
225
+ get() {
226
+ return props.selectedTimespanType || periodOptions.value[0].value
227
+ },
228
+ set(newValue) {
229
+ emits('update:selected-timespan-type', newValue)
230
+ },
231
+ })
232
+
233
+ const isShowModal = ref<boolean>(false)
234
+ watch(isShowModal, (newValue) => {
235
+ if (!newValue && !selectedView.value)
236
+ selectedView.value = viewOptions.value[0].value
237
+ })
238
+
239
+ const updateTools = (): void => {
240
+ const periodValue = selectedPeriod.value
241
+ const viewValue = selectedView.value
242
+ const selectedValue = useLocalStorage(
243
+ viewValue + 'ChartOptions',
244
+ undefined,
245
+ false
246
+ )
247
+
248
+ const fields = selectedValue
249
+ ? selectedValue.counters.map((item) => item.name).join(', ')
250
+ : ''
251
+ const validPeriodData = getValidDateByOptionFunc(
252
+ periodValue,
253
+ selectedValue,
254
+ props.unitsCount,
255
+ props.selectedCustomTime
256
+ )
257
+
258
+ const period = [
259
+ Math.round(validPeriodData[0] / 1000),
260
+ Math.round(validPeriodData[1] / 1000),
261
+ ]
262
+
263
+ if (periodValue === 'custom_interval' && props.periodType === 'period') {
264
+ const checkDateResult = checkDateFunc(
265
+ localization.value,
266
+ props.customDateFrom,
267
+ props.customDateTo,
268
+ props.customTimeFrom,
269
+ props.customTimeTo
270
+ )
271
+ if (Array.isArray(checkDateResult)) {
272
+ period[0] = Math.round(checkDateResult[0] / 1000)
273
+ period[1] = Math.round(checkDateResult[1] / 1000)
274
+ }
275
+ }
276
+
277
+ const tools: UI_I_MonitorGraphPayload = {
278
+ fields,
279
+ period,
280
+ periodType: periodValue,
281
+ view: viewValue,
282
+ }
283
+ if (selectedValue.metric) tools.metricType = selectedValue.metric
284
+
285
+ emits('update-timespan-type', selectedPeriod.value)
286
+ emits('update-tools', tools)
287
+ }
288
+
289
+ const onChangePeriod = (): void => {
290
+ updateTools()
291
+ }
292
+
293
+ const onChangeView = (): void => {
294
+ updateTools()
295
+ }
296
+
297
+ const chartTitleDate = computed<string>(() => {
298
+ if (!props.startDate) return ''
299
+
300
+ const start = $formattedDatetime(props.startDate, '', true)
301
+ const end = $formattedDatetime(new Date(), '', true)
302
+ return `${start} - ${end}`
303
+ })
304
+
305
+ const onOpenAdvancedPage = (): void => emits('open-advanced-page')
306
+
307
+ const exportMenu = ref<UI_I_DropMenu<string>[]>(exportFunc(localization.value))
308
+
309
+ const onExportMenuItem = (item: UI_I_DropMenu<any>): void =>
310
+ emits('exporting', item.action)
311
+
312
+ const onShowChartOptions = (): void => {
313
+ isShowModal.value = true
314
+ }
315
+
316
+ const onSaveOptionName = (): void => {
317
+ optionsNames.value = getCurrentOptionsStorageFunc(routeType)
318
+ }
319
+
320
+ onMounted(() => {
321
+ optionsNames.value = getCurrentOptionsStorageFunc(routeType)
322
+ updateTools()
323
+ })
324
+ </script>
325
+
326
+ <style scoped lang="scss">
327
+ .horizontal-flex-container {
328
+ display: flex;
329
+ flex-direction: row;
330
+ align-items: center;
331
+ line-height: 20px;
332
+ flex-shrink: 0;
333
+
334
+ .chart-title-content {
335
+ overflow: hidden;
336
+ text-overflow: ellipsis;
337
+ }
338
+
339
+ .select select {
340
+ height: 20px;
341
+ margin: 5px;
342
+ color: var(--global-font-color);
343
+ }
344
+ .single-option {
345
+ margin-left: 5px;
346
+ }
347
+
348
+ .chart-title {
349
+ color: var(--global-font-color);
350
+ text-overflow: ellipsis;
351
+ white-space: nowrap;
352
+ overflow: hidden;
353
+ margin: 6px;
354
+ font-weight: 700;
355
+ text-transform: capitalize;
356
+
357
+ &.uppercase {
358
+ text-transform: uppercase;
359
+ }
360
+ }
361
+
362
+ .view-select-label {
363
+ margin-left: auto;
364
+ padding-right: 7px;
365
+ padding-left: 7px;
366
+ text-overflow: ellipsis;
367
+ white-space: nowrap;
368
+ align-items: center;
369
+ }
370
+
371
+ .chart-options-button {
372
+ margin-left: 5px;
373
+ text-overflow: ellipsis;
374
+ white-space: nowrap;
375
+ text-transform: capitalize;
376
+ color: var(--dropdown-item-color);
377
+ cursor: pointer;
378
+ }
379
+
380
+ .chart-action-bar {
381
+ white-space: nowrap;
382
+
383
+ .menu-item {
384
+ padding-right: 4px;
385
+ display: inline-block;
386
+ list-style: none;
387
+ vertical-align: middle;
388
+
389
+ &:last-child {
390
+ padding-right: 0;
391
+ }
392
+
393
+ .item-link {
394
+ padding: 4px;
395
+ line-height: 22px;
396
+ border: 1px solid transparent;
397
+ display: inline-block;
398
+
399
+ &:hover {
400
+ text-decoration: none;
401
+ background-color: #e9f6fd;
402
+ border: 1px solid #c7e9ff;
403
+ }
404
+
405
+ .icon {
406
+ width: 16px;
407
+ height: 16px;
408
+ display: block;
409
+ min-width: 16px;
410
+ min-height: 16px;
411
+ background-size: 100% auto;
412
+ }
413
+ }
414
+
415
+ :deep(.dropdown-menu) {
416
+ min-width: auto;
417
+ padding: 0;
418
+ }
419
+ :deep(.user-menu-large) {
420
+ padding: 0;
421
+ }
422
+ :deep(.angle-icon) {
423
+ display: none;
424
+ }
425
+ }
426
+ }
427
+ }
428
+ </style>