bfg-common 1.3.231 → 1.3.233

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 (75) hide show
  1. package/components/atoms/alert/Alert.vue +96 -95
  2. package/components/atoms/alert/Notification.vue +171 -170
  3. package/components/atoms/autocomplete/Autocomplete.vue +3 -0
  4. package/components/atoms/collapse/CollapseNav.vue +1 -1
  5. package/components/atoms/collapse/CollapseNavItem.vue +17 -13
  6. package/components/atoms/combobox/Combobox.vue +5 -0
  7. package/components/atoms/datepicker/Datepicker.vue +19 -1
  8. package/components/atoms/datepicker/lib/models/interfaces.ts +1 -0
  9. package/components/atoms/dropdown/Portlet.vue +10 -7
  10. package/components/atoms/dropdown/dropdown/Dropdown.vue +10 -2
  11. package/components/atoms/dropdown/dropdown/lib/models/interfaces.ts +1 -0
  12. package/components/atoms/dropdown/tree/Tree.vue +2 -0
  13. package/components/atoms/dropdown/tree/lib/models/interfaces.ts +1 -0
  14. package/components/atoms/lib/models/interfaces.ts +2 -0
  15. package/components/atoms/list/SelectList.vue +1 -0
  16. package/components/atoms/modal/Modal.vue +3 -0
  17. package/components/atoms/modal/bySteps/BySteps.vue +56 -51
  18. package/components/atoms/modal/byStepsSecond/ByStepsSecond.vue +10 -1
  19. package/components/atoms/nav/VerticalNavBar.vue +1 -0
  20. package/components/atoms/nav/lib/models/interfaces.ts +1 -0
  21. package/components/atoms/notificationBar/NotificationBar.vue +9 -1
  22. package/components/atoms/perPage/PerPage.vue +1 -0
  23. package/components/atoms/popover/Popover.vue +5 -1
  24. package/components/atoms/popup/SimplePopup.vue +1 -0
  25. package/components/atoms/select/TheSelect.vue +2 -0
  26. package/components/atoms/select/lib/models/interfaces.ts +1 -0
  27. package/components/atoms/stack/StackBlock.vue +3 -0
  28. package/components/atoms/step/VerticalStep.vue +1 -0
  29. package/components/atoms/switch/Switch.vue +111 -111
  30. package/components/atoms/table/compact/Compact.vue +526 -526
  31. package/components/atoms/table/dataGrid/DataGrid.vue +13 -1
  32. package/components/atoms/table/dataGrid/DataGridColumnSwitch.vue +10 -2
  33. package/components/atoms/table/dataGrid/DataGridPage.vue +5 -0
  34. package/components/atoms/table/dataGrid/lib/models/interfaces.ts +2 -0
  35. package/components/atoms/table/simpleInfo/SimpleInfo.vue +7 -2
  36. package/components/atoms/table/simpleInfo/lib/models/interfaces.ts +1 -0
  37. package/components/atoms/table/simpleTable/SimpleTable.vue +5 -1
  38. package/components/atoms/table/simpleTable/lib/models/interfaces.ts +2 -0
  39. package/components/atoms/tabs/VerticalTabs.vue +1 -0
  40. package/components/atoms/tabs/lib/models/interfaces.ts +3 -2
  41. package/components/atoms/tooltip/Signpost.vue +226 -225
  42. package/components/atoms/wizard/Wizard.vue +5 -0
  43. package/components/atoms/wizard/step/Step.vue +1 -0
  44. package/components/common/mainNavigationPanel/MainNavigationPanel.vue +4 -1
  45. package/components/common/mainNavigationPanel/lib/models/interfaces.ts +1 -0
  46. package/components/common/pages/Tasks.vue +120 -120
  47. package/components/common/recursionTree/RecursionTree.vue +203 -203
  48. package/components/common/tools/Actions.vue +2 -1
  49. package/components/common/tools/lib/models/interfaces.ts +1 -0
  50. package/components/common/vm/actions/add/Add.vue +575 -575
  51. package/components/common/vm/actions/clone/Clone.vue +518 -518
  52. package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +269 -269
  53. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +693 -693
  54. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuModel.vue +220 -220
  55. package/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/config/dropdownItems.ts +59 -59
  56. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +294 -294
  57. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +165 -165
  58. package/components/common/vm/actions/common/select/storage/lib/config/config.ts +166 -166
  59. package/components/common/vm/actions/editSettings/EditSettings.vue +313 -313
  60. package/components/common/weekSelect/WeekSelect.vue +112 -112
  61. package/components/common/weekSelect/lib/config/options.ts +10 -10
  62. package/composables/useAppVersion.ts +21 -21
  63. package/composables/useEnvLanguage.ts +20 -20
  64. package/lib/utils/sendTask.ts +72 -72
  65. package/minify.js +146 -146
  66. package/package.json +1 -1
  67. package/public/spice-console/application/codec.js +257 -257
  68. package/public/spice-console/lib/rasterEngine.js +907 -907
  69. package/public/spice-console/network/spicechannel.js +369 -369
  70. package/store/main/lib/interfaces.ts +9 -9
  71. package/store/tasks/actions.ts +133 -133
  72. package/store/tasks/getters.ts +25 -25
  73. package/store/tasks/lib/models/interfaces.ts +18 -18
  74. package/store/tasks/mutations.ts +58 -58
  75. package/store/tasks/state.ts +16 -16
@@ -1,294 +1,294 @@
1
- <template>
2
- <div class="hardware-network">
3
- <atoms-stack-block
4
- :has-children="true"
5
- :removable="isRemovable"
6
- @remove="removeNetwork"
7
- >
8
- <template #stackBlockKey>
9
- <div class="vm-wizard-toggle-block-network flex-align-center">
10
- <span>{{ label }}</span>
11
- <atoms-the-icon
12
- v-show="newNetworkInvalid"
13
- width="24px"
14
- height="24px"
15
- class="is-error tooltip-trigger"
16
- name="info"
17
- />
18
- </div>
19
- </template>
20
- <template #stackBlockContent>
21
- <div class="flex-align-center flex-space-between">
22
- <atoms-tooltip-error
23
- :has-error="!!apiError"
24
- :selector="`.vm-wizard-network-field-${props.index}`"
25
- @remove="onRemoveValidationError"
26
- >
27
- <template #elem>
28
- <div class="select">
29
- <select
30
- :id="`vm-wizard-network-field-${props.index}`"
31
- v-model="selectedLocation"
32
- :class="`vm-wizard-network-field-${props.index} input-text-color`"
33
- :disabled="props.type === 'edit' && state !== 1"
34
- @click.stop
35
- @change="changeLocation"
36
- >
37
- <option
38
- v-for="(item, key) in locationOptions"
39
- :key="key"
40
- :value="item.value"
41
- >
42
- {{ item.text }}
43
- </option>
44
- </select>
45
- </div>
46
- </template>
47
- <template #content>{{ apiError }}</template>
48
- </atoms-tooltip-error>
49
- </div>
50
- </template>
51
- <template #stackChildren>
52
- <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-adapter-type
53
- v-model:adapter-type="adapterType"
54
- :index="props.index"
55
- :disabled="props.type === 'edit' || isRunning"
56
- :error-validation-fields="props.errorValidationFields"
57
- @remove-error-by-title="emits('remove-error-by-title', $event)"
58
- />
59
- <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-mac-address
60
- v-model:mac-address="macAddress"
61
- v-model:mac-address-type="macAddressType"
62
- :index="props.index"
63
- :disabled="props.type === 'edit'"
64
- :error-validation-fields="props.errorValidationFields"
65
- @invalid="newNetworkInvalid = $event"
66
- @remove-error-by-title="emits('remove-error-by-title', $event)"
67
- />
68
- </template>
69
- </atoms-stack-block>
70
-
71
- <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-location
72
- :location-modal-is-show="locationModalIsShow"
73
- :networks-table="networksTable"
74
- @hide="onHideLocationModal"
75
- @select="onSelectLocation"
76
- />
77
- </div>
78
- </template>
79
-
80
- <script setup lang="ts">
81
- import { UI_I_TablePayload } from '~/lib/models/table/interfaces'
82
- import { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
83
- import { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
84
- import { UI_I_SendDataNewNetwork } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
85
- import { UI_T_NetworkType } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/types'
86
- import {
87
- UI_I_Localization,
88
- UI_I_HTMLSelectElement,
89
- } from '~/lib/models/interfaces'
90
- import { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
91
-
92
- const props = defineProps<{
93
- index: number
94
- type: UI_T_NetworkType
95
- network: UI_I_SendDataNewNetwork
96
- networksTable: UI_I_NetworkTableItem[]
97
- errorValidationFields: UI_I_ErrorValidationField[]
98
- isEdit: boolean
99
- state?: string | number
100
- }>()
101
-
102
- const emits = defineEmits<{
103
- (event: 'send-data', value: UI_I_SendDataNewNetwork): void
104
- (event: 'invalid', value: boolean): void
105
- (event: 'remove'): void
106
- (event: 'remove-error-by-title', value: string): void
107
- (event: 'get-networks-table', value: UI_I_TablePayload): void
108
- }>()
109
-
110
- const localization = computed<UI_I_Localization>(() => useLocal())
111
-
112
- const isRunning = computed<boolean>(() => {
113
- return props.state === 2
114
- })
115
-
116
- const isRemovable = computed<boolean>(() => {
117
- return (
118
- !props.isEdit ||
119
- !isRunning.value ||
120
- (isRunning.value && adapterType.value === 'virtio')
121
- )
122
- })
123
-
124
- const label = computed<string>(() => {
125
- if (props.type === 'edit')
126
- return `${localization.value.networkAdapter} ${props.index + 1}`
127
-
128
- return `${localization.value.newNetwork} *`
129
- })
130
-
131
- const removeNetwork = (): void => {
132
- emits('remove')
133
- }
134
-
135
- const selectedLocationOld = ref<string>('')
136
- const selectedLocation = ref<string>('')
137
- const locationOptions = ref<UI_I_OptionItem[]>([])
138
-
139
- const getNetworks = (): void => {
140
- // if (props.networksTable.length) return // Из-за этого кода был баг. Открыть визард вм -> создать сеть -> открыть визард вм и в списке сетей нету новой сети
141
-
142
- const payload: UI_I_TablePayload = {
143
- pagination: {
144
- page: 1,
145
- pageSize: 100,
146
- },
147
- schema: 'full',
148
- type: 'network',
149
- sortBy: null,
150
- }
151
- emits('get-networks-table', payload)
152
- }
153
- getNetworks()
154
- watch(
155
- () => props.networksTable,
156
- (newValue) => {
157
- const isExistValue = newValue.some(
158
- (network) => network.net_bridge === selectedLocation.value
159
- )
160
- if (!newValue.length || props.type === 'edit' || isExistValue) return
161
-
162
- selectedLocationOld.value = newValue[0].net_bridge
163
- selectedLocation.value = newValue[0].net_bridge
164
-
165
- locationOptions.value = [
166
- { text: newValue[0].name, value: newValue[0].net_bridge },
167
- { text: `${localization.value.browse}...`, value: '' },
168
- ]
169
- },
170
- { immediate: true }
171
- )
172
-
173
- const locationModalIsShow = ref<boolean>(false)
174
- const onHideLocationModal = (): void => {
175
- locationModalIsShow.value = false
176
- selectedLocation.value = selectedLocationOld.value
177
- }
178
- const changeLocation = (event: UI_I_HTMLSelectElement): void => {
179
- const value = event.target.value
180
- if (value === '') {
181
- locationModalIsShow.value = true
182
- return
183
- }
184
-
185
- selectedLocationOld.value = value
186
- selectedLocation.value = value
187
- // netBridge.value = value
188
- }
189
- const onSelectLocation = (network: UI_I_NetworkTableItem): void => {
190
- locationModalIsShow.value = false
191
-
192
- selectedLocationOld.value = network.net_bridge
193
- selectedLocation.value = network.net_bridge
194
-
195
- const hasNetwork = locationOptions.value.some(
196
- (option) => option.value === network.net_bridge
197
- )
198
- if (hasNetwork) {
199
- return
200
- }
201
-
202
- locationOptions.value = [
203
- ...locationOptions.value.slice(0, -1),
204
- { text: network.name, value: network.net_bridge },
205
- locationOptions.value[locationOptions.value.length - 1],
206
- ]
207
- }
208
-
209
- const adapterType = ref<string>('rtl8139')
210
-
211
- const target = ref<string>('')
212
-
213
- const macAddress = ref<string>('')
214
- const macAddressType = ref<string>('automatic')
215
- const newNetworkInvalid = ref<boolean>(false)
216
- watch(
217
- newNetworkInvalid,
218
- (newValue) => {
219
- emits('invalid', newValue)
220
- },
221
- { immediate: true }
222
- )
223
-
224
- watch(
225
- [selectedLocation, adapterType, macAddress, macAddressType, locationOptions],
226
- () => {
227
- const option = locationOptions.value.find(
228
- (option) => option.value === selectedLocation.value
229
- )
230
- if (!option) return
231
-
232
- emits('send-data', {
233
- network: option.text,
234
- net_bridge: option.value,
235
- target: target.value,
236
- model: adapterType.value,
237
- mac: macAddress.value,
238
- boot_order: props.network.boot_order,
239
- })
240
- },
241
- { immediate: true }
242
- )
243
-
244
- // Добавляем данные для редактирования
245
- watch(
246
- () => props.network,
247
- (newValue) => {
248
- if (props.type !== 'edit') return
249
-
250
- locationOptions.value = [
251
- { text: newValue.network, value: newValue.net_bridge },
252
- { text: `${localization.value.browse}...`, value: '' },
253
- ]
254
- selectedLocation.value = newValue.net_bridge
255
-
256
- adapterType.value = newValue.model
257
- macAddress.value = newValue.mac
258
- target.value = newValue.target
259
- },
260
- { immediate: true }
261
- )
262
-
263
- watch(
264
- isRunning,
265
- (newValue) => {
266
- if (newValue && props.type === 'new') {
267
- adapterType.value = 'virtio'
268
- }
269
- },
270
- { immediate: true }
271
- )
272
-
273
- const typeError = computed<string>(
274
- () => `network_devices[${props.index}].network`
275
- )
276
-
277
- const apiError = computed<string>(() => {
278
- return (
279
- props.errorValidationFields?.find(
280
- (message) => message.field === typeError.value
281
- )?.error_message || ''
282
- )
283
- })
284
-
285
- const onRemoveValidationError = (): void => {
286
- emits('remove-error-by-title', typeError.value)
287
- }
288
- </script>
289
-
290
- <style scoped lang="scss">
291
- #network-connect {
292
- margin-right: 4px;
293
- }
294
- </style>
1
+ <template>
2
+ <div class="hardware-network">
3
+ <atoms-stack-block
4
+ :has-children="true"
5
+ :removable="isRemovable"
6
+ @remove="removeNetwork"
7
+ >
8
+ <template #stackBlockKey>
9
+ <div class="vm-wizard-toggle-block-network flex-align-center">
10
+ <span>{{ label }}</span>
11
+ <atoms-the-icon
12
+ v-show="newNetworkInvalid"
13
+ width="24px"
14
+ height="24px"
15
+ class="is-error tooltip-trigger"
16
+ name="info"
17
+ />
18
+ </div>
19
+ </template>
20
+ <template #stackBlockContent>
21
+ <div class="flex-align-center flex-space-between">
22
+ <atoms-tooltip-error
23
+ :has-error="!!apiError"
24
+ :selector="`.vm-wizard-network-field-${props.index}`"
25
+ @remove="onRemoveValidationError"
26
+ >
27
+ <template #elem>
28
+ <div class="select">
29
+ <select
30
+ :id="`vm-wizard-network-field-${props.index}`"
31
+ v-model="selectedLocation"
32
+ :class="`vm-wizard-network-field-${props.index} input-text-color`"
33
+ :disabled="props.type === 'edit' && state !== 1"
34
+ @click.stop
35
+ @change="changeLocation"
36
+ >
37
+ <option
38
+ v-for="(item, key) in locationOptions"
39
+ :key="key"
40
+ :value="item.value"
41
+ >
42
+ {{ item.text }}
43
+ </option>
44
+ </select>
45
+ </div>
46
+ </template>
47
+ <template #content>{{ apiError }}</template>
48
+ </atoms-tooltip-error>
49
+ </div>
50
+ </template>
51
+ <template #stackChildren>
52
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-adapter-type
53
+ v-model:adapter-type="adapterType"
54
+ :index="props.index"
55
+ :disabled="props.type === 'edit' || isRunning"
56
+ :error-validation-fields="props.errorValidationFields"
57
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
58
+ />
59
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-mac-address
60
+ v-model:mac-address="macAddress"
61
+ v-model:mac-address-type="macAddressType"
62
+ :index="props.index"
63
+ :disabled="props.type === 'edit'"
64
+ :error-validation-fields="props.errorValidationFields"
65
+ @invalid="newNetworkInvalid = $event"
66
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
67
+ />
68
+ </template>
69
+ </atoms-stack-block>
70
+
71
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-location
72
+ :location-modal-is-show="locationModalIsShow"
73
+ :networks-table="networksTable"
74
+ @hide="onHideLocationModal"
75
+ @select="onSelectLocation"
76
+ />
77
+ </div>
78
+ </template>
79
+
80
+ <script setup lang="ts">
81
+ import { UI_I_TablePayload } from '~/lib/models/table/interfaces'
82
+ import { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
83
+ import { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
84
+ import { UI_I_SendDataNewNetwork } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
85
+ import { UI_T_NetworkType } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/types'
86
+ import {
87
+ UI_I_Localization,
88
+ UI_I_HTMLSelectElement,
89
+ } from '~/lib/models/interfaces'
90
+ import { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
91
+
92
+ const props = defineProps<{
93
+ index: number
94
+ type: UI_T_NetworkType
95
+ network: UI_I_SendDataNewNetwork
96
+ networksTable: UI_I_NetworkTableItem[]
97
+ errorValidationFields: UI_I_ErrorValidationField[]
98
+ isEdit: boolean
99
+ state?: string | number
100
+ }>()
101
+
102
+ const emits = defineEmits<{
103
+ (event: 'send-data', value: UI_I_SendDataNewNetwork): void
104
+ (event: 'invalid', value: boolean): void
105
+ (event: 'remove'): void
106
+ (event: 'remove-error-by-title', value: string): void
107
+ (event: 'get-networks-table', value: UI_I_TablePayload): void
108
+ }>()
109
+
110
+ const localization = computed<UI_I_Localization>(() => useLocal())
111
+
112
+ const isRunning = computed<boolean>(() => {
113
+ return props.state === 2
114
+ })
115
+
116
+ const isRemovable = computed<boolean>(() => {
117
+ return (
118
+ !props.isEdit ||
119
+ !isRunning.value ||
120
+ (isRunning.value && adapterType.value === 'virtio')
121
+ )
122
+ })
123
+
124
+ const label = computed<string>(() => {
125
+ if (props.type === 'edit')
126
+ return `${localization.value.networkAdapter} ${props.index + 1}`
127
+
128
+ return `${localization.value.newNetwork} *`
129
+ })
130
+
131
+ const removeNetwork = (): void => {
132
+ emits('remove')
133
+ }
134
+
135
+ const selectedLocationOld = ref<string>('')
136
+ const selectedLocation = ref<string>('')
137
+ const locationOptions = ref<UI_I_OptionItem[]>([])
138
+
139
+ const getNetworks = (): void => {
140
+ // if (props.networksTable.length) return // Из-за этого кода был баг. Открыть визард вм -> создать сеть -> открыть визард вм и в списке сетей нету новой сети
141
+
142
+ const payload: UI_I_TablePayload = {
143
+ pagination: {
144
+ page: 1,
145
+ pageSize: 100,
146
+ },
147
+ schema: 'full',
148
+ type: 'network',
149
+ sortBy: null,
150
+ }
151
+ emits('get-networks-table', payload)
152
+ }
153
+ getNetworks()
154
+ watch(
155
+ () => props.networksTable,
156
+ (newValue) => {
157
+ const isExistValue = newValue.some(
158
+ (network) => network.net_bridge === selectedLocation.value
159
+ )
160
+ if (!newValue.length || props.type === 'edit' || isExistValue) return
161
+
162
+ selectedLocationOld.value = newValue[0].net_bridge
163
+ selectedLocation.value = newValue[0].net_bridge
164
+
165
+ locationOptions.value = [
166
+ { text: newValue[0].name, value: newValue[0].net_bridge },
167
+ { text: `${localization.value.browse}...`, value: '' },
168
+ ]
169
+ },
170
+ { immediate: true }
171
+ )
172
+
173
+ const locationModalIsShow = ref<boolean>(false)
174
+ const onHideLocationModal = (): void => {
175
+ locationModalIsShow.value = false
176
+ selectedLocation.value = selectedLocationOld.value
177
+ }
178
+ const changeLocation = (event: UI_I_HTMLSelectElement): void => {
179
+ const value = event.target.value
180
+ if (value === '') {
181
+ locationModalIsShow.value = true
182
+ return
183
+ }
184
+
185
+ selectedLocationOld.value = value
186
+ selectedLocation.value = value
187
+ // netBridge.value = value
188
+ }
189
+ const onSelectLocation = (network: UI_I_NetworkTableItem): void => {
190
+ locationModalIsShow.value = false
191
+
192
+ selectedLocationOld.value = network.net_bridge
193
+ selectedLocation.value = network.net_bridge
194
+
195
+ const hasNetwork = locationOptions.value.some(
196
+ (option) => option.value === network.net_bridge
197
+ )
198
+ if (hasNetwork) {
199
+ return
200
+ }
201
+
202
+ locationOptions.value = [
203
+ ...locationOptions.value.slice(0, -1),
204
+ { text: network.name, value: network.net_bridge },
205
+ locationOptions.value[locationOptions.value.length - 1],
206
+ ]
207
+ }
208
+
209
+ const adapterType = ref<string>('rtl8139')
210
+
211
+ const target = ref<string>('')
212
+
213
+ const macAddress = ref<string>('')
214
+ const macAddressType = ref<string>('automatic')
215
+ const newNetworkInvalid = ref<boolean>(false)
216
+ watch(
217
+ newNetworkInvalid,
218
+ (newValue) => {
219
+ emits('invalid', newValue)
220
+ },
221
+ { immediate: true }
222
+ )
223
+
224
+ watch(
225
+ [selectedLocation, adapterType, macAddress, macAddressType, locationOptions],
226
+ () => {
227
+ const option = locationOptions.value.find(
228
+ (option) => option.value === selectedLocation.value
229
+ )
230
+ if (!option) return
231
+
232
+ emits('send-data', {
233
+ network: option.text,
234
+ net_bridge: option.value,
235
+ target: target.value,
236
+ model: adapterType.value,
237
+ mac: macAddress.value,
238
+ boot_order: props.network.boot_order,
239
+ })
240
+ },
241
+ { immediate: true }
242
+ )
243
+
244
+ // Добавляем данные для редактирования
245
+ watch(
246
+ () => props.network,
247
+ (newValue) => {
248
+ if (props.type !== 'edit') return
249
+
250
+ locationOptions.value = [
251
+ { text: newValue.network, value: newValue.net_bridge },
252
+ { text: `${localization.value.browse}...`, value: '' },
253
+ ]
254
+ selectedLocation.value = newValue.net_bridge
255
+
256
+ adapterType.value = newValue.model
257
+ macAddress.value = newValue.mac
258
+ target.value = newValue.target
259
+ },
260
+ { immediate: true }
261
+ )
262
+
263
+ watch(
264
+ isRunning,
265
+ (newValue) => {
266
+ if (newValue && props.type === 'new') {
267
+ adapterType.value = 'virtio'
268
+ }
269
+ },
270
+ { immediate: true }
271
+ )
272
+
273
+ const typeError = computed<string>(
274
+ () => `network_devices[${props.index}].network`
275
+ )
276
+
277
+ const apiError = computed<string>(() => {
278
+ return (
279
+ props.errorValidationFields?.find(
280
+ (message) => message.field === typeError.value
281
+ )?.error_message || ''
282
+ )
283
+ })
284
+
285
+ const onRemoveValidationError = (): void => {
286
+ emits('remove-error-by-title', typeError.value)
287
+ }
288
+ </script>
289
+
290
+ <style scoped lang="scss">
291
+ #network-connect {
292
+ margin-right: 4px;
293
+ }
294
+ </style>