bfg-common 1.3.313 → 1.3.314
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.
- package/components/common/vm/actions/common/select/storage/lib/config/config.ts +16 -14
- package/package.json +1 -1
- package/components/common/vm/actions/common/customizeHardware/CustomizeHardwareOld.vue +0 -267
- package/components/common/vm/actions/common/select/name/NameOld.vue +0 -215
- package/components/common/vm/actions/common/select/storage/StorageOld.vue +0 -193
|
@@ -93,19 +93,21 @@ export const bodyItems = (
|
|
|
93
93
|
data.forEach((storage: UI_I_DatastoreTableItem, key: number) => {
|
|
94
94
|
const state =
|
|
95
95
|
localization[datastoreLocalizationByState[storage[storageTableKeys[1]]]]
|
|
96
|
+
const storageName = storage[storageTableKeys[0]].toString()
|
|
97
|
+
|
|
96
98
|
bodyItems.push([
|
|
97
99
|
{
|
|
98
100
|
key: 'icon',
|
|
99
|
-
text:
|
|
101
|
+
text: storageName,
|
|
100
102
|
data: `vsphere-icon-${datastoreIconByState[storage.state]}`,
|
|
101
103
|
id: key,
|
|
102
|
-
testId: `storage-table-item-${
|
|
104
|
+
testId: `storage-table-item-${storageName}`,
|
|
103
105
|
},
|
|
104
106
|
{
|
|
105
107
|
key: 'col1',
|
|
106
108
|
text: state,
|
|
107
109
|
id: key,
|
|
108
|
-
testId: `storage-table-item-${
|
|
110
|
+
testId: `storage-table-item-${storageName}`,
|
|
109
111
|
},
|
|
110
112
|
{
|
|
111
113
|
key: 'col2',
|
|
@@ -114,7 +116,7 @@ export const bodyItems = (
|
|
|
114
116
|
sortValue: storage.capacity[storageTableKeys[2]],
|
|
115
117
|
},
|
|
116
118
|
id: key,
|
|
117
|
-
testId: `storage-table-item-${
|
|
119
|
+
testId: `storage-table-item-${storageName}`,
|
|
118
120
|
},
|
|
119
121
|
{
|
|
120
122
|
key: 'col3',
|
|
@@ -123,7 +125,7 @@ export const bodyItems = (
|
|
|
123
125
|
sortValue: storage.capacity[storageTableKeys[3]],
|
|
124
126
|
},
|
|
125
127
|
id: key,
|
|
126
|
-
testId: `storage-table-item-${
|
|
128
|
+
testId: `storage-table-item-${storageName}`,
|
|
127
129
|
},
|
|
128
130
|
{
|
|
129
131
|
key: 'col4',
|
|
@@ -132,7 +134,7 @@ export const bodyItems = (
|
|
|
132
134
|
sortValue: storage.capacity[storageTableKeys[4]],
|
|
133
135
|
},
|
|
134
136
|
id: key,
|
|
135
|
-
testId: `storage-table-item-${
|
|
137
|
+
testId: `storage-table-item-${storageName}`,
|
|
136
138
|
},
|
|
137
139
|
{
|
|
138
140
|
key: 'col5',
|
|
@@ -141,49 +143,49 @@ export const bodyItems = (
|
|
|
141
143
|
sortValue: storage.capacity[storageTableKeys[5]],
|
|
142
144
|
},
|
|
143
145
|
id: key,
|
|
144
|
-
testId: `storage-table-item-${
|
|
146
|
+
testId: `storage-table-item-${storageName}`,
|
|
145
147
|
},
|
|
146
148
|
{
|
|
147
149
|
key: 'col6',
|
|
148
150
|
text: storage[storageTableKeys[6]].toString(),
|
|
149
151
|
id: key,
|
|
150
|
-
testId: `storage-table-item-${
|
|
152
|
+
testId: `storage-table-item-${storageName}`,
|
|
151
153
|
},
|
|
152
154
|
{
|
|
153
155
|
key: 'col7',
|
|
154
156
|
text: storage[storageTableKeys[7]] ? localization.yes : localization.no,
|
|
155
157
|
id: key,
|
|
156
|
-
testId: `storage-table-item-${
|
|
158
|
+
testId: `storage-table-item-${storageName}`,
|
|
157
159
|
},
|
|
158
160
|
{
|
|
159
161
|
key: 'col8',
|
|
160
162
|
text: storage[storageTableKeys[8]].toString(),
|
|
161
163
|
id: key,
|
|
162
|
-
testId: `storage-table-item-${
|
|
164
|
+
testId: `storage-table-item-${storageName}`,
|
|
163
165
|
},
|
|
164
166
|
{
|
|
165
167
|
key: 'col9',
|
|
166
168
|
text: storage[storageTableKeys[9]].toString(),
|
|
167
169
|
id: key,
|
|
168
|
-
testId: `storage-table-item-${
|
|
170
|
+
testId: `storage-table-item-${storageName}`,
|
|
169
171
|
},
|
|
170
172
|
{
|
|
171
173
|
key: 'col10',
|
|
172
174
|
text: storage[storageTableKeys[10]].toString(),
|
|
173
175
|
id: key,
|
|
174
|
-
testId: `storage-table-item-${
|
|
176
|
+
testId: `storage-table-item-${storageName}`,
|
|
175
177
|
},
|
|
176
178
|
{
|
|
177
179
|
key: 'col11',
|
|
178
180
|
text: storage[storageTableKeys[11]].toString(),
|
|
179
181
|
id: key,
|
|
180
|
-
testId: `storage-table-item-${
|
|
182
|
+
testId: `storage-table-item-${storageName}`,
|
|
181
183
|
},
|
|
182
184
|
{
|
|
183
185
|
key: 'col12',
|
|
184
186
|
text: storage[storageTableKeys[12]].toString(),
|
|
185
187
|
id: key,
|
|
186
|
-
testId: `storage-table-item-${
|
|
188
|
+
testId: `storage-table-item-${storageName}`,
|
|
187
189
|
},
|
|
188
190
|
])
|
|
189
191
|
})
|
package/package.json
CHANGED
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="customize-hardware">
|
|
3
|
-
<atoms-nav-bar v-model="selectedNavItem" :items="navItems" />
|
|
4
|
-
<atoms-alert
|
|
5
|
-
v-show="errors.length"
|
|
6
|
-
status="alert-danger"
|
|
7
|
-
:items="errors"
|
|
8
|
-
@remove="onRemoveValidationErrors"
|
|
9
|
-
/>
|
|
10
|
-
|
|
11
|
-
<div v-show="selectedNavItem === 0">
|
|
12
|
-
<common-vm-actions-common-customize-hardware-virtual-hardware
|
|
13
|
-
:vm-name="vmNameLocal"
|
|
14
|
-
:storage="props.storage"
|
|
15
|
-
:max-cpus="props.maxCpus"
|
|
16
|
-
:max-memory="props.maxMemory"
|
|
17
|
-
:cpu-models="props.cpuModels"
|
|
18
|
-
:cpu="props.cpu"
|
|
19
|
-
:memory="props.memory"
|
|
20
|
-
:is-edit="props.isEdit"
|
|
21
|
-
:is-clone="props.isClone"
|
|
22
|
-
:state="props.state"
|
|
23
|
-
:hard-disks="props.hardDisks"
|
|
24
|
-
:cd-dvd-drives="props.cdDvdDrives"
|
|
25
|
-
:networks="props.networks"
|
|
26
|
-
:networks-table="props.networksTable"
|
|
27
|
-
:video-card="props.videoCard"
|
|
28
|
-
:usb-controller="props.usbController"
|
|
29
|
-
:pci-devices="props.pciDevices"
|
|
30
|
-
:nodes="props.nodes"
|
|
31
|
-
:files="props.files"
|
|
32
|
-
:error-validation-fields="props.errorValidationFields"
|
|
33
|
-
:get-datastore-table-func="props.getDatastoreTableFunc"
|
|
34
|
-
:datastore="props.datastore"
|
|
35
|
-
:vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
|
|
36
|
-
:passthrough-devices="props.passthroughDevices"
|
|
37
|
-
@send-data="onSendDataVirtualHardwareMethod"
|
|
38
|
-
@get-storage="emits('get-storage', $event)"
|
|
39
|
-
@get-folders-or-files="emits('get-folders-or-files', $event)"
|
|
40
|
-
@get-active-device-child="emits('get-active-device-child', $event)"
|
|
41
|
-
@show-datastore-child="emits('show-datastore-child', $event)"
|
|
42
|
-
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
43
|
-
@invalid="virtualHardwareInvalid = $event"
|
|
44
|
-
@get-networks-table="emits('get-networks-table', $event)"
|
|
45
|
-
@get-pci-devices="emits('get-pci-devices')"
|
|
46
|
-
/>
|
|
47
|
-
</div>
|
|
48
|
-
<div v-show="selectedNavItem === 1">
|
|
49
|
-
<common-vm-actions-common-customize-hardware-vmoptions
|
|
50
|
-
v-model:vm-name="vmNameLocal"
|
|
51
|
-
v-model:guest-machine-type="guestMachineTypeLocal"
|
|
52
|
-
v-model:guest-os-family="guestOsFamilyLocal"
|
|
53
|
-
v-model:guest-os-version="guestOsVersionLocal"
|
|
54
|
-
:hard-disks="props.hardDisksForBootOptions"
|
|
55
|
-
:cd-dvd-drives="props.cdDvdDrivesForBootOptions"
|
|
56
|
-
:networks="props.networksForBootOptions"
|
|
57
|
-
:options="props.options"
|
|
58
|
-
:is-edit="props.isEdit"
|
|
59
|
-
:is-clone="props.isClone"
|
|
60
|
-
:error-validation-fields="props.errorValidationFields"
|
|
61
|
-
:state="props.state"
|
|
62
|
-
@change-boot-order="onChangeBootOrder"
|
|
63
|
-
@send-data="onSendDataVmOptionsMethod"
|
|
64
|
-
@invalid="vmOptionsInvalid = $event"
|
|
65
|
-
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
66
|
-
/>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
</template>
|
|
70
|
-
|
|
71
|
-
<script setup lang="ts">
|
|
72
|
-
import { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
|
|
73
|
-
import { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
|
|
74
|
-
import { UI_I_TablePayload } from '~/lib/models/table/interfaces'
|
|
75
|
-
import { UI_I_FolderOrFileTreePayload } from '~/lib/models/store/storage/interfaces'
|
|
76
|
-
import { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
|
|
77
|
-
import {
|
|
78
|
-
UI_I_SendDataNewPciDevice,
|
|
79
|
-
UI_I_SendDataNewCdDvdDrive,
|
|
80
|
-
UI_I_SendDataNewHardDisk,
|
|
81
|
-
UI_I_SendDataNewNetwork,
|
|
82
|
-
UI_I_SendDataVideoCard,
|
|
83
|
-
UI_I_SendDataVirtualHardware,
|
|
84
|
-
} from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
|
|
85
|
-
import { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
|
|
86
|
-
import { UI_I_SendDataVmoptions } from '~/components/common/vm/actions/common/customizeHardware/vmoptions/lib/models/interfaces'
|
|
87
|
-
import { UI_T_SelectedNavItem } from '~/components/common/vm/actions/common/lib/models/types'
|
|
88
|
-
import { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
|
|
89
|
-
import { UI_I_Localization } from '~/lib/models/interfaces'
|
|
90
|
-
import { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
|
|
91
|
-
import { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
|
|
92
|
-
import { UI_I_ConfigurePciDevicesTable } from '~/lib/models/store/host/interfaces'
|
|
93
|
-
import { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
|
|
94
|
-
import {
|
|
95
|
-
API_UI_I_VmEditCpu,
|
|
96
|
-
API_UI_I_VmEditMemory,
|
|
97
|
-
} from '~/lib/models/store/vm/interfaces'
|
|
98
|
-
import { navItemsFunc } from '~/components/common/vm/actions/common/customizeHardware/lib/config/navItems'
|
|
99
|
-
|
|
100
|
-
const props = defineProps<{
|
|
101
|
-
vmName: string
|
|
102
|
-
errorValidationFields: UI_I_ErrorValidationField[]
|
|
103
|
-
storage: UI_I_DatastoreTableItem | null
|
|
104
|
-
guestMachineType: UI_I_OptionItem | null
|
|
105
|
-
guestOsFamily: UI_I_OptionItem | null
|
|
106
|
-
guestOsVersion: UI_I_OptionItem | null
|
|
107
|
-
cpuModels: UI_I_OptionItem[]
|
|
108
|
-
hardDisksForBootOptions: UI_I_SendDataNewHardDisk[] | null
|
|
109
|
-
cdDvdDrivesForBootOptions: UI_I_SendDataNewCdDvdDrive[] | null
|
|
110
|
-
networksForBootOptions: UI_I_SendDataNewNetwork[] | null
|
|
111
|
-
customizeHardwareSubmit: number
|
|
112
|
-
maxCpus: number
|
|
113
|
-
maxMemory: number
|
|
114
|
-
selectedNavItem: UI_T_SelectedNavItem
|
|
115
|
-
nodes: UI_I_FileTreeNode[]
|
|
116
|
-
files: UI_I_FileTreeNode[]
|
|
117
|
-
networksTable: UI_I_NetworkTableItem[]
|
|
118
|
-
cpu?: API_UI_I_VmEditCpu
|
|
119
|
-
memory?: API_UI_I_VmEditMemory
|
|
120
|
-
vmCpuHelpTextSecond?: string
|
|
121
|
-
getDatastoreTableFunc?: (payload: UI_I_TablePayload) => Promise<void>
|
|
122
|
-
datastore: UI_I_DatastoreTableItem[]
|
|
123
|
-
hardDisks?: UI_I_SendDataNewHardDisk[] | null
|
|
124
|
-
cdDvdDrives?: UI_I_SendDataNewCdDvdDrive[] | null
|
|
125
|
-
networks?: UI_I_SendDataNewNetwork[] | null
|
|
126
|
-
videoCard?: UI_I_SendDataVideoCard
|
|
127
|
-
pciDevices?: UI_I_SendDataNewPciDevice[]
|
|
128
|
-
usbController?: string
|
|
129
|
-
options?: UI_I_SendDataVmoptions
|
|
130
|
-
isEdit?: boolean
|
|
131
|
-
isClone?: boolean
|
|
132
|
-
state?: string | number
|
|
133
|
-
passthroughDevices?: UI_I_ConfigurePciDevicesTable | null
|
|
134
|
-
}>()
|
|
135
|
-
const emits = defineEmits<{
|
|
136
|
-
(
|
|
137
|
-
event: 'change-boot-order',
|
|
138
|
-
value: [
|
|
139
|
-
UI_I_SendDataNewHardDisk[],
|
|
140
|
-
UI_I_SendDataNewCdDvdDrive[],
|
|
141
|
-
UI_I_SendDataNewNetwork[]
|
|
142
|
-
]
|
|
143
|
-
): void
|
|
144
|
-
(event: 'send-data', value: UI_I_SendDataCustomizeHardware): void
|
|
145
|
-
(event: 'next'): void
|
|
146
|
-
(event: 'update:vm-name', value: string): void
|
|
147
|
-
(event: 'update:guest-machine-type', value: UI_I_OptionItem | null): void
|
|
148
|
-
(event: 'update:guest-os-family', value: UI_I_OptionItem | null): void
|
|
149
|
-
(event: 'update:guest-os-version', value: UI_I_OptionItem | null): void
|
|
150
|
-
(event: 'get-storage', value: UI_I_TablePayload): void
|
|
151
|
-
(event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
|
|
152
|
-
(event: 'get-active-device-child', value: UI_I_FileTreeNode): void
|
|
153
|
-
(event: 'show-datastore-child', value: UI_I_FileTreeNode): void
|
|
154
|
-
(event: 'remove-error-by-title', value: string): void
|
|
155
|
-
(event: 'get-networks-table', value: UI_I_TablePayload): void
|
|
156
|
-
(event: 'get-pci-devices'): void
|
|
157
|
-
}>()
|
|
158
|
-
|
|
159
|
-
const vmNameLocal = computed<string>({
|
|
160
|
-
get() {
|
|
161
|
-
return props.vmName
|
|
162
|
-
},
|
|
163
|
-
set(newValue) {
|
|
164
|
-
emits('update:vm-name', newValue)
|
|
165
|
-
},
|
|
166
|
-
})
|
|
167
|
-
const guestMachineTypeLocal = computed<UI_I_OptionItem | null>({
|
|
168
|
-
get() {
|
|
169
|
-
return props.guestMachineType
|
|
170
|
-
},
|
|
171
|
-
set(newValue) {
|
|
172
|
-
emits('update:guest-machine-type', newValue)
|
|
173
|
-
},
|
|
174
|
-
})
|
|
175
|
-
const guestOsFamilyLocal = computed<UI_I_OptionItem | null>({
|
|
176
|
-
get() {
|
|
177
|
-
return props.guestOsFamily
|
|
178
|
-
},
|
|
179
|
-
set(newValue) {
|
|
180
|
-
emits('update:guest-os-family', newValue)
|
|
181
|
-
},
|
|
182
|
-
})
|
|
183
|
-
const guestOsVersionLocal = computed<UI_I_OptionItem | null>({
|
|
184
|
-
get() {
|
|
185
|
-
return props.guestOsVersion
|
|
186
|
-
},
|
|
187
|
-
set(newValue) {
|
|
188
|
-
emits('update:guest-os-version', newValue)
|
|
189
|
-
},
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
193
|
-
|
|
194
|
-
const navItems = computed<UI_I_CollapseNavItem[]>(() =>
|
|
195
|
-
navItemsFunc(localization.value)
|
|
196
|
-
)
|
|
197
|
-
const selectedNavItem = ref<number>(0)
|
|
198
|
-
watch(
|
|
199
|
-
() => props.selectedNavItem,
|
|
200
|
-
(n) => {
|
|
201
|
-
selectedNavItem.value = n
|
|
202
|
-
}
|
|
203
|
-
)
|
|
204
|
-
|
|
205
|
-
const sendDataVirtualHardware = ref<UI_I_SendDataVirtualHardware | null>(null)
|
|
206
|
-
const onSendDataVirtualHardwareMethod = (
|
|
207
|
-
data: UI_I_SendDataVirtualHardware
|
|
208
|
-
): void => {
|
|
209
|
-
sendDataVirtualHardware.value = data
|
|
210
|
-
sendData()
|
|
211
|
-
}
|
|
212
|
-
const sendDataVmOptions = ref<UI_I_SendDataVmoptions | null>(null)
|
|
213
|
-
const onSendDataVmOptionsMethod = (data: UI_I_SendDataVmoptions): void => {
|
|
214
|
-
sendDataVmOptions.value = data
|
|
215
|
-
sendData()
|
|
216
|
-
}
|
|
217
|
-
const sendData = (): void => {
|
|
218
|
-
emits('send-data', {
|
|
219
|
-
virtualHardware: sendDataVirtualHardware.value,
|
|
220
|
-
vmOptions: sendDataVmOptions.value,
|
|
221
|
-
})
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
|
|
225
|
-
emits('change-boot-order', data)
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
watch(
|
|
229
|
-
() => props.customizeHardwareSubmit,
|
|
230
|
-
() => {
|
|
231
|
-
submit()
|
|
232
|
-
}
|
|
233
|
-
)
|
|
234
|
-
const virtualHardwareInvalid = ref<string[]>([])
|
|
235
|
-
const vmOptionsInvalid = ref<string[]>([])
|
|
236
|
-
const submit = (): void => {
|
|
237
|
-
const invalidDevices = [
|
|
238
|
-
...virtualHardwareInvalid.value,
|
|
239
|
-
...vmOptionsInvalid.value,
|
|
240
|
-
]
|
|
241
|
-
.filter((item: string) => !!item)
|
|
242
|
-
.join(', ')
|
|
243
|
-
|
|
244
|
-
if (invalidDevices) {
|
|
245
|
-
showValidationErrors([
|
|
246
|
-
localization.value.thereErrorsFollowingFields.replace(
|
|
247
|
-
'{0}',
|
|
248
|
-
invalidDevices
|
|
249
|
-
),
|
|
250
|
-
])
|
|
251
|
-
return
|
|
252
|
-
}
|
|
253
|
-
onRemoveValidationErrors()
|
|
254
|
-
|
|
255
|
-
emits('next')
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const errors = ref<string[]>([])
|
|
259
|
-
const showValidationErrors = (arr: string[]): void => {
|
|
260
|
-
errors.value = arr
|
|
261
|
-
}
|
|
262
|
-
const onRemoveValidationErrors = (): void => {
|
|
263
|
-
errors.value = []
|
|
264
|
-
}
|
|
265
|
-
</script>
|
|
266
|
-
|
|
267
|
-
<style scoped lang="scss"></style>
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="select-name">
|
|
3
|
-
<atoms-alert
|
|
4
|
-
v-show="errors.length"
|
|
5
|
-
status="alert-danger"
|
|
6
|
-
:items="errors"
|
|
7
|
-
@remove="onRemoveValidationErrors"
|
|
8
|
-
/>
|
|
9
|
-
|
|
10
|
-
<form id="virtual-machine-form" @submit.prevent>
|
|
11
|
-
<label for="virtual-machine-name"
|
|
12
|
-
>{{ localization.virtualMachineName }}:</label
|
|
13
|
-
>
|
|
14
|
-
<input id="virtual-machine-name" v-model.trim="vmName" type="text" />
|
|
15
|
-
<div id="vm-name-help-icon" class="content-signpost relative">
|
|
16
|
-
<atoms-the-icon
|
|
17
|
-
class="icon-show-help"
|
|
18
|
-
fill="#0072a3"
|
|
19
|
-
width="24px"
|
|
20
|
-
height="24px"
|
|
21
|
-
name="info-circle"
|
|
22
|
-
@click="isShowHelp = !isShowHelp"
|
|
23
|
-
/>
|
|
24
|
-
<atoms-tooltip-signpost
|
|
25
|
-
v-if="isShowHelp"
|
|
26
|
-
test-id="help-signpost"
|
|
27
|
-
elem-id="vm-name-help-icon"
|
|
28
|
-
@hide="isShowHelp = false"
|
|
29
|
-
>
|
|
30
|
-
<p>
|
|
31
|
-
{{ localization.vmNameValidationDescription2 }}
|
|
32
|
-
</p>
|
|
33
|
-
</atoms-tooltip-signpost>
|
|
34
|
-
</div>
|
|
35
|
-
</form>
|
|
36
|
-
|
|
37
|
-
<template v-if="props.project === 'sphere'">
|
|
38
|
-
<p class="new-vm-name-and-folder-instructions mt-1">
|
|
39
|
-
{{ localization.selectLocationVirtualMachine }}
|
|
40
|
-
</p>
|
|
41
|
-
<div class="tree-view-wrap">
|
|
42
|
-
<common-vm-actions-add-folder-tree-view
|
|
43
|
-
:data-center="props.dataCenter"
|
|
44
|
-
@select-node="onSelectNode"
|
|
45
|
-
/>
|
|
46
|
-
</div>
|
|
47
|
-
</template>
|
|
48
|
-
</div>
|
|
49
|
-
</template>
|
|
50
|
-
|
|
51
|
-
<script setup lang="ts">
|
|
52
|
-
// import { API_UI_I_Error } from '~/lib/models/store/interfaces'
|
|
53
|
-
import { UI_I_Localization } from '~/lib/models/interfaces'
|
|
54
|
-
import { UI_T_Project } from '~/lib/models/types'
|
|
55
|
-
import { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
|
|
56
|
-
|
|
57
|
-
const props = defineProps<{
|
|
58
|
-
nameFormSubmit: number
|
|
59
|
-
show: boolean
|
|
60
|
-
project: UI_T_Project
|
|
61
|
-
dataCenter?: UI_I_TreeNode // для сферы
|
|
62
|
-
}>()
|
|
63
|
-
const emits = defineEmits<{
|
|
64
|
-
(event: 'submit', value: [string, UI_I_TreeNode | null]): void
|
|
65
|
-
(event: 'loading', value: boolean): void
|
|
66
|
-
(
|
|
67
|
-
event: 'check-name',
|
|
68
|
-
value: [[string, UI_I_TreeNode | null], (error: any) => void]
|
|
69
|
-
): void
|
|
70
|
-
}>()
|
|
71
|
-
|
|
72
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
73
|
-
|
|
74
|
-
const vmName = ref<string>('')
|
|
75
|
-
|
|
76
|
-
const selectedNode = ref<UI_I_TreeNode | null>(null)
|
|
77
|
-
const onSelectNode = (node: UI_I_TreeNode): void => {
|
|
78
|
-
selectedNode.value = node
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
watch(
|
|
82
|
-
() => props.nameFormSubmit,
|
|
83
|
-
() => {
|
|
84
|
-
submit()
|
|
85
|
-
}
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
const isParentDatacenter = (node: UI_I_TreeNode | null): boolean => {
|
|
89
|
-
if (!node) return false
|
|
90
|
-
|
|
91
|
-
if (node.parent?.type === 'datacenter') return true
|
|
92
|
-
if (node.parent?.type === 'folder') return isParentDatacenter(node.parent)
|
|
93
|
-
return false
|
|
94
|
-
}
|
|
95
|
-
const submit = async (): Promise<void> => {
|
|
96
|
-
const name = vmName.value
|
|
97
|
-
|
|
98
|
-
if (name !== '') {
|
|
99
|
-
const isNameValid = await checkNameIsValid(name)
|
|
100
|
-
if (!isNameValid) return
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (props.project === 'sphere') {
|
|
104
|
-
const isDatacenterFolder = isParentDatacenter(selectedNode.value)
|
|
105
|
-
|
|
106
|
-
if (
|
|
107
|
-
selectedNode.value?.type !== 'datacenter' &&
|
|
108
|
-
selectedNode.value?.type === 'folder' &&
|
|
109
|
-
!isDatacenterFolder
|
|
110
|
-
) {
|
|
111
|
-
showValidationErrors([
|
|
112
|
-
localization.value.enterValidLocationVirtualMachine,
|
|
113
|
-
])
|
|
114
|
-
return
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
onRemoveValidationErrors()
|
|
119
|
-
emits('submit', [name, selectedNode.value])
|
|
120
|
-
}
|
|
121
|
-
const checkNameIsValid = async (name: string): Promise<boolean> => {
|
|
122
|
-
emits('loading', true)
|
|
123
|
-
|
|
124
|
-
return new Promise((resolve) => {
|
|
125
|
-
emits('check-name', [
|
|
126
|
-
[name, selectedNode.value],
|
|
127
|
-
(error) => {
|
|
128
|
-
emits('loading', false)
|
|
129
|
-
|
|
130
|
-
const status = error?.statusCode || 200
|
|
131
|
-
switch (status) {
|
|
132
|
-
case 406: // Invalid name
|
|
133
|
-
showValidationErrors([
|
|
134
|
-
localization.value.vmNameValidationDescription2,
|
|
135
|
-
])
|
|
136
|
-
resolve(false)
|
|
137
|
-
break
|
|
138
|
-
case 409: // Name exist
|
|
139
|
-
showValidationErrors([
|
|
140
|
-
localization.value.vmNameExistInSelectedLocation,
|
|
141
|
-
])
|
|
142
|
-
resolve(false)
|
|
143
|
-
break
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
resolve(true)
|
|
147
|
-
},
|
|
148
|
-
])
|
|
149
|
-
})
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const errors = ref<string[]>([])
|
|
153
|
-
const showValidationErrors = (data: string[]): void => {
|
|
154
|
-
errors.value = data
|
|
155
|
-
}
|
|
156
|
-
const onRemoveValidationErrors = (): void => {
|
|
157
|
-
errors.value = []
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
watch(
|
|
161
|
-
() => props.show,
|
|
162
|
-
(newValue) => {
|
|
163
|
-
if (!newValue) return
|
|
164
|
-
|
|
165
|
-
const input = document.getElementById('virtual-machine-name')
|
|
166
|
-
if (!input) return
|
|
167
|
-
|
|
168
|
-
setTimeout(() => {
|
|
169
|
-
input.focus()
|
|
170
|
-
}, 0)
|
|
171
|
-
}
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
const isShowHelp = ref<boolean>(false)
|
|
175
|
-
</script>
|
|
176
|
-
|
|
177
|
-
<style scoped lang="scss">
|
|
178
|
-
.select-name {
|
|
179
|
-
form {
|
|
180
|
-
display: flex;
|
|
181
|
-
align-items: center;
|
|
182
|
-
padding-top: 20px;
|
|
183
|
-
|
|
184
|
-
label {
|
|
185
|
-
width: 216px;
|
|
186
|
-
}
|
|
187
|
-
input {
|
|
188
|
-
width: 345px;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.tree-view-wrap {
|
|
193
|
-
position: relative;
|
|
194
|
-
border: 1px solid #000;
|
|
195
|
-
padding: 5px;
|
|
196
|
-
max-height: 300px;
|
|
197
|
-
min-height: 200px;
|
|
198
|
-
overflow: auto;
|
|
199
|
-
margin-bottom: 10px;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
.content-signpost {
|
|
203
|
-
.icon-show-help {
|
|
204
|
-
cursor: pointer;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.help-title {
|
|
208
|
-
font-size: 22px;
|
|
209
|
-
margin-bottom: 24px;
|
|
210
|
-
}
|
|
211
|
-
.signpost {
|
|
212
|
-
max-width: 360px;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
</style>
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="select-storage">
|
|
3
|
-
<atoms-alert
|
|
4
|
-
v-show="errors.length"
|
|
5
|
-
status="alert-danger"
|
|
6
|
-
:items="errors"
|
|
7
|
-
@remove="onRemoveValidationErrors"
|
|
8
|
-
/>
|
|
9
|
-
<div class="table-wrap">
|
|
10
|
-
<atoms-table-data-grid
|
|
11
|
-
v-model:selected-row="selectedRow"
|
|
12
|
-
v-model:column-keys="columnKeys"
|
|
13
|
-
v-model:page-size="pagination.pageSize"
|
|
14
|
-
v-model:page="pagination.page"
|
|
15
|
-
type="radio"
|
|
16
|
-
:head-items="headItems"
|
|
17
|
-
:body-items="bodyItems"
|
|
18
|
-
:total-items="bodyItems.length"
|
|
19
|
-
:total-pages="1"
|
|
20
|
-
server-off
|
|
21
|
-
hide-page-size
|
|
22
|
-
@sorting="sorting"
|
|
23
|
-
@change="changeStorage"
|
|
24
|
-
>
|
|
25
|
-
<template #icon="{ item }">
|
|
26
|
-
<span :class="['datagrid-cell-icon', item.data]" />
|
|
27
|
-
<span class="text-ellipsis">
|
|
28
|
-
{{ item.text }}
|
|
29
|
-
</span>
|
|
30
|
-
</template>
|
|
31
|
-
</atoms-table-data-grid>
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<div v-if="!hideCompatibility" class="compatibility-wrap">
|
|
35
|
-
<p class="compatibility">
|
|
36
|
-
{{ localization.compatibility }}
|
|
37
|
-
</p>
|
|
38
|
-
<div class="compatibility-message flex-align-center">
|
|
39
|
-
<template v-if="selectedStorage">
|
|
40
|
-
<div class="icon-status-ok" />
|
|
41
|
-
<span>{{ localization.compatibilityChecksSucceeded }}</span>
|
|
42
|
-
</template>
|
|
43
|
-
<div v-else>
|
|
44
|
-
<br />
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</template>
|
|
50
|
-
|
|
51
|
-
<script setup lang="ts">
|
|
52
|
-
import { UI_I_Pagination, UI_I_TablePayload } from '~/lib/models/table/interfaces'
|
|
53
|
-
import { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
|
|
54
|
-
import { UI_I_Localization } from '~/lib/models/interfaces'
|
|
55
|
-
import {
|
|
56
|
-
UI_I_ColumnKey,
|
|
57
|
-
UI_I_HeadItem,
|
|
58
|
-
UI_I_BodyItem,
|
|
59
|
-
} from '~/components/atoms/table/dataGrid/lib/models/interfaces'
|
|
60
|
-
import * as table from '~/components/common/vm/actions/common/select/storage/lib/config/config'
|
|
61
|
-
|
|
62
|
-
const props = defineProps<{
|
|
63
|
-
storageSubmit: number
|
|
64
|
-
datastore: UI_I_DatastoreTableItem[]
|
|
65
|
-
storage: UI_I_DatastoreTableItem
|
|
66
|
-
hideCompatibility?: boolean
|
|
67
|
-
getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
|
|
68
|
-
}>()
|
|
69
|
-
const emits = defineEmits<{
|
|
70
|
-
(event: 'submit', value: UI_I_DatastoreTableItem): void
|
|
71
|
-
}>()
|
|
72
|
-
|
|
73
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
74
|
-
|
|
75
|
-
const headItems = ref<UI_I_HeadItem[]>(table.headItems(localization.value))
|
|
76
|
-
const columnKeys = ref<UI_I_ColumnKey[]>(table.columnKeys(localization.value))
|
|
77
|
-
watch(localization, () => {
|
|
78
|
-
columnKeys.value = table.columnKeys(localization.value)
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
const bodyItems = computed<UI_I_BodyItem[][]>(() => {
|
|
82
|
-
return table.bodyItems(props.datastore || [], localization.value)
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
const sort = ref<string | null>(null)
|
|
86
|
-
const pagination = ref<UI_I_Pagination>({
|
|
87
|
-
page: 1,
|
|
88
|
-
pageSize: 100,
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
const sorting = (data: [string, boolean]): void => {
|
|
92
|
-
const [column, status] = data
|
|
93
|
-
const direction = status ? 'asc' : 'desc'
|
|
94
|
-
sort.value = `${column}.${direction}`
|
|
95
|
-
|
|
96
|
-
getStorage()
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const getStorage = async (): Promise<void> => {
|
|
100
|
-
const payload: UI_I_TablePayload = {
|
|
101
|
-
pagination: pagination.value,
|
|
102
|
-
sortBy: sort.value,
|
|
103
|
-
type: 'datastore',
|
|
104
|
-
schema: 'full',
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
props.getDatastoreTableFunc(payload).then(() => {
|
|
108
|
-
selectedRow.value = null
|
|
109
|
-
setStorageFromProps()
|
|
110
|
-
})
|
|
111
|
-
}
|
|
112
|
-
getStorage()
|
|
113
|
-
|
|
114
|
-
const selectedStorage = ref<UI_I_DatastoreTableItem | null>(null)
|
|
115
|
-
const selectedRow = ref<number | null>(null)
|
|
116
|
-
const changeStorage = (index: number): void => {
|
|
117
|
-
if (!props.datastore) return
|
|
118
|
-
selectedStorage.value = props.datastore[index]
|
|
119
|
-
selectedRow.value = index
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const setStorageFromProps = (): void => {
|
|
123
|
-
if (!props.storage) return
|
|
124
|
-
props.datastore.forEach((item, index) => {
|
|
125
|
-
if (item.id === props.storage.id) changeStorage(index)
|
|
126
|
-
})
|
|
127
|
-
}
|
|
128
|
-
watch(
|
|
129
|
-
() => props.storage,
|
|
130
|
-
() => {
|
|
131
|
-
setStorageFromProps()
|
|
132
|
-
},
|
|
133
|
-
{ immediate: true }
|
|
134
|
-
)
|
|
135
|
-
|
|
136
|
-
watch(
|
|
137
|
-
() => props.storageSubmit,
|
|
138
|
-
() => {
|
|
139
|
-
submit()
|
|
140
|
-
}
|
|
141
|
-
)
|
|
142
|
-
const submit = (): void => {
|
|
143
|
-
if (!selectedStorage.value) {
|
|
144
|
-
showValidationErrors([localization.value.selectValidDestinationStorage])
|
|
145
|
-
return
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
emits('submit', selectedStorage.value)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const errors = ref<string[]>([])
|
|
152
|
-
const showValidationErrors = (arr: string[]): void => {
|
|
153
|
-
errors.value = arr
|
|
154
|
-
}
|
|
155
|
-
const onRemoveValidationErrors = (): void => {
|
|
156
|
-
errors.value = []
|
|
157
|
-
}
|
|
158
|
-
</script>
|
|
159
|
-
|
|
160
|
-
<style scoped lang="scss">
|
|
161
|
-
.select-storage {
|
|
162
|
-
flex: 1;
|
|
163
|
-
display: flex;
|
|
164
|
-
flex-direction: column;
|
|
165
|
-
|
|
166
|
-
.table-wrap {
|
|
167
|
-
flex: 1;
|
|
168
|
-
|
|
169
|
-
.datagrid-cell-icon {
|
|
170
|
-
margin-right: 6px;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
:deep(.relative) {
|
|
174
|
-
height: 100%;
|
|
175
|
-
|
|
176
|
-
.datagrid-outer-wrapper {
|
|
177
|
-
height: 100%;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.compatibility-wrap {
|
|
183
|
-
padding-top: 10px;
|
|
184
|
-
|
|
185
|
-
.compatibility-message {
|
|
186
|
-
border: 1px solid #000;
|
|
187
|
-
padding-top: 5px;
|
|
188
|
-
padding-left: 5px;
|
|
189
|
-
overflow: auto;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
</style>
|