bfg-common 1.4.54 → 1.4.56
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/atoms/modal/bySteps/BySteps.vue +253 -253
- package/components/common/browse/blocks/Title.vue +91 -91
- package/components/common/browse/blocks/info/Date.vue +21 -21
- package/components/common/context/recursion/Recursion.vue +86 -86
- package/components/common/context/recursion/RecursionNew.vue +198 -198
- package/components/common/context/recursion/RecursionOld.vue +212 -212
- package/components/common/split/horizontal/HorizontalNew.vue +321 -321
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +403 -400
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuHotPlug.vue +57 -52
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Hv.vue +99 -99
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/streamingMode/StreamingMode.vue +85 -85
- package/components/common/wizards/datastore/add/Add.vue +437 -437
- package/composables/productNameLocal.ts +30 -30
- package/package.json +1 -1
- package/plugins/recursion.ts +311 -311
- package/public/spice-console/lib/images/bitmap.js +203 -203
- package/store/tasks/mappers/recentTasks.ts +45 -45
|
@@ -1,437 +1,437 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="new-datastore">
|
|
3
|
-
<atoms-modal-by-steps
|
|
4
|
-
test-id="add-datastore-wizard"
|
|
5
|
-
:show="true"
|
|
6
|
-
:title="localization.common.newDatastore"
|
|
7
|
-
:step-items="stepItems"
|
|
8
|
-
:step-position="stepPosition"
|
|
9
|
-
:loading="loading"
|
|
10
|
-
@finish="onAddDatastore"
|
|
11
|
-
@next="onNextStep"
|
|
12
|
-
@back="back"
|
|
13
|
-
@change-step="onChangeStep"
|
|
14
|
-
@hide="onHideModal"
|
|
15
|
-
>
|
|
16
|
-
<template #modalBody>
|
|
17
|
-
<div class="new-datastore__body">
|
|
18
|
-
<!-- :project="props.mode"-->
|
|
19
|
-
<common-wizards-datastore-add-types
|
|
20
|
-
v-show="stepPosition === 0"
|
|
21
|
-
v-model:type="datastoreType"
|
|
22
|
-
/>
|
|
23
|
-
|
|
24
|
-
<common-wizards-datastore-add-local
|
|
25
|
-
v-show="datastoreType === 'local' && !isShowCompleteBlock"
|
|
26
|
-
:mode="props.mode"
|
|
27
|
-
:step-position="stepPosition"
|
|
28
|
-
:datastore-type="datastoreType"
|
|
29
|
-
:local-create-name-submit="localCreateNameSubmit"
|
|
30
|
-
:datacenter-hosts="props.datacenterHosts"
|
|
31
|
-
:is-main-filter="props.isMainFilter"
|
|
32
|
-
@loading="(e) => (loading = e)"
|
|
33
|
-
@submit="onSaveNameAndNextLocal"
|
|
34
|
-
@main-filter="emits('main-filter', $event)"
|
|
35
|
-
/>
|
|
36
|
-
|
|
37
|
-
<common-wizards-datastore-add-shared-storm
|
|
38
|
-
v-show="datastoreType === 'shared-storm' && !isShowCompleteBlock"
|
|
39
|
-
:mode="props.mode"
|
|
40
|
-
:step-position="stepPosition"
|
|
41
|
-
:datastore-type="datastoreType"
|
|
42
|
-
:device-selection-submit="deviceSelectionSubmit"
|
|
43
|
-
:datacenter-hosts="props.datacenterHosts"
|
|
44
|
-
:is-main-filter="props.isMainFilter"
|
|
45
|
-
:host-id="props.hostId"
|
|
46
|
-
@loading="(e) => (loading = e)"
|
|
47
|
-
@submit="onSaveAndNextSharedStorm"
|
|
48
|
-
@main-filter="emits('main-filter', $event)"
|
|
49
|
-
/>
|
|
50
|
-
|
|
51
|
-
<common-wizards-datastore-add-nfs
|
|
52
|
-
v-show="datastoreType === 'nfs' && !isShowCompleteBlock"
|
|
53
|
-
:mode="props.mode"
|
|
54
|
-
:step-position="stepPosition"
|
|
55
|
-
:datastore-type="datastoreType"
|
|
56
|
-
:nfs-configuration-submit="nfsConfigurationSubmit"
|
|
57
|
-
:host-accessibility-submit="hostAccessibilitySubmit"
|
|
58
|
-
:hosts="props.nfsHosts"
|
|
59
|
-
@loading="(e) => (loading = e)"
|
|
60
|
-
@change-nfs-version="updateNfsVersion"
|
|
61
|
-
@submit="saveChangesAndNextNfs"
|
|
62
|
-
/>
|
|
63
|
-
|
|
64
|
-
<common-wizards-datastore-add-ready-complete
|
|
65
|
-
v-show="isShowCompleteBlock"
|
|
66
|
-
:data-ready-view="dataReadyView"
|
|
67
|
-
/>
|
|
68
|
-
</div>
|
|
69
|
-
</template>
|
|
70
|
-
</atoms-modal-by-steps>
|
|
71
|
-
</div>
|
|
72
|
-
</template>
|
|
73
|
-
|
|
74
|
-
<script setup lang="ts">
|
|
75
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
76
|
-
import type { UI_I_VerticalStepItem } from '~/components/atoms/lib/models/interfaces'
|
|
77
|
-
import type {
|
|
78
|
-
UI_T_DatastoreType,
|
|
79
|
-
UI_T_NfsType,
|
|
80
|
-
UI_T_WizardDatastoreMode,
|
|
81
|
-
} from '~/components/common/wizards/datastore/add/lib/models/types'
|
|
82
|
-
import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
|
|
83
|
-
import type {
|
|
84
|
-
UI_I_LunDisk,
|
|
85
|
-
UI_I_SelectHostOptions,
|
|
86
|
-
} from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
|
|
87
|
-
import { stepItemsFunc } from '~/components/common/wizards/datastore/add/lib/config/stepItems'
|
|
88
|
-
import { constructDataReadyViewFunc } from '~/components/common/wizards/datastore/add/readyComplete/lib/config/propertiesDetails'
|
|
89
|
-
|
|
90
|
-
const props = defineProps<{
|
|
91
|
-
// TODO refactoring to project
|
|
92
|
-
mode: UI_T_WizardDatastoreMode
|
|
93
|
-
finishFunc: (
|
|
94
|
-
datastoreForm: UI_I_CreateDatastoreForm,
|
|
95
|
-
datastoreType: UI_T_DatastoreType,
|
|
96
|
-
version: UI_T_NfsType
|
|
97
|
-
) => Promise<void>
|
|
98
|
-
datacenterHosts?: UI_I_SelectHostOptions[]
|
|
99
|
-
nfsHosts?: any
|
|
100
|
-
isMainFilter?: boolean
|
|
101
|
-
hostId?: string
|
|
102
|
-
}>()
|
|
103
|
-
const emits = defineEmits<{
|
|
104
|
-
(event: 'hide'): void
|
|
105
|
-
(event: 'global-refresh'): void
|
|
106
|
-
(event: 'main-filter', value: string): void
|
|
107
|
-
}>()
|
|
108
|
-
|
|
109
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
110
|
-
|
|
111
|
-
const loading = ref<boolean>(false)
|
|
112
|
-
const datastoreType = ref<UI_T_DatastoreType>(
|
|
113
|
-
// props.mode === 'procurator' ? 'local' : 'shared-storm'
|
|
114
|
-
'shared-storm'
|
|
115
|
-
)
|
|
116
|
-
const nfsVersion = ref<UI_T_NfsType>('nfs-3')
|
|
117
|
-
|
|
118
|
-
const stepPosition = ref<number>(0)
|
|
119
|
-
const dataReadyView = ref<any>([])
|
|
120
|
-
|
|
121
|
-
const datastoreForm = ref<UI_I_CreateDatastoreForm>({
|
|
122
|
-
local: {
|
|
123
|
-
name: '',
|
|
124
|
-
hosts: [],
|
|
125
|
-
type_code: 1,
|
|
126
|
-
},
|
|
127
|
-
sharedStorm: {
|
|
128
|
-
name: '',
|
|
129
|
-
dev_names: [],
|
|
130
|
-
hosts: [],
|
|
131
|
-
pool_name: '',
|
|
132
|
-
type_code: 2,
|
|
133
|
-
},
|
|
134
|
-
nfs: {
|
|
135
|
-
name: '',
|
|
136
|
-
server: '',
|
|
137
|
-
folder: '',
|
|
138
|
-
readonly: false,
|
|
139
|
-
version: nfsVersion.value,
|
|
140
|
-
type_code: 4,
|
|
141
|
-
hosts: [],
|
|
142
|
-
},
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
const stepItems = computed<UI_I_VerticalStepItem[]>(() =>
|
|
146
|
-
stepItemsFunc(localization.value, datastoreType.value, props.mode)
|
|
147
|
-
)
|
|
148
|
-
|
|
149
|
-
let cashStep = -1
|
|
150
|
-
const onNextStep = (force = false): void => {
|
|
151
|
-
const isValid = checkSubmit(force)
|
|
152
|
-
|
|
153
|
-
if (!isValid) {
|
|
154
|
-
return
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const isDisabled = stepItems.value[cashStep]?.disabled
|
|
158
|
-
if (cashStep !== -1 && !isDisabled) {
|
|
159
|
-
stepPosition.value = cashStep
|
|
160
|
-
cashStep = -1
|
|
161
|
-
return
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
stepItems.value[stepPosition.value].complete = true
|
|
165
|
-
stepItems.value[stepPosition.value + 1].disabled = false
|
|
166
|
-
stepPosition.value++
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const back = (): void => {
|
|
170
|
-
stepPosition.value--
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const onChangeStep = (key: number): void => {
|
|
174
|
-
if (key < stepPosition.value) {
|
|
175
|
-
stepPosition.value = key
|
|
176
|
-
return
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const isValid = checkSubmit()
|
|
180
|
-
|
|
181
|
-
if (!isValid) {
|
|
182
|
-
cashStep = key
|
|
183
|
-
return
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
stepPosition.value = key
|
|
187
|
-
}
|
|
188
|
-
const onHideModal = (): void => {
|
|
189
|
-
emits('hide')
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
const updateNfsVersion = (event: UI_T_NfsType): void => {
|
|
193
|
-
nfsVersion.value = event
|
|
194
|
-
const { name, server, folder, hosts } = datastoreForm.value.nfs
|
|
195
|
-
saveChangesAndNextNfs({ name, server, folder, hosts }, false)
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
const localCreateNameSubmit = ref<number>(0)
|
|
199
|
-
|
|
200
|
-
const nfsConfigurationSubmit = ref<number>(0)
|
|
201
|
-
const hostAccessibilitySubmit = ref<number>(0)
|
|
202
|
-
|
|
203
|
-
const deviceSelectionSubmit = ref<number>(0)
|
|
204
|
-
|
|
205
|
-
const checkSubmit = (force = false): boolean => {
|
|
206
|
-
if (datastoreType.value === 'local') {
|
|
207
|
-
if (stepPosition.value === 1 && !force) {
|
|
208
|
-
localCreateNameSubmit.value++
|
|
209
|
-
return false
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
if (datastoreType.value === 'shared-storm') {
|
|
214
|
-
if (stepPosition.value === 1 && !force) {
|
|
215
|
-
deviceSelectionSubmit.value++
|
|
216
|
-
return false
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (datastoreType.value === 'nfs') {
|
|
221
|
-
if (stepPosition.value === 2 && !force) {
|
|
222
|
-
nfsConfigurationSubmit.value++
|
|
223
|
-
return false
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
if (props.mode === 'sphere' && stepPosition.value === 3 && !force) {
|
|
227
|
-
hostAccessibilitySubmit.value++
|
|
228
|
-
return false
|
|
229
|
-
}
|
|
230
|
-
// if (
|
|
231
|
-
// ((stepPosition.value === 4 && nfsVersion.value === 'nfs-4.1') ||
|
|
232
|
-
// (stepPosition.value === 3 && nfsVersion.value === 'nfs-3')) &&
|
|
233
|
-
// !force
|
|
234
|
-
// ) {
|
|
235
|
-
// hostAccessibilitySubmit.value++
|
|
236
|
-
// return false
|
|
237
|
-
// }
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return true
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
const isWizardModeForSphere = computed<boolean>(() => props.mode === 'sphere')
|
|
244
|
-
|
|
245
|
-
const onSaveNameAndNextLocal = (event: any): void => {
|
|
246
|
-
const { local } = datastoreForm.value
|
|
247
|
-
|
|
248
|
-
if (isWizardModeForSphere.value) {
|
|
249
|
-
local.name = event.name
|
|
250
|
-
local.hosts.push(event.host)
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
if (!isWizardModeForSphere.value) {
|
|
254
|
-
local.name = event
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
dataReadyView.value = constructDataReadyViewFunc(
|
|
258
|
-
localization.value,
|
|
259
|
-
'local',
|
|
260
|
-
event,
|
|
261
|
-
isWizardModeForSphere.value
|
|
262
|
-
)
|
|
263
|
-
|
|
264
|
-
onNextStep(true)
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
const onSaveAndNextSharedStorm = (event: any): void => {
|
|
268
|
-
const { sharedStorm } = datastoreForm.value
|
|
269
|
-
sharedStorm.name = event.name
|
|
270
|
-
sharedStorm.dev_names = event.lunDisk.map((lun: UI_I_LunDisk) => lun.name)
|
|
271
|
-
sharedStorm.hosts = [event.host]
|
|
272
|
-
|
|
273
|
-
dataReadyView.value = constructDataReadyViewFunc(
|
|
274
|
-
localization.value,
|
|
275
|
-
'shared-storm',
|
|
276
|
-
event,
|
|
277
|
-
isWizardModeForSphere.value
|
|
278
|
-
)
|
|
279
|
-
|
|
280
|
-
onNextStep(true)
|
|
281
|
-
}
|
|
282
|
-
const saveChangesAndNextNfs = (event: any, next = true): void => {
|
|
283
|
-
const { nfs } = datastoreForm.value
|
|
284
|
-
nfs.name = event.name
|
|
285
|
-
nfs.folder = event.folder
|
|
286
|
-
nfs.server = event.server
|
|
287
|
-
nfs.hosts = event.hosts
|
|
288
|
-
|
|
289
|
-
// TODO refactoring
|
|
290
|
-
const hostsNames = props.nfsHosts
|
|
291
|
-
? props.nfsHosts.items
|
|
292
|
-
.filter((host) => event.hosts.includes(host.id))
|
|
293
|
-
.map((host) => host.host)
|
|
294
|
-
: []
|
|
295
|
-
|
|
296
|
-
dataReadyView.value = constructDataReadyViewFunc(
|
|
297
|
-
localization.value,
|
|
298
|
-
'nfs',
|
|
299
|
-
{
|
|
300
|
-
...event,
|
|
301
|
-
hosts: hostsNames,
|
|
302
|
-
version: nfsVersion.value,
|
|
303
|
-
},
|
|
304
|
-
isWizardModeForSphere.value
|
|
305
|
-
)
|
|
306
|
-
|
|
307
|
-
next && onNextStep(true)
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
const isShowCompleteBlock = computed<boolean>(() => {
|
|
311
|
-
// TODO refactoring
|
|
312
|
-
const localStep = datastoreType.value === 'local' && stepPosition.value === 2
|
|
313
|
-
|
|
314
|
-
const sharesStep =
|
|
315
|
-
datastoreType.value === 'shared-storm' &&
|
|
316
|
-
(props.mode === 'procurator'
|
|
317
|
-
? stepPosition.value === 3
|
|
318
|
-
: stepPosition.value === 2)
|
|
319
|
-
|
|
320
|
-
let nfsFirst
|
|
321
|
-
if (props.mode === 'procurator') {
|
|
322
|
-
nfsFirst =
|
|
323
|
-
datastoreType.value === 'nfs' &&
|
|
324
|
-
nfsVersion.value === 'nfs-3' &&
|
|
325
|
-
stepPosition.value === 3
|
|
326
|
-
} else {
|
|
327
|
-
nfsFirst =
|
|
328
|
-
datastoreType.value === 'nfs' &&
|
|
329
|
-
nfsVersion.value === 'nfs-3' &&
|
|
330
|
-
stepPosition.value === 4
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
let nfsSecond
|
|
334
|
-
if (props.mode === 'procurator') {
|
|
335
|
-
nfsSecond =
|
|
336
|
-
datastoreType.value === 'nfs' &&
|
|
337
|
-
nfsVersion.value === 'nfs-4.1' &&
|
|
338
|
-
stepPosition.value === 3
|
|
339
|
-
} else {
|
|
340
|
-
nfsSecond =
|
|
341
|
-
datastoreType.value === 'nfs' &&
|
|
342
|
-
nfsVersion.value === 'nfs-4.1' &&
|
|
343
|
-
stepPosition.value === 4
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
return localStep || sharesStep || nfsFirst || nfsSecond
|
|
347
|
-
})
|
|
348
|
-
|
|
349
|
-
const onAddDatastore = async (): Promise<void> => {
|
|
350
|
-
loading.value = true
|
|
351
|
-
|
|
352
|
-
props
|
|
353
|
-
.finishFunc(datastoreForm.value, datastoreType.value, nfsVersion.value)
|
|
354
|
-
.then(() => {
|
|
355
|
-
emits('global-refresh')
|
|
356
|
-
loading.value = false
|
|
357
|
-
onHideModal()
|
|
358
|
-
})
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
// const createDatastoreFromLocal = async (): Promise<API_UI_I_Error> => {
|
|
362
|
-
// const { local } = datastoreForm.value
|
|
363
|
-
//
|
|
364
|
-
// return await createDatastore<Omit<UI_I_CreateDatastoreBodyRequest, 'pool_name'>>(
|
|
365
|
-
// local
|
|
366
|
-
// )
|
|
367
|
-
// }
|
|
368
|
-
// const createDatastoreFromSharedStorm = async (): Promise<API_UI_I_Error> => {
|
|
369
|
-
// const {
|
|
370
|
-
// sharedStorm: { dev_names: disks, ...sendData },
|
|
371
|
-
// } = datastoreForm.value
|
|
372
|
-
//
|
|
373
|
-
// const { data, msg } = await getStoragePoolName<{ dev_names: string[] }>(
|
|
374
|
-
// '/psm/api/v1/storage/lvm/create',
|
|
375
|
-
// { dev_names: disks }
|
|
376
|
-
// )
|
|
377
|
-
//
|
|
378
|
-
// if (!data && msg) return msg
|
|
379
|
-
//
|
|
380
|
-
// sendData.pool_name = data?.pool_name || ''
|
|
381
|
-
//
|
|
382
|
-
// return await createDatastore(sendData)
|
|
383
|
-
// }
|
|
384
|
-
|
|
385
|
-
// const createDatastoreFromNfs = async (): Promise<API_UI_I_Error> => {
|
|
386
|
-
// const {
|
|
387
|
-
// nfs: { server, folder, readonly, name, type_code: type },
|
|
388
|
-
// } = datastoreForm.value
|
|
389
|
-
//
|
|
390
|
-
// const sendDataOne = {
|
|
391
|
-
// server,
|
|
392
|
-
// folder,
|
|
393
|
-
// readonly,
|
|
394
|
-
// version: nfsVersion.value === 'nfs-4.1' ? 4.1 : 3.0,
|
|
395
|
-
// }
|
|
396
|
-
//
|
|
397
|
-
// const { data, msg } = await getStoragePoolName<UI_I_NfsPoolNameForm>(
|
|
398
|
-
// '/psm/api/v1/storage/cnfs',
|
|
399
|
-
// sendDataOne
|
|
400
|
-
// )
|
|
401
|
-
//
|
|
402
|
-
// if (!data && msg) return msg
|
|
403
|
-
//
|
|
404
|
-
// const sendDataTwo = {
|
|
405
|
-
// name,
|
|
406
|
-
// type_code: type,
|
|
407
|
-
// pool_name: data?.pool_name || '',
|
|
408
|
-
// }
|
|
409
|
-
//
|
|
410
|
-
// return await createDatastore(sendDataTwo)
|
|
411
|
-
// }
|
|
412
|
-
</script>
|
|
413
|
-
|
|
414
|
-
<style scoped lang="scss">
|
|
415
|
-
@import '~/assets/scss/common/mixins.scss';
|
|
416
|
-
|
|
417
|
-
.new-datastore {
|
|
418
|
-
&__body {
|
|
419
|
-
@include flex($dir: column);
|
|
420
|
-
height: 100%;
|
|
421
|
-
padding-left: 24px;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
.finish-block {
|
|
426
|
-
padding: 18px 24px 24px 24px;
|
|
427
|
-
|
|
428
|
-
.add-hosts-ready-to-complete-mt-12 {
|
|
429
|
-
margin-top: 12px;
|
|
430
|
-
|
|
431
|
-
.add-hosts-ready-to-complete-bold {
|
|
432
|
-
line-height: 18px;
|
|
433
|
-
font-weight: 700;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="new-datastore">
|
|
3
|
+
<atoms-modal-by-steps
|
|
4
|
+
test-id="add-datastore-wizard"
|
|
5
|
+
:show="true"
|
|
6
|
+
:title="localization.common.newDatastore"
|
|
7
|
+
:step-items="stepItems"
|
|
8
|
+
:step-position="stepPosition"
|
|
9
|
+
:loading="loading"
|
|
10
|
+
@finish="onAddDatastore"
|
|
11
|
+
@next="onNextStep"
|
|
12
|
+
@back="back"
|
|
13
|
+
@change-step="onChangeStep"
|
|
14
|
+
@hide="onHideModal"
|
|
15
|
+
>
|
|
16
|
+
<template #modalBody>
|
|
17
|
+
<div class="new-datastore__body">
|
|
18
|
+
<!-- :project="props.mode"-->
|
|
19
|
+
<common-wizards-datastore-add-types
|
|
20
|
+
v-show="stepPosition === 0"
|
|
21
|
+
v-model:type="datastoreType"
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
<common-wizards-datastore-add-local
|
|
25
|
+
v-show="datastoreType === 'local' && !isShowCompleteBlock"
|
|
26
|
+
:mode="props.mode"
|
|
27
|
+
:step-position="stepPosition"
|
|
28
|
+
:datastore-type="datastoreType"
|
|
29
|
+
:local-create-name-submit="localCreateNameSubmit"
|
|
30
|
+
:datacenter-hosts="props.datacenterHosts"
|
|
31
|
+
:is-main-filter="props.isMainFilter"
|
|
32
|
+
@loading="(e) => (loading = e)"
|
|
33
|
+
@submit="onSaveNameAndNextLocal"
|
|
34
|
+
@main-filter="emits('main-filter', $event)"
|
|
35
|
+
/>
|
|
36
|
+
|
|
37
|
+
<common-wizards-datastore-add-shared-storm
|
|
38
|
+
v-show="datastoreType === 'shared-storm' && !isShowCompleteBlock"
|
|
39
|
+
:mode="props.mode"
|
|
40
|
+
:step-position="stepPosition"
|
|
41
|
+
:datastore-type="datastoreType"
|
|
42
|
+
:device-selection-submit="deviceSelectionSubmit"
|
|
43
|
+
:datacenter-hosts="props.datacenterHosts"
|
|
44
|
+
:is-main-filter="props.isMainFilter"
|
|
45
|
+
:host-id="props.hostId"
|
|
46
|
+
@loading="(e) => (loading = e)"
|
|
47
|
+
@submit="onSaveAndNextSharedStorm"
|
|
48
|
+
@main-filter="emits('main-filter', $event)"
|
|
49
|
+
/>
|
|
50
|
+
|
|
51
|
+
<common-wizards-datastore-add-nfs
|
|
52
|
+
v-show="datastoreType === 'nfs' && !isShowCompleteBlock"
|
|
53
|
+
:mode="props.mode"
|
|
54
|
+
:step-position="stepPosition"
|
|
55
|
+
:datastore-type="datastoreType"
|
|
56
|
+
:nfs-configuration-submit="nfsConfigurationSubmit"
|
|
57
|
+
:host-accessibility-submit="hostAccessibilitySubmit"
|
|
58
|
+
:hosts="props.nfsHosts"
|
|
59
|
+
@loading="(e) => (loading = e)"
|
|
60
|
+
@change-nfs-version="updateNfsVersion"
|
|
61
|
+
@submit="saveChangesAndNextNfs"
|
|
62
|
+
/>
|
|
63
|
+
|
|
64
|
+
<common-wizards-datastore-add-ready-complete
|
|
65
|
+
v-show="isShowCompleteBlock"
|
|
66
|
+
:data-ready-view="dataReadyView"
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
</atoms-modal-by-steps>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<script setup lang="ts">
|
|
75
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
76
|
+
import type { UI_I_VerticalStepItem } from '~/components/atoms/lib/models/interfaces'
|
|
77
|
+
import type {
|
|
78
|
+
UI_T_DatastoreType,
|
|
79
|
+
UI_T_NfsType,
|
|
80
|
+
UI_T_WizardDatastoreMode,
|
|
81
|
+
} from '~/components/common/wizards/datastore/add/lib/models/types'
|
|
82
|
+
import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
|
|
83
|
+
import type {
|
|
84
|
+
UI_I_LunDisk,
|
|
85
|
+
UI_I_SelectHostOptions,
|
|
86
|
+
} from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
|
|
87
|
+
import { stepItemsFunc } from '~/components/common/wizards/datastore/add/lib/config/stepItems'
|
|
88
|
+
import { constructDataReadyViewFunc } from '~/components/common/wizards/datastore/add/readyComplete/lib/config/propertiesDetails'
|
|
89
|
+
|
|
90
|
+
const props = defineProps<{
|
|
91
|
+
// TODO refactoring to project
|
|
92
|
+
mode: UI_T_WizardDatastoreMode
|
|
93
|
+
finishFunc: (
|
|
94
|
+
datastoreForm: UI_I_CreateDatastoreForm,
|
|
95
|
+
datastoreType: UI_T_DatastoreType,
|
|
96
|
+
version: UI_T_NfsType
|
|
97
|
+
) => Promise<void>
|
|
98
|
+
datacenterHosts?: UI_I_SelectHostOptions[]
|
|
99
|
+
nfsHosts?: any
|
|
100
|
+
isMainFilter?: boolean
|
|
101
|
+
hostId?: string
|
|
102
|
+
}>()
|
|
103
|
+
const emits = defineEmits<{
|
|
104
|
+
(event: 'hide'): void
|
|
105
|
+
(event: 'global-refresh'): void
|
|
106
|
+
(event: 'main-filter', value: string): void
|
|
107
|
+
}>()
|
|
108
|
+
|
|
109
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
110
|
+
|
|
111
|
+
const loading = ref<boolean>(false)
|
|
112
|
+
const datastoreType = ref<UI_T_DatastoreType>(
|
|
113
|
+
// props.mode === 'procurator' ? 'local' : 'shared-storm'
|
|
114
|
+
'shared-storm'
|
|
115
|
+
)
|
|
116
|
+
const nfsVersion = ref<UI_T_NfsType>('nfs-3')
|
|
117
|
+
|
|
118
|
+
const stepPosition = ref<number>(0)
|
|
119
|
+
const dataReadyView = ref<any>([])
|
|
120
|
+
|
|
121
|
+
const datastoreForm = ref<UI_I_CreateDatastoreForm>({
|
|
122
|
+
local: {
|
|
123
|
+
name: '',
|
|
124
|
+
hosts: [],
|
|
125
|
+
type_code: 1,
|
|
126
|
+
},
|
|
127
|
+
sharedStorm: {
|
|
128
|
+
name: '',
|
|
129
|
+
dev_names: [],
|
|
130
|
+
hosts: [],
|
|
131
|
+
pool_name: '',
|
|
132
|
+
type_code: 2,
|
|
133
|
+
},
|
|
134
|
+
nfs: {
|
|
135
|
+
name: '',
|
|
136
|
+
server: '',
|
|
137
|
+
folder: '',
|
|
138
|
+
readonly: false,
|
|
139
|
+
version: nfsVersion.value,
|
|
140
|
+
type_code: 4,
|
|
141
|
+
hosts: [],
|
|
142
|
+
},
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
const stepItems = computed<UI_I_VerticalStepItem[]>(() =>
|
|
146
|
+
stepItemsFunc(localization.value, datastoreType.value, props.mode)
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
let cashStep = -1
|
|
150
|
+
const onNextStep = (force = false): void => {
|
|
151
|
+
const isValid = checkSubmit(force)
|
|
152
|
+
|
|
153
|
+
if (!isValid) {
|
|
154
|
+
return
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const isDisabled = stepItems.value[cashStep]?.disabled
|
|
158
|
+
if (cashStep !== -1 && !isDisabled) {
|
|
159
|
+
stepPosition.value = cashStep
|
|
160
|
+
cashStep = -1
|
|
161
|
+
return
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
stepItems.value[stepPosition.value].complete = true
|
|
165
|
+
stepItems.value[stepPosition.value + 1].disabled = false
|
|
166
|
+
stepPosition.value++
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const back = (): void => {
|
|
170
|
+
stepPosition.value--
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const onChangeStep = (key: number): void => {
|
|
174
|
+
if (key < stepPosition.value) {
|
|
175
|
+
stepPosition.value = key
|
|
176
|
+
return
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const isValid = checkSubmit()
|
|
180
|
+
|
|
181
|
+
if (!isValid) {
|
|
182
|
+
cashStep = key
|
|
183
|
+
return
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
stepPosition.value = key
|
|
187
|
+
}
|
|
188
|
+
const onHideModal = (): void => {
|
|
189
|
+
emits('hide')
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const updateNfsVersion = (event: UI_T_NfsType): void => {
|
|
193
|
+
nfsVersion.value = event
|
|
194
|
+
const { name, server, folder, hosts } = datastoreForm.value.nfs
|
|
195
|
+
saveChangesAndNextNfs({ name, server, folder, hosts }, false)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const localCreateNameSubmit = ref<number>(0)
|
|
199
|
+
|
|
200
|
+
const nfsConfigurationSubmit = ref<number>(0)
|
|
201
|
+
const hostAccessibilitySubmit = ref<number>(0)
|
|
202
|
+
|
|
203
|
+
const deviceSelectionSubmit = ref<number>(0)
|
|
204
|
+
|
|
205
|
+
const checkSubmit = (force = false): boolean => {
|
|
206
|
+
if (datastoreType.value === 'local') {
|
|
207
|
+
if (stepPosition.value === 1 && !force) {
|
|
208
|
+
localCreateNameSubmit.value++
|
|
209
|
+
return false
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (datastoreType.value === 'shared-storm') {
|
|
214
|
+
if (stepPosition.value === 1 && !force) {
|
|
215
|
+
deviceSelectionSubmit.value++
|
|
216
|
+
return false
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (datastoreType.value === 'nfs') {
|
|
221
|
+
if (stepPosition.value === 2 && !force) {
|
|
222
|
+
nfsConfigurationSubmit.value++
|
|
223
|
+
return false
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (props.mode === 'sphere' && stepPosition.value === 3 && !force) {
|
|
227
|
+
hostAccessibilitySubmit.value++
|
|
228
|
+
return false
|
|
229
|
+
}
|
|
230
|
+
// if (
|
|
231
|
+
// ((stepPosition.value === 4 && nfsVersion.value === 'nfs-4.1') ||
|
|
232
|
+
// (stepPosition.value === 3 && nfsVersion.value === 'nfs-3')) &&
|
|
233
|
+
// !force
|
|
234
|
+
// ) {
|
|
235
|
+
// hostAccessibilitySubmit.value++
|
|
236
|
+
// return false
|
|
237
|
+
// }
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return true
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const isWizardModeForSphere = computed<boolean>(() => props.mode === 'sphere')
|
|
244
|
+
|
|
245
|
+
const onSaveNameAndNextLocal = (event: any): void => {
|
|
246
|
+
const { local } = datastoreForm.value
|
|
247
|
+
|
|
248
|
+
if (isWizardModeForSphere.value) {
|
|
249
|
+
local.name = event.name
|
|
250
|
+
local.hosts.push(event.host)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (!isWizardModeForSphere.value) {
|
|
254
|
+
local.name = event
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
dataReadyView.value = constructDataReadyViewFunc(
|
|
258
|
+
localization.value,
|
|
259
|
+
'local',
|
|
260
|
+
event,
|
|
261
|
+
isWizardModeForSphere.value
|
|
262
|
+
)
|
|
263
|
+
|
|
264
|
+
onNextStep(true)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const onSaveAndNextSharedStorm = (event: any): void => {
|
|
268
|
+
const { sharedStorm } = datastoreForm.value
|
|
269
|
+
sharedStorm.name = event.name
|
|
270
|
+
sharedStorm.dev_names = event.lunDisk.map((lun: UI_I_LunDisk) => lun.name)
|
|
271
|
+
sharedStorm.hosts = [event.host]
|
|
272
|
+
|
|
273
|
+
dataReadyView.value = constructDataReadyViewFunc(
|
|
274
|
+
localization.value,
|
|
275
|
+
'shared-storm',
|
|
276
|
+
event,
|
|
277
|
+
isWizardModeForSphere.value
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
onNextStep(true)
|
|
281
|
+
}
|
|
282
|
+
const saveChangesAndNextNfs = (event: any, next = true): void => {
|
|
283
|
+
const { nfs } = datastoreForm.value
|
|
284
|
+
nfs.name = event.name
|
|
285
|
+
nfs.folder = event.folder
|
|
286
|
+
nfs.server = event.server
|
|
287
|
+
nfs.hosts = event.hosts
|
|
288
|
+
|
|
289
|
+
// TODO refactoring
|
|
290
|
+
const hostsNames = props.nfsHosts
|
|
291
|
+
? props.nfsHosts.items
|
|
292
|
+
.filter((host) => event.hosts.includes(host.id))
|
|
293
|
+
.map((host) => host.host)
|
|
294
|
+
: []
|
|
295
|
+
|
|
296
|
+
dataReadyView.value = constructDataReadyViewFunc(
|
|
297
|
+
localization.value,
|
|
298
|
+
'nfs',
|
|
299
|
+
{
|
|
300
|
+
...event,
|
|
301
|
+
hosts: hostsNames,
|
|
302
|
+
version: nfsVersion.value,
|
|
303
|
+
},
|
|
304
|
+
isWizardModeForSphere.value
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
next && onNextStep(true)
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const isShowCompleteBlock = computed<boolean>(() => {
|
|
311
|
+
// TODO refactoring
|
|
312
|
+
const localStep = datastoreType.value === 'local' && stepPosition.value === 2
|
|
313
|
+
|
|
314
|
+
const sharesStep =
|
|
315
|
+
datastoreType.value === 'shared-storm' &&
|
|
316
|
+
(props.mode === 'procurator'
|
|
317
|
+
? stepPosition.value === 3
|
|
318
|
+
: stepPosition.value === 2)
|
|
319
|
+
|
|
320
|
+
let nfsFirst
|
|
321
|
+
if (props.mode === 'procurator') {
|
|
322
|
+
nfsFirst =
|
|
323
|
+
datastoreType.value === 'nfs' &&
|
|
324
|
+
nfsVersion.value === 'nfs-3' &&
|
|
325
|
+
stepPosition.value === 3
|
|
326
|
+
} else {
|
|
327
|
+
nfsFirst =
|
|
328
|
+
datastoreType.value === 'nfs' &&
|
|
329
|
+
nfsVersion.value === 'nfs-3' &&
|
|
330
|
+
stepPosition.value === 4
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
let nfsSecond
|
|
334
|
+
if (props.mode === 'procurator') {
|
|
335
|
+
nfsSecond =
|
|
336
|
+
datastoreType.value === 'nfs' &&
|
|
337
|
+
nfsVersion.value === 'nfs-4.1' &&
|
|
338
|
+
stepPosition.value === 3
|
|
339
|
+
} else {
|
|
340
|
+
nfsSecond =
|
|
341
|
+
datastoreType.value === 'nfs' &&
|
|
342
|
+
nfsVersion.value === 'nfs-4.1' &&
|
|
343
|
+
stepPosition.value === 4
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return localStep || sharesStep || nfsFirst || nfsSecond
|
|
347
|
+
})
|
|
348
|
+
|
|
349
|
+
const onAddDatastore = async (): Promise<void> => {
|
|
350
|
+
loading.value = true
|
|
351
|
+
|
|
352
|
+
props
|
|
353
|
+
.finishFunc(datastoreForm.value, datastoreType.value, nfsVersion.value)
|
|
354
|
+
.then(() => {
|
|
355
|
+
emits('global-refresh')
|
|
356
|
+
loading.value = false
|
|
357
|
+
onHideModal()
|
|
358
|
+
})
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// const createDatastoreFromLocal = async (): Promise<API_UI_I_Error> => {
|
|
362
|
+
// const { local } = datastoreForm.value
|
|
363
|
+
//
|
|
364
|
+
// return await createDatastore<Omit<UI_I_CreateDatastoreBodyRequest, 'pool_name'>>(
|
|
365
|
+
// local
|
|
366
|
+
// )
|
|
367
|
+
// }
|
|
368
|
+
// const createDatastoreFromSharedStorm = async (): Promise<API_UI_I_Error> => {
|
|
369
|
+
// const {
|
|
370
|
+
// sharedStorm: { dev_names: disks, ...sendData },
|
|
371
|
+
// } = datastoreForm.value
|
|
372
|
+
//
|
|
373
|
+
// const { data, msg } = await getStoragePoolName<{ dev_names: string[] }>(
|
|
374
|
+
// '/psm/api/v1/storage/lvm/create',
|
|
375
|
+
// { dev_names: disks }
|
|
376
|
+
// )
|
|
377
|
+
//
|
|
378
|
+
// if (!data && msg) return msg
|
|
379
|
+
//
|
|
380
|
+
// sendData.pool_name = data?.pool_name || ''
|
|
381
|
+
//
|
|
382
|
+
// return await createDatastore(sendData)
|
|
383
|
+
// }
|
|
384
|
+
|
|
385
|
+
// const createDatastoreFromNfs = async (): Promise<API_UI_I_Error> => {
|
|
386
|
+
// const {
|
|
387
|
+
// nfs: { server, folder, readonly, name, type_code: type },
|
|
388
|
+
// } = datastoreForm.value
|
|
389
|
+
//
|
|
390
|
+
// const sendDataOne = {
|
|
391
|
+
// server,
|
|
392
|
+
// folder,
|
|
393
|
+
// readonly,
|
|
394
|
+
// version: nfsVersion.value === 'nfs-4.1' ? 4.1 : 3.0,
|
|
395
|
+
// }
|
|
396
|
+
//
|
|
397
|
+
// const { data, msg } = await getStoragePoolName<UI_I_NfsPoolNameForm>(
|
|
398
|
+
// '/psm/api/v1/storage/cnfs',
|
|
399
|
+
// sendDataOne
|
|
400
|
+
// )
|
|
401
|
+
//
|
|
402
|
+
// if (!data && msg) return msg
|
|
403
|
+
//
|
|
404
|
+
// const sendDataTwo = {
|
|
405
|
+
// name,
|
|
406
|
+
// type_code: type,
|
|
407
|
+
// pool_name: data?.pool_name || '',
|
|
408
|
+
// }
|
|
409
|
+
//
|
|
410
|
+
// return await createDatastore(sendDataTwo)
|
|
411
|
+
// }
|
|
412
|
+
</script>
|
|
413
|
+
|
|
414
|
+
<style scoped lang="scss">
|
|
415
|
+
@import '~/assets/scss/common/mixins.scss';
|
|
416
|
+
|
|
417
|
+
.new-datastore {
|
|
418
|
+
&__body {
|
|
419
|
+
@include flex($dir: column);
|
|
420
|
+
height: 100%;
|
|
421
|
+
padding-left: 24px;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.finish-block {
|
|
426
|
+
padding: 18px 24px 24px 24px;
|
|
427
|
+
|
|
428
|
+
.add-hosts-ready-to-complete-mt-12 {
|
|
429
|
+
margin-top: 12px;
|
|
430
|
+
|
|
431
|
+
.add-hosts-ready-to-complete-bold {
|
|
432
|
+
line-height: 18px;
|
|
433
|
+
font-weight: 700;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
</style>
|