bfg-common 1.3.394 → 1.3.395

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