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
@@ -149,26 +149,26 @@ watch(timeFormatUpdater, () => {
149
149
  getCurrentTime()
150
150
  })
151
151
 
152
- const onUpdateDateFrom = (val: number) => {
152
+ const onUpdateDateFrom = (val: number): void => {
153
153
  if (!val) return
154
154
 
155
155
  currentDateFrom.value = $formattedDate(new Date(val), '')
156
156
  }
157
- watch(currentDateFrom, (val) => {
158
- if (!val) return
157
+ watch(currentDateFrom, (newValue) => {
158
+ if (!newValue) return
159
159
 
160
- if ($isDate(val)) dateFrom.value = $getUnixByDate(val)
160
+ if ($isDate(newValue)) dateFrom.value = $getUnixByDate(newValue)
161
161
  })
162
162
 
163
- const onUpdateDateTo = (val: number) => {
163
+ const onUpdateDateTo = (val: number): void => {
164
164
  if (!val) return
165
165
 
166
166
  currentDateTo.value = $formattedDate(new Date(val), '')
167
167
  }
168
- watch(currentDateTo, (val) => {
169
- if (!val) return
168
+ watch(currentDateTo, (newValue) => {
169
+ if (!newValue) return
170
170
 
171
- if ($isDate(val)) dateTo.value = $getUnixByDate(val)
171
+ if ($isDate(newValue)) dateTo.value = $getUnixByDate(newValue)
172
172
  })
173
173
 
174
174
  const alertShow = ref<boolean>(false)
@@ -13,7 +13,7 @@ export const checkDateFunc = (
13
13
  const startDate = dateFrom + ' ' + timeFrom
14
14
  const endDate = dateTo + ' ' + timeTo
15
15
 
16
- if (!$isDate(startDate) || !$isDate(endDate))
16
+ if (!$isDate(startDate) || !$isDate(endDate) || !timeFrom || !timeTo)
17
17
  result = localization.invalidTimeEntry
18
18
  else {
19
19
  const endDateFormatted = $formattedDatetime(endDate, '', true)
@@ -47,15 +47,16 @@
47
47
  <div v-show="selectedNavItem === 1">
48
48
  <common-vm-actions-add-customize-hardware-vmoptions
49
49
  v-model:vm-name="vmNameLocal"
50
- :guest-machine-type="props.guestMachineType"
51
- :guest-os-family="props.guestOsFamily"
52
- :guest-os-version="props.guestOsVersion"
50
+ v-model:guest-machine-type="guestMachineTypeLocal"
51
+ v-model:guest-os-family="guestOsFamilyLocal"
52
+ v-model:guest-os-version="guestOsVersionLocal"
53
53
  :hard-disks="props.hardDisksForBootOptions"
54
54
  :cd-dvd-drives="props.cdDvdDrivesForBootOptions"
55
55
  :networks="props.networksForBootOptions"
56
56
  :options="props.options"
57
57
  :is-edit="props.isEdit"
58
58
  :error-validation-fields="props.errorValidationFields"
59
+ :state="props.state"
59
60
  @change-boot-order="onChangeBootOrder"
60
61
  @send-data="onSendDataVmOptionsMethod"
61
62
  @invalid="vmOptionsInvalid = $event"
@@ -125,7 +126,7 @@ const props = defineProps<{
125
126
  usbController?: string
126
127
  options?: UI_I_SendDataVmoptions
127
128
  isEdit?: boolean
128
- state?: string
129
+ state?: string | number
129
130
  passthroughDevices?: UI_I_ConfigurePciDevicesTable | null
130
131
  }>()
131
132
  const emits = defineEmits<{
@@ -140,6 +141,9 @@ const emits = defineEmits<{
140
141
  (event: 'send-data', value: UI_I_SendDataCustomizeHardware): void
141
142
  (event: 'next'): void
142
143
  (event: 'update:vm-name', value: string): void
144
+ (event: 'update:guest-machine-type', value: UI_I_OptionItem | null): void
145
+ (event: 'update:guest-os-family', value: UI_I_OptionItem | null): void
146
+ (event: 'update:guest-os-version', value: UI_I_OptionItem | null): void
143
147
  (event: 'get-storage', value: UI_I_TablePayload): void
144
148
  (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
145
149
  (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
@@ -157,6 +161,30 @@ const vmNameLocal = computed<string>({
157
161
  emits('update:vm-name', newValue)
158
162
  },
159
163
  })
164
+ const guestMachineTypeLocal = computed<UI_I_OptionItem | null>({
165
+ get() {
166
+ return props.guestMachineType
167
+ },
168
+ set(newValue) {
169
+ emits('update:guest-machine-type', newValue)
170
+ },
171
+ })
172
+ const guestOsFamilyLocal = computed<UI_I_OptionItem | null>({
173
+ get() {
174
+ return props.guestOsFamily
175
+ },
176
+ set(newValue) {
177
+ emits('update:guest-os-family', newValue)
178
+ },
179
+ })
180
+ const guestOsVersionLocal = computed<UI_I_OptionItem | null>({
181
+ get() {
182
+ return props.guestOsVersion
183
+ },
184
+ set(newValue) {
185
+ emits('update:guest-os-version', newValue)
186
+ },
187
+ })
160
188
 
161
189
  const localization = computed<UI_I_Localization>(() => useLocal())
162
190
 
@@ -58,6 +58,7 @@
58
58
  :network="item"
59
59
  :networks-table="props.networksTable"
60
60
  :error-validation-fields="props.errorValidationFields"
61
+ :state="props.state"
61
62
  @remove="onRemoveNetwork(networksIndex[key])"
62
63
  @send-data="sendDataNewNetworkMethod($event, networksIndex[key])"
63
64
  @invalid="onSetInvalidNetwork($event, networksIndex[key])"
@@ -90,6 +91,7 @@
90
91
  <common-vm-actions-add-customize-hardware-virtual-hardware-new-usb-controller
91
92
  :usb-controller="props.usbController"
92
93
  :is-edit="props.isEdit"
94
+ :state="props.state"
93
95
  @send-data="onSendDataNewUsbControllerMethod"
94
96
  />
95
97
  <template v-if="props.passthroughDevices">
@@ -113,6 +115,7 @@
113
115
  :is-edit="props.isEdit"
114
116
  :video-card="props.videoCard"
115
117
  :error-validation-fields="props.errorValidationFields"
118
+ :state="props.state"
116
119
  @send-data="onSendDataVideoCardMethod"
117
120
  @invalid="videoCardInvalid = $event"
118
121
  @remove-error-by-title="emits('remove-error-by-title', $event)"
@@ -189,7 +192,7 @@ const props = defineProps<{
189
192
  networksTable: UI_I_NetworkTableItem[]
190
193
  getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
191
194
  datastore: UI_I_DatastoreTableItem[]
192
- state?: string
195
+ state?: string | number
193
196
  cpu?: API_UI_I_VmEditCpu
194
197
  memory?: API_UI_I_VmEditMemory
195
198
  vmCpuHelpTextSecond?: string
@@ -227,6 +230,7 @@ const hardDisks = ref<UI_I_SendDataNewHardDisk[]>([
227
230
  create: true,
228
231
  size: 90,
229
232
  source: '',
233
+ boot_order: -1,
230
234
  },
231
235
  ])
232
236
  watch(
@@ -117,7 +117,7 @@ const props = defineProps<{
117
117
  errorValidationFields: UI_I_ErrorValidationField<string>[]
118
118
  type: UI_T_CdDvdType
119
119
  isEdit: boolean
120
- state?: string
120
+ state?: string | number
121
121
  }>()
122
122
 
123
123
  const emits = defineEmits<{
@@ -132,7 +132,7 @@ const props = defineProps<{
132
132
  isEdit: boolean
133
133
  errorValidationFields: UI_I_ErrorValidationField<string>[]
134
134
  vmCpuHelpTextSecond?: string
135
- state?: string
135
+ state?: string | number
136
136
  cpu?: API_UI_I_VmEditCpu
137
137
  }>()
138
138
  const emits = defineEmits<{
@@ -103,7 +103,7 @@ const props = defineProps<{
103
103
  maxMemory: number
104
104
  isEdit: boolean
105
105
  errorValidationFields: UI_I_ErrorValidationField[]
106
- state?: string
106
+ state?: string | number
107
107
  memory?: API_UI_I_VmEditMemory
108
108
  }>()
109
109
  const emits = defineEmits<{
@@ -183,7 +183,7 @@ const props = defineProps<{
183
183
  getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
184
184
  datastore: UI_I_DatastoreTableItem[]
185
185
  isEdit: boolean
186
- state?: string
186
+ state?: string | number
187
187
  }>()
188
188
  const emits = defineEmits<{
189
189
  (event: 'send-data', value: UI_I_SendDataNewHardDisk): void
@@ -26,6 +26,7 @@
26
26
  :id="`vm-wizard-network-field-${props.index}`"
27
27
  v-model="selectedLocation"
28
28
  :class="`vm-wizard-network-field-${props.index} input-text-color`"
29
+ :disabled="props.type === 'edit' && state !== 1"
29
30
  @click.stop
30
31
  @change="changeLocation"
31
32
  >
@@ -47,7 +48,7 @@
47
48
  <common-vm-actions-add-customize-hardware-virtual-hardware-new-network-adapter-type
48
49
  v-model:adapter-type="adapterType"
49
50
  :index="props.index"
50
- :disabled="props.type === 'edit'"
51
+ :disabled="props.type === 'edit' && state !== 1"
51
52
  :error-validation-fields="props.errorValidationFields"
52
53
  @remove-error-by-title="emits('remove-error-by-title', $event)"
53
54
  />
@@ -87,6 +88,7 @@ const props = defineProps<{
87
88
  network: UI_I_SendDataNewNetwork
88
89
  networksTable: UI_I_NetworkTableItem[]
89
90
  errorValidationFields: UI_I_ErrorValidationField[]
91
+ state?: string | number
90
92
  }>()
91
93
 
92
94
  const emits = defineEmits<{
@@ -11,6 +11,7 @@
11
11
  <select
12
12
  id="usb-controller-select"
13
13
  v-model="selectedUsbController"
14
+ :disabled="props.isEdit && props.state !== 1"
14
15
  @click.stop
15
16
  >
16
17
  <option
@@ -35,6 +36,7 @@ const props = withDefaults(
35
36
  defineProps<{
36
37
  usbController: string
37
38
  isEdit: boolean
39
+ state?: string | number
38
40
  }>(),
39
41
  {
40
42
  usbController: 'usb2',
@@ -25,6 +25,7 @@
25
25
  id="vm-wizard-video-card"
26
26
  v-model="selectedVideoCard"
27
27
  class="vm-wizard-video-card input-text-color"
28
+ :disabled="props.isEdit && props.state !== 1"
28
29
  @click.stop
29
30
  >
30
31
  <option
@@ -43,7 +44,7 @@
43
44
  <template #stackChildren>
44
45
  <common-vm-actions-add-customize-hardware-virtual-hardware-video-card-number-displays
45
46
  v-model:number-displays="numberDisplays"
46
- :disabled="isDisabled || props.isEdit"
47
+ :disabled="isDisabled"
47
48
  :error-validation-fields="props.errorValidationFields"
48
49
  @remove-error-by-title="emits('remove-error-by-title', $event)"
49
50
  />
@@ -60,7 +61,7 @@
60
61
  <!-- />-->
61
62
  <common-vm-actions-add-customize-hardware-virtual-hardware-video-card-model
62
63
  v-model:video-card-model="videoCardModel"
63
- :disabled="isDisabled || props.isEdit"
64
+ :disabled="isDisabled"
64
65
  />
65
66
  </template>
66
67
  </atoms-stack-block>
@@ -79,6 +80,7 @@ const props = defineProps<{
79
80
  isEdit: boolean
80
81
  errorValidationFields: UI_I_ErrorValidationField[]
81
82
  videoCard?: UI_I_SendDataVideoCard
83
+ state?: string | number
82
84
  }>()
83
85
  const emits = defineEmits<{
84
86
  (event: 'send-data', value: UI_I_SendDataVideoCard): void
@@ -93,7 +95,7 @@ const videoCardOptions = ref<UI_I_OptionItem[]>(
93
95
  videoCardOptionsFunc(localization.value)
94
96
  )
95
97
 
96
- const isDisabled = computed<boolean>(() => selectedVideoCard.value === 0)
98
+ const isDisabled = computed<boolean>(() => selectedVideoCard.value === 0 || props.isEdit && props.state !== 1)
97
99
  watch(isDisabled, (val) => {
98
100
  if (!val) {
99
101
  return
@@ -4,14 +4,17 @@
4
4
  <div class="stack-view">
5
5
  <common-vm-actions-add-customize-hardware-vmoptions-general-options
6
6
  v-model:vm-name="vmNameLocal"
7
- :guest-machine-type="props.guestMachineType"
8
- :guest-os-family="props.guestOsFamily"
9
- :guest-os-version="props.guestOsVersion"
7
+ v-model:guest-machine-type="guestMachineTypeLocal"
8
+ v-model:guest-os-family="guestOsFamilyLocal"
9
+ v-model:guest-os-version="guestOsVersionLocal"
10
10
  :is-edit="props.isEdit"
11
+ :state="props.state"
11
12
  />
12
13
  <common-vm-actions-add-customize-hardware-vmoptions-remote-console-options
13
14
  :error-validation-fields="props.errorValidationFields"
14
15
  :remote-console-options="props.options?.remote_console"
16
+ :is-edit="props.isEdit"
17
+ :state="props.state"
15
18
  @send-data="sendDataRemoteConsoleOptionsMethod"
16
19
  @invalid="remoteConsoleOptionsInvalid = $event"
17
20
  @remove-error-by-title="emits('remove-error-by-title', $event)"
@@ -64,6 +67,7 @@ const props = defineProps<{
64
67
  isEdit: boolean
65
68
  errorValidationFields: UI_I_ErrorValidationField[]
66
69
  options?: UI_I_SendDataVmoptions
70
+ state?: string | number
67
71
  }>()
68
72
  const emits = defineEmits<{
69
73
  (
@@ -77,6 +81,9 @@ const emits = defineEmits<{
77
81
  (event: 'send-data', value: UI_I_SendDataVmoptions): void
78
82
  (event: 'invalid', value: string[]): void
79
83
  (event: 'update:vm-name', value: string): void
84
+ (event: 'update:guest-machine-type', value: UI_I_OptionItem | null): void
85
+ (event: 'update:guest-os-family', value: UI_I_OptionItem | null): void
86
+ (event: 'update:guest-os-version', value: UI_I_OptionItem | null): void
80
87
  (event: 'remove-error-by-title', value: string): void
81
88
  }>()
82
89
 
@@ -88,6 +95,30 @@ const vmNameLocal = computed<string>({
88
95
  emits('update:vm-name', newValue)
89
96
  },
90
97
  })
98
+ const guestMachineTypeLocal = computed<UI_I_OptionItem | null>({
99
+ get() {
100
+ return props.guestMachineType
101
+ },
102
+ set(newValue) {
103
+ emits('update:guest-machine-type', newValue)
104
+ },
105
+ })
106
+ const guestOsFamilyLocal = computed<UI_I_OptionItem | null>({
107
+ get() {
108
+ return props.guestOsFamily
109
+ },
110
+ set(newValue) {
111
+ emits('update:guest-os-family', newValue)
112
+ },
113
+ })
114
+ const guestOsVersionLocal = computed<UI_I_OptionItem | null>({
115
+ get() {
116
+ return props.guestOsVersion
117
+ },
118
+ set(newValue) {
119
+ emits('update:guest-os-version', newValue)
120
+ },
121
+ })
91
122
 
92
123
  const localization = computed<UI_I_Localization>(() => useLocal())
93
124
 
@@ -1,114 +1,172 @@
1
- <template>
2
- <div class="hardware-cpu">
3
- <atoms-stack-block :has-children="true" @toggle="blockIsOpen = $event">
4
- <template #stackBlockKey>
5
- <div class="flex-align-center">
6
- <span>{{ localization.generalOptions }}</span>
7
- </div>
8
- </template>
9
- <template #stackBlockContent>
10
- <div v-show="!blockIsOpen">
11
- {{ localization.vmName }}: {{ vmNameLocal }}
12
- </div>
13
- </template>
14
- <template #stackChildren>
15
- <atoms-stack-block :has-children="false">
16
- <template #stackBlockKey>
17
- {{ localization.vmName }}
18
- </template>
19
- <template #stackBlockContent>
20
- <span v-if="!props.isEdit">{{ vmNameLocal }}</span>
21
- <input
22
- v-else
23
- id="general-option-vm-name"
24
- v-model="vmNameLocal"
25
- type="text"
26
- />
27
- </template>
28
- </atoms-stack-block>
29
-
30
- <atoms-stack-block :has-children="false">
31
- <template #stackBlockKey>
32
- {{ localization.machineType }}
33
- </template>
34
- <template #stackBlockContent>
35
- <select
36
- v-if="props.guestMachineType"
37
- id="guest-machine-type-select"
38
- disabled
39
- >
40
- <option selected :value="props.guestMachineType.value">
41
- {{ props.guestMachineType.text }}
42
- </option>
43
- </select>
44
- </template>
45
- </atoms-stack-block>
46
-
47
- <atoms-stack-block :has-children="false">
48
- <template #stackBlockKey>
49
- {{ localization.guestOsFamily }}
50
- </template>
51
- <template #stackBlockContent>
52
- <select
53
- v-if="props.guestOsFamily"
54
- id="guest-os-family-select"
55
- disabled
56
- >
57
- <option selected :value="props.guestOsFamily.value">
58
- {{ props.guestOsFamily.text }}
59
- </option>
60
- </select>
61
- </template>
62
- </atoms-stack-block>
63
-
64
- <atoms-stack-block :has-children="false">
65
- <template #stackBlockKey>
66
- {{ localization.guestOsVersion }}
67
- </template>
68
- <template #stackBlockContent>
69
- <select
70
- v-if="props.guestOsVersion"
71
- id="guest-os-version-select"
72
- disabled
73
- >
74
- <option selected :value="props.guestOsVersion.value">
75
- {{ props.guestOsVersion.text }}
76
- </option>
77
- </select>
78
- </template>
79
- </atoms-stack-block>
80
- </template>
81
- </atoms-stack-block>
82
- </div>
83
- </template>
84
-
85
- <script setup lang="ts">
86
- import { UI_I_Localization } from '~/models/interfaces'
87
- import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
88
-
89
- const localization = computed<UI_I_Localization>(() => useLocal())
90
-
91
- const props = defineProps<{
92
- vmName: string
93
- guestMachineType: UI_I_OptionItem | null
94
- guestOsFamily: UI_I_OptionItem | null
95
- guestOsVersion: UI_I_OptionItem | null
96
- isEdit: boolean
97
- }>()
98
- const emits = defineEmits<{
99
- (event: 'update:vm-name', value: string): void
100
- }>()
101
-
102
- const vmNameLocal = computed<string>({
103
- get() {
104
- return props.vmName
105
- },
106
- set(newValue) {
107
- emits('update:vm-name', newValue)
108
- },
109
- })
110
-
111
- const blockIsOpen = ref<boolean>(false)
112
- </script>
113
-
114
- <style scoped lang="scss"></style>
1
+ <template>
2
+ <div class="hardware-cpu">
3
+ <atoms-stack-block :has-children="true" @toggle="blockIsOpen = $event">
4
+ <template #stackBlockKey>
5
+ <div class="flex-align-center">
6
+ <span>{{ localization.generalOptions }}</span>
7
+ </div>
8
+ </template>
9
+ <template #stackBlockContent>
10
+ <div v-show="!blockIsOpen">
11
+ {{ localization.vmName }}: {{ vmNameLocal }}
12
+ </div>
13
+ </template>
14
+ <template #stackChildren>
15
+ <atoms-stack-block :has-children="false">
16
+ <template #stackBlockKey>
17
+ {{ localization.vmName }}
18
+ </template>
19
+ <template #stackBlockContent>
20
+ <span v-if="!props.isEdit">{{ vmNameLocal }}</span>
21
+ <input
22
+ v-else
23
+ id="general-option-vm-name"
24
+ v-model="vmNameLocal"
25
+ type="text"
26
+ />
27
+ </template>
28
+ </atoms-stack-block>
29
+
30
+ <atoms-stack-block :has-children="false">
31
+ <template #stackBlockKey>
32
+ {{ localization.machineType }}
33
+ </template>
34
+ <template #stackBlockContent>
35
+ <select
36
+ v-if="props.guestMachineType"
37
+ id="guest-machine-type-select"
38
+ :disabled="isDisabled"
39
+ v-model="guestMachineTypeLocal"
40
+ >
41
+ <option
42
+ v-for="item in machineTypeOptions"
43
+ :key="item.value"
44
+ :value="item"
45
+ >
46
+ {{ item.text }}
47
+ </option>
48
+ </select>
49
+ </template>
50
+ </atoms-stack-block>
51
+
52
+ <atoms-stack-block :has-children="false">
53
+ <template #stackBlockKey>
54
+ {{ localization.guestOsFamily }}
55
+ </template>
56
+ <template #stackBlockContent>
57
+ <select
58
+ v-if="props.guestOsFamily"
59
+ id="guest-os-family-select"
60
+ v-model="guestOsFamilyLocal"
61
+ :disabled="isDisabled"
62
+ @change="onChangeOS"
63
+ >
64
+ <option v-for="item in osOptions" :key="item.value" :value="item">
65
+ {{ item.text }}
66
+ </option>
67
+ </select>
68
+ </template>
69
+ </atoms-stack-block>
70
+
71
+ <atoms-stack-block :has-children="false">
72
+ <template #stackBlockKey>
73
+ {{ localization.guestOsVersion }}
74
+ </template>
75
+ <template #stackBlockContent>
76
+ <select
77
+ v-if="props.guestOsVersion"
78
+ id="guest-os-version-select"
79
+ v-model=""
80
+ :disabled="isDisabled"
81
+ >
82
+ <option
83
+ v-for="item in versionsOptions"
84
+ :key="item.value"
85
+ :value="item"
86
+ >
87
+ {{ item.text }}
88
+ </option>
89
+ </select>
90
+ </template>
91
+ </atoms-stack-block>
92
+ </template>
93
+ </atoms-stack-block>
94
+ </div>
95
+ </template>
96
+
97
+ <script setup lang="ts">
98
+ import { UI_I_Localization } from '~/models/interfaces'
99
+ import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
100
+ import { capabilities } from '~/components/common/vm/actions/add/config/capabilities'
101
+
102
+ const localization = computed<UI_I_Localization>(() => useLocal())
103
+
104
+ const props = defineProps<{
105
+ vmName: string
106
+ guestMachineType: UI_I_OptionItem | null
107
+ guestOsFamily: UI_I_OptionItem | null
108
+ guestOsVersion: UI_I_OptionItem | null
109
+ isEdit: boolean
110
+ state?: string | number
111
+ }>()
112
+ const emits = defineEmits<{
113
+ (event: 'update:vm-name', value: string): void
114
+ (event: 'update:guest-machine-type', value: UI_I_OptionItem | null): void
115
+ (event: 'update:guest-os-family', value: UI_I_OptionItem | null): void
116
+ (event: 'update:guest-os-version', value: UI_I_OptionItem | null): void
117
+ }>()
118
+
119
+ const isDisabled = computed<boolean>(
120
+ () => !props.isEdit || (props.isEdit && props.state !== 1)
121
+ )
122
+
123
+ const vmNameLocal = computed<string>({
124
+ get() {
125
+ return props.vmName
126
+ },
127
+ set(newValue) {
128
+ emits('update:vm-name', newValue)
129
+ },
130
+ })
131
+
132
+ const guestMachineTypeLocal = computed<UI_I_OptionItem | null>({
133
+ get() {
134
+ return props.guestMachineType
135
+ },
136
+ set(newValue) {
137
+ emits('update:guest-machine-type', newValue)
138
+ },
139
+ })
140
+ const machineTypeOptions = ref<UI_I_OptionItem[]>(capabilities.machineTypes)
141
+
142
+ const guestOsFamilyLocal = computed<UI_I_OptionItem | null>({
143
+ get() {
144
+ return props.guestOsFamily
145
+ },
146
+ set(newValue) {
147
+ emits('update:guest-os-family', newValue)
148
+ },
149
+ })
150
+ const osOptions = ref<UI_I_OptionItem[]>(capabilities.guestOsFamilies)
151
+ const onChangeOS = (): void => {
152
+ guestOsVersionLocal.value = versionsOptions.value[0]
153
+ }
154
+
155
+ const guestOsVersionLocal = computed<UI_I_OptionItem | null>({
156
+ get() {
157
+ return props.guestOsVersion
158
+ },
159
+ set(newValue) {
160
+ emits('update:guest-os-version', newValue)
161
+ },
162
+ })
163
+ const versionsOptions = computed<UI_I_OptionItem[]>(() => {
164
+ if (!guestOsFamilyLocal.value) return []
165
+
166
+ return capabilities.guestOsVersions[guestOsFamilyLocal.value.value] || []
167
+ })
168
+
169
+ const blockIsOpen = ref<boolean>(false)
170
+ </script>
171
+
172
+ <style scoped lang="scss"></style>
@@ -6,7 +6,7 @@
6
6
  </template>
7
7
  <template #stackBlockContent>
8
8
  <div class="flex-align-center">
9
- <input id="copy-paste" v-model="copyPasteLocal" type="checkbox" />
9
+ <input id="copy-paste" v-model="copyPasteLocal" :disabled="props.disabled" type="checkbox" />
10
10
  <label for="copy-paste" class="label-text-normal">{{
11
11
  localization.enable
12
12
  }}</label>
@@ -23,6 +23,7 @@ const localization = computed<UI_I_Localization>(() => useLocal())
23
23
 
24
24
  const props = defineProps<{
25
25
  copyPaste: boolean
26
+ disabled: boolean
26
27
  }>()
27
28
  const emits = defineEmits<{
28
29
  (event: 'update:copy-paste', value: boolean): void