bfg-common 1.1.76 → 1.1.78

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