bfg-common 1.3.486 → 1.3.488

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 (67) hide show
  1. package/assets/img/icons/icons-sprite-dark-8.svg +190 -190
  2. package/assets/img/icons/icons-sprite-light-8.svg +190 -190
  3. package/assets/scss/common/normalize.scss +340 -340
  4. package/components/atoms/TheIcon2.vue +1353 -1353
  5. package/components/atoms/loader/Loader.vue +30 -30
  6. package/components/atoms/loader/PreLoader.vue +38 -38
  7. package/components/atoms/switch/Switch.vue +111 -111
  8. package/components/atoms/table/compact/Compact.vue +526 -526
  9. package/components/common/adapterManager/ui/table/Header.vue +93 -93
  10. package/components/common/adapterManager/ui/table/Table.vue +162 -162
  11. package/components/common/context/Context.vue +99 -99
  12. package/components/common/layout/theHeader/userMenu/modals/preferences/View.vue +129 -129
  13. package/components/common/lib/config/states.ts +160 -160
  14. package/components/common/mainNavigationPanel/MainNavigationPanel.vue +142 -142
  15. package/components/common/mainNavigationPanel/MainNavigationPanelNew.vue +248 -248
  16. package/components/common/mainNavigationPanel/MainNavigationPanelOld.vue +288 -288
  17. package/components/common/readyToComplete/ReadyToComplete.vue +15 -15
  18. package/components/common/resource/progressBlock/ProgressBlock.vue +142 -142
  19. package/components/common/split/horizontal/Horizontal.vue +70 -70
  20. package/components/common/vm/actions/clone/Clone.vue +511 -511
  21. package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +273 -273
  22. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +697 -697
  23. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +400 -400
  24. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +329 -329
  25. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +305 -305
  26. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +168 -168
  27. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +82 -82
  28. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +32 -32
  29. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +182 -182
  30. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptions.vue +114 -114
  31. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +192 -192
  32. package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/Tools.vue +72 -72
  33. package/components/common/vm/actions/common/select/computeResource/ComputeResource.vue +164 -164
  34. package/components/common/vm/actions/common/select/name/Name.vue +235 -235
  35. package/components/common/vm/actions/common/select/storage/Storage.vue +198 -198
  36. package/components/common/vm/actions/editSettings/EditSettings.vue +316 -316
  37. package/components/common/weekSelect/lib/config/options.ts +10 -10
  38. package/components/common/wizards/datastore/add/Add.vue +436 -436
  39. package/components/common/wizards/datastore/add/lib/config/stepItems.ts +191 -191
  40. package/components/common/wizards/datastore/add/lib/models/interfaces.ts +38 -38
  41. package/components/common/wizards/datastore/add/lib/utils.ts +70 -70
  42. package/components/common/wizards/datastore/add/local/createName/CreateName.vue +160 -160
  43. package/components/common/wizards/datastore/add/nfs/Nfs.vue +112 -112
  44. package/components/common/wizards/datastore/add/nfs/accessibility/Accessibility.vue +104 -104
  45. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/compatibleTable.ts +62 -62
  46. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/hostsTableItems.ts +53 -53
  47. package/components/common/wizards/datastore/add/readyComplete/ReadyComplete.vue +86 -86
  48. package/components/common/wizards/datastore/add/readyComplete/lib/config/propertiesDetails.ts +184 -184
  49. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/DeviceSelection.vue +459 -459
  50. package/components/common/wizards/datastore/add/types/Types.vue +80 -80
  51. package/components/common/wizards/datastore/add/types/lib/config/typeOptions.ts +49 -49
  52. package/composables/useAppVersion.ts +22 -22
  53. package/composables/useEnvLanguage.ts +20 -20
  54. package/lib/utils/sendTask.ts +73 -73
  55. package/minify.js +146 -146
  56. package/package.json +1 -1
  57. package/plugins/spice-console/spice.console.ts +147 -147
  58. package/public/spice-console/application/codec.js +263 -263
  59. package/public/spice-console/lib/rasterEngine.js +907 -907
  60. package/public/spice-console/network/spicechannel.js +375 -375
  61. package/store/main/lib/interfaces.ts +9 -9
  62. package/store/tasks/actions.ts +133 -133
  63. package/store/tasks/getters.ts +25 -25
  64. package/store/tasks/lib/models/interfaces.ts +18 -18
  65. package/store/tasks/mappers/recentTasks.ts +45 -43
  66. package/store/tasks/mutations.ts +58 -58
  67. package/store/tasks/state.ts +16 -16
@@ -1,305 +1,305 @@
1
- <template>
2
- <div class="hardware-network">
3
- <atoms-stack-block
4
- :has-children="true"
5
- :removable="isRemovable"
6
- test-id="network-stack-block"
7
- @remove="removeNetwork"
8
- >
9
- <template #stackBlockKey>
10
- <div
11
- :id="`vm-wizard-toggle-block-network-${props.index}`"
12
- :data-id="`vm-wizard-toggle-block-network-${props.index}`"
13
- class="vm-wizard-toggle-block-network flex-align-center"
14
- >
15
- <span>{{ label }}</span>
16
- <atoms-the-icon
17
- v-show="newNetworkInvalid"
18
- width="24px"
19
- height="24px"
20
- class="is-error tooltip-trigger"
21
- name="info"
22
- />
23
- </div>
24
- </template>
25
- <template #stackBlockContent>
26
- <div class="flex-align-center flex-space-between">
27
- <atoms-tooltip-error
28
- :has-error="!!apiError"
29
- :selector="`.vm-wizard-network-field-${props.index}`"
30
- @remove="onRemoveValidationError"
31
- >
32
- <template #elem>
33
- <div class="select">
34
- <select
35
- :id="`vm-wizard-network-field-${props.index}`"
36
- v-model="selectedLocation"
37
- :data-id="`vm-wizard-network-field-${props.index}`"
38
- :class="`vm-wizard-network-field-${props.index} input-text-color`"
39
- :disabled="props.type === 'edit' && state !== 1"
40
- @click.stop
41
- @change="changeLocation"
42
- >
43
- <option
44
- v-for="(item, key) in locationOptions"
45
- :key="key"
46
- :value="item.value"
47
- >
48
- {{ item.text }}
49
- </option>
50
- </select>
51
- </div>
52
- </template>
53
- <template #content>{{ apiError }}</template>
54
- </atoms-tooltip-error>
55
- </div>
56
- </template>
57
- <template #stackChildren>
58
- <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-adapter-type
59
- v-model:adapter-type="adapterType"
60
- :index="props.index"
61
- :disabled="props.type === 'edit' || isRunning"
62
- :error-validation-fields="props.errorValidationFields"
63
- @remove-error-by-title="emits('remove-error-by-title', $event)"
64
- />
65
- <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-mac-address
66
- v-model:mac-address="macAddress"
67
- v-model:mac-address-type="macAddressType"
68
- :index="props.index"
69
- :disabled="props.type === 'edit'"
70
- :error-validation-fields="props.errorValidationFields"
71
- @invalid="newNetworkInvalid = $event"
72
- @remove-error-by-title="emits('remove-error-by-title', $event)"
73
- />
74
- </template>
75
- </atoms-stack-block>
76
-
77
- <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-location
78
- :location-modal-is-show="locationModalIsShow"
79
- :networks-table="networksTable"
80
- @hide="onHideLocationModal"
81
- @select="onSelectLocation"
82
- />
83
- </div>
84
- </template>
85
-
86
- <script setup lang="ts">
87
- import { UI_T_Project } from '~/lib/models/types'
88
- import { UI_I_TablePayload } from '~/lib/models/table/interfaces'
89
- import { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
90
- import { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
91
- import { UI_I_SendDataNewNetwork } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
92
- import { UI_T_NetworkType } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/types'
93
- import {
94
- UI_I_Localization,
95
- UI_I_HTMLSelectElement,
96
- } from '~/lib/models/interfaces'
97
- import { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
98
-
99
- const props = defineProps<{
100
- project: UI_T_Project
101
- index: number
102
- type: UI_T_NetworkType
103
- network: UI_I_SendDataNewNetwork
104
- networksTable: UI_I_NetworkTableItem[]
105
- errorValidationFields: UI_I_ErrorValidationField[]
106
- isEdit: boolean
107
- state?: string | number
108
- }>()
109
-
110
- const emits = defineEmits<{
111
- (event: 'send-data', value: UI_I_SendDataNewNetwork): void
112
- (event: 'invalid', value: boolean): void
113
- (event: 'remove'): void
114
- (event: 'remove-error-by-title', value: string): void
115
- (event: 'get-networks-table', value: UI_I_TablePayload): void
116
- }>()
117
-
118
- const localization = computed<UI_I_Localization>(() => useLocal())
119
-
120
- const isRunning = computed<boolean>(() => {
121
- return props.state === 2
122
- })
123
-
124
- const isRemovable = computed<boolean>(() => {
125
- return (
126
- !props.isEdit ||
127
- !isRunning.value ||
128
- (isRunning.value && adapterType.value === 'virtio')
129
- )
130
- })
131
-
132
- const label = computed<string>(() => {
133
- if (props.type === 'edit')
134
- return `${localization.value.networkAdapter} ${props.index + 1}`
135
-
136
- return `${localization.value.newNetwork} *`
137
- })
138
-
139
- const removeNetwork = (): void => {
140
- emits('remove')
141
- }
142
-
143
- const selectedLocationOld = ref<string>('')
144
- const selectedLocation = ref<string>('')
145
- const locationOptions = ref<UI_I_OptionItem[]>([])
146
-
147
- const getNetworks = (): void => {
148
- // if (props.networksTable.length) return // Из-за этого кода был баг. Открыть визард вм -> создать сеть -> открыть визард вм и в списке сетей нету новой сети
149
-
150
- const payload: UI_I_TablePayload = {
151
- pagination: {
152
- page: 1,
153
- pageSize: 100,
154
- },
155
- schema: 'full',
156
- type: 'network',
157
- sortBy: null,
158
- }
159
- emits('get-networks-table', payload)
160
- }
161
- getNetworks()
162
-
163
- const valueProp: 'net_bridge' | 'id' =
164
- props.project === 'procurator' ? 'net_bridge' : 'id'
165
- watch(
166
- () => props.networksTable,
167
- (newValue) => {
168
- const isExistValue = newValue.some(
169
- (network) => network[valueProp] === selectedLocation.value
170
- )
171
- if (!newValue.length || props.type === 'edit' || isExistValue) return
172
-
173
- selectedLocationOld.value = newValue[0][valueProp]
174
- selectedLocation.value = newValue[0][valueProp]
175
-
176
- locationOptions.value = [
177
- { text: newValue[0].name, value: newValue[0][valueProp] },
178
- { text: `${localization.value.browse}...`, value: '' },
179
- ]
180
- },
181
- { immediate: true }
182
- )
183
-
184
- const locationModalIsShow = ref<boolean>(false)
185
- const onHideLocationModal = (): void => {
186
- locationModalIsShow.value = false
187
- selectedLocation.value = selectedLocationOld.value
188
- }
189
- const changeLocation = (event: UI_I_HTMLSelectElement): void => {
190
- const value = event.target.value
191
- if (value === '') {
192
- locationModalIsShow.value = true
193
- return
194
- }
195
-
196
- selectedLocationOld.value = value
197
- selectedLocation.value = value
198
- // netBridge.value = value
199
- }
200
- const onSelectLocation = (network: UI_I_NetworkTableItem): void => {
201
- locationModalIsShow.value = false
202
-
203
- selectedLocationOld.value = network[valueProp]
204
- selectedLocation.value = network[valueProp]
205
-
206
- const hasNetwork = locationOptions.value.some(
207
- (option) => option.value === network[valueProp]
208
- )
209
- if (hasNetwork) {
210
- return
211
- }
212
-
213
- locationOptions.value = [
214
- ...locationOptions.value.slice(0, -1),
215
- { text: network.name, value: network[valueProp] },
216
- locationOptions.value[locationOptions.value.length - 1],
217
- ]
218
- }
219
-
220
- const adapterType = ref<string>('rtl8139')
221
-
222
- const target = ref<string>('')
223
-
224
- const macAddress = ref<string>('')
225
- const macAddressType = ref<string>('automatic')
226
- const newNetworkInvalid = ref<boolean>(false)
227
- watch(
228
- newNetworkInvalid,
229
- (newValue) => {
230
- emits('invalid', newValue)
231
- },
232
- { immediate: true }
233
- )
234
-
235
- watch(
236
- [selectedLocation, adapterType, macAddress, macAddressType, locationOptions],
237
- () => {
238
- const option = locationOptions.value.find(
239
- (option) => option.value === selectedLocation.value
240
- )
241
- if (!option) return
242
-
243
- emits('send-data', {
244
- network: option.text,
245
- net_bridge: props.project === 'procurator' ? option.value : '',
246
- target: target.value,
247
- model: adapterType.value,
248
- mac: macAddress.value,
249
- boot_order: props.network.boot_order,
250
- })
251
- },
252
- { immediate: true }
253
- )
254
-
255
- // Добавляем данные для редактирования
256
- watch(
257
- () => props.network,
258
- (newValue) => {
259
- if (props.type !== 'edit') return
260
-
261
- locationOptions.value = [
262
- { text: newValue.network, value: newValue[valueProp] },
263
- { text: `${localization.value.browse}...`, value: '' },
264
- ]
265
- selectedLocation.value = newValue[valueProp]
266
-
267
- adapterType.value = newValue.model
268
- macAddress.value = newValue.mac
269
- target.value = newValue.target
270
- },
271
- { immediate: true }
272
- )
273
-
274
- watch(
275
- isRunning,
276
- (newValue) => {
277
- if (newValue && props.type === 'new') {
278
- adapterType.value = 'virtio'
279
- }
280
- },
281
- { immediate: true }
282
- )
283
-
284
- const typeError = computed<string>(
285
- () => `network_devices[${props.index}].network`
286
- )
287
-
288
- const apiError = computed<string>(() => {
289
- return (
290
- props.errorValidationFields?.find(
291
- (message) => message.field === typeError.value
292
- )?.error_message || ''
293
- )
294
- })
295
-
296
- const onRemoveValidationError = (): void => {
297
- emits('remove-error-by-title', typeError.value)
298
- }
299
- </script>
300
-
301
- <style scoped lang="scss">
302
- #network-connect {
303
- margin-right: 4px;
304
- }
305
- </style>
1
+ <template>
2
+ <div class="hardware-network">
3
+ <atoms-stack-block
4
+ :has-children="true"
5
+ :removable="isRemovable"
6
+ test-id="network-stack-block"
7
+ @remove="removeNetwork"
8
+ >
9
+ <template #stackBlockKey>
10
+ <div
11
+ :id="`vm-wizard-toggle-block-network-${props.index}`"
12
+ :data-id="`vm-wizard-toggle-block-network-${props.index}`"
13
+ class="vm-wizard-toggle-block-network flex-align-center"
14
+ >
15
+ <span>{{ label }}</span>
16
+ <atoms-the-icon
17
+ v-show="newNetworkInvalid"
18
+ width="24px"
19
+ height="24px"
20
+ class="is-error tooltip-trigger"
21
+ name="info"
22
+ />
23
+ </div>
24
+ </template>
25
+ <template #stackBlockContent>
26
+ <div class="flex-align-center flex-space-between">
27
+ <atoms-tooltip-error
28
+ :has-error="!!apiError"
29
+ :selector="`.vm-wizard-network-field-${props.index}`"
30
+ @remove="onRemoveValidationError"
31
+ >
32
+ <template #elem>
33
+ <div class="select">
34
+ <select
35
+ :id="`vm-wizard-network-field-${props.index}`"
36
+ v-model="selectedLocation"
37
+ :data-id="`vm-wizard-network-field-${props.index}`"
38
+ :class="`vm-wizard-network-field-${props.index} input-text-color`"
39
+ :disabled="props.type === 'edit' && state !== 1"
40
+ @click.stop
41
+ @change="changeLocation"
42
+ >
43
+ <option
44
+ v-for="(item, key) in locationOptions"
45
+ :key="key"
46
+ :value="item.value"
47
+ >
48
+ {{ item.text }}
49
+ </option>
50
+ </select>
51
+ </div>
52
+ </template>
53
+ <template #content>{{ apiError }}</template>
54
+ </atoms-tooltip-error>
55
+ </div>
56
+ </template>
57
+ <template #stackChildren>
58
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-adapter-type
59
+ v-model:adapter-type="adapterType"
60
+ :index="props.index"
61
+ :disabled="props.type === 'edit' || isRunning"
62
+ :error-validation-fields="props.errorValidationFields"
63
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
64
+ />
65
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-mac-address
66
+ v-model:mac-address="macAddress"
67
+ v-model:mac-address-type="macAddressType"
68
+ :index="props.index"
69
+ :disabled="props.type === 'edit'"
70
+ :error-validation-fields="props.errorValidationFields"
71
+ @invalid="newNetworkInvalid = $event"
72
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
73
+ />
74
+ </template>
75
+ </atoms-stack-block>
76
+
77
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-location
78
+ :location-modal-is-show="locationModalIsShow"
79
+ :networks-table="networksTable"
80
+ @hide="onHideLocationModal"
81
+ @select="onSelectLocation"
82
+ />
83
+ </div>
84
+ </template>
85
+
86
+ <script setup lang="ts">
87
+ import { UI_T_Project } from '~/lib/models/types'
88
+ import { UI_I_TablePayload } from '~/lib/models/table/interfaces'
89
+ import { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
90
+ import { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
91
+ import { UI_I_SendDataNewNetwork } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
92
+ import { UI_T_NetworkType } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/types'
93
+ import {
94
+ UI_I_Localization,
95
+ UI_I_HTMLSelectElement,
96
+ } from '~/lib/models/interfaces'
97
+ import { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
98
+
99
+ const props = defineProps<{
100
+ project: UI_T_Project
101
+ index: number
102
+ type: UI_T_NetworkType
103
+ network: UI_I_SendDataNewNetwork
104
+ networksTable: UI_I_NetworkTableItem[]
105
+ errorValidationFields: UI_I_ErrorValidationField[]
106
+ isEdit: boolean
107
+ state?: string | number
108
+ }>()
109
+
110
+ const emits = defineEmits<{
111
+ (event: 'send-data', value: UI_I_SendDataNewNetwork): void
112
+ (event: 'invalid', value: boolean): void
113
+ (event: 'remove'): void
114
+ (event: 'remove-error-by-title', value: string): void
115
+ (event: 'get-networks-table', value: UI_I_TablePayload): void
116
+ }>()
117
+
118
+ const localization = computed<UI_I_Localization>(() => useLocal())
119
+
120
+ const isRunning = computed<boolean>(() => {
121
+ return props.state === 2
122
+ })
123
+
124
+ const isRemovable = computed<boolean>(() => {
125
+ return (
126
+ !props.isEdit ||
127
+ !isRunning.value ||
128
+ (isRunning.value && adapterType.value === 'virtio')
129
+ )
130
+ })
131
+
132
+ const label = computed<string>(() => {
133
+ if (props.type === 'edit')
134
+ return `${localization.value.networkAdapter} ${props.index + 1}`
135
+
136
+ return `${localization.value.newNetwork} *`
137
+ })
138
+
139
+ const removeNetwork = (): void => {
140
+ emits('remove')
141
+ }
142
+
143
+ const selectedLocationOld = ref<string>('')
144
+ const selectedLocation = ref<string>('')
145
+ const locationOptions = ref<UI_I_OptionItem[]>([])
146
+
147
+ const getNetworks = (): void => {
148
+ // if (props.networksTable.length) return // Из-за этого кода был баг. Открыть визард вм -> создать сеть -> открыть визард вм и в списке сетей нету новой сети
149
+
150
+ const payload: UI_I_TablePayload = {
151
+ pagination: {
152
+ page: 1,
153
+ pageSize: 100,
154
+ },
155
+ schema: 'full',
156
+ type: 'network',
157
+ sortBy: null,
158
+ }
159
+ emits('get-networks-table', payload)
160
+ }
161
+ getNetworks()
162
+
163
+ const valueProp: 'net_bridge' | 'id' =
164
+ props.project === 'procurator' ? 'net_bridge' : 'id'
165
+ watch(
166
+ () => props.networksTable,
167
+ (newValue) => {
168
+ const isExistValue = newValue.some(
169
+ (network) => network[valueProp] === selectedLocation.value
170
+ )
171
+ if (!newValue.length || props.type === 'edit' || isExistValue) return
172
+
173
+ selectedLocationOld.value = newValue[0][valueProp]
174
+ selectedLocation.value = newValue[0][valueProp]
175
+
176
+ locationOptions.value = [
177
+ { text: newValue[0].name, value: newValue[0][valueProp] },
178
+ { text: `${localization.value.browse}...`, value: '' },
179
+ ]
180
+ },
181
+ { immediate: true }
182
+ )
183
+
184
+ const locationModalIsShow = ref<boolean>(false)
185
+ const onHideLocationModal = (): void => {
186
+ locationModalIsShow.value = false
187
+ selectedLocation.value = selectedLocationOld.value
188
+ }
189
+ const changeLocation = (event: UI_I_HTMLSelectElement): void => {
190
+ const value = event.target.value
191
+ if (value === '') {
192
+ locationModalIsShow.value = true
193
+ return
194
+ }
195
+
196
+ selectedLocationOld.value = value
197
+ selectedLocation.value = value
198
+ // netBridge.value = value
199
+ }
200
+ const onSelectLocation = (network: UI_I_NetworkTableItem): void => {
201
+ locationModalIsShow.value = false
202
+
203
+ selectedLocationOld.value = network[valueProp]
204
+ selectedLocation.value = network[valueProp]
205
+
206
+ const hasNetwork = locationOptions.value.some(
207
+ (option) => option.value === network[valueProp]
208
+ )
209
+ if (hasNetwork) {
210
+ return
211
+ }
212
+
213
+ locationOptions.value = [
214
+ ...locationOptions.value.slice(0, -1),
215
+ { text: network.name, value: network[valueProp] },
216
+ locationOptions.value[locationOptions.value.length - 1],
217
+ ]
218
+ }
219
+
220
+ const adapterType = ref<string>('rtl8139')
221
+
222
+ const target = ref<string>('')
223
+
224
+ const macAddress = ref<string>('')
225
+ const macAddressType = ref<string>('automatic')
226
+ const newNetworkInvalid = ref<boolean>(false)
227
+ watch(
228
+ newNetworkInvalid,
229
+ (newValue) => {
230
+ emits('invalid', newValue)
231
+ },
232
+ { immediate: true }
233
+ )
234
+
235
+ watch(
236
+ [selectedLocation, adapterType, macAddress, macAddressType, locationOptions],
237
+ () => {
238
+ const option = locationOptions.value.find(
239
+ (option) => option.value === selectedLocation.value
240
+ )
241
+ if (!option) return
242
+
243
+ emits('send-data', {
244
+ network: option.text,
245
+ net_bridge: props.project === 'procurator' ? option.value : '',
246
+ target: target.value,
247
+ model: adapterType.value,
248
+ mac: macAddress.value,
249
+ boot_order: props.network.boot_order,
250
+ })
251
+ },
252
+ { immediate: true }
253
+ )
254
+
255
+ // Добавляем данные для редактирования
256
+ watch(
257
+ () => props.network,
258
+ (newValue) => {
259
+ if (props.type !== 'edit') return
260
+
261
+ locationOptions.value = [
262
+ { text: newValue.network, value: newValue[valueProp] },
263
+ { text: `${localization.value.browse}...`, value: '' },
264
+ ]
265
+ selectedLocation.value = newValue[valueProp]
266
+
267
+ adapterType.value = newValue.model
268
+ macAddress.value = newValue.mac
269
+ target.value = newValue.target
270
+ },
271
+ { immediate: true }
272
+ )
273
+
274
+ watch(
275
+ isRunning,
276
+ (newValue) => {
277
+ if (newValue && props.type === 'new') {
278
+ adapterType.value = 'virtio'
279
+ }
280
+ },
281
+ { immediate: true }
282
+ )
283
+
284
+ const typeError = computed<string>(
285
+ () => `network_devices[${props.index}].network`
286
+ )
287
+
288
+ const apiError = computed<string>(() => {
289
+ return (
290
+ props.errorValidationFields?.find(
291
+ (message) => message.field === typeError.value
292
+ )?.error_message || ''
293
+ )
294
+ })
295
+
296
+ const onRemoveValidationError = (): void => {
297
+ emits('remove-error-by-title', typeError.value)
298
+ }
299
+ </script>
300
+
301
+ <style scoped lang="scss">
302
+ #network-connect {
303
+ margin-right: 4px;
304
+ }
305
+ </style>