bfg-common 1.1.65 → 1.1.66

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 (47) hide show
  1. package/assets/localization/local_be.json +1 -1
  2. package/assets/localization/local_hy.json +1 -1
  3. package/assets/localization/local_kk.json +1 -1
  4. package/assets/localization/local_ru.json +1 -1
  5. package/components/common/graph/Graph.vue +20 -18
  6. package/components/common/monitor/advanced/Advanced.vue +33 -3
  7. package/components/common/monitor/advanced/GraphView.vue +4 -4
  8. package/components/common/monitor/advanced/table/Table.vue +5 -5
  9. package/components/common/monitor/advanced/tools/Tools.vue +91 -27
  10. package/components/common/monitor/advanced/tools/chartOptionsModal/ChartOptionsModal.vue +101 -17
  11. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/Counters.vue +25 -7
  12. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/config/utils.ts +55 -0
  13. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/models/interfaces.ts +1 -1
  14. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/Timespan.vue +32 -3
  15. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/Form.vue +25 -8
  16. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/Object.vue +41 -19
  17. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/models/interfaces.ts +1 -1
  18. package/components/common/monitor/advanced/tools/config/advancedToolbar.ts +50 -38
  19. package/components/common/monitor/advanced/tools/utils/countCores.ts +7 -0
  20. package/components/common/monitor/config/getValidDateByOption.ts +105 -6
  21. package/components/common/monitor/overview/filters/Filters.vue +6 -6
  22. package/components/common/monitor/overview/filters/customIntervalModal/CustomIntervalModal.vue +8 -8
  23. package/components/common/monitor/overview/filters/customIntervalModal/config/dateChecker.ts +1 -1
  24. package/components/common/vm/actions/add/customizeHardware/CustomizeHardware.vue +2 -1
  25. package/components/common/vm/actions/add/customizeHardware/virtualHardware/VirtualHardware.vue +5 -1
  26. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue +1 -1
  27. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Cpu.vue +1 -1
  28. package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/Memory.vue +1 -1
  29. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +1 -1
  30. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +3 -1
  31. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +2 -0
  32. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/VideoCard.vue +5 -3
  33. package/components/common/vm/actions/add/customizeHardware/vmoptions/Vmoptions.vue +4 -0
  34. package/components/common/vm/actions/add/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +6 -3
  35. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/CopyPaste.vue +2 -1
  36. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/FileTransfer.vue +2 -0
  37. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/PlaybackCompression.vue +2 -0
  38. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/RemoteConsoleOptions.vue +16 -0
  39. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/imgCompression/ImgCompression.vue +2 -0
  40. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/jpegCompression/JpegCompression.vue +2 -0
  41. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +2 -1
  42. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/password/Password.vue +4 -2
  43. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/streamingMode/StreamingMode.vue +2 -0
  44. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/type/Type.vue +2 -0
  45. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/zlibCompression/ZlibCompression.vue +2 -0
  46. package/components/common/vm/actions/editSettings/EditSettings.vue +1 -1
  47. package/package.json +1 -1
@@ -1117,7 +1117,7 @@
1117
1117
  "offlineOps": "Пазасеткавыя аперацыі.",
1118
1118
  "ok": "добра",
1119
1119
  "okOrCancelToReviewYourChanges": "Націсніце ОК, каб працягнуць, або Адмена, каб праглядзець унесеныя змены.",
1120
- "oneOfSelectedDatesIsInTheFuture": "The specified time range is not valid. One of the selected dates is in the future.",
1120
+ "oneOfSelectedDatesIsInTheFuture": "Ўказаны часовай дыяпазон недапушчальны. Адна з выбраных дат знаходзіцца ў будучыні.",
1121
1121
  "opaqueNetwork": "Непразрыстая сетка",
1122
1122
  "openId": "OpenID",
1123
1123
  "openidAddress": "Адрас OpenID",
@@ -1117,7 +1117,7 @@
1117
1117
  "offlineOps": "Անցանց գործողություններ",
1118
1118
  "ok": "Լավ",
1119
1119
  "okOrCancelToReviewYourChanges": "Կտտացրեք OK՝ շարունակելու համար կամ չեղարկել՝ ձեր կատարած փոփոխությունները դիտելու համար:",
1120
- "oneOfSelectedDatesIsInTheFuture": "The specified time range is not valid. One of the selected dates is in the future.",
1120
+ "oneOfSelectedDatesIsInTheFuture": "Նշված ժամանակային միջակայքն անընդունելի է: Ընտրված ամսաթվերից մեկը ապագայում է:",
1121
1121
  "opaqueNetwork": "Անթափանց ցանց",
1122
1122
  "openId": "OpenID",
1123
1123
  "openidAddress": "OpenID հասցե",
@@ -1117,7 +1117,7 @@
1117
1117
  "offlineOps": "Офлайн операциялар",
1118
1118
  "ok": "ЖАРАЙДЫ МА",
1119
1119
  "okOrCancelToReviewYourChanges": "Жалғастыру үшін OK немесе енгізілген өзгерістерді көру үшін Болдырмау түймесін басыңыз.",
1120
- "oneOfSelectedDatesIsInTheFuture": "The specified time range is not valid. One of the selected dates is in the future.",
1120
+ "oneOfSelectedDatesIsInTheFuture": "Көрсетілген уақыт диапазонына жол берілмейді. Таңдалған күндердің бірі болашақта.",
1121
1121
  "opaqueNetwork": "Мөлдір емес желі",
1122
1122
  "openId": "OpenID",
1123
1123
  "openidAddress": "OpenID мекенжайы",
@@ -1117,7 +1117,7 @@
1117
1117
  "offlineOps": "Оффлайн операции",
1118
1118
  "ok": "ОК",
1119
1119
  "okOrCancelToReviewYourChanges": "Нажмите \"ОК\", чтобы продолжить, или \"Отмена\", чтобы просмотреть внесенные изменения.",
1120
- "oneOfSelectedDatesIsInTheFuture": "The specified time range is not valid. One of the selected dates is in the future.",
1120
+ "oneOfSelectedDatesIsInTheFuture": "Указанный временной диапазон недопустим. Одна из выбранных дат находится в будущем.",
1121
1121
  "opaqueNetwork": "Непрозрачная сеть",
1122
1122
  "openId": "OpenID",
1123
1123
  "openidAddress": "OpenID-адрес",
@@ -26,27 +26,27 @@ const props = defineProps<{
26
26
  selectedRow?: number[]
27
27
  }>()
28
28
 
29
- let chart: any = null
29
+ let localChart: any = null
30
30
  const exportChart = (type: string): void => {
31
31
  if (type === 'png') {
32
- chart.exportChart({
32
+ localChart.exportChart({
33
33
  type: 'image/png',
34
34
  })
35
35
  } else if (type === 'jpeg') {
36
- chart.exportChart({
36
+ localChart.exportChart({
37
37
  type: 'image/jpeg',
38
38
  })
39
39
  } else if (type === 'svg') {
40
- chart.exportChart({
40
+ localChart.exportChart({
41
41
  type: 'image/svg+xml',
42
42
  })
43
43
  } else if (type === 'csv') {
44
- chart.downloadCSV()
44
+ localChart.downloadCSV()
45
45
  }
46
46
  }
47
47
 
48
48
  const chartOptions = ref<I_LineGraph | I_DiskGraph | null>(null)
49
- const initGraph = () => {
49
+ const initGraph = (): void => {
50
50
  if (!props.data) return
51
51
  setTimeout(() => {
52
52
  chartOptions.value = props.data
@@ -55,42 +55,44 @@ const initGraph = () => {
55
55
 
56
56
  watch(
57
57
  () => props.update,
58
- (val) => {
59
- val && initGraph()
58
+ (newValue) => {
59
+ newValue && initGraph()
60
60
  },
61
61
  { immediate: true }
62
62
  )
63
63
 
64
64
  watch(
65
65
  () => props.exportType,
66
- (val) => {
67
- if (!val) return
66
+ (newValue) => {
67
+ if (!newValue) return
68
68
 
69
- exportChart(val)
69
+ exportChart(newValue)
70
70
  }
71
71
  )
72
72
 
73
73
  watch(
74
74
  () => props.chart,
75
- (val) => {
76
- if (val.series) chart = val
75
+ (newValue) => {
76
+ if (newValue.series) localChart = newValue
77
77
  },
78
78
  { deep: true }
79
79
  )
80
80
 
81
81
  const updateSeriesStrokeWidth = (data: number[]): void => {
82
- if (!chart) return
82
+ if (!localChart) return
83
83
 
84
- chart.series.forEach((_: any, key: number) => {
85
- chart.options.series[key].lineWidth = 1.5
84
+ localChart.series.forEach((_: any, key: number) => {
85
+ localChart.options.series[key].lineWidth = 1.5
86
86
 
87
- if (data.includes(key)) chart.options.series[key].lineWidth = 3
87
+ if (data.includes(key)) localChart.options.series[key].lineWidth = 3
88
88
  })
89
+
90
+ localChart.update(localChart.options)
89
91
  }
90
92
 
91
93
  watch(
92
94
  () => props.selectedRow,
93
- (val) => val && updateSeriesStrokeWidth(val)
95
+ (newValue) => newValue && updateSeriesStrokeWidth(newValue)
94
96
  )
95
97
  </script>
96
98
 
@@ -26,7 +26,13 @@
26
26
  :period-type="props.periodType"
27
27
  :selected-custom-time="props.selectedCustomTime"
28
28
  :selected-chart-option-name="props.selectedChartOptionName"
29
- @update-tools="onUpdateTools"
29
+ :custom-date-from="props.customDateFrom"
30
+ :custom-date-to="props.customDateTo"
31
+ :custom-time-from="props.customTimeFrom"
32
+ :custom-time-to="props.customTimeTo"
33
+ :total-cores="totalCores"
34
+ :host-id="props.hostId"
35
+ @update-tools="emits('update-tools', $event)"
30
36
  @exporting="onExporting"
31
37
  @open-advanced-page="onGetEmptyPage"
32
38
  @select-row="emits('select-row', $event)"
@@ -38,6 +44,11 @@
38
44
  @update-custom-time="emits('update-custom-time', $event)"
39
45
  @select-chart-name="emits('select-chart-name', $event)"
40
46
  @delete-option="emits('delete-option')"
47
+ @update-custom-date-from="emits('update-custom-date-from', $event)"
48
+ @update-custom-date-to="emits('update-custom-date-to', $event)"
49
+ @update-custom-time-from="emits('update-custom-time-from', $event)"
50
+ @update-custom-time-to="emits('update-custom-time-to', $event)"
51
+ @submit-options="emits('submit-options', $event)"
41
52
  />
42
53
 
43
54
  <div v-show="!props.data" class="empty-container">
@@ -85,6 +96,7 @@ import {
85
96
  T_ChartHost,
86
97
  T_ChartVm,
87
98
  } from '~/components/common/monitor/advanced/tools/chartOptionsModal/models/types'
99
+ import { getCountCores } from '~/components/common/monitor/advanced/tools/utils/countCores'
88
100
 
89
101
  const props = defineProps<{
90
102
  type: UI_T_AdvancedType
@@ -103,6 +115,11 @@ const props = defineProps<{
103
115
  periodType: string
104
116
  selectedCustomTime: string
105
117
  selectedChartOptionName: string
118
+ customDateFrom: string
119
+ customDateTo: string
120
+ customTimeFrom: string
121
+ customTimeTo: string
122
+ hostId: string
106
123
  disabledPeriod?: boolean
107
124
  disabledView?: boolean
108
125
  }>()
@@ -120,12 +137,25 @@ const emits = defineEmits<{
120
137
  (event: 'update-custom-time', value: string): void
121
138
  (event: 'select-chart-name', value: string): void
122
139
  (event: 'delete-option'): void
140
+ (event: 'update-custom-date-from', value: string): void
141
+ (event: 'update-custom-date-to', value: string): void
142
+ (event: 'update-custom-time-from', value: string): void
143
+ (event: 'update-custom-time-to', value: string): void
144
+ (event: 'submit-options', value: string): void
123
145
  }>()
124
146
 
125
147
  const localization = computed<UI_I_Localization>(() => useLocal())
126
148
 
127
- const onUpdateTools = (tools: UI_I_MonitorGraphPayload): void =>
128
- emits('update-tools', tools)
149
+ const totalCores = ref<number>(0)
150
+ watch(
151
+ () => props.data,
152
+ (newValue) => {
153
+ if (!newValue) return
154
+
155
+ totalCores.value = getCountCores(newValue)
156
+ },
157
+ { immediate: true }
158
+ )
129
159
 
130
160
  const exportGraph = ref<string>('')
131
161
  const onExporting = (key: string): void => {
@@ -6,7 +6,7 @@
6
6
  :data="chartData"
7
7
  :update="chartHelper"
8
8
  :export-type="exportType"
9
- :selected-row="selectedRow"
9
+ :selected-row="props.selectedRow"
10
10
  />
11
11
  </template>
12
12
  </div>
@@ -129,10 +129,10 @@ watch(width, (newValue) => {
129
129
  const exportType = ref<string>('')
130
130
  watch(
131
131
  () => props.export,
132
- (val) => {
133
- if (!val) return
132
+ (newValue) => {
133
+ if (!newValue) return
134
134
 
135
- exportType.value = val
135
+ exportType.value = newValue
136
136
  },
137
137
  { immediate: true }
138
138
  )
@@ -59,17 +59,17 @@ const dataBody = ref<UI_I_BodyItem[][]>([])
59
59
 
60
60
  watch(
61
61
  () => props.data,
62
- (val) => {
63
- if (!val) return
62
+ (newValue) => {
63
+ if (!newValue) return
64
64
 
65
- dataBody.value = table.bodyItems(val)
65
+ dataBody.value = table.bodyItems(newValue)
66
66
  },
67
67
  { immediate: true }
68
68
  )
69
69
  watch(
70
70
  selectedRow,
71
- (val) => {
72
- emits('select', val)
71
+ (newValue) => {
72
+ emits('select', newValue)
73
73
  },
74
74
  { deep: true }
75
75
  )
@@ -19,6 +19,7 @@
19
19
  id="periodSelect"
20
20
  v-model="selectedPeriod"
21
21
  :disabled="props.disabledPeriod"
22
+ @change="onChangePeriod"
22
23
  >
23
24
  <option
24
25
  v-for="(item, index) in periodOptions"
@@ -46,6 +47,7 @@
46
47
  id="viewSelect"
47
48
  v-model="selectedView"
48
49
  :disabled="props.disabledView"
50
+ @change="onChangeView"
49
51
  >
50
52
  <option
51
53
  v-for="(item, index) in viewOptions"
@@ -93,6 +95,12 @@
93
95
  :period-type="props.periodType"
94
96
  :selected-custom-time="props.selectedCustomTime"
95
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"
96
104
  @hide="isShowModal = false"
97
105
  @select-row="emits('select-row', $event)"
98
106
  @select-metric="emits('select-metric', $event)"
@@ -104,6 +112,11 @@
104
112
  @select-chart-name="onSelectChartName"
105
113
  @delete-option="onDeleteOption"
106
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)"
107
120
  />
108
121
  </template>
109
122
 
@@ -125,6 +138,7 @@ import {
125
138
  exportFunc,
126
139
  getCurrentOptionsStorageFunc,
127
140
  } from '~/components/common/monitor/advanced/tools/config/advancedToolbar'
141
+ import { checkDateFunc } from '~/components/common/monitor/overview/filters/customIntervalModal/config/dateChecker'
128
142
 
129
143
  const props = defineProps<{
130
144
  type: UI_T_AdvancedType
@@ -139,6 +153,12 @@ const props = defineProps<{
139
153
  periodType: string
140
154
  selectedCustomTime: string
141
155
  selectedChartOptionName: string
156
+ customDateFrom: string
157
+ customDateTo: string
158
+ customTimeFrom: string
159
+ customTimeTo: string
160
+ totalCores: number
161
+ hostId: string
142
162
  disabledPeriod?: boolean
143
163
  disabledView?: boolean
144
164
  }>()
@@ -156,6 +176,11 @@ const emits = defineEmits<{
156
176
  (event: 'update-custom-time', value: string): void
157
177
  (event: 'select-chart-name', value: string): void
158
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
159
184
  }>()
160
185
 
161
186
  const routeType = '' + useRoute().params.type
@@ -199,7 +224,7 @@ const onDeleteOption = (): void => {
199
224
 
200
225
  const selectedPeriod = ref<string>('')
201
226
  const periodOptions = computed<UI_I_OptionItem[]>(() =>
202
- periodFunc(localization.value)
227
+ periodFunc(localization.value, props.selectedTimespanType)
203
228
  )
204
229
  watch(
205
230
  () => periodOptions.value,
@@ -208,6 +233,15 @@ watch(
208
233
  },
209
234
  { immediate: true }
210
235
  )
236
+ watch(
237
+ () => props.selectedTimespanType,
238
+ (newValue) => {
239
+ if (!newValue) return
240
+
241
+ selectedPeriod.value = newValue
242
+ updateTools()
243
+ }
244
+ )
211
245
 
212
246
  const isShowModal = ref<boolean>(false)
213
247
  watch(isShowModal, (newValue) => {
@@ -215,34 +249,63 @@ watch(isShowModal, (newValue) => {
215
249
  selectedView.value = viewOptions.value[0].value
216
250
  })
217
251
 
218
- watch(
219
- () => [selectedPeriod.value, selectedView.value],
220
- (newValue: string[]) => {
221
- const selectedValue = useLocalStorage(
222
- newValue[1] + 'ChartOptions',
223
- undefined,
224
- false
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
225
285
  )
226
- const fields = selectedValue
227
- ? selectedValue.counters.map((item) => item.name).join(', ')
228
- : ''
229
-
230
- const validPeriodData = getValidDateByOptionFunc(newValue[0])
231
-
232
- const period = [
233
- Math.round(validPeriodData[0] / 1000),
234
- Math.round(validPeriodData[1] / 1000),
235
- ]
236
- const tools: UI_I_MonitorGraphPayload = {
237
- fields,
238
- period,
239
- periodType: newValue[0],
240
- view: newValue[1],
286
+ if (Array.isArray(checkDateResult)) {
287
+ period[0] = Math.round(checkDateResult[0] / 1000)
288
+ period[1] = Math.round(checkDateResult[1] / 1000)
241
289
  }
242
- emits('update-tools', tools)
243
- },
244
- { immediate: true }
245
- )
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
+ }
246
309
 
247
310
  const chartTitleDate = computed<string>(() => {
248
311
  if (!props.startDate) return ''
@@ -269,6 +332,7 @@ const onSaveOptionName = (): void => {
269
332
 
270
333
  onMounted(() => {
271
334
  optionsNames.value = getCurrentOptionsStorageFunc(routeType)
335
+ updateTools()
272
336
  })
273
337
  </script>
274
338
 
@@ -39,12 +39,22 @@
39
39
  :units-count="localUnitsCount"
40
40
  :period-type="localPeriodType"
41
41
  :selected-custom-time="localCustomTime"
42
+ :custom-date-from="props.customDateFrom"
43
+ :custom-date-to="props.customDateTo"
44
+ :custom-time-from="props.customTimeFrom"
45
+ :custom-time-to="props.customTimeTo"
46
+ :total-cores="props.totalCores"
47
+ :host-id="props.hostId"
42
48
  @select-row="selectedRows = $event"
43
49
  @update-chart-type="selectedChartTypeLocal = $event"
44
50
  @update-custom-time="localCustomTime = $event"
45
51
  @update-timespan-type="timespanType = $event"
46
52
  @update-unit-count="unitCount = $event"
47
53
  @update-period-type="localPeriodType = $event"
54
+ @update-custom-date-from="onUpdateCustomDateFrom"
55
+ @update-custom-date-to="onUpdateCustomDateTo"
56
+ @update-custom-time-from="onUpdateCustomTimeFrom"
57
+ @update-custom-time-to="onUpdateCustomTimeTo"
48
58
  />
49
59
  </div>
50
60
  </div>
@@ -64,6 +74,7 @@ import {
64
74
  } from '~/components/common/monitor/advanced/tools/chartOptionsModal/models/types'
65
75
  import { metricsFunc } from '~/components/common/monitor/advanced/tools/chartOptionsModal/metrics/config/optionsMetrics'
66
76
  import { getCurrentOptionsStorageFunc } from '~/components/common/monitor/advanced/tools/config/advancedToolbar'
77
+ import { checkDateFunc } from '~/components/common/monitor/overview/filters/customIntervalModal/config/dateChecker'
67
78
 
68
79
  const props = defineProps<{
69
80
  type: UI_T_AdvancedType
@@ -76,6 +87,12 @@ const props = defineProps<{
76
87
  periodType: string
77
88
  selectedCustomTime: string
78
89
  selectedChartOptionName: string
90
+ customDateFrom: string
91
+ customDateTo: string
92
+ customTimeFrom: string
93
+ customTimeTo: string
94
+ totalCores: number
95
+ hostId: string
79
96
  }>()
80
97
 
81
98
  const emits = defineEmits<{
@@ -90,12 +107,35 @@ const emits = defineEmits<{
90
107
  (event: 'select-chart-name', value: string): void
91
108
  (event: 'delete-option'): void
92
109
  (event: 'save-option-name'): void
110
+ (event: 'update-custom-date-from', value: string): void
111
+ (event: 'update-custom-date-to', value: string): void
112
+ (event: 'update-custom-time-from', value: string): void
113
+ (event: 'update-custom-time-to', value: string): void
114
+ (event: 'submit-options', value: string): void
115
+ (event: 'select-objects', value: string): void
93
116
  }>()
94
117
 
95
118
  const routeType = '' + useRoute().params.type
96
119
 
97
120
  const localization = computed<UI_I_Localization>(() => useLocal())
98
121
 
122
+ const localCustomDateFrom = ref<string>('')
123
+ const onUpdateCustomDateFrom = (value: string): void => {
124
+ localCustomDateFrom.value = value
125
+ }
126
+ const localCustomDateTo = ref<string>('')
127
+ const onUpdateCustomDateTo = (value: string): void => {
128
+ localCustomDateTo.value = value
129
+ }
130
+ const localCustomTimeFrom = ref<string>('')
131
+ const onUpdateCustomTimeFrom = (value: string): void => {
132
+ localCustomTimeFrom.value = value
133
+ }
134
+ const localCustomTimeTo = ref<string>('')
135
+ const onUpdateCustomTimeTo = (value: string): void => {
136
+ localCustomTimeTo.value = value
137
+ }
138
+
99
139
  const metricsItems = computed<UI_I_VerticalTabs[]>(() =>
100
140
  metricsFunc(localization.value, props.type)
101
141
  )
@@ -173,17 +213,30 @@ const selectedRows = ref<UI_I_AdvancedCounterItem[]>([])
173
213
  const selectedChartTypeLocal = ref<string>('')
174
214
 
175
215
  const checkValidations = (): boolean => {
176
- if (selectedRows.value.length) {
177
- alerts.value = []
178
- isShowAlerts.value = false
216
+ const checkDateResult = checkDateFunc(
217
+ localization.value,
218
+ localCustomDateFrom.value,
219
+ localCustomDateTo.value,
220
+ localCustomTimeFrom.value,
221
+ localCustomTimeTo.value
222
+ )
179
223
 
180
- return true
224
+ if (!selectedRows.value.length) {
225
+ alerts.value = [localization.value.noCountersSelected]
226
+ isShowAlerts.value = true
227
+ return false
228
+ } else if (
229
+ timespanType.value === 'custom_interval' &&
230
+ localPeriodType.value === 'period' &&
231
+ checkDateResult !== '' &&
232
+ typeof checkDateResult === 'string'
233
+ ) {
234
+ alerts.value = [checkDateResult]
235
+ isShowAlerts.value = true
236
+ return false
181
237
  }
182
238
 
183
- alerts.value = [localization.value.noCountersSelected]
184
- isShowAlerts.value = true
185
-
186
- return false
239
+ return true
187
240
  }
188
241
 
189
242
  const localSelectedChartOptionName = ref<string>('')
@@ -197,6 +250,8 @@ watch(
197
250
 
198
251
  const selectedLocalOptionName = ref<string>('')
199
252
 
253
+ const selectedObjects = ref<string>('')
254
+
200
255
  const onSubmit = (): void => {
201
256
  if (!checkValidations()) return
202
257
 
@@ -205,14 +260,37 @@ const onSubmit = (): void => {
205
260
 
206
261
  onSaveOptions(selectedLocalOptionName.value)
207
262
 
208
- emits('select-metric', selectedMetric.value)
209
- emits('select-row', selectedRows.value)
210
- emits('update-chart-type', selectedChartTypeLocal.value)
211
- emits('update-timespan-type', timespanType.value)
212
- emits('update-unit-count', unitCount.value)
213
- emits('update-period-type', localPeriodType.value)
214
- emits('update-custom-time', localCustomTime.value)
215
- emits('select-chart-name', selectedLocalOptionName.value)
263
+ // emits('select-chart-name', selectedLocalOptionName.value) +
264
+ // emits('select-metric', selectedMetric.value) +
265
+ // emits('select-row', selectedRows.value) +
266
+ // emits('update-timespan-type', timespanType.value) +
267
+ // emits('update-period-type', localPeriodType.value) +
268
+ // emits('update-unit-count', unitCount.value) +
269
+ // emits('update-custom-time', localCustomTime.value) +
270
+ // emits('update-custom-date-from', localCustomDateFrom.value) +
271
+ // emits('update-custom-date-to', localCustomDateTo.value) +
272
+ // emits('update-custom-time-from', localCustomTimeFrom.value) +
273
+ // emits('update-custom-time-to', localCustomTimeTo.value) +
274
+ // emits('update-chart-type', selectedChartTypeLocal.value) +
275
+ // emits('submit-options')
276
+
277
+ const savedObject = {
278
+ optionName: selectedLocalOptionName.value,
279
+ metric: selectedMetric.value,
280
+ counters: selectedRows.value,
281
+ timespanType: timespanType.value,
282
+ periodType: localPeriodType.value,
283
+ unitCount: unitCount.value,
284
+ localTimespanType: localCustomTime.value,
285
+ dateFrom: localCustomDateFrom.value,
286
+ timeFrom: localCustomTimeFrom.value,
287
+ dateTo: localCustomDateTo.value,
288
+ timeTo: localCustomTimeTo.value,
289
+ chartType: selectedChartTypeLocal.value,
290
+ objects: selectedObjects.value,
291
+ }
292
+
293
+ emits('submit-options', savedObject)
216
294
  onHide()
217
295
  }
218
296
 
@@ -251,7 +329,13 @@ const onSaveOptions = (name: string): void => {
251
329
  }
252
330
 
253
331
  const setSelectOptions = (): void => {
254
- setDefaultOptions()
332
+ selectedMetric.value = props.selectedMetric || metricsItems.value[0]?.value
333
+ localSelectedCountersKeys.value = props.selectedCountersKeys
334
+ localSelectedChartType.value = props.selectedChartType
335
+ localSelectedTimespanType.value = props.selectedTimespanType
336
+ localUnitsCount.value = props.unitsCount
337
+ localPeriodType.value = props.periodType
338
+ localCustomTime.value = props.selectedCustomTime
255
339
  }
256
340
 
257
341
  const setDefaultOptions = (): void => {