bfg-common 1.1.65 → 1.1.67

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 +32 -4
  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 +34 -3
  34. package/components/common/vm/actions/add/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +172 -114
  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 +4 -4
  47. package/package.json +1 -1
@@ -7,18 +7,30 @@
7
7
  @select-row="emits('select-row', $event)"
8
8
  />
9
9
  <common-monitor-advanced-tools-chart-options-modal-counters-timespan
10
+ :type="props.type"
11
+ :chart="props.chart"
10
12
  :language="props.language"
11
- :selected="selectedOptions"
12
13
  :selected-chart-type="props.selectedChartType"
13
14
  :selected-timespan-type="props.selectedTimespanType"
14
15
  :units-count="props.unitsCount"
15
16
  :period-type="props.periodType"
16
17
  :selected-custom-time="props.selectedCustomTime"
18
+ :custom-date-from="props.customDateFrom"
19
+ :custom-date-to="props.customDateTo"
20
+ :custom-time-from="props.customTimeFrom"
21
+ :custom-time-to="props.customTimeTo"
22
+ :total-cores="props.totalCores"
23
+ :host-id="props.hostId"
17
24
  @update-chart-type="emits('update-chart-type', $event)"
18
25
  @update-custom-time="emits('update-custom-time', $event)"
19
26
  @update-timespan-type="emits('update-timespan-type', $event)"
20
27
  @update-unit-count="emits('update-unit-count', $event)"
21
28
  @update-period-type="emits('update-period-type', $event)"
29
+ @update-custom-date-from="emits('update-custom-date-from', $event)"
30
+ @update-custom-date-to="emits('update-custom-date-to', $event)"
31
+ @update-custom-time-from="emits('update-custom-time-from', $event)"
32
+ @update-custom-time-to="emits('update-custom-time-to', $event)"
33
+ @select-objects="emits('select-objects', $event)"
22
34
  />
23
35
  </div>
24
36
  </template>
@@ -29,10 +41,7 @@ import {
29
41
  T_ChartVm,
30
42
  } from '~/components/common/monitor/advanced/tools/chartOptionsModal/models/types'
31
43
  import { UI_T_AdvancedType } from '~/components/common/monitor/advanced/models/types'
32
- import {
33
- UI_I_AdvancedCounterItem,
34
- UI_I_AdvancedTargetObject,
35
- } from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/models/interfaces'
44
+ import { UI_I_AdvancedCounterItem } from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/models/interfaces'
36
45
 
37
46
  const props = defineProps<{
38
47
  language: string
@@ -44,6 +53,12 @@ const props = defineProps<{
44
53
  unitsCount: number
45
54
  periodType: string
46
55
  selectedCustomTime: string
56
+ customDateFrom: string
57
+ customDateTo: string
58
+ customTimeFrom: string
59
+ customTimeTo: string
60
+ totalCores: number
61
+ hostId: string
47
62
  }>()
48
63
 
49
64
  const emits = defineEmits<{
@@ -53,9 +68,12 @@ const emits = defineEmits<{
53
68
  (event: 'update-timespan-type', value: string): void
54
69
  (event: 'update-unit-count', value: number): void
55
70
  (event: 'update-period-type', value: string): void
71
+ (event: 'update-custom-date-from', value: string): void
72
+ (event: 'update-custom-date-to', value: string): void
73
+ (event: 'update-custom-time-from', value: string): void
74
+ (event: 'update-custom-time-to', value: string): void
75
+ (event: 'select-objects', value: string): void
56
76
  }>()
57
-
58
- const selectedOptions = ref<UI_I_AdvancedTargetObject[][]>([])
59
77
  </script>
60
78
 
61
79
  <style scoped lang="scss">
@@ -631,3 +631,58 @@ export const countersItemsFunc = (
631
631
 
632
632
  return result
633
633
  }
634
+
635
+ export const getDefaultMetricName = (type: string, view: string): string => {
636
+ if (type === 'datacenter') return 'cpu'
637
+ else if (type === 'host') {
638
+ if (view === 'cpuUsageInPercent') return 'cpu'
639
+ return view
640
+ }
641
+
642
+ return ''
643
+ }
644
+
645
+ export const getDefaultCounters = (
646
+ type: string,
647
+ view: string
648
+ ): UI_I_AdvancedCounterItem[] => {
649
+ switch (type) {
650
+ case 'datacenter':
651
+ return [hostItemsFunc('cpu', {})[0]]
652
+ case 'host':
653
+ switch (view) {
654
+ case 'cpuUsageInPercent':
655
+ return hostItemsFunc('cpu', {}).splice(0, 2)
656
+ case 'disk':
657
+ const allItems = hostItemsFunc('disk', {})
658
+ return allItems.filter((_, key) => [0, 14].includes(key))
659
+ case 'memory':
660
+ return hostItemsFunc('memory', {})
661
+ case 'network':
662
+ return hostItemsFunc('network', {}).splice(1, 3)
663
+ }
664
+ break
665
+ case 'vm':
666
+ switch (view) {
667
+ case 'cpuUsageInPercent':
668
+ return []
669
+ }
670
+ }
671
+
672
+ // if (type === 'datacenter') {
673
+ // return [hostItemsFunc('cpu', {})[0]]
674
+ // } else if (type === 'host') {
675
+ // if (view === 'cpuUsageInPercent')
676
+ // return hostItemsFunc('cpu', {}).splice(0, 2)
677
+ // else if (view === 'disk') {
678
+ // const allItems = hostItemsFunc('disk', {})
679
+ // return allItems.filter((_, key) => [0, 14].includes(key))
680
+ // } else if (view === 'memory') return hostItemsFunc('memory', {})
681
+ // else if (view === 'network')
682
+ // return hostItemsFunc('network', {}).splice(1, 3)
683
+ // } else if (type === 'vm') {
684
+ // if (view === 'cpuUsageInPercent') return []
685
+ // }
686
+
687
+ return []
688
+ }
@@ -1,5 +1,5 @@
1
1
  export interface UI_I_AdvancedTargetObject {
2
- id: number
2
+ id: string
3
3
  target_object: string
4
4
  }
5
5
 
@@ -7,29 +7,52 @@
7
7
  :units-count="props.unitsCount"
8
8
  :period-type="props.periodType"
9
9
  :selected-custom-time="props.selectedCustomTime"
10
+ :custom-date-from="props.customDateFrom"
11
+ :custom-date-to="props.customDateTo"
12
+ :custom-time-from="props.customTimeFrom"
13
+ :custom-time-to="props.customTimeTo"
10
14
  @update-chart-type="emits('update-chart-type', $event)"
11
15
  @update-custom-time="emits('update-custom-time', $event)"
12
16
  @update-timespan-type="emits('update-timespan-type', $event)"
13
17
  @update-unit-count="emits('update-unit-count', $event)"
14
18
  @update-period-type="emits('update-period-type', $event)"
19
+ @update-custom-date-from="emits('update-custom-date-from', $event)"
20
+ @update-custom-date-to="emits('update-custom-date-to', $event)"
21
+ @update-custom-time-from="emits('update-custom-time-from', $event)"
22
+ @update-custom-time-to="emits('update-custom-time-to', $event)"
15
23
  />
16
24
  <common-monitor-advanced-tools-chart-options-modal-counters-timespan-object
17
- :selected="props.selected"
25
+ :type="props.type"
26
+ :chart="props.chart"
27
+ :total-cores="props.totalCores"
28
+ :host-id="props.hostId"
29
+ @select-objects="emits('select-objects', $event)"
18
30
  />
19
31
  </div>
20
32
  </template>
21
33
 
22
34
  <script setup lang="ts">
23
- import { UI_I_AdvancedTargetObject } from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/models/interfaces'
35
+ import { UI_T_AdvancedType } from '~/components/common/monitor/advanced/models/types'
36
+ import {
37
+ T_ChartHost,
38
+ T_ChartVm,
39
+ } from '~/components/common/monitor/advanced/tools/chartOptionsModal/models/types'
24
40
 
25
41
  const props = defineProps<{
26
- selected: UI_I_AdvancedTargetObject[][]
42
+ type: UI_T_AdvancedType
43
+ chart: T_ChartHost | T_ChartVm
27
44
  language: string
28
45
  selectedChartType: string
29
46
  selectedTimespanType: string
30
47
  unitsCount: number
31
48
  periodType: string
32
49
  selectedCustomTime: string
50
+ customDateFrom: string
51
+ customDateTo: string
52
+ customTimeFrom: string
53
+ customTimeTo: string
54
+ totalCores: number
55
+ hostId: string
33
56
  }>()
34
57
 
35
58
  const emits = defineEmits<{
@@ -38,6 +61,12 @@ const emits = defineEmits<{
38
61
  (event: 'update-timespan-type', value: string): void
39
62
  (event: 'update-unit-count', value: number): void
40
63
  (event: 'update-period-type', value: string): void
64
+ (event: 'update-period-type', value: string): void
65
+ (event: 'update-custom-date-from', value: string): void
66
+ (event: 'update-custom-date-to', value: string): void
67
+ (event: 'update-custom-time-from', value: string): void
68
+ (event: 'update-custom-time-to', value: string): void
69
+ (event: 'select-objects', value: string): void
41
70
  }>()
42
71
  </script>
43
72
 
@@ -111,7 +111,7 @@
111
111
  >
112
112
  <input
113
113
  id="current-date-from"
114
- v-model.lazy="currentDateFrom"
114
+ v-model.lazy="localCurrentDateFrom"
115
115
  type="text"
116
116
  class="chart-option-setting-row custom-time-input first-from"
117
117
  />
@@ -221,6 +221,10 @@ const props = defineProps<{
221
221
  unitsCount: number
222
222
  periodType: string
223
223
  selectedCustomTime: string
224
+ customDateFrom: string
225
+ customDateTo: string
226
+ customTimeFrom: string
227
+ customTimeTo: string
224
228
  }>()
225
229
 
226
230
  const emits = defineEmits<{
@@ -229,6 +233,10 @@ const emits = defineEmits<{
229
233
  (event: 'update-timespan-type', value: string): void
230
234
  (event: 'update-unit-count', value: number): void
231
235
  (event: 'update-period-type', value: string): void
236
+ (event: 'update-custom-date-from', value: string): void
237
+ (event: 'update-custom-date-to', value: string): void
238
+ (event: 'update-custom-time-from', value: string): void
239
+ (event: 'update-custom-time-to', value: string): void
232
240
  }>()
233
241
 
234
242
  const { $formattedDate, $isDate, $getTimeFormat, $getUnixByDate } = useNuxtApp()
@@ -348,26 +356,28 @@ const yesterday = new Date().setDate(new Date().getDate() - 1)
348
356
  const dateFrom = ref<number>(yesterday)
349
357
  const dateTo = ref<number>(new Date().getTime())
350
358
 
351
- const currentDateFrom = ref<string>('')
359
+ const localCurrentDateFrom = ref<string>('')
352
360
  const currentDateTo = ref<string>('')
353
361
  const currentTimeFrom = ref<string>('')
354
362
  const currentTimeTo = ref<string>('')
355
363
 
356
364
  const getCurrentTime = (): void => {
357
- currentDateFrom.value = $formattedDate(yesterday, '')
358
- currentDateTo.value = $formattedDate(new Date(), '')
365
+ localCurrentDateFrom.value =
366
+ props.customDateFrom || $formattedDate(yesterday, '')
367
+ currentDateTo.value = props.customDateTo || $formattedDate(new Date(), '')
359
368
 
360
369
  const currentTime = format(new Date(), $getTimeFormat(true))
361
- currentTimeFrom.value = currentTime
362
- currentTimeTo.value = currentTime
370
+ currentTimeFrom.value = props.customTimeFrom || currentTime
371
+ currentTimeTo.value = props.customTimeTo || currentTime
363
372
  }
364
373
 
365
374
  const onUpdateDateFrom = (val: number): void => {
366
375
  if (!val) return
367
376
 
368
- currentDateFrom.value = $formattedDate(new Date(val), '')
377
+ localCurrentDateFrom.value = $formattedDate(new Date(val), '')
369
378
  }
370
- watch(currentDateFrom, (newValue) => {
379
+ watch(localCurrentDateFrom, (newValue) => {
380
+ emits('update-custom-date-from', newValue)
371
381
  if (!newValue) return
372
382
 
373
383
  if ($isDate(newValue)) dateFrom.value = $getUnixByDate(newValue)
@@ -379,10 +389,17 @@ const onUpdateDateTo = (val: number): void => {
379
389
  currentDateTo.value = $formattedDate(new Date(val), '')
380
390
  }
381
391
  watch(currentDateTo, (newValue) => {
392
+ emits('update-custom-date-to', newValue)
382
393
  if (!newValue) return
383
394
 
384
395
  if ($isDate(newValue)) dateTo.value = $getUnixByDate(newValue)
385
396
  })
397
+ watch(currentTimeFrom, (newValue) => {
398
+ emits('update-custom-time-from', newValue)
399
+ })
400
+ watch(currentTimeTo, (newValue) => {
401
+ emits('update-custom-time-to', newValue)
402
+ })
386
403
 
387
404
  onMounted(() => {
388
405
  getCurrentTime()
@@ -34,10 +34,21 @@ import {
34
34
  import { UI_I_Localization } from '~/models/interfaces'
35
35
  import { UI_I_AdvancedTargetObject } from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/models/interfaces'
36
36
  import * as table from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/config/objectTable'
37
- import { UI_I_ObjectItem } from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/models/interfaces'
37
+ import { UI_T_AdvancedType } from '~/components/common/monitor/advanced/models/types'
38
+ import {
39
+ T_ChartHost,
40
+ T_ChartVm,
41
+ } from '~/components/common/monitor/advanced/tools/chartOptionsModal/models/types'
38
42
 
39
43
  const props = defineProps<{
40
- selected: UI_I_AdvancedTargetObject[][]
44
+ type: UI_T_AdvancedType
45
+ chart: T_ChartHost | T_ChartVm
46
+ totalCores: number
47
+ hostId: string
48
+ }>()
49
+
50
+ const emits = defineEmits<{
51
+ (event: 'select-objects', value: string): void
41
52
  }>()
42
53
 
43
54
  const localization = computed<UI_I_Localization>(() => useLocal())
@@ -57,28 +68,38 @@ const columnItems = computed<UI_I_ColumnKey[]>(() =>
57
68
 
58
69
  const bodyItems = ref<UI_I_BodyItem[][]>([])
59
70
 
71
+ const items: UI_I_AdvancedTargetObject[] = []
60
72
  watch(
61
- () => props.selected,
62
- (val) => {
63
- const items: UI_I_ObjectItem[] = []
64
- if (!val.length) {
65
- bodyItems.value = table.bodyItems(items)
66
- return
67
- }
68
-
69
- val.forEach((itemArr) => {
70
- itemArr.forEach((item) =>
73
+ () => [props.type, props.chart, props.totalCores, props.hostId],
74
+ (newValue) => {
75
+ if (newValue[0] === 'host' && newValue[1] === 'cpu') {
76
+ items.push({
77
+ id: 'total',
78
+ target_object: newValue[3],
79
+ })
80
+ for (let i = 0; i < newValue[2]; i++) {
71
81
  items.push({
72
- id: item.id,
73
- target_object: item.target_object,
82
+ id: 'core' + i,
83
+ target_object: '' + i,
74
84
  })
75
- )
76
- })
77
-
78
- bodyItems.value = table.bodyItems(items)
85
+ }
86
+ bodyItems.value = table.bodyItems(items)
87
+ }
79
88
  },
80
- { deep: true }
89
+ { immediate: true }
81
90
  )
91
+
92
+ watch(selectedRow, (newValue) => {
93
+ const selectedItems: number[] = []
94
+
95
+ newValue.forEach((key) => {
96
+ selectedItems.push(+items[key].id)
97
+ })
98
+
99
+ const selectedNames =
100
+ items.length === newValue.length ? '*' : selectedItems.join(', ')
101
+ emits('select-objects', selectedNames)
102
+ })
82
103
  </script>
83
104
 
84
105
  <style scoped lang="scss">
@@ -91,6 +112,7 @@ watch(
91
112
  }
92
113
  .flex-to-absolute-positioning-container {
93
114
  height: 100%;
115
+ max-height: 204px;
94
116
  .flex-to-absolute-positioning-container-inner {
95
117
  height: inherit;
96
118
 
@@ -1,4 +1,4 @@
1
1
  export interface UI_I_ObjectItem {
2
- id: number
2
+ id: string
3
3
  target_object: string
4
4
  }
@@ -5,29 +5,41 @@ import { UI_T_AdvancedType } from '~/components/common/monitor/advanced/models/t
5
5
  import { UI_I_OptionData } from '~/components/common/monitor/advanced/models/interfaces'
6
6
 
7
7
  export const periodFunc = (
8
- localization: UI_I_Localization
9
- ): UI_I_OptionItem[] => [
10
- {
11
- text: localization.realTime,
12
- value: 'real_time',
13
- },
14
- {
15
- text: localization.lastDay,
16
- value: 'last_day',
17
- },
18
- {
19
- text: localization.lastWeek,
20
- value: 'last_week',
21
- },
22
- {
23
- text: localization.lastMonth,
24
- value: 'last_month',
25
- },
26
- // {
27
- // text: localization.lastYear,
28
- // value: 'last_year',
29
- // },
30
- ]
8
+ localization: UI_I_Localization,
9
+ selectedTimespanType: string
10
+ ): UI_I_OptionItem[] => {
11
+ const result = [
12
+ {
13
+ text: localization.realTime,
14
+ value: 'real_time',
15
+ },
16
+ {
17
+ text: localization.lastDay,
18
+ value: 'last_day',
19
+ },
20
+ {
21
+ text: localization.lastWeek,
22
+ value: 'last_week',
23
+ },
24
+ {
25
+ text: localization.lastMonth,
26
+ value: 'last_month',
27
+ },
28
+ // {
29
+ // text: localization.lastYear,
30
+ // value: 'last_year',
31
+ // },
32
+ ]
33
+
34
+ if (selectedTimespanType === 'custom_interval') {
35
+ result.push({
36
+ text: localization.customInterval,
37
+ value: 'custom_interval',
38
+ })
39
+ }
40
+
41
+ return result
42
+ }
31
43
 
32
44
  export const viewFunc = (
33
45
  localization: UI_I_Localization,
@@ -43,29 +55,29 @@ export const viewFunc = (
43
55
  ],
44
56
  host: [
45
57
  { text: localization.cpuUsageInPercent, value: 'cpuUsageInPercent' },
46
- { text: localization.datastore, value: 'datastore' },
58
+ // { text: localization.datastore, value: 'datastore' },
47
59
  { text: localization.memory, value: 'memory' },
48
60
  { text: localization.disk, value: 'disk' },
49
61
  { text: localization.network, value: 'network' },
50
- { text: localization.power, value: 'power' },
51
- { text: localization.storageAdapters, value: 'storageAdapters' },
52
- { text: localization.storagePath, value: 'storagePath' },
53
- { text: localization.system, value: 'system' },
54
- {
55
- text: localization.procuratorReplication,
56
- value: 'procuratorReplication',
57
- },
62
+ // { text: localization.power, value: 'power' },
63
+ // { text: localization.storageAdapters, value: 'storageAdapters' },
64
+ // { text: localization.storagePath, value: 'storagePath' },
65
+ // { text: localization.system, value: 'system' },
66
+ // {
67
+ // text: localization.procuratorReplication,
68
+ // value: 'procuratorReplication',
69
+ // },
58
70
  ],
59
71
  vm: [
60
72
  { text: localization.cpuUsageInPercent, value: 'cpuUsageInPercent' },
61
- { text: localization.cpuUsageInMhz, value: 'cpuUsageInMhz' },
62
- { text: localization.cpuReady, value: 'cpuReady' },
63
- { text: localization.datastore, value: 'datastore' },
64
- { text: localization.disk, value: 'disk' },
73
+ // { text: localization.cpuUsageInMhz, value: 'cpuUsageInMhz' },
74
+ // { text: localization.cpuReady, value: 'cpuReady' },
75
+ // { text: localization.datastore, value: 'datastore' },
65
76
  { text: localization.memory, value: 'memory' },
77
+ { text: localization.disk, value: 'disk' },
66
78
  { text: localization.network, value: 'network' },
67
- { text: localization.power, value: 'power' },
68
- { text: localization.virtualDisk, value: 'virtualDisk' },
79
+ // { text: localization.power, value: 'power' },
80
+ // { text: localization.virtualDisk, value: 'virtualDisk' },
69
81
  ],
70
82
  }
71
83
  const currentOptions = viewData[type]
@@ -0,0 +1,7 @@
1
+ import { I_SeriesLine } from 'bfg-nuxt-3-graph/graph/models/interfaces'
2
+
3
+ export const getCountCores = (data: I_SeriesLine | null): number => {
4
+ if (!data) return 0
5
+
6
+ return Math.max(...data.lines[0].data)
7
+ }
@@ -1,14 +1,113 @@
1
1
  import { subDays, subHours, subMonths, subWeeks, subYears } from 'date-fns'
2
2
 
3
- export const getValidDateByOptionFunc = (type: string): number[] => {
3
+ export const getValidDateByOptionFunc = (
4
+ type: string,
5
+ selectedOptions = null,
6
+ unitsCount: null | number = null,
7
+ timeType: null | string = ''
8
+ ): number[] => {
4
9
  const newDate = new Date()
5
10
  let startTime = 0
6
11
 
7
- if (type === 'real_time') startTime = subHours(newDate, 1).getTime()
8
- else if (type === 'last_day') startTime = subDays(newDate, 1).getTime()
9
- else if (type === 'last_week') startTime = subWeeks(newDate, 1).getTime()
10
- else if (type === 'last_month') startTime = subMonths(newDate, 1).getTime()
11
- else if (type === 'last_year') startTime = subYears(newDate, 1).getTime()
12
+ switch (type) {
13
+ case 'real_time':
14
+ startTime = subHours(newDate, 1).getTime()
15
+ break
16
+ case 'last_day':
17
+ startTime = subDays(newDate, 1).getTime()
18
+ break
19
+ case 'last_week':
20
+ startTime = subWeeks(newDate, 1).getTime()
21
+ break
22
+ case 'last_month':
23
+ startTime = subMonths(newDate, 1).getTime()
24
+ break
25
+ case 'last_year':
26
+ startTime = subYears(newDate, 1).getTime()
27
+ break
28
+ case 'custom_interval':
29
+ if (selectedOptions) {
30
+ switch (selectedOptions.timespan.periodType) {
31
+ case 'last':
32
+ const currentUnits =
33
+ selectedOptions.timespan.unitsCount < 1
34
+ ? 1
35
+ : +selectedOptions.timespan.unitsCount
36
+
37
+ switch (selectedOptions.timespan.units) {
38
+ case 'hours':
39
+ startTime = subHours(newDate, currentUnits).getTime()
40
+ break
41
+ case 'days':
42
+ startTime = subDays(newDate, currentUnits).getTime()
43
+ break
44
+ case 'weeks':
45
+ startTime = subWeeks(newDate, currentUnits).getTime()
46
+ break
47
+ case 'months':
48
+ startTime = subMonths(newDate, currentUnits).getTime()
49
+ break
50
+ }
51
+ }
52
+ } else if (
53
+ !selectedOptions &&
54
+ typeof unitsCount === 'number' &&
55
+ typeof timeType === 'string'
56
+ ) {
57
+ switch (timeType) {
58
+ case 'hours':
59
+ startTime = subHours(newDate, unitsCount).getTime()
60
+ break
61
+ case 'days':
62
+ startTime = subDays(newDate, unitsCount).getTime()
63
+ break
64
+ case 'weeks':
65
+ startTime = subWeeks(newDate, unitsCount).getTime()
66
+ break
67
+ case 'months':
68
+ startTime = subMonths(newDate, unitsCount).getTime()
69
+ break
70
+ }
71
+ }
72
+ break
73
+ }
74
+
75
+ // if (type === 'real_time') startTime = subHours(newDate, 1).getTime()
76
+ // else if (type === 'last_day') startTime = subDays(newDate, 1).getTime()
77
+ // else if (type === 'last_week') startTime = subWeeks(newDate, 1).getTime()
78
+ // else if (type === 'last_month') startTime = subMonths(newDate, 1).getTime()
79
+ // else if (type === 'last_year') startTime = subYears(newDate, 1).getTime()
80
+ // else if (type === 'custom_interval' && selectedOptions) {
81
+ // if (selectedOptions.timespan.periodType === 'last') {
82
+ // const currentUnits =
83
+ // selectedOptions.timespan.unitsCount < 1
84
+ // ? 1
85
+ // : +selectedOptions.timespan.unitsCount
86
+ //
87
+ // if (selectedOptions.timespan.units === 'hours')
88
+ // startTime = subHours(newDate, currentUnits).getTime()
89
+ // else if (selectedOptions.timespan.units === 'days')
90
+ // startTime = subDays(newDate, currentUnits).getTime()
91
+ // else if (selectedOptions.timespan.units === 'weeks')
92
+ // startTime = subWeeks(newDate, currentUnits).getTime()
93
+ // else if (selectedOptions.timespan.units === 'months')
94
+ // startTime = subMonths(newDate, currentUnits).getTime()
95
+ // }
96
+ // } else if (
97
+ // type === 'custom_interval' &&
98
+ // !selectedOptions &&
99
+ // typeof unitsCount === 'number' &&
100
+ // typeof timeType === 'string'
101
+ // ) {
102
+ // if (timeType === 'hours')
103
+ // startTime = subHours(newDate, unitsCount).getTime()
104
+ // else if (timeType === 'days')
105
+ // startTime = subDays(newDate, unitsCount).getTime()
106
+ // else if (timeType === 'weeks')
107
+ // startTime = subWeeks(newDate, unitsCount).getTime()
108
+ // else if (timeType === 'months')
109
+ // startTime = subMonths(newDate, unitsCount).getTime()
110
+ // }
12
111
 
13
112
  return [startTime, newDate.getTime()]
14
113
  }
@@ -87,8 +87,8 @@ const periodOptions = computed<UI_I_OptionItem[]>(() =>
87
87
  )
88
88
  watch(
89
89
  () => periodOptions.value,
90
- (val: UI_I_OptionItem[]) => {
91
- if (val) selectedPeriod.value = val[0].value
90
+ (newValue: UI_I_OptionItem[]) => {
91
+ if (newValue) selectedPeriod.value = newValue[0].value
92
92
  },
93
93
  { immediate: true }
94
94
  )
@@ -142,8 +142,8 @@ const viewOptions = computed<UI_I_OptionItem[]>(() =>
142
142
  )
143
143
  watch(
144
144
  () => viewOptions.value,
145
- (val: UI_I_OptionItem[]) => {
146
- if (val) selectedView.value = val[0].value
145
+ (newValue: UI_I_OptionItem[]) => {
146
+ if (newValue) selectedView.value = newValue[0].value
147
147
  },
148
148
  { immediate: true }
149
149
  )
@@ -163,8 +163,8 @@ const sendUpdatedFilters = (): void => {
163
163
  }
164
164
  watch(
165
165
  () => [selectedPeriod.value, selectedView.value],
166
- (value: string[]) => {
167
- value[0] !== 'custom_interval' && sendUpdatedFilters()
166
+ (newValue: string[]) => {
167
+ newValue[0] !== 'custom_interval' && sendUpdatedFilters()
168
168
  },
169
169
  { immediate: true }
170
170
  )