bfg-common 1.3.239 → 1.3.241

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 (163) hide show
  1. package/components/common/BadBrowser.vue +16 -12
  2. package/components/common/accordion/Accordion.vue +1 -0
  3. package/components/common/accordion/Recursion.vue +2 -0
  4. package/components/common/accordion/lib/models/interfaces.ts +1 -0
  5. package/components/common/adapterManager/AddAdapterModal.vue +11 -4
  6. package/components/common/adapterManager/AddAdapterWarningModal.vue +1 -0
  7. package/components/common/adapterManager/ui/actions/AddAdapterButton.vue +2 -0
  8. package/components/common/adapterManager/ui/actions/MoveDownAdapterButton.vue +2 -0
  9. package/components/common/adapterManager/ui/actions/MoveUpAdapterButton.vue +2 -0
  10. package/components/common/adapterManager/ui/actions/RemoveAdapterButton.vue +2 -0
  11. package/components/common/adapterManager/ui/table/Adapters.vue +14 -13
  12. package/components/common/adapterManager/ui/table/Header.vue +6 -4
  13. package/components/common/adapterManager/ui/table/Table.vue +13 -4
  14. package/components/common/browse/Browse.vue +5 -1
  15. package/components/common/browse/blocks/Container.vue +3 -0
  16. package/components/common/browse/blocks/contents/Files.vue +1 -0
  17. package/components/common/context/ContextRecursion.vue +6 -1
  18. package/components/common/details/DetailsItem.vue +3 -0
  19. package/components/common/diagramMain/Header.vue +4 -0
  20. package/components/common/diagramMain/adapter/AdapterItem.vue +2 -0
  21. package/components/common/diagramMain/adapter/Contents.vue +2 -0
  22. package/components/common/diagramMain/lib/models/interfaces.ts +10 -0
  23. package/components/common/diagramMain/modals/editSettings/tabs/NetworkProperties.vue +1 -0
  24. package/components/common/diagramMain/modals/editSettings/tabs/Security.vue +13 -27
  25. package/components/common/diagramMain/modals/editSettings/tabs/SwitchProperties.vue +1 -0
  26. package/components/common/diagramMain/modals/editSettings/tabs/TeamingFailover.vue +3 -0
  27. package/components/common/diagramMain/modals/editSettings/tabs/TrafficShaping.vue +8 -0
  28. package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +6 -0
  29. package/components/common/diagramMain/modals/editSettings/tabs/port/PortProperties.vue +2 -0
  30. package/components/common/diagramMain/modals/lib/config/networkModal.ts +4 -0
  31. package/components/common/diagramMain/modals/lib/config/portModal.ts +7 -2
  32. package/components/common/diagramMain/modals/lib/mappers/mappers.ts +36 -0
  33. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/ConnectionSettings.vue +19 -13
  34. package/components/common/diagramMain/modals/remove/RemoveModal.vue +5 -0
  35. package/components/common/diagramMain/modals/viewSettings/ViewSettings.vue +11 -7
  36. package/components/common/diagramMain/network/Contents.vue +5 -4
  37. package/components/common/diagramMain/port/Port.vue +1 -0
  38. package/components/common/feedback/Buttons.vue +2 -0
  39. package/components/common/feedback/Feedback.vue +9 -2
  40. package/components/common/feedback/Message.vue +9 -0
  41. package/components/common/feedback/VisitPortal.vue +11 -2
  42. package/components/common/help/navbar/left/Left.vue +1 -0
  43. package/components/common/help/navbar/right/Right.vue +12 -2
  44. package/components/common/help/navbar/right/lib/models/interfaces.ts +1 -0
  45. package/components/common/home/alertsTable/AlertsTable.vue +1 -0
  46. package/components/common/modals/Confirmation.vue +10 -2
  47. package/components/common/modals/Rename.vue +1 -0
  48. package/components/common/monitor/advanced/tools/Tools.vue +10 -1
  49. package/components/common/monitor/advanced/tools/chartOptionsModal/actions/Actions.vue +7 -1
  50. package/components/common/monitor/advanced/tools/chartOptionsModal/actions/saveOptionsModal/SaveOptionsModal.vue +6 -1
  51. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/Form.vue +14 -1
  52. package/components/common/monitor/overview/filters/Filters.vue +12 -5
  53. package/components/common/monitor/overview/filters/customIntervalModal/CustomIntervalModal.vue +4 -0
  54. package/components/common/pages/Tasks.vue +120 -120
  55. package/components/common/perPage/PerPage.vue +1 -0
  56. package/components/common/recursionTree/RecursionTree.vue +205 -203
  57. package/components/common/recursionTree/lib/models/interfaces.ts +4 -2
  58. package/components/common/select/button/ButtonDropdown.vue +2 -0
  59. package/components/common/select/button/lib/models/interfaces.ts +1 -0
  60. package/components/common/select/input/Input.vue +1 -0
  61. package/components/common/select/radio/RadioGroup.vue +2 -0
  62. package/components/common/select/radio/lib/models/interfaces.ts +1 -0
  63. package/components/common/shortcuts/Block.vue +2 -0
  64. package/components/common/shortcuts/Category.vue +1 -0
  65. package/components/common/shortcuts/lib/models/interfaces.ts +1 -0
  66. package/components/common/spiceConsole/Drawer.vue +4 -0
  67. package/components/common/spiceConsole/keyboard/Keyboard.vue +1 -0
  68. package/components/common/spiceConsole/keyboard/lib/config/keyboardRows.ts +81 -6
  69. package/components/common/spiceConsole/keyboard/lib/models/interfaces.ts +1 -0
  70. package/components/common/split/horizontal/Horizontal.vue +1 -0
  71. package/components/common/vm/actions/add/Add.vue +576 -575
  72. package/components/common/vm/actions/clone/select/options/Options.vue +9 -3
  73. package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/Bus.vue +5 -1
  74. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue +7 -2
  75. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/Media.vue +2 -0
  76. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CoresPerSocket.vue +1 -0
  77. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuHotPlug.vue +1 -0
  78. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuModel.vue +225 -220
  79. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Hv.vue +2 -0
  80. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Iommu.vue +1 -0
  81. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Pc.vue +1 -0
  82. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Sa.vue +2 -0
  83. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/Shares.vue +5 -1
  84. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/tooltip/Tooltip.vue +1 -0
  85. package/components/common/vm/actions/common/customizeHardware/virtualHardware/limit/Limit.vue +2 -1
  86. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +1 -0
  87. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/MemoryHotPlug.vue +1 -0
  88. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/Location.vue +6 -6
  89. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +5 -6
  90. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/cache/Cache.vue +1 -0
  91. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/limitIops/LimitIops.vue +1 -0
  92. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/mode/Mode.vue +1 -0
  93. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/provisioning/Provisioning.vue +1 -0
  94. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/sharing/Sharing.vue +1 -0
  95. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/Location.vue +2 -0
  96. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +295 -294
  97. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/adapterType/AdapterType.vue +1 -0
  98. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +12 -4
  99. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIo.vue +5 -1
  100. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/NvidiaGrid.vue +2 -1
  101. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/typeSelection/TypeSelection.vue +2 -1
  102. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +1 -0
  103. package/components/common/vm/actions/common/customizeHardware/virtualHardware/reservation/Reservation.vue +3 -1
  104. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/Graphics.vue +6 -1
  105. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/TotalVideoMemory.vue +2 -1
  106. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +1 -0
  107. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/model/Model.vue +1 -0
  108. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/numberDisplays/NumberDisplays.vue +1 -0
  109. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/Menu.vue +6 -1
  110. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/Secure.vue +6 -1
  111. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/delay/Delay.vue +5 -1
  112. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +1 -0
  113. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +5 -1
  114. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/lib/models/interfaces.ts +1 -0
  115. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +4 -1
  116. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/CopyPaste.vue +1 -0
  117. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/FileTransfer.vue +1 -0
  118. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/FolderSharing.vue +1 -0
  119. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/PlaybackCompression.vue +1 -0
  120. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/PowerControl.vue +1 -0
  121. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/imgCompression/ImgCompression.vue +1 -0
  122. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/jpegCompression/JpegCompression.vue +1 -0
  123. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +2 -1
  124. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/mouseMode/MouseMode.vue +6 -1
  125. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/Password.vue +7 -1
  126. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/sharePolicy/SharePolicy.vue +5 -1
  127. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/streamingMode/StreamingMode.vue +1 -0
  128. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/type/Type.vue +1 -0
  129. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirection.vue +2 -1
  130. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/zlibCompression/ZlibCompression.vue +1 -0
  131. package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/Tools.vue +6 -1
  132. package/components/common/vm/actions/common/select/compatibility/Compatibility.vue +31 -27
  133. package/components/common/vm/actions/common/select/name/Name.vue +7 -1
  134. package/components/common/vm/actions/common/select/os/os.vue +7 -1
  135. package/components/common/weekSelect/WeekSelect.vue +143 -112
  136. package/components/common/weekSelect/lib/models/interfaces.ts +1 -0
  137. package/components/common/wizards/datastore/add/local/createName/CreateName.vue +1 -0
  138. package/components/common/wizards/datastore/add/nfs/accessibility/Accessibility.vue +8 -7
  139. package/components/common/wizards/datastore/add/nfs/configuration/Configuration.vue +9 -1
  140. package/components/common/wizards/datastore/add/nfs/configuration/serversList/DeletePopover.vue +6 -3
  141. package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +1 -0
  142. package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/lib/config/radioOptions.ts +3 -0
  143. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/DeviceSelection.vue +2 -0
  144. package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +2 -0
  145. package/components/common/wizards/datastore/add/types/Types.vue +1 -0
  146. package/components/common/wizards/network/add/modals/SelectNetwork.vue +16 -3
  147. package/components/common/wizards/network/add/modals/SelectStandardSwitch.vue +10 -2
  148. package/components/common/wizards/network/add/modals/SelectSwitch.vue +10 -2
  149. package/components/common/wizards/network/add/steps/ConnectionSettings.vue +5 -1
  150. package/components/common/wizards/network/add/steps/IpFourSettings.vue +12 -2
  151. package/components/common/wizards/network/add/steps/PortProperties.vue +16 -3
  152. package/components/common/wizards/network/add/steps/SelectConnectionType.vue +6 -3
  153. package/components/common/wizards/network/add/steps/SelectedTargetDevice.vue +11 -0
  154. package/components/common/wizards/vm/common/tooltip/Tooltip.vue +2 -0
  155. package/components/common/wizards/vm/migrate/select/network/Network.vue +1 -0
  156. package/components/common/wizards/vm/migrate/select/network/table/network/Network.vue +1 -0
  157. package/components/common/wizards/vm/migrate/select/storage/Storage.vue +5 -1
  158. package/components/common/wizards/vm/migrate/select/storage/configure/disk/Disk.vue +1 -0
  159. package/components/common/wizards/vm/migrate/select/storage/diskFormat/DiskFormat.vue +1 -0
  160. package/components/common/wizards/vm/migrate/select/storage/policy/Policy.vue +1 -0
  161. package/components/common/wizards/vm/migrate/select/storage/selectedPerDisk/SelectedPerDisk.vue +1 -0
  162. package/components/common/wizards/vm/migrate/select/targetServer/new/New.vue +9 -1
  163. package/package.json +1 -1
@@ -1,294 +1,295 @@
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
+ :data-id="`vm-wizard-network-field-${props.index}`"
33
+ :class="`vm-wizard-network-field-${props.index} input-text-color`"
34
+ :disabled="props.type === 'edit' && state !== 1"
35
+ @click.stop
36
+ @change="changeLocation"
37
+ >
38
+ <option
39
+ v-for="(item, key) in locationOptions"
40
+ :key="key"
41
+ :value="item.value"
42
+ >
43
+ {{ item.text }}
44
+ </option>
45
+ </select>
46
+ </div>
47
+ </template>
48
+ <template #content>{{ apiError }}</template>
49
+ </atoms-tooltip-error>
50
+ </div>
51
+ </template>
52
+ <template #stackChildren>
53
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-adapter-type
54
+ v-model:adapter-type="adapterType"
55
+ :index="props.index"
56
+ :disabled="props.type === 'edit' || isRunning"
57
+ :error-validation-fields="props.errorValidationFields"
58
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
59
+ />
60
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-mac-address
61
+ v-model:mac-address="macAddress"
62
+ v-model:mac-address-type="macAddressType"
63
+ :index="props.index"
64
+ :disabled="props.type === 'edit'"
65
+ :error-validation-fields="props.errorValidationFields"
66
+ @invalid="newNetworkInvalid = $event"
67
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
68
+ />
69
+ </template>
70
+ </atoms-stack-block>
71
+
72
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-network-location
73
+ :location-modal-is-show="locationModalIsShow"
74
+ :networks-table="networksTable"
75
+ @hide="onHideLocationModal"
76
+ @select="onSelectLocation"
77
+ />
78
+ </div>
79
+ </template>
80
+
81
+ <script setup lang="ts">
82
+ import { UI_I_TablePayload } from '~/lib/models/table/interfaces'
83
+ import { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
84
+ import { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
85
+ import { UI_I_SendDataNewNetwork } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
86
+ import { UI_T_NetworkType } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/types'
87
+ import {
88
+ UI_I_Localization,
89
+ UI_I_HTMLSelectElement,
90
+ } from '~/lib/models/interfaces'
91
+ import { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
92
+
93
+ const props = defineProps<{
94
+ index: number
95
+ type: UI_T_NetworkType
96
+ network: UI_I_SendDataNewNetwork
97
+ networksTable: UI_I_NetworkTableItem[]
98
+ errorValidationFields: UI_I_ErrorValidationField[]
99
+ isEdit: boolean
100
+ state?: string | number
101
+ }>()
102
+
103
+ const emits = defineEmits<{
104
+ (event: 'send-data', value: UI_I_SendDataNewNetwork): void
105
+ (event: 'invalid', value: boolean): void
106
+ (event: 'remove'): void
107
+ (event: 'remove-error-by-title', value: string): void
108
+ (event: 'get-networks-table', value: UI_I_TablePayload): void
109
+ }>()
110
+
111
+ const localization = computed<UI_I_Localization>(() => useLocal())
112
+
113
+ const isRunning = computed<boolean>(() => {
114
+ return props.state === 2
115
+ })
116
+
117
+ const isRemovable = computed<boolean>(() => {
118
+ return (
119
+ !props.isEdit ||
120
+ !isRunning.value ||
121
+ (isRunning.value && adapterType.value === 'virtio')
122
+ )
123
+ })
124
+
125
+ const label = computed<string>(() => {
126
+ if (props.type === 'edit')
127
+ return `${localization.value.networkAdapter} ${props.index + 1}`
128
+
129
+ return `${localization.value.newNetwork} *`
130
+ })
131
+
132
+ const removeNetwork = (): void => {
133
+ emits('remove')
134
+ }
135
+
136
+ const selectedLocationOld = ref<string>('')
137
+ const selectedLocation = ref<string>('')
138
+ const locationOptions = ref<UI_I_OptionItem[]>([])
139
+
140
+ const getNetworks = (): void => {
141
+ // if (props.networksTable.length) return // Из-за этого кода был баг. Открыть визард вм -> создать сеть -> открыть визард вм и в списке сетей нету новой сети
142
+
143
+ const payload: UI_I_TablePayload = {
144
+ pagination: {
145
+ page: 1,
146
+ pageSize: 100,
147
+ },
148
+ schema: 'full',
149
+ type: 'network',
150
+ sortBy: null,
151
+ }
152
+ emits('get-networks-table', payload)
153
+ }
154
+ getNetworks()
155
+ watch(
156
+ () => props.networksTable,
157
+ (newValue) => {
158
+ const isExistValue = newValue.some(
159
+ (network) => network.net_bridge === selectedLocation.value
160
+ )
161
+ if (!newValue.length || props.type === 'edit' || isExistValue) return
162
+
163
+ selectedLocationOld.value = newValue[0].net_bridge
164
+ selectedLocation.value = newValue[0].net_bridge
165
+
166
+ locationOptions.value = [
167
+ { text: newValue[0].name, value: newValue[0].net_bridge },
168
+ { text: `${localization.value.browse}...`, value: '' },
169
+ ]
170
+ },
171
+ { immediate: true }
172
+ )
173
+
174
+ const locationModalIsShow = ref<boolean>(false)
175
+ const onHideLocationModal = (): void => {
176
+ locationModalIsShow.value = false
177
+ selectedLocation.value = selectedLocationOld.value
178
+ }
179
+ const changeLocation = (event: UI_I_HTMLSelectElement): void => {
180
+ const value = event.target.value
181
+ if (value === '') {
182
+ locationModalIsShow.value = true
183
+ return
184
+ }
185
+
186
+ selectedLocationOld.value = value
187
+ selectedLocation.value = value
188
+ // netBridge.value = value
189
+ }
190
+ const onSelectLocation = (network: UI_I_NetworkTableItem): void => {
191
+ locationModalIsShow.value = false
192
+
193
+ selectedLocationOld.value = network.net_bridge
194
+ selectedLocation.value = network.net_bridge
195
+
196
+ const hasNetwork = locationOptions.value.some(
197
+ (option) => option.value === network.net_bridge
198
+ )
199
+ if (hasNetwork) {
200
+ return
201
+ }
202
+
203
+ locationOptions.value = [
204
+ ...locationOptions.value.slice(0, -1),
205
+ { text: network.name, value: network.net_bridge },
206
+ locationOptions.value[locationOptions.value.length - 1],
207
+ ]
208
+ }
209
+
210
+ const adapterType = ref<string>('rtl8139')
211
+
212
+ const target = ref<string>('')
213
+
214
+ const macAddress = ref<string>('')
215
+ const macAddressType = ref<string>('automatic')
216
+ const newNetworkInvalid = ref<boolean>(false)
217
+ watch(
218
+ newNetworkInvalid,
219
+ (newValue) => {
220
+ emits('invalid', newValue)
221
+ },
222
+ { immediate: true }
223
+ )
224
+
225
+ watch(
226
+ [selectedLocation, adapterType, macAddress, macAddressType, locationOptions],
227
+ () => {
228
+ const option = locationOptions.value.find(
229
+ (option) => option.value === selectedLocation.value
230
+ )
231
+ if (!option) return
232
+
233
+ emits('send-data', {
234
+ network: option.text,
235
+ net_bridge: option.value,
236
+ target: target.value,
237
+ model: adapterType.value,
238
+ mac: macAddress.value,
239
+ boot_order: props.network.boot_order,
240
+ })
241
+ },
242
+ { immediate: true }
243
+ )
244
+
245
+ // Добавляем данные для редактирования
246
+ watch(
247
+ () => props.network,
248
+ (newValue) => {
249
+ if (props.type !== 'edit') return
250
+
251
+ locationOptions.value = [
252
+ { text: newValue.network, value: newValue.net_bridge },
253
+ { text: `${localization.value.browse}...`, value: '' },
254
+ ]
255
+ selectedLocation.value = newValue.net_bridge
256
+
257
+ adapterType.value = newValue.model
258
+ macAddress.value = newValue.mac
259
+ target.value = newValue.target
260
+ },
261
+ { immediate: true }
262
+ )
263
+
264
+ watch(
265
+ isRunning,
266
+ (newValue) => {
267
+ if (newValue && props.type === 'new') {
268
+ adapterType.value = 'virtio'
269
+ }
270
+ },
271
+ { immediate: true }
272
+ )
273
+
274
+ const typeError = computed<string>(
275
+ () => `network_devices[${props.index}].network`
276
+ )
277
+
278
+ const apiError = computed<string>(() => {
279
+ return (
280
+ props.errorValidationFields?.find(
281
+ (message) => message.field === typeError.value
282
+ )?.error_message || ''
283
+ )
284
+ })
285
+
286
+ const onRemoveValidationError = (): void => {
287
+ emits('remove-error-by-title', typeError.value)
288
+ }
289
+ </script>
290
+
291
+ <style scoped lang="scss">
292
+ #network-connect {
293
+ margin-right: 4px;
294
+ }
295
+ </style>
@@ -15,6 +15,7 @@
15
15
  <select
16
16
  :id="`vm-wizard-network-model-field-${props.index}`"
17
17
  v-model="adapterTypeLocal"
18
+ :data-id="`vm-wizard-network-model-field-${props.index}`"
18
19
  :class="`vm-wizard-network-model-field-${props.index}`"
19
20
  :disabled="props.disabled"
20
21
  >
@@ -13,9 +13,10 @@
13
13
  >
14
14
  <template #elem>
15
15
  <input
16
- :id="[`vm-wizard-network-mac-address-field-${props.index}`]"
16
+ :id="`vm-wizard-network-mac-address-field-${props.index}`"
17
17
  type="text"
18
18
  :value="props.macAddress"
19
+ :data-id="`vm-wizard-network-mac-address-field-${props.index}`"
19
20
  :disabled="
20
21
  props.macAddressType === 'automatic' || props.disabled
21
22
  "
@@ -33,8 +34,9 @@
33
34
 
34
35
  <div class="select">
35
36
  <select
36
- :id="`mac-address-select-${props.index}`"
37
+ :id="`mac-address-select-${props.index}`"
37
38
  :value="props.macAddressType"
39
+ :data-id="`mac-address-select-${props.index}`"
38
40
  :disabled="props.disabled"
39
41
  @change="onChangeMacAddressType"
40
42
  >
@@ -54,7 +56,10 @@
54
56
  </template>
55
57
 
56
58
  <script setup lang="ts">
57
- import { UI_I_Localization, UI_I_HTMLSelectElement } from '~/lib/models/interfaces'
59
+ import {
60
+ UI_I_Localization,
61
+ UI_I_HTMLSelectElement,
62
+ } from '~/lib/models/interfaces'
58
63
  import { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
59
64
  import { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
60
65
  import { macAddressOptionsFunc } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/lib/config/options'
@@ -81,7 +86,10 @@ const macAddressOptions = ref<UI_I_OptionItem[]>(
81
86
 
82
87
  const onChangeMacAddressType = (event: UI_I_HTMLSelectElement): void => {
83
88
  emits('update:mac-address-type', event.target.value)
84
- emits('update:mac-address', event.target.value === 'manual' ? '00:50:56:' : '')
89
+ emits(
90
+ 'update:mac-address',
91
+ event.target.value === 'manual' ? '00:50:56:' : ''
92
+ )
85
93
  }
86
94
  const onChangeMacAddress = (event: Event): void => {
87
95
  const target = event.target as HTMLInputElement