bfg-common 1.0.14 → 1.0.16

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 (38) hide show
  1. package/components/common/vm/actions/add/Add.vue +1 -1
  2. package/components/common/vm/actions/add/FolderTreeView.vue +1 -1
  3. package/components/common/vm/actions/add/customizeHardware/CustomizeHardware.vue +1 -1
  4. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/CoresPerSocket.vue +1 -1
  5. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Cpu.vue +371 -368
  6. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/CpuModel.vue +2 -2
  7. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/MaxCpu.vue +105 -99
  8. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/shares/Shares.vue +155 -151
  9. package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/Limit.vue +214 -210
  10. package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/Memory.vue +282 -278
  11. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/Location.vue +10 -10
  12. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +10 -6
  13. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/cache/Cache.vue +1 -1
  14. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/limitIops/LimitIops.vue +7 -3
  15. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/provisioning/Provisioning.vue +2 -2
  16. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/Location.vue +1 -1
  17. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +256 -252
  18. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/adapterType/AdapterType.vue +1 -1
  19. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +6 -6
  20. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +3 -3
  21. package/components/common/vm/actions/add/customizeHardware/virtualHardware/reservation/Reservation.vue +231 -228
  22. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/TotalVideoMemory.vue +1 -1
  23. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/VideoCard.vue +173 -169
  24. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/numberDisplays/NumberDisplays.vue +1 -1
  25. package/components/common/vm/actions/add/customizeHardware/vmoptions/Vmoptions.vue +145 -141
  26. package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/BootOptions.vue +1 -1
  27. package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +1 -1
  28. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/RemoteConsoleOptions.vue +230 -226
  29. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/imgCompression/ImgCompression.vue +1 -1
  30. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/jpegCompression/JpegCompression.vue +1 -1
  31. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +1 -1
  32. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/mouseMode/MouseMode.vue +1 -1
  33. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/streamingMode/StreamingMode.vue +1 -1
  34. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/type/Type.vue +1 -1
  35. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/zlibCompression/ZlibCompression.vue +1 -1
  36. package/components/common/vm/actions/add/select/compatibility/Compatibility.vue +6 -6
  37. package/components/common/vm/actions/add/select/os/os.vue +7 -7
  38. package/package.json +1 -1
@@ -1,278 +1,282 @@
1
- <template>
2
- <div class="hardware-memory">
3
- <atoms-stack-block :has-children="true">
4
- <template #stackBlockKey>
5
- <div id="vm-wizard-toggle-block-memory" class="flex-align-center">
6
- <span>{{ localization.memory }}</span>
7
- <atoms-the-icon
8
- v-show="memoryInvalid"
9
- width="24px"
10
- height="24px"
11
- class="is-error tooltip-trigger"
12
- name="info"
13
- />
14
- </div>
15
- </template>
16
- <template #stackBlockContent>
17
- <div class="flex-align-center">
18
- <atoms-tooltip-error
19
- :has-error="!!memorySizeLocalAndApiErrorsTexts"
20
- selector="#vm-wizard-memory-field input"
21
- @remove="onRemoveValidationError"
22
- >
23
- <template #elem>
24
- <atoms-combobox
25
- id="vm-wizard-memory-field"
26
- v-model="selectedMemory"
27
- :items="memoryOptions"
28
- :disabled="isMemoryDisabled"
29
- @click.stop
30
- @select="selectMemory"
31
- />
32
- </template>
33
- <template #content>{{ memorySizeLocalAndApiErrorsTexts }}</template>
34
- </atoms-tooltip-error>
35
-
36
- <div class="select ml-1">
37
- <select
38
- id="vm-wizard-memory-type-select"
39
- v-model="memoryType"
40
- @click.stop
41
- >
42
- <option
43
- v-for="(item, key) in memoryTypeOptions"
44
- :key="key"
45
- :value="item.value"
46
- >
47
- {{ item.text }}
48
- </option>
49
- </select>
50
- </div>
51
- </div>
52
- </template>
53
- <template #stackChildren>
54
- <common-vm-actions-add-customize-hardware-virtual-hardware-reservation
55
- v-model:reservation="reservation"
56
- v-model:reservation-type="reservationType"
57
- v-model:reserve-guest-memory="reserveGuestMemory"
58
- :error-validation-fields="props.errorValidationFields"
59
- :multiply="2"
60
- :disabled="isDisabled"
61
- component-type="memory"
62
- type="mb"
63
- class="memory-reservation"
64
- @remove-error-by-title="emits('remove-error-by-title', $event)"
65
- @invalid="reservationInvalid = $event"
66
- />
67
- <common-vm-actions-add-customize-hardware-virtual-hardware-limit
68
- v-model:limit="limit"
69
- v-model:limit-type="limitType"
70
- :error-validation-fields="props.errorValidationFields"
71
- :limit-options="limitOptions"
72
- :disabled="isDisabled"
73
- type="mb"
74
- component-type="memory"
75
- class="memory-limit"
76
- @invalid="limitInvalid = $event"
77
- @remove-error-by-title="emits('remove-error-by-title', $event)"
78
- />
79
- <common-vm-actions-add-customize-hardware-virtual-hardware-memory-hot-plug
80
- v-model:memory-hot-plug="memoryHotPlug"
81
- :disabled="isDisabledMemoryHotPlug"
82
- />
83
- </template>
84
- </atoms-stack-block>
85
- </div>
86
- </template>
87
-
88
- <script setup lang="ts">
89
- import { API_UI_I_VmEditMemory } from '~/models/store/vm/interfaces'
90
- import { UI_I_SendDataMemory } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/models/interfaces'
91
- import { UI_I_Localization } from '~/models/interfaces'
92
- import { UI_I_ErrorValidationField } from '~/models/store/interfaces'
93
- import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
94
- import { binaryOptionsFunc } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/config/binaryOptions'
95
- import { memoryOptionsFunc } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/config/memoryOptions'
96
-
97
- const props = defineProps<{
98
- maxMemory: number
99
- isEdit: boolean
100
- errorValidationFields: UI_I_ErrorValidationField<string>[]
101
- state?: string
102
- memory?: API_UI_I_VmEditMemory
103
- }>()
104
- const emits = defineEmits<{
105
- (event: 'send-data', value: UI_I_SendDataMemory): void
106
- (event: 'invalid', value: boolean): void
107
- (event: 'remove-error-by-title', value: string): void
108
- }>()
109
-
110
- const localization = computed<UI_I_Localization>(() => useLocal())
111
- const { $binary } = useNuxtApp()
112
-
113
- const minMemoryInMb = 128
114
- watch(
115
- () => props.maxMemory,
116
- (newValue) => {
117
- memoryOptions.value = memoryOptionsFunc(
118
- localization.value,
119
- minMemoryInMb,
120
- newValue
121
- )
122
- }
123
- )
124
-
125
- const isDisabled = computed<boolean>(() => {
126
- return props.state === '1'
127
- })
128
-
129
- const isMemoryDisabled = computed<boolean>(
130
- () => isDisabled.value && !memoryHotPlug.value
131
- )
132
-
133
- const selectedMemory = ref<number>(4)
134
- const memoryType = ref<string>('gb')
135
- const memoryTypeOptions = ref<UI_I_OptionItem[]>(
136
- binaryOptionsFunc(localization.value)
137
- )
138
- const memoryInMb = computed<number>(() => {
139
- if (memoryType.value === 'mb') {
140
- return +selectedMemory.value
141
- }
142
-
143
- return $binary.universalFromTo(+selectedMemory.value, memoryType.value, 'mb')
144
- })
145
-
146
- const memoryOptions = ref<UI_I_OptionItem[]>(
147
- memoryOptionsFunc(localization.value, minMemoryInMb, props.maxMemory)
148
- )
149
- const selectMemory = (mb: number): void => {
150
- if (memoryType.value === 'mb') {
151
- selectedMemory.value = mb
152
- return
153
- }
154
-
155
- selectedMemory.value = $binary.universalFromTo(mb, 'mb', memoryType.value, 12)
156
- }
157
-
158
- const memoryErrorLocalText = computed<string>(() => {
159
- const validValue = /^\d+(\.\d+)?$/.test(selectedMemory.value + '')
160
- if (!validValue) {
161
- return localization.value.inputContainsInvalidCharacters
162
- }
163
-
164
- const maxMemoryInGb = $binary.mbToGb(props.maxMemory)
165
- if (memoryInMb.value < minMemoryInMb || memoryInMb.value > props.maxMemory) {
166
- return localization.value.memoryMustBe
167
- .replace('{0}', `${minMemoryInMb} ${localization.value.mb}`)
168
- .replace('{1}', `${maxMemoryInGb} ${localization.value.gb}`)
169
- }
170
-
171
- if (memoryInMb.value % 2 !== 0) {
172
- return localization.value.valueShouldMultiple.replace(
173
- '{0}',
174
- `${2} ${localization.value.mb}`
175
- )
176
- }
177
- return ''
178
- })
179
-
180
- const apiErrorLocal = computed<string>(() => {
181
- return (
182
- props.errorValidationFields?.find(
183
- (message) => message.field === 'memory.size_mb'
184
- )?.error_message || ''
185
- )
186
- })
187
-
188
- const memorySizeLocalAndApiErrorsTexts = computed<string>(() => {
189
- const localError = memoryErrorLocalText.value
190
- const apiError = apiErrorLocal.value
191
-
192
- let result = ''
193
- if (localError && !apiError) result = localError
194
- if (apiError && !localError) result = apiError
195
- if (localError && apiError) result = localError + ', ' + apiError
196
- if (!localError && apiError) result = apiError
197
-
198
- return result
199
- })
200
-
201
- const reservationInvalid = ref<boolean>(false)
202
- const limitInvalid = ref<boolean>(false)
203
- const memoryInvalid = computed<boolean>(
204
- () =>
205
- !!memorySizeLocalAndApiErrorsTexts.value ||
206
- reservationInvalid.value ||
207
- limitInvalid.value
208
- )
209
- watch(memoryInvalid, (val) => {
210
- emits('invalid', val)
211
- })
212
-
213
- const reservation = ref<string>('2')
214
- const reservationType = ref<string>('mb')
215
- const reserveGuestMemory = ref<boolean>(false)
216
-
217
- const limit = ref<string>('Unlimited')
218
- const limitType = ref<string>('mb')
219
- const limitOptions = computed<UI_I_OptionItem[] | undefined>(() => {
220
- if (memoryHotPlug.value)
221
- return memoryOptionsFunc(
222
- localization.value,
223
- memoryInMb.value,
224
- props.maxMemory
225
- )
226
- })
227
-
228
- const memoryHotPlug = ref<boolean>(false)
229
- const isDisabledMemoryHotPlug = computed(
230
- () => memoryInMb.value >= props.maxMemory || isDisabled.value
231
- )
232
- watch(isDisabledMemoryHotPlug, (newValue) => {
233
- if (newValue) memoryHotPlug.value = false
234
- })
235
-
236
- watch(
237
- [memoryInMb, memoryHotPlug, reservation, reservationType, limit],
238
- () => {
239
- const reservationInMb =
240
- reservationType.value === 'mb'
241
- ? reservation.value
242
- : '' +
243
- $binary.universalFromTo(
244
- reservation.value,
245
- reservationType.value,
246
- 'mb',
247
- 12
248
- )
249
- emits('send-data', {
250
- memory: '' + memoryInMb.value,
251
- hotplug: memoryHotPlug.value,
252
- reservation_mb: reservationInMb,
253
- limit_mb: limit.value,
254
- })
255
- },
256
- { immediate: true }
257
- )
258
-
259
- // Добавляем данные для редактирования
260
- watch(
261
- () => props.memory,
262
- (newValue) => {
263
- if (!newValue) return
264
-
265
- selectedMemory.value = $binary.mbToGb(newValue.size_mb)
266
- reservation.value = '' + newValue.reservation_mb
267
- limit.value = '' + newValue.limit_mb
268
- memoryHotPlug.value = newValue.hotplug
269
- },
270
- { immediate: true }
271
- )
272
-
273
- const onRemoveValidationError = (): void => {
274
- emits('remove-error-by-title', 'memory.size_mb')
275
- }
276
- </script>
277
-
278
- <style scoped lang="scss"></style>
1
+ <template>
2
+ <div class="hardware-memory">
3
+ <atoms-stack-block :has-children="true">
4
+ <template #stackBlockKey>
5
+ <div id="vm-wizard-toggle-block-memory" class="flex-align-center">
6
+ <span>{{ localization.memory }}</span>
7
+ <atoms-the-icon
8
+ v-show="memoryInvalid"
9
+ width="24px"
10
+ height="24px"
11
+ class="is-error tooltip-trigger"
12
+ name="info"
13
+ />
14
+ </div>
15
+ </template>
16
+ <template #stackBlockContent>
17
+ <div class="flex-align-center">
18
+ <atoms-tooltip-error
19
+ :has-error="!!memorySizeLocalAndApiErrorsTexts"
20
+ selector="#vm-wizard-memory-field input"
21
+ @remove="onRemoveValidationError"
22
+ >
23
+ <template #elem>
24
+ <atoms-combobox
25
+ id="vm-wizard-memory-field"
26
+ v-model="selectedMemory"
27
+ :items="memoryOptions"
28
+ :disabled="isMemoryDisabled"
29
+ @click.stop
30
+ @select="selectMemory"
31
+ />
32
+ </template>
33
+ <template #content>{{ memorySizeLocalAndApiErrorsTexts }}</template>
34
+ </atoms-tooltip-error>
35
+
36
+ <div class="select ml-1">
37
+ <select
38
+ id="vm-wizard-memory-type-select"
39
+ v-model="memoryType"
40
+ @click.stop
41
+ >
42
+ <option
43
+ v-for="(item, key) in memoryTypeOptions"
44
+ :key="key"
45
+ :value="item.value"
46
+ >
47
+ {{ item.text }}
48
+ </option>
49
+ </select>
50
+ </div>
51
+ </div>
52
+ </template>
53
+ <template #stackChildren>
54
+ <common-vm-actions-add-customize-hardware-virtual-hardware-reservation
55
+ v-model:reservation="reservation"
56
+ v-model:reservation-type="reservationType"
57
+ v-model:reserve-guest-memory="reserveGuestMemory"
58
+ :error-validation-fields="props.errorValidationFields"
59
+ :multiply="2"
60
+ :disabled="isDisabled"
61
+ component-type="memory"
62
+ type="mb"
63
+ class="memory-reservation"
64
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
65
+ @invalid="reservationInvalid = $event"
66
+ />
67
+ <common-vm-actions-add-customize-hardware-virtual-hardware-limit
68
+ v-model:limit="limit"
69
+ v-model:limit-type="limitType"
70
+ :error-validation-fields="props.errorValidationFields"
71
+ :limit-options="limitOptions"
72
+ :disabled="isDisabled"
73
+ type="mb"
74
+ component-type="memory"
75
+ class="memory-limit"
76
+ @invalid="limitInvalid = $event"
77
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
78
+ />
79
+ <common-vm-actions-add-customize-hardware-virtual-hardware-memory-hot-plug
80
+ v-model:memory-hot-plug="memoryHotPlug"
81
+ :disabled="isDisabledMemoryHotPlug"
82
+ />
83
+ </template>
84
+ </atoms-stack-block>
85
+ </div>
86
+ </template>
87
+
88
+ <script setup lang="ts">
89
+ import { API_UI_I_VmEditMemory } from '~/models/store/vm/interfaces'
90
+ import { UI_I_SendDataMemory } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/models/interfaces'
91
+ import { UI_I_Localization } from '~/models/interfaces'
92
+ import { UI_I_ErrorValidationField } from '~/models/store/interfaces'
93
+ import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
94
+ import { binaryOptionsFunc } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/config/binaryOptions'
95
+ import { memoryOptionsFunc } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/config/memoryOptions'
96
+
97
+ const props = defineProps<{
98
+ maxMemory: number
99
+ isEdit: boolean
100
+ errorValidationFields: UI_I_ErrorValidationField[]
101
+ state?: string
102
+ memory?: API_UI_I_VmEditMemory
103
+ }>()
104
+ const emits = defineEmits<{
105
+ (event: 'send-data', value: UI_I_SendDataMemory): void
106
+ (event: 'invalid', value: boolean): void
107
+ (event: 'remove-error-by-title', value: string): void
108
+ }>()
109
+
110
+ const localization = computed<UI_I_Localization>(() => useLocal())
111
+ const { $binary } = useNuxtApp()
112
+
113
+ const minMemoryInMb = 128
114
+ watch(
115
+ () => props.maxMemory,
116
+ (newValue) => {
117
+ memoryOptions.value = memoryOptionsFunc(
118
+ localization.value,
119
+ minMemoryInMb,
120
+ newValue
121
+ )
122
+ }
123
+ )
124
+
125
+ const isDisabled = computed<boolean>(() => {
126
+ return props.state === '1'
127
+ })
128
+
129
+ const isMemoryDisabled = computed<boolean>(
130
+ () => isDisabled.value && !memoryHotPlug.value
131
+ )
132
+
133
+ const selectedMemory = ref<number>(4)
134
+ const memoryType = ref<string>('gb')
135
+ const memoryTypeOptions = ref<UI_I_OptionItem[]>(
136
+ binaryOptionsFunc(localization.value)
137
+ )
138
+ const memoryInMb = computed<number>(() => {
139
+ if (memoryType.value === 'mb') {
140
+ return +selectedMemory.value
141
+ }
142
+
143
+ return $binary.universalFromTo(+selectedMemory.value, memoryType.value, 'mb')
144
+ })
145
+
146
+ const memoryOptions = ref<UI_I_OptionItem[]>(
147
+ memoryOptionsFunc(localization.value, minMemoryInMb, props.maxMemory)
148
+ )
149
+ const selectMemory = (mb: number): void => {
150
+ if (memoryType.value === 'mb') {
151
+ selectedMemory.value = mb
152
+ return
153
+ }
154
+
155
+ selectedMemory.value = $binary.universalFromTo(mb, 'mb', memoryType.value, 12)
156
+ }
157
+
158
+ const memoryErrorLocalText = computed<string>(() => {
159
+ const validValue = /^\d+(\.\d+)?$/.test(selectedMemory.value + '')
160
+ if (!validValue) {
161
+ return localization.value.inputContainsInvalidCharacters
162
+ }
163
+
164
+ const maxMemoryInGb = $binary.mbToGb(props.maxMemory)
165
+ if (memoryInMb.value < minMemoryInMb || memoryInMb.value > props.maxMemory) {
166
+ return localization.value.memoryMustBe
167
+ .replace('{0}', `${minMemoryInMb} ${localization.value.mb}`)
168
+ .replace('{1}', `${maxMemoryInGb} ${localization.value.gb}`)
169
+ }
170
+
171
+ if (memoryInMb.value % 2 !== 0) {
172
+ return localization.value.valueShouldMultiple.replace(
173
+ '{0}',
174
+ `${2} ${localization.value.mb}`
175
+ )
176
+ }
177
+ return ''
178
+ })
179
+
180
+ const apiErrorLocal = computed<string>(() => {
181
+ return (
182
+ props.errorValidationFields?.find(
183
+ (message) => message.field === 'memory.size_mb'
184
+ )?.error_message || ''
185
+ )
186
+ })
187
+
188
+ const memorySizeLocalAndApiErrorsTexts = computed<string>(() => {
189
+ const localError = memoryErrorLocalText.value
190
+ const apiError = apiErrorLocal.value
191
+
192
+ let result = ''
193
+ if (localError && !apiError) result = localError
194
+ if (apiError && !localError) result = apiError
195
+ if (localError && apiError) result = localError + ', ' + apiError
196
+ if (!localError && apiError) result = apiError
197
+
198
+ return result
199
+ })
200
+
201
+ const reservationInvalid = ref<boolean>(false)
202
+ const limitInvalid = ref<boolean>(false)
203
+ const memoryInvalid = computed<boolean>(
204
+ () =>
205
+ !!memorySizeLocalAndApiErrorsTexts.value ||
206
+ reservationInvalid.value ||
207
+ limitInvalid.value
208
+ )
209
+ watch(
210
+ memoryInvalid,
211
+ (newValue) => {
212
+ emits('invalid', newValue)
213
+ },
214
+ { immediate: true }
215
+ )
216
+
217
+ const reservation = ref<string>('2')
218
+ const reservationType = ref<string>('mb')
219
+ const reserveGuestMemory = ref<boolean>(false)
220
+
221
+ const limit = ref<string>('Unlimited')
222
+ const limitType = ref<string>('mb')
223
+ const limitOptions = computed<UI_I_OptionItem[] | undefined>(() => {
224
+ if (memoryHotPlug.value)
225
+ return memoryOptionsFunc(
226
+ localization.value,
227
+ memoryInMb.value,
228
+ props.maxMemory
229
+ )
230
+ })
231
+
232
+ const memoryHotPlug = ref<boolean>(false)
233
+ const isDisabledMemoryHotPlug = computed<boolean>(
234
+ () => memoryInMb.value >= props.maxMemory || isDisabled.value
235
+ )
236
+ watch(isDisabledMemoryHotPlug, (newValue) => {
237
+ if (newValue) memoryHotPlug.value = false
238
+ })
239
+
240
+ watch(
241
+ [memoryInMb, memoryHotPlug, reservation, reservationType, limit],
242
+ () => {
243
+ const reservationInMb =
244
+ reservationType.value === 'mb'
245
+ ? reservation.value
246
+ : '' +
247
+ $binary.universalFromTo(
248
+ reservation.value,
249
+ reservationType.value,
250
+ 'mb',
251
+ 12
252
+ )
253
+ emits('send-data', {
254
+ memory: '' + memoryInMb.value,
255
+ hotplug: memoryHotPlug.value,
256
+ reservation_mb: reservationInMb,
257
+ limit_mb: limit.value,
258
+ })
259
+ },
260
+ { immediate: true }
261
+ )
262
+
263
+ // Добавляем данные для редактирования
264
+ watch(
265
+ () => props.memory,
266
+ (newValue) => {
267
+ if (!newValue) return
268
+
269
+ selectedMemory.value = $binary.mbToGb(newValue.size_mb)
270
+ reservation.value = '' + newValue.reservation_mb
271
+ limit.value = '' + newValue.limit_mb
272
+ memoryHotPlug.value = newValue.hotplug
273
+ },
274
+ { immediate: true }
275
+ )
276
+
277
+ const onRemoveValidationError = (): void => {
278
+ emits('remove-error-by-title', 'memory.size_mb')
279
+ }
280
+ </script>
281
+
282
+ <style scoped lang="scss"></style>
@@ -96,18 +96,18 @@ const locationOptions = ref<UI_I_OptionItem[]>([])
96
96
 
97
97
  watch(
98
98
  () => props.location,
99
- (val) => {
100
- if (locationOptions.value.length || !val) {
99
+ (newValue) => {
100
+ if (locationOptions.value.length || !newValue) {
101
101
  return
102
102
  }
103
103
 
104
104
  locationOptions.value = [
105
- { text: localization.value.storeWithVirtualMachine, value: val.id },
105
+ { text: localization.value.storeWithVirtualMachine, value: newValue.id },
106
106
  { text: `${localization.value.browse}...`, value: -1 },
107
107
  ]
108
- selectedLocation.value = val.id
109
- storages.value.push(val)
110
- addStorage(val)
108
+ selectedLocation.value = newValue.id
109
+ storages.value.push(newValue)
110
+ addStorage(newValue)
111
111
  },
112
112
  { immediate: true }
113
113
  )
@@ -133,15 +133,15 @@ const changeStorage = (storage: UI_I_DatastoreTableItem): void => {
133
133
  const onHideStorageModal = (): void => {
134
134
  storageModalIsShow.value = false
135
135
  }
136
- const changeLocation = (e: UI_I_HTMLSelectElement): void => {
137
- const value = +e.target.value
136
+ const changeLocation = (event: UI_I_HTMLSelectElement): void => {
137
+ const value = +event.target.value
138
138
  if (value === -1) {
139
139
  storageModalIsShow.value = true
140
140
  return
141
141
  }
142
142
 
143
- selectedLocation.value = e.target.value
144
- const storage = storages.value.find((item) => item.id === e.target.value)
143
+ selectedLocation.value = event.target.value
144
+ const storage = storages.value.find((item) => item.id === event.target.value)
145
145
  storage && emits('change', storage)
146
146
  }
147
147
 
@@ -308,9 +308,9 @@ const onRollBackHardDisk = (): void => {
308
308
  const location = ref<UI_I_DatastoreTableItem | null>(props.storage || null)
309
309
  watch(
310
310
  () => props.storage,
311
- (val) => {
312
- location.value = val
313
- storage.value = val
311
+ (newValue) => {
312
+ location.value = newValue
313
+ storage.value = newValue
314
314
  }
315
315
  )
316
316
  const storage = ref<UI_I_DatastoreTableItem | null>(props.storage)
@@ -428,9 +428,13 @@ watch(
428
428
  const hardDiskInvalid = computed<boolean>(() => {
429
429
  return !!hardDiskTypeErrorLocalText.value || limitIopsInvalid.value
430
430
  })
431
- watch(hardDiskInvalid, (val) => {
432
- emits('invalid', val)
433
- })
431
+ watch(
432
+ hardDiskInvalid,
433
+ (newValue) => {
434
+ emits('invalid', newValue)
435
+ },
436
+ { immediate: true }
437
+ )
434
438
  </script>
435
439
 
436
440
  <style scoped lang="scss">
@@ -46,7 +46,7 @@ const props = defineProps<{
46
46
  cache: string
47
47
  index: number
48
48
  disabled: boolean
49
- errorValidationFields: UI_I_ErrorValidationField<string>[]
49
+ errorValidationFields: UI_I_ErrorValidationField[]
50
50
  }>()
51
51
  const emits = defineEmits<{
52
52
  (event: 'update:cache', value: string): void
@@ -125,9 +125,13 @@ const limitIopsErrorText = computed<string>(() => {
125
125
  }
126
126
  return ''
127
127
  })
128
- watch(limitIopsErrorText, (val) => {
129
- emits('valid', !!val)
130
- })
128
+ watch(
129
+ limitIopsErrorText,
130
+ (newValue) => {
131
+ emits('valid', !!newValue)
132
+ },
133
+ { immediate: true }
134
+ )
131
135
 
132
136
  const typeError = computed<string>(() => `disk_devices[${props.index}].io`)
133
137