bfg-common 1.1.80 → 1.1.82

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/components/atoms/alert/Notification.vue +167 -167
  2. package/components/atoms/autocomplete/Autocomplete.vue +236 -236
  3. package/components/atoms/datepicker/Datepicker.vue +612 -612
  4. package/components/atoms/list/SelectList.vue +62 -62
  5. package/components/atoms/nav/NavBar.vue +116 -116
  6. package/components/atoms/nav/VerticalNavBar.vue +89 -89
  7. package/components/atoms/notificationBar/NotificationBar.vue +175 -175
  8. package/components/atoms/perPage/PerPage.vue +52 -52
  9. package/components/atoms/popup/SimplePopup.vue +90 -90
  10. package/components/atoms/step/VerticalStep.vue +104 -104
  11. package/components/atoms/switch/Switch.vue +107 -107
  12. package/components/atoms/table/dataGrid/DataGridColumnSwitch.vue +206 -206
  13. package/components/atoms/table/dataGrid/DataGridPage.vue +189 -189
  14. package/components/atoms/tabs/Tabs.vue +189 -189
  15. package/components/atoms/tooltip/Signpost.vue +224 -224
  16. package/components/common/adapterManager/AddAdapterWarningModal.vue +82 -82
  17. package/components/common/adapterManager/NoActiveAdaptersModal.vue +62 -62
  18. package/components/common/adapterManager/NoConnectedActiveAdaptersModal.vue +62 -62
  19. package/components/common/browse/Browse.vue +182 -182
  20. package/components/common/browse/blocks/Title.vue +66 -66
  21. package/components/common/diagramMain/Diagram.vue +186 -186
  22. package/components/common/diagramMain/DiagramMain.vue +986 -986
  23. package/components/common/diagramMain/adapter/AdapterItem.vue +227 -227
  24. package/components/common/diagramMain/adapter/AdapterItems.vue +57 -57
  25. package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +339 -339
  26. package/components/common/diagramMain/modals/editSettings/tabs/port/PortProperties.vue +202 -202
  27. package/components/common/diagramMain/modals/remove/RemoveModal.vue +226 -226
  28. package/components/common/diagramMain/network/Contents.vue +238 -238
  29. package/components/common/feedback/Buttons.vue +232 -232
  30. package/components/common/feedback/Message.vue +468 -468
  31. package/components/common/feedback/VisitPortal.vue +54 -54
  32. package/components/common/help/navbar/left/Left.vue +159 -159
  33. package/components/common/help/navbar/left/utils/constructAccordion.ts +27 -27
  34. package/components/common/mainNavigationPanel/MainNavigationPanel.vue +359 -359
  35. package/components/common/modals/Rename.vue +165 -165
  36. package/components/common/monitor/advanced/Advanced.vue +234 -221
  37. package/components/common/monitor/advanced/tools/Tools.vue +428 -441
  38. package/components/common/monitor/advanced/tools/chartOptionsModal/ChartOptionsModal.vue +484 -424
  39. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/Counters.vue +8 -0
  40. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/Table.vue +9 -0
  41. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/config/utils.ts +3 -2
  42. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/Timespan.vue +79 -73
  43. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/Object.vue +66 -19
  44. package/components/common/monitor/advanced/tools/chartOptionsModal/models/models.ts +19 -0
  45. package/components/common/monitor/models/interfaces.ts +1 -0
  46. package/components/common/perPage/PerPage.vue +51 -51
  47. package/components/common/recursionTree/RecursionTree.vue +201 -201
  48. package/components/common/vm/actions/add/config/capabilities.ts +777 -777
  49. package/components/common/vm/actions/add/customizeHardware/virtualHardware/VirtualHardware.vue +646 -646
  50. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue +246 -246
  51. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/CoresPerSocket.vue +108 -108
  52. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Cpu.vue +382 -375
  53. package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/Limit.vue +234 -234
  54. package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/config/options.ts +28 -28
  55. package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/Memory.vue +316 -316
  56. package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/config/memoryOptions.ts +35 -35
  57. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +445 -445
  58. package/components/common/vm/actions/add/customizeHardware/virtualHardware/reservation/Reservation.vue +235 -235
  59. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/VideoCard.vue +177 -177
  60. package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/order/Order.vue +197 -197
  61. package/components/common/vm/actions/add/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +180 -180
  62. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/CopyPaste.vue +51 -51
  63. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +55 -55
  64. package/components/common/vm/actions/add/select/storage/config/config.ts +154 -154
  65. package/components/common/wizards/datastore/add/nfs/configuration/Configuration.vue +373 -373
  66. package/components/common/wizards/datastore/add/nfs/configuration/serversList/ServersList.vue +123 -123
  67. package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +54 -54
  68. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/HostTable.vue +131 -131
  69. package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +230 -230
  70. package/models/store/interfaces.ts +37 -37
  71. package/models/store/storage/interfaces.ts +32 -32
  72. package/models/store/types.ts +32 -32
  73. package/modules/fixContentBuild/utils/methods.ts +114 -114
  74. package/package.json +1 -1
  75. package/public/spice-console/application/codec.js +257 -257
  76. package/public/spice-console/lib/rasterEngine.js +907 -907
  77. package/public/spice-console/network/spicechannel.js +369 -369
  78. package/public/spice-console-minify/lib/decoder/dixie.min.js +4 -4
  79. package/public/spice-console-minify/lib/jgestures.min.js +24 -24
  80. package/public/spice-console-minify/lib/jquery-2.0.3.min.js +24 -24
  81. package/public/spice-console-minify/lib/jquery-mousewheel.min.js +11 -11
  82. package/public/spice-console-minify/lib/jquery-visibility.min.js +1 -1
  83. package/public/spice-console-minify/lib/lodash.4.0.0.min.js +5 -5
  84. package/utils/contentBuild.ts +34 -34
@@ -1,441 +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
- href="#"
36
- class="chart-options-button"
37
- @click="onShowChartOptions"
38
- >{{ localization.chartOptions }}</a
39
- >
40
- </div>
41
- <div class="view-select-label horizontal-flex-container">
42
- <label for="viewSelect" class="label-select"
43
- >{{ localization.view }}:</label
44
- >
45
- <div class="select">
46
- <select
47
- id="viewSelect"
48
- v-model="selectedView"
49
- :disabled="props.disabledView"
50
- @change="onChangeView"
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 class="chart-action-bar vui-action-bar">
63
- <ul>
64
- <li class="menu-item">
65
- <a
66
- id="advanced-page-link"
67
- class="item-link"
68
- @click="onOpenAdvancedPage"
69
- >
70
- <span class="vx-icon-window-popout icon"></span>
71
- </a>
72
- </li>
73
- <li class="menu-item">
74
- <atoms-dropdown :drop-menu="exportMenu" @select="onExportMenuItem">
75
- <template #icon>
76
- <a id="export-link" href="#" class="item-link">
77
- <span class="vx-icon-export icon"></span>
78
- </a>
79
- </template>
80
- </atoms-dropdown>
81
- </li>
82
- </ul>
83
- </div>
84
- </div>
85
-
86
- <common-monitor-advanced-tools-chart-options-modal
87
- v-if="isShowModal"
88
- :type="props.type"
89
- :language="props.language"
90
- :selected-counters-keys="props.selectedCountersKeys"
91
- :selected-metric="props.selectedMetric"
92
- :selected-chart-type="props.selectedChartType"
93
- :selected-timespan-type="props.selectedTimespanType"
94
- :units-count="props.unitsCount"
95
- :period-type="props.periodType"
96
- :selected-custom-time="props.selectedCustomTime"
97
- :selected-chart-option-name="props.selectedChartOptionName"
98
- :custom-date-from="props.customDateFrom"
99
- :custom-date-to="props.customDateTo"
100
- :custom-time-from="props.customTimeFrom"
101
- :custom-time-to="props.customTimeTo"
102
- :total-cores="props.totalCores"
103
- :host-id="props.hostId"
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
- @select-chart-name="onSelectChartName"
113
- @delete-option="onDeleteOption"
114
- @save-option-name="onSaveOptionName"
115
- @update-custom-date-from="emits('update-custom-date-from', $event)"
116
- @update-custom-date-to="emits('update-custom-date-to', $event)"
117
- @update-custom-time-from="emits('update-custom-time-from', $event)"
118
- @update-custom-time-to="emits('update-custom-time-to', $event)"
119
- @submit-options="emits('submit-options', $event)"
120
- />
121
- </template>
122
-
123
- <script setup lang="ts">
124
- import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
125
- import { UI_I_Localization } from '~/models/interfaces'
126
- import { UI_I_MonitorGraphPayload } from '~/components/common/monitor/models/interfaces'
127
- import { UI_I_DropMenu } from '~/components/common/monitor/advanced/tools/models/interfaces'
128
- import { UI_T_AdvancedType } from '~/components/common/monitor/advanced/models/types'
129
- import { UI_I_AdvancedCounterItem } from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/models/interfaces'
130
- import {
131
- T_ChartHost,
132
- T_ChartVm,
133
- } from '~/components/common/monitor/advanced/tools/chartOptionsModal/models/types'
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
- disabledPeriod?: boolean
163
- disabledView?: boolean
164
- }>()
165
-
166
- const emits = defineEmits<{
167
- (event: 'update-tools', obj: UI_I_MonitorGraphPayload): void
168
- (event: 'exporting', str: string): void
169
- (event: 'open-advanced-page'): void
170
- (event: 'select-row', value: UI_I_AdvancedCounterItem[]): void
171
- (event: 'select-metric', value: string): void
172
- (event: 'update-chart-type', value: string): void
173
- (event: 'update-timespan-type', value: string): void
174
- (event: 'update-unit-count', value: number): void
175
- (event: 'update-period-type', value: string): void
176
- (event: 'update-custom-time', value: string): void
177
- (event: 'select-chart-name', 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: string): void
184
- }>()
185
-
186
- const routeType = '' + useRoute().params.type
187
-
188
- const localization = computed<UI_I_Localization>(() => useLocal())
189
- const { $formattedDatetime } = useNuxtApp()
190
-
191
- const selectedView = ref<string>('')
192
- const optionsNames = ref<string[]>([])
193
- const viewOptions = computed<UI_I_OptionItem[]>(() =>
194
- viewFunc(localization.value, props.type, optionsNames.value)
195
- )
196
-
197
- watch(
198
- () => props.selectedChartOptionName,
199
- (newValue) => {
200
- let currentValue = ''
201
-
202
- if (newValue) currentValue = newValue
203
- else if (
204
- selectedView.value &&
205
- optionsNames.value.includes(selectedView.value)
206
- )
207
- currentValue = selectedView.value
208
- else currentValue = viewOptions.value[0].value
209
-
210
- selectedView.value = currentValue
211
- },
212
- { immediate: true }
213
- )
214
-
215
- const onSelectChartName = (name: string): void => {
216
- emits('select-chart-name', name)
217
- optionsNames.value = getCurrentOptionsStorageFunc(routeType)
218
- }
219
-
220
- const onDeleteOption = (): void => {
221
- emits('delete-option')
222
- optionsNames.value = getCurrentOptionsStorageFunc(routeType)
223
- }
224
-
225
- const selectedPeriod = ref<string>('')
226
- const periodOptions = computed<UI_I_OptionItem[]>(() =>
227
- periodFunc(localization.value, props.selectedTimespanType)
228
- )
229
- watch(
230
- () => periodOptions.value,
231
- (newValue: UI_I_OptionItem[]) => {
232
- if (newValue) selectedPeriod.value = newValue[0].value
233
- },
234
- { immediate: true }
235
- )
236
- watch(
237
- () => props.selectedTimespanType,
238
- (newValue) => {
239
- if (!newValue) return
240
-
241
- selectedPeriod.value = newValue
242
- updateTools()
243
- }
244
- )
245
-
246
- const isShowModal = ref<boolean>(false)
247
- watch(isShowModal, (newValue) => {
248
- if (!newValue && !selectedView.value)
249
- selectedView.value = viewOptions.value[0].value
250
- })
251
-
252
- const selectedObjects = ref<string>('')
253
-
254
- const updateTools = (): void => {
255
- const periodValue = selectedPeriod.value
256
- const viewValue = selectedView.value
257
- const selectedValue = useLocalStorage(
258
- viewValue + 'ChartOptions',
259
- undefined,
260
- false
261
- )
262
-
263
- const fields = selectedValue
264
- ? selectedValue.counters.map((item) => item.name).join(', ')
265
- : ''
266
- const validPeriodData = getValidDateByOptionFunc(
267
- periodValue,
268
- selectedValue,
269
- props.unitsCount,
270
- props.selectedCustomTime
271
- )
272
-
273
- const period = [
274
- Math.round(validPeriodData[0] / 1000),
275
- Math.round(validPeriodData[1] / 1000),
276
- ]
277
-
278
- if (periodValue === 'custom_interval' && props.periodType === 'period') {
279
- const checkDateResult = checkDateFunc(
280
- localization.value,
281
- props.customDateFrom,
282
- props.customDateTo,
283
- props.customTimeFrom,
284
- props.customTimeTo
285
- )
286
- if (Array.isArray(checkDateResult)) {
287
- period[0] = Math.round(checkDateResult[0] / 1000)
288
- period[1] = Math.round(checkDateResult[1] / 1000)
289
- }
290
- }
291
-
292
- const tools: UI_I_MonitorGraphPayload = {
293
- fields,
294
- period,
295
- periodType: periodValue,
296
- view: viewValue,
297
- }
298
- emits('update-timespan-type', selectedPeriod.value)
299
- emits('update-tools', tools)
300
- }
301
-
302
- const onChangePeriod = (): void => {
303
- updateTools()
304
- }
305
-
306
- const onChangeView = (): void => {
307
- updateTools()
308
- }
309
-
310
- const chartTitleDate = computed<string>(() => {
311
- if (!props.startDate) return ''
312
-
313
- const start = $formattedDatetime(props.startDate, '', true)
314
- const end = $formattedDatetime(new Date(), '', true)
315
- return `${start} - ${end}`
316
- })
317
-
318
- const onOpenAdvancedPage = (): void => emits('open-advanced-page')
319
-
320
- const exportMenu = ref<UI_I_DropMenu<string>[]>(exportFunc(localization.value))
321
-
322
- const onExportMenuItem = (item: UI_I_DropMenu<any>): void =>
323
- emits('exporting', item.action)
324
-
325
- const onShowChartOptions = (): void => {
326
- isShowModal.value = true
327
- }
328
-
329
- const onSaveOptionName = (): void => {
330
- optionsNames.value = getCurrentOptionsStorageFunc(routeType)
331
- }
332
-
333
- onMounted(() => {
334
- optionsNames.value = getCurrentOptionsStorageFunc(routeType)
335
- updateTools()
336
- })
337
- </script>
338
-
339
- <style scoped lang="scss">
340
- .horizontal-flex-container {
341
- display: flex;
342
- flex-direction: row;
343
- align-items: center;
344
- line-height: 20px;
345
- flex-shrink: 0;
346
-
347
- .chart-title-content {
348
- overflow: hidden;
349
- text-overflow: ellipsis;
350
- }
351
-
352
- .select select {
353
- height: 20px;
354
- margin: 5px;
355
- color: var(--global-font-color);
356
- }
357
- .single-option {
358
- margin-left: 5px;
359
- }
360
-
361
- .chart-title {
362
- color: var(--global-font-color);
363
- text-overflow: ellipsis;
364
- white-space: nowrap;
365
- overflow: hidden;
366
- margin: 6px;
367
- font-weight: 700;
368
- text-transform: capitalize;
369
-
370
- &.uppercase {
371
- text-transform: uppercase;
372
- }
373
- }
374
-
375
- .view-select-label {
376
- margin-left: auto;
377
- padding-right: 7px;
378
- padding-left: 7px;
379
- text-overflow: ellipsis;
380
- white-space: nowrap;
381
- align-items: center;
382
- }
383
-
384
- .chart-options-button {
385
- margin-left: 5px;
386
- text-overflow: ellipsis;
387
- white-space: nowrap;
388
- text-transform: capitalize;
389
- color: var(--dropdown-item-color);
390
- }
391
-
392
- .chart-action-bar {
393
- white-space: nowrap;
394
-
395
- .menu-item {
396
- padding-right: 4px;
397
- display: inline-block;
398
- list-style: none;
399
- vertical-align: middle;
400
-
401
- &:last-child {
402
- padding-right: 0;
403
- }
404
-
405
- .item-link {
406
- padding: 4px;
407
- line-height: 22px;
408
- border: 1px solid transparent;
409
- display: inline-block;
410
-
411
- &:hover {
412
- text-decoration: none;
413
- background-color: #e9f6fd;
414
- border: 1px solid #c7e9ff;
415
- }
416
-
417
- .icon {
418
- width: 16px;
419
- height: 16px;
420
- display: block;
421
- min-width: 16px;
422
- min-height: 16px;
423
- background-size: 100% auto;
424
- display: block;
425
- }
426
- }
427
-
428
- :deep(.dropdown-menu) {
429
- min-width: auto;
430
- padding: 0;
431
- }
432
- :deep(.user-menu-large) {
433
- padding: 0;
434
- }
435
- :deep(.angle-icon) {
436
- display: none;
437
- }
438
- }
439
- }
440
- }
441
- </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
+ href="#"
36
+ class="chart-options-button"
37
+ @click="onShowChartOptions"
38
+ >{{ localization.chartOptions }}</a
39
+ >
40
+ </div>
41
+ <div class="view-select-label horizontal-flex-container">
42
+ <label for="viewSelect" class="label-select"
43
+ >{{ localization.view }}:</label
44
+ >
45
+ <div class="select">
46
+ <select
47
+ id="viewSelect"
48
+ v-model="selectedView"
49
+ :disabled="props.disabledView"
50
+ @change="onChangeView"
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 class="chart-action-bar vui-action-bar">
63
+ <ul>
64
+ <li class="menu-item">
65
+ <a
66
+ id="advanced-page-link"
67
+ class="item-link"
68
+ @click="onOpenAdvancedPage"
69
+ >
70
+ <span class="vx-icon-window-popout icon"></span>
71
+ </a>
72
+ </li>
73
+ <li class="menu-item">
74
+ <atoms-dropdown :drop-menu="exportMenu" @select="onExportMenuItem">
75
+ <template #icon>
76
+ <a id="export-link" href="#" class="item-link">
77
+ <span class="vx-icon-export icon"></span>
78
+ </a>
79
+ </template>
80
+ </atoms-dropdown>
81
+ </li>
82
+ </ul>
83
+ </div>
84
+ </div>
85
+
86
+ <common-monitor-advanced-tools-chart-options-modal
87
+ v-if="isShowModal"
88
+ :type="props.type"
89
+ :language="props.language"
90
+ :selected-counters-keys="props.selectedCountersKeys"
91
+ :selected-metric="props.selectedMetric"
92
+ :selected-chart-type="props.selectedChartType"
93
+ :selected-timespan-type="props.selectedTimespanType"
94
+ :units-count="props.unitsCount"
95
+ :period-type="props.periodType"
96
+ :selected-custom-time="props.selectedCustomTime"
97
+ :selected-chart-option-name="props.selectedChartOptionName"
98
+ :custom-date-from="props.customDateFrom"
99
+ :custom-date-to="props.customDateTo"
100
+ :custom-time-from="props.customTimeFrom"
101
+ :custom-time-to="props.customTimeTo"
102
+ :total-cores="props.totalCores"
103
+ :host-id="props.hostId"
104
+ :selected-objects="props.selectedObjects"
105
+ @hide="isShowModal = false"
106
+ @select-row="emits('select-row', $event)"
107
+ @select-metric="emits('select-metric', $event)"
108
+ @update-chart-type="emits('update-chart-type', $event)"
109
+ @update-timespan-type="emits('update-timespan-type', $event)"
110
+ @update-unit-count="emits('update-unit-count', $event)"
111
+ @update-period-type="emits('update-period-type', $event)"
112
+ @update-custom-time="emits('update-custom-time', $event)"
113
+ @delete-option="onDeleteOption"
114
+ @save-option-name="onSaveOptionName"
115
+ @update-custom-date-from="emits('update-custom-date-from', $event)"
116
+ @update-custom-date-to="emits('update-custom-date-to', $event)"
117
+ @update-custom-time-from="emits('update-custom-time-from', $event)"
118
+ @update-custom-time-to="emits('update-custom-time-to', $event)"
119
+ @submit-options="emits('submit-options', $event)"
120
+ />
121
+ </template>
122
+
123
+ <script setup lang="ts">
124
+ import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
125
+ import { UI_I_Localization } from '~/models/interfaces'
126
+ import { UI_I_MonitorGraphPayload } from '~/components/common/monitor/models/interfaces'
127
+ import { UI_I_DropMenu } from '~/components/common/monitor/advanced/tools/models/interfaces'
128
+ import { UI_T_AdvancedType } from '~/components/common/monitor/advanced/models/types'
129
+ import {
130
+ T_ChartHost,
131
+ T_ChartVm,
132
+ } from '~/components/common/monitor/advanced/tools/chartOptionsModal/models/types'
133
+ import { UI_I_OptionsForm } from '~/components/common/monitor/advanced/tools/chartOptionsModal/models/models'
134
+ import { UI_I_AdvancedCounterItem } from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/models/interfaces'
135
+ import { getValidDateByOptionFunc } from '~/components/common/monitor/config/getValidDateByOption'
136
+ import {
137
+ periodFunc,
138
+ viewFunc,
139
+ exportFunc,
140
+ getCurrentOptionsStorageFunc,
141
+ } from '~/components/common/monitor/advanced/tools/config/advancedToolbar'
142
+ import { checkDateFunc } from '~/components/common/monitor/overview/filters/customIntervalModal/config/dateChecker'
143
+
144
+ const props = defineProps<{
145
+ type: UI_T_AdvancedType
146
+ startDate: number
147
+ chartTitle: string
148
+ language: string
149
+ selectedCountersKeys: number[]
150
+ selectedMetric: T_ChartHost | T_ChartVm
151
+ selectedChartType: string
152
+ selectedTimespanType: string
153
+ unitsCount: number
154
+ periodType: string
155
+ selectedCustomTime: string
156
+ selectedChartOptionName: string
157
+ customDateFrom: string
158
+ customDateTo: string
159
+ customTimeFrom: string
160
+ customTimeTo: string
161
+ totalCores: number
162
+ hostId: string
163
+ selectedObjects: string
164
+ disabledPeriod?: boolean
165
+ disabledView?: boolean
166
+ }>()
167
+
168
+ const emits = defineEmits<{
169
+ (event: 'update-tools', obj: UI_I_MonitorGraphPayload): void
170
+ (event: 'exporting', str: string): void
171
+ (event: 'open-advanced-page'): void
172
+ (event: 'select-row', value: UI_I_AdvancedCounterItem[]): void
173
+ (event: 'select-metric', value: string): void
174
+ (event: 'update-chart-type', value: string): void
175
+ (event: 'update-timespan-type', value: string): void
176
+ (event: 'update-unit-count', value: number): void
177
+ (event: 'update-period-type', value: string): void
178
+ (event: 'update-custom-time', value: string): void
179
+ (event: 'delete-option'): void
180
+ (event: 'update-custom-date-from', value: string): void
181
+ (event: 'update-custom-date-to', value: string): void
182
+ (event: 'update-custom-time-from', value: string): void
183
+ (event: 'update-custom-time-to', value: string): void
184
+ (event: 'submit-options', value: UI_I_OptionsForm): void
185
+ (event: 'update:selected-timespan-type', value: string): void
186
+ }>()
187
+
188
+ const routeType = '' + useRoute().params.type
189
+
190
+ const localization = computed<UI_I_Localization>(() => useLocal())
191
+ const { $formattedDatetime } = useNuxtApp()
192
+
193
+ const selectedView = ref<string>('')
194
+ const optionsNames = ref<string[]>([])
195
+ const viewOptions = computed<UI_I_OptionItem[]>(() =>
196
+ viewFunc(localization.value, props.type, optionsNames.value)
197
+ )
198
+
199
+ watch(
200
+ () => props.selectedChartOptionName,
201
+ (newValue) => {
202
+ let currentValue = ''
203
+
204
+ if (newValue) currentValue = newValue
205
+ else if (
206
+ selectedView.value &&
207
+ optionsNames.value.includes(selectedView.value)
208
+ )
209
+ currentValue = selectedView.value
210
+ else currentValue = viewOptions.value[0].value
211
+
212
+ selectedView.value = currentValue
213
+ },
214
+ { immediate: true }
215
+ )
216
+
217
+ const onDeleteOption = (): void => {
218
+ emits('delete-option')
219
+ optionsNames.value = getCurrentOptionsStorageFunc(routeType)
220
+ }
221
+
222
+ const periodOptions = computed<UI_I_OptionItem[]>(() =>
223
+ periodFunc(localization.value, props.selectedTimespanType)
224
+ )
225
+ const selectedPeriod = computed<string>({
226
+ get() {
227
+ return props.selectedTimespanType || periodOptions.value[0].value
228
+ },
229
+ set(newValue) {
230
+ emits('update:selected-timespan-type', newValue)
231
+ },
232
+ })
233
+
234
+ const isShowModal = ref<boolean>(false)
235
+ watch(isShowModal, (newValue) => {
236
+ if (!newValue && !selectedView.value)
237
+ selectedView.value = viewOptions.value[0].value
238
+ })
239
+
240
+ const updateTools = (): void => {
241
+ const periodValue = selectedPeriod.value
242
+ const viewValue = selectedView.value
243
+ const selectedValue = useLocalStorage(
244
+ viewValue + 'ChartOptions',
245
+ undefined,
246
+ false
247
+ )
248
+
249
+ const fields = selectedValue
250
+ ? selectedValue.counters.map((item) => item.name).join(', ')
251
+ : ''
252
+ const validPeriodData = getValidDateByOptionFunc(
253
+ periodValue,
254
+ selectedValue,
255
+ props.unitsCount,
256
+ props.selectedCustomTime
257
+ )
258
+
259
+ const period = [
260
+ Math.round(validPeriodData[0] / 1000),
261
+ Math.round(validPeriodData[1] / 1000),
262
+ ]
263
+
264
+ if (periodValue === 'custom_interval' && props.periodType === 'period') {
265
+ const checkDateResult = checkDateFunc(
266
+ localization.value,
267
+ props.customDateFrom,
268
+ props.customDateTo,
269
+ props.customTimeFrom,
270
+ props.customTimeTo
271
+ )
272
+ if (Array.isArray(checkDateResult)) {
273
+ period[0] = Math.round(checkDateResult[0] / 1000)
274
+ period[1] = Math.round(checkDateResult[1] / 1000)
275
+ }
276
+ }
277
+
278
+ const tools: UI_I_MonitorGraphPayload = {
279
+ fields,
280
+ period,
281
+ periodType: periodValue,
282
+ view: viewValue,
283
+ }
284
+ if (selectedValue.metric) tools.metricType = selectedValue.metric
285
+
286
+ emits('update-timespan-type', selectedPeriod.value)
287
+ emits('update-tools', tools)
288
+ }
289
+
290
+ const onChangePeriod = (): void => {
291
+ updateTools()
292
+ }
293
+
294
+ const onChangeView = (): void => {
295
+ updateTools()
296
+ }
297
+
298
+ const chartTitleDate = computed<string>(() => {
299
+ if (!props.startDate) return ''
300
+
301
+ const start = $formattedDatetime(props.startDate, '', true)
302
+ const end = $formattedDatetime(new Date(), '', true)
303
+ return `${start} - ${end}`
304
+ })
305
+
306
+ const onOpenAdvancedPage = (): void => emits('open-advanced-page')
307
+
308
+ const exportMenu = ref<UI_I_DropMenu<string>[]>(exportFunc(localization.value))
309
+
310
+ const onExportMenuItem = (item: UI_I_DropMenu<any>): void =>
311
+ emits('exporting', item.action)
312
+
313
+ const onShowChartOptions = (): void => {
314
+ isShowModal.value = true
315
+ }
316
+
317
+ const onSaveOptionName = (): void => {
318
+ optionsNames.value = getCurrentOptionsStorageFunc(routeType)
319
+ }
320
+
321
+ onMounted(() => {
322
+ optionsNames.value = getCurrentOptionsStorageFunc(routeType)
323
+ updateTools()
324
+ })
325
+ </script>
326
+
327
+ <style scoped lang="scss">
328
+ .horizontal-flex-container {
329
+ display: flex;
330
+ flex-direction: row;
331
+ align-items: center;
332
+ line-height: 20px;
333
+ flex-shrink: 0;
334
+
335
+ .chart-title-content {
336
+ overflow: hidden;
337
+ text-overflow: ellipsis;
338
+ }
339
+
340
+ .select select {
341
+ height: 20px;
342
+ margin: 5px;
343
+ color: var(--global-font-color);
344
+ }
345
+ .single-option {
346
+ margin-left: 5px;
347
+ }
348
+
349
+ .chart-title {
350
+ color: var(--global-font-color);
351
+ text-overflow: ellipsis;
352
+ white-space: nowrap;
353
+ overflow: hidden;
354
+ margin: 6px;
355
+ font-weight: 700;
356
+ text-transform: capitalize;
357
+
358
+ &.uppercase {
359
+ text-transform: uppercase;
360
+ }
361
+ }
362
+
363
+ .view-select-label {
364
+ margin-left: auto;
365
+ padding-right: 7px;
366
+ padding-left: 7px;
367
+ text-overflow: ellipsis;
368
+ white-space: nowrap;
369
+ align-items: center;
370
+ }
371
+
372
+ .chart-options-button {
373
+ margin-left: 5px;
374
+ text-overflow: ellipsis;
375
+ white-space: nowrap;
376
+ text-transform: capitalize;
377
+ color: var(--dropdown-item-color);
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>