bfg-common 1.2.49 → 1.2.51
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/customizeHardware/virtualHardware/VirtualHardware.vue
CHANGED
|
@@ -238,12 +238,20 @@ const hardDisks = ref<UI_I_SendDataNewHardDisk[]>([
|
|
|
238
238
|
watch(
|
|
239
239
|
() => props.hardDisks,
|
|
240
240
|
(newValue) => {
|
|
241
|
-
if (!props.isEdit && !props.isClone || !newValue) return
|
|
241
|
+
if ((!props.isEdit && !props.isClone) || !newValue) return
|
|
242
242
|
|
|
243
243
|
const count = newValue?.length || 0
|
|
244
244
|
hardDisksIndex.value = [...Array(count).keys()]
|
|
245
|
-
hardDisksType.value = Array(count).fill(props.isEdit ? 'edit' : 'new')
|
|
246
245
|
hardDisks.value = newValue
|
|
246
|
+
if (props.isEdit) {
|
|
247
|
+
hardDisksType.value = Array(count).fill('edit')
|
|
248
|
+
} else if (props.isClone) {
|
|
249
|
+
hardDisksType.value = Array(count).fill('new')
|
|
250
|
+
hardDisks.value = newValue.map((hardDisk) => {
|
|
251
|
+
hardDisk.create = true
|
|
252
|
+
return hardDisk
|
|
253
|
+
})
|
|
254
|
+
}
|
|
247
255
|
},
|
|
248
256
|
{ immediate: true }
|
|
249
257
|
)
|
|
@@ -320,14 +328,18 @@ const networksIndex = ref<number[]>([0])
|
|
|
320
328
|
watch(
|
|
321
329
|
() => props.networks,
|
|
322
330
|
(newValue) => {
|
|
323
|
-
if (!props.isEdit && !props.isClone || !newValue) return
|
|
331
|
+
if ((!props.isEdit && !props.isClone) || !newValue) return
|
|
324
332
|
|
|
325
333
|
// networks.value = newValue
|
|
326
334
|
// networksType.value = Array(newValue.length).fill('edit')
|
|
327
335
|
const count = newValue?.length || 0
|
|
328
336
|
networksIndex.value = [...Array(count).keys()]
|
|
329
|
-
networksType.value = Array(count).fill(props.isEdit ? 'edit' : 'new')
|
|
330
337
|
networks.value = newValue
|
|
338
|
+
if (props.isEdit) {
|
|
339
|
+
networksType.value = Array(count).fill('edit')
|
|
340
|
+
} else if (props.isClone) {
|
|
341
|
+
networksType.value = Array(count).fill('new')
|
|
342
|
+
}
|
|
331
343
|
},
|
|
332
344
|
{ immediate: true }
|
|
333
345
|
)
|
|
@@ -372,14 +384,18 @@ const cdDvdDrivesType = ref<UI_T_CdDvdType[]>(['new'])
|
|
|
372
384
|
watch(
|
|
373
385
|
() => props.cdDvdDrives,
|
|
374
386
|
(newValue) => {
|
|
375
|
-
if (!props.isEdit && !props.isClone || !newValue) return
|
|
387
|
+
if ((!props.isEdit && !props.isClone) || !newValue) return
|
|
376
388
|
|
|
377
389
|
// cdDvdDrives.value = newValue
|
|
378
390
|
// cdDvdDrivesType.value = Array(newValue.length).fill('edit')
|
|
379
391
|
const count = newValue?.length || 0
|
|
380
392
|
cdDvdDrivesIndex.value = [...Array(count).keys()]
|
|
381
|
-
cdDvdDrivesType.value = Array(count).fill(props.isEdit ? 'edit' : 'new')
|
|
382
393
|
cdDvdDrives.value = newValue
|
|
394
|
+
if (props.isEdit) {
|
|
395
|
+
cdDvdDrivesType.value = Array(count).fill('edit')
|
|
396
|
+
} else if (props.isClone) {
|
|
397
|
+
cdDvdDrivesType.value = Array(count).fill('new')
|
|
398
|
+
}
|
|
383
399
|
},
|
|
384
400
|
{ immediate: true }
|
|
385
401
|
)
|
|
@@ -390,7 +406,7 @@ const addCdDvdDrive = (): void => {
|
|
|
390
406
|
cdDvdDrives.value.push({
|
|
391
407
|
...useDeepCopy(defaultCdDvdDriver),
|
|
392
408
|
attach: true,
|
|
393
|
-
boot_order: 0 // Убираем галочку
|
|
409
|
+
boot_order: 0, // Убираем галочку
|
|
394
410
|
})
|
|
395
411
|
}
|
|
396
412
|
const onRemoveCdDvdDrive = (
|
|
@@ -442,12 +458,16 @@ const pciDevices = ref<UI_I_PciDevice[]>([])
|
|
|
442
458
|
watch(
|
|
443
459
|
() => props.pciDevices,
|
|
444
460
|
(newValue) => {
|
|
445
|
-
if (!props.isEdit && !props.isClone) return
|
|
461
|
+
if ((!props.isEdit && !props.isClone) || !newValue) return
|
|
446
462
|
|
|
447
463
|
const count = newValue?.length || 0
|
|
448
464
|
pciDevicesIndex.value = [...Array(count).keys()]
|
|
449
|
-
pciDevicesType.value = Array(count).fill(props.isEdit ? 'edit' : 'new')
|
|
450
465
|
pciDevices.value = newValue || []
|
|
466
|
+
if (props.isEdit) {
|
|
467
|
+
pciDevicesType.value = Array(count).fill('edit')
|
|
468
|
+
} else if (props.isClone) {
|
|
469
|
+
pciDevicesType.value = Array(count).fill('new')
|
|
470
|
+
}
|
|
451
471
|
},
|
|
452
472
|
{ immediate: true }
|
|
453
473
|
)
|
|
@@ -1,177 +1,194 @@
|
|
|
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 } from '~/models/interfaces'
|
|
53
|
-
import { UI_I_TablePayload } from '~/models/store/interfaces'
|
|
54
|
-
import { UI_I_DatastoreTableItem } from '~/models/store/storage/interfaces'
|
|
55
|
-
import
|
|
56
|
-
import {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const props = defineProps<{
|
|
64
|
-
storageSubmit: number
|
|
65
|
-
datastore: UI_I_DatastoreTableItem[]
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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 } from '~/models/interfaces'
|
|
53
|
+
import { UI_I_TablePayload } from '~/models/store/interfaces'
|
|
54
|
+
import { UI_I_DatastoreTableItem } from '~/models/store/storage/interfaces'
|
|
55
|
+
import { UI_I_Localization } from '~/models/interfaces'
|
|
56
|
+
import {
|
|
57
|
+
UI_I_ColumnKey,
|
|
58
|
+
UI_I_HeadItem,
|
|
59
|
+
UI_I_BodyItem,
|
|
60
|
+
} from '~/components/atoms/table/dataGrid/models/interfaces'
|
|
61
|
+
import * as table from '~/components/common/vm/actions/common/select/storage/config/config'
|
|
62
|
+
|
|
63
|
+
const props = defineProps<{
|
|
64
|
+
storageSubmit: number
|
|
65
|
+
datastore: UI_I_DatastoreTableItem[]
|
|
66
|
+
storage: UI_I_DatastoreTableItem
|
|
67
|
+
hideCompatibility?: boolean
|
|
68
|
+
getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
|
|
69
|
+
}>()
|
|
70
|
+
const emits = defineEmits<{
|
|
71
|
+
(event: 'submit', value: UI_I_DatastoreTableItem): void
|
|
72
|
+
}>()
|
|
73
|
+
|
|
74
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
75
|
+
|
|
76
|
+
const headItems = ref<UI_I_HeadItem[]>(table.headItems(localization.value))
|
|
77
|
+
const columnKeys = ref<UI_I_ColumnKey[]>(table.columnKeys(localization.value))
|
|
78
|
+
watch(localization, () => {
|
|
79
|
+
columnKeys.value = table.columnKeys(localization.value)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const bodyItems = computed<UI_I_BodyItem[][]>(() => {
|
|
83
|
+
return table.bodyItems(props.datastore || [], localization.value)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
const sort = ref<string | null>(null)
|
|
87
|
+
const pagination = ref<UI_I_Pagination>({
|
|
88
|
+
page: 1,
|
|
89
|
+
pageSize: 100,
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
const sorting = (data: [string, boolean]): void => {
|
|
93
|
+
const [column, status] = data
|
|
94
|
+
const direction = status ? 'asc' : 'desc'
|
|
95
|
+
sort.value = `${column}.${direction}`
|
|
96
|
+
|
|
97
|
+
getStorage()
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const getStorage = async (): Promise<void> => {
|
|
101
|
+
const payload: UI_I_TablePayload = {
|
|
102
|
+
pagination: pagination.value,
|
|
103
|
+
sortBy: sort.value,
|
|
104
|
+
type: 'datastore',
|
|
105
|
+
schema: 'full',
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
props.getDatastoreTableFunc(payload).then(() => {
|
|
109
|
+
selectedRow.value = null
|
|
110
|
+
setStorageFromProps()
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
getStorage()
|
|
114
|
+
|
|
115
|
+
const selectedStorage = ref<UI_I_DatastoreTableItem | null>(null)
|
|
116
|
+
const selectedRow = ref<number | null>(null)
|
|
117
|
+
const changeStorage = (index: number): void => {
|
|
118
|
+
if (!props.datastore) return
|
|
119
|
+
selectedStorage.value = props.datastore[index]
|
|
120
|
+
selectedRow.value = index
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const setStorageFromProps = (): void => {
|
|
124
|
+
if (!props.storage) return
|
|
125
|
+
props.datastore.forEach((item, index) => {
|
|
126
|
+
if (item.id === props.storage.id) changeStorage(index)
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
watch(
|
|
130
|
+
() => props.storage,
|
|
131
|
+
() => {
|
|
132
|
+
setStorageFromProps()
|
|
133
|
+
},
|
|
134
|
+
{ immediate: true }
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
watch(
|
|
138
|
+
() => props.storageSubmit,
|
|
139
|
+
() => {
|
|
140
|
+
submit()
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
const submit = (): void => {
|
|
144
|
+
if (!selectedStorage.value) {
|
|
145
|
+
showValidationErrors([localization.value.selectValidDestinationStorage])
|
|
146
|
+
return
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
emits('submit', selectedStorage.value)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const errors = ref<string[]>([])
|
|
153
|
+
const showValidationErrors = (arr: string[]): void => {
|
|
154
|
+
errors.value = arr
|
|
155
|
+
}
|
|
156
|
+
const onRemoveValidationErrors = (): void => {
|
|
157
|
+
errors.value = []
|
|
158
|
+
}
|
|
159
|
+
</script>
|
|
160
|
+
|
|
161
|
+
<style scoped lang="scss">
|
|
162
|
+
.select-storage {
|
|
163
|
+
flex: 1;
|
|
164
|
+
display: flex;
|
|
165
|
+
flex-direction: column;
|
|
166
|
+
|
|
167
|
+
.table-wrap {
|
|
168
|
+
flex: 1;
|
|
169
|
+
|
|
170
|
+
.datagrid-cell-icon {
|
|
171
|
+
margin-right: 6px;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
:deep(.relative) {
|
|
175
|
+
height: 100%;
|
|
176
|
+
|
|
177
|
+
.datagrid-outer-wrapper {
|
|
178
|
+
height: 100%;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.compatibility-wrap {
|
|
184
|
+
padding-top: 10px;
|
|
185
|
+
|
|
186
|
+
.compatibility-message {
|
|
187
|
+
border: 1px solid #000;
|
|
188
|
+
padding-top: 5px;
|
|
189
|
+
padding-left: 5px;
|
|
190
|
+
overflow: auto;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
</style>
|