bfg-common 1.5.390 → 1.5.391
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/backup/storage/actions/add/Add.vue +251 -250
- package/components/common/backup/storage/actions/add/lib/validations.ts +252 -234
- package/components/common/backup/storage/actions/add/steps/nameAndConfigure/NameAndConfigure.vue +46 -44
- package/components/common/backup/storage/actions/add/steps/nameAndConfigure/NameAndConfigureNew.vue +280 -272
- package/components/common/backup/storage/actions/add/steps/nameAndConfigure/NameAndConfigureOld.vue +339 -328
- package/components/common/vmt/actions/add/Old.vue +5 -4
- package/package.json +1 -1
@@ -1,250 +1,251 @@
|
|
1
|
-
<template>
|
2
|
-
<common-backup-storage-actions-add-new
|
3
|
-
v-if="isNewView"
|
4
|
-
v-model="form"
|
5
|
-
:project="props.project"
|
6
|
-
:wizard="wizard"
|
7
|
-
:selected-scheme="selectedScheme"
|
8
|
-
:alert-messages="alertMessages"
|
9
|
-
:title="title"
|
10
|
-
:hosts="props.hosts"
|
11
|
-
:datastore="props.datastore"
|
12
|
-
:is-datastore-loading="props.isDatastoreLoading"
|
13
|
-
:get-datastore-table-func="props.getDatastoreTableFunc"
|
14
|
-
@change-steps="onChangeSteps"
|
15
|
-
@change-storage="onChangeStorage"
|
16
|
-
@submit="onCreate"
|
17
|
-
@hide="onHideModal"
|
18
|
-
/>
|
19
|
-
<common-backup-storage-actions-add-old
|
20
|
-
v-else
|
21
|
-
v-model="form"
|
22
|
-
:project="props.project"
|
23
|
-
:wizard="wizard"
|
24
|
-
:selected-scheme="selectedScheme"
|
25
|
-
:alert-messages="alertMessages"
|
26
|
-
:title="title"
|
27
|
-
:hosts="props.hosts"
|
28
|
-
:datastore="props.datastore"
|
29
|
-
:is-datastore-loading="props.isDatastoreLoading"
|
30
|
-
:get-datastore-table-func="props.getDatastoreTableFunc"
|
31
|
-
@change-steps="onChangeSteps"
|
32
|
-
@change-storage="onChangeStorage"
|
33
|
-
@submit="onCreate"
|
34
|
-
@hide="onHideModal"
|
35
|
-
/>
|
36
|
-
</template>
|
37
|
-
|
38
|
-
<script setup lang="ts">
|
39
|
-
import type { UI_T_Project } from '~/lib/models/types'
|
40
|
-
import type { UI_I_CreateDatastoreForm } from '~/components/common/backup/storage/actions/add/lib/models/interfaces'
|
41
|
-
import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
|
42
|
-
import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
|
43
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
44
|
-
import type {
|
45
|
-
UI_I_ValidationReturn,
|
46
|
-
UI_I_WizardStep,
|
47
|
-
} from '~/components/atoms/wizard/lib/models/interfaces'
|
48
|
-
import type { UI_T_DatastoreTypeCode } from '~/components/common/backup/storage/actions/add/lib/models/types'
|
49
|
-
// TODO use from uikit
|
50
|
-
import Wizard from
|
51
|
-
import {
|
52
|
-
stepsFunc,
|
53
|
-
stepsSchemeInitial,
|
54
|
-
} from '~/components/common/backup/storage/actions/add/lib/config/steps'
|
55
|
-
import { datastoreDefaultFormFunc } from '~/components/common/backup/storage/actions/add/lib/config/createDatastore'
|
56
|
-
import {
|
57
|
-
dynamicSteps,
|
58
|
-
getStepScheme,
|
59
|
-
} from '~/components/common/backup/storage/actions/add/lib/config/steps'
|
60
|
-
import * as validation from '~/components/common/backup/storage/actions/add/lib/validations'
|
61
|
-
|
62
|
-
const props = withDefaults(
|
63
|
-
defineProps<{
|
64
|
-
project: UI_T_Project
|
65
|
-
datastore: UI_I_DatastoreTableItem[]
|
66
|
-
isDatastoreLoading: boolean
|
67
|
-
getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
|
68
|
-
hosts?: any[]
|
69
|
-
}>(),
|
70
|
-
{ hosts: [] }
|
71
|
-
)
|
72
|
-
const emits = defineEmits<{
|
73
|
-
(event: 'create', value: UI_I_CreateDatastoreForm): void
|
74
|
-
(event: 'hide'): void
|
75
|
-
}>()
|
76
|
-
|
77
|
-
const { $store }: any = useNuxtApp()
|
78
|
-
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
79
|
-
|
80
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
81
|
-
|
82
|
-
const title = ref(localization.value.common.newBackupStorage)
|
83
|
-
|
84
|
-
const wizard: Wizard = new Wizard(
|
85
|
-
stepsFunc(localization.value),
|
86
|
-
stepsSchemeInitial
|
87
|
-
)
|
88
|
-
|
89
|
-
const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
|
90
|
-
const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
|
91
|
-
|
92
|
-
const form = ref<UI_I_CreateDatastoreForm>(
|
93
|
-
useDeepCopy(datastoreDefaultFormFunc())
|
94
|
-
)
|
95
|
-
|
96
|
-
const validationFunc = async (
|
97
|
-
value: UI_I_WizardStep[],
|
98
|
-
currentStep: UI_I_WizardStep,
|
99
|
-
nextStep: UI_I_WizardStep
|
100
|
-
): Promise<UI_I_ValidationReturn> => {
|
101
|
-
let stepHasError = false
|
102
|
-
|
103
|
-
if (
|
104
|
-
wizard.isValidateForStep(dynamicSteps.name, currentStep.id, nextStep.id)
|
105
|
-
) {
|
106
|
-
const nameValidation = await validation.checkDatastoreNameAsync(
|
107
|
-
localization.value,
|
108
|
-
value,
|
109
|
-
form.value,
|
110
|
-
dynamicSteps.name,
|
111
|
-
'name',
|
112
|
-
wizard,
|
113
|
-
props.project
|
114
|
-
)
|
115
|
-
|
116
|
-
value = nameValidation.newValue
|
117
|
-
|
118
|
-
stepHasError = nameValidation.stepHasError
|
119
|
-
}
|
120
|
-
|
121
|
-
if (
|
122
|
-
wizard.isValidateForStep(
|
123
|
-
dynamicSteps.nameAndConfigure,
|
124
|
-
currentStep.id,
|
125
|
-
nextStep.id
|
126
|
-
)
|
127
|
-
) {
|
128
|
-
const nameValidation = await validation.checkDatastoreNameAsync(
|
129
|
-
localization.value,
|
130
|
-
value,
|
131
|
-
form.value,
|
132
|
-
dynamicSteps.nameAndConfigure,
|
133
|
-
'name',
|
134
|
-
wizard,
|
135
|
-
props.project
|
136
|
-
)
|
137
|
-
value = nameValidation.newValue
|
138
|
-
|
139
|
-
const folderValidation = validation.checkFolderSync(
|
140
|
-
localization.value,
|
141
|
-
form.value.folder,
|
142
|
-
wizard,
|
143
|
-
value
|
144
|
-
)
|
145
|
-
value = folderValidation.newValue
|
146
|
-
|
147
|
-
const serverValidation = validation.checkServerSync(
|
148
|
-
localization.value,
|
149
|
-
form.value.server,
|
150
|
-
wizard,
|
151
|
-
value
|
152
|
-
)
|
153
|
-
value = serverValidation.newValue
|
154
|
-
|
155
|
-
const usernameValidation = validation.checkUsernameSync(
|
156
|
-
localization.value,
|
157
|
-
form.value.user,
|
158
|
-
wizard,
|
159
|
-
value
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
value
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
value
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
1
|
+
<template>
|
2
|
+
<common-backup-storage-actions-add-new
|
3
|
+
v-if="isNewView"
|
4
|
+
v-model="form"
|
5
|
+
:project="props.project"
|
6
|
+
:wizard="wizard"
|
7
|
+
:selected-scheme="selectedScheme"
|
8
|
+
:alert-messages="alertMessages"
|
9
|
+
:title="title"
|
10
|
+
:hosts="props.hosts"
|
11
|
+
:datastore="props.datastore"
|
12
|
+
:is-datastore-loading="props.isDatastoreLoading"
|
13
|
+
:get-datastore-table-func="props.getDatastoreTableFunc"
|
14
|
+
@change-steps="onChangeSteps"
|
15
|
+
@change-storage="onChangeStorage"
|
16
|
+
@submit="onCreate"
|
17
|
+
@hide="onHideModal"
|
18
|
+
/>
|
19
|
+
<common-backup-storage-actions-add-old
|
20
|
+
v-else
|
21
|
+
v-model="form"
|
22
|
+
:project="props.project"
|
23
|
+
:wizard="wizard"
|
24
|
+
:selected-scheme="selectedScheme"
|
25
|
+
:alert-messages="alertMessages"
|
26
|
+
:title="title"
|
27
|
+
:hosts="props.hosts"
|
28
|
+
:datastore="props.datastore"
|
29
|
+
:is-datastore-loading="props.isDatastoreLoading"
|
30
|
+
:get-datastore-table-func="props.getDatastoreTableFunc"
|
31
|
+
@change-steps="onChangeSteps"
|
32
|
+
@change-storage="onChangeStorage"
|
33
|
+
@submit="onCreate"
|
34
|
+
@hide="onHideModal"
|
35
|
+
/>
|
36
|
+
</template>
|
37
|
+
|
38
|
+
<script setup lang="ts">
|
39
|
+
import type { UI_T_Project } from '~/lib/models/types'
|
40
|
+
import type { UI_I_CreateDatastoreForm } from '~/components/common/backup/storage/actions/add/lib/models/interfaces'
|
41
|
+
import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
|
42
|
+
import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
|
43
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
44
|
+
import type {
|
45
|
+
UI_I_ValidationReturn,
|
46
|
+
UI_I_WizardStep,
|
47
|
+
} from '~/components/atoms/wizard/lib/models/interfaces'
|
48
|
+
import type { UI_T_DatastoreTypeCode } from '~/components/common/backup/storage/actions/add/lib/models/types'
|
49
|
+
// TODO use from uikit
|
50
|
+
import Wizard from '~/components/atoms/wizard/lib/utils/utils'
|
51
|
+
import {
|
52
|
+
stepsFunc,
|
53
|
+
stepsSchemeInitial,
|
54
|
+
} from '~/components/common/backup/storage/actions/add/lib/config/steps'
|
55
|
+
import { datastoreDefaultFormFunc } from '~/components/common/backup/storage/actions/add/lib/config/createDatastore'
|
56
|
+
import {
|
57
|
+
dynamicSteps,
|
58
|
+
getStepScheme,
|
59
|
+
} from '~/components/common/backup/storage/actions/add/lib/config/steps'
|
60
|
+
import * as validation from '~/components/common/backup/storage/actions/add/lib/validations'
|
61
|
+
|
62
|
+
const props = withDefaults(
|
63
|
+
defineProps<{
|
64
|
+
project: UI_T_Project
|
65
|
+
datastore: UI_I_DatastoreTableItem[]
|
66
|
+
isDatastoreLoading: boolean
|
67
|
+
getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
|
68
|
+
hosts?: any[]
|
69
|
+
}>(),
|
70
|
+
{ hosts: [] }
|
71
|
+
)
|
72
|
+
const emits = defineEmits<{
|
73
|
+
(event: 'create', value: UI_I_CreateDatastoreForm): void
|
74
|
+
(event: 'hide'): void
|
75
|
+
}>()
|
76
|
+
|
77
|
+
const { $store }: any = useNuxtApp()
|
78
|
+
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
79
|
+
|
80
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
81
|
+
|
82
|
+
const title = ref(localization.value.common.newBackupStorage)
|
83
|
+
|
84
|
+
const wizard: Wizard = new Wizard(
|
85
|
+
stepsFunc(localization.value),
|
86
|
+
stepsSchemeInitial
|
87
|
+
)
|
88
|
+
|
89
|
+
const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
|
90
|
+
const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
|
91
|
+
|
92
|
+
const form = ref<UI_I_CreateDatastoreForm>(
|
93
|
+
useDeepCopy(datastoreDefaultFormFunc())
|
94
|
+
)
|
95
|
+
|
96
|
+
const validationFunc = async (
|
97
|
+
value: UI_I_WizardStep[],
|
98
|
+
currentStep: UI_I_WizardStep,
|
99
|
+
nextStep: UI_I_WizardStep
|
100
|
+
): Promise<UI_I_ValidationReturn> => {
|
101
|
+
let stepHasError = false
|
102
|
+
|
103
|
+
if (
|
104
|
+
wizard.isValidateForStep(dynamicSteps.name, currentStep.id, nextStep.id)
|
105
|
+
) {
|
106
|
+
const nameValidation = await validation.checkDatastoreNameAsync(
|
107
|
+
localization.value,
|
108
|
+
value,
|
109
|
+
form.value,
|
110
|
+
dynamicSteps.name,
|
111
|
+
'name',
|
112
|
+
wizard,
|
113
|
+
props.project
|
114
|
+
)
|
115
|
+
|
116
|
+
value = nameValidation.newValue
|
117
|
+
|
118
|
+
stepHasError = nameValidation.stepHasError
|
119
|
+
}
|
120
|
+
|
121
|
+
if (
|
122
|
+
wizard.isValidateForStep(
|
123
|
+
dynamicSteps.nameAndConfigure,
|
124
|
+
currentStep.id,
|
125
|
+
nextStep.id
|
126
|
+
)
|
127
|
+
) {
|
128
|
+
const nameValidation = await validation.checkDatastoreNameAsync(
|
129
|
+
localization.value,
|
130
|
+
value,
|
131
|
+
form.value,
|
132
|
+
dynamicSteps.nameAndConfigure,
|
133
|
+
'name',
|
134
|
+
wizard,
|
135
|
+
props.project
|
136
|
+
)
|
137
|
+
value = nameValidation.newValue
|
138
|
+
|
139
|
+
const folderValidation = validation.checkFolderSync(
|
140
|
+
localization.value,
|
141
|
+
form.value.folder,
|
142
|
+
wizard,
|
143
|
+
value
|
144
|
+
)
|
145
|
+
value = folderValidation.newValue
|
146
|
+
|
147
|
+
const serverValidation = validation.checkServerSync(
|
148
|
+
localization.value,
|
149
|
+
form.value.server,
|
150
|
+
wizard,
|
151
|
+
value
|
152
|
+
)
|
153
|
+
value = serverValidation.newValue
|
154
|
+
|
155
|
+
const usernameValidation = validation.checkUsernameSync(
|
156
|
+
localization.value,
|
157
|
+
form.value.user,
|
158
|
+
wizard,
|
159
|
+
value,
|
160
|
+
props.project
|
161
|
+
)
|
162
|
+
value = usernameValidation.newValue
|
163
|
+
|
164
|
+
const passwordValidation = validation.checkPasswordSync(
|
165
|
+
localization.value,
|
166
|
+
form.value.password,
|
167
|
+
wizard,
|
168
|
+
value,
|
169
|
+
props.project
|
170
|
+
)
|
171
|
+
value = passwordValidation.newValue
|
172
|
+
|
173
|
+
stepHasError =
|
174
|
+
nameValidation.stepHasError ||
|
175
|
+
folderValidation.stepHasError ||
|
176
|
+
serverValidation.stepHasError ||
|
177
|
+
usernameValidation.stepHasError ||
|
178
|
+
passwordValidation.stepHasError
|
179
|
+
}
|
180
|
+
|
181
|
+
if (
|
182
|
+
wizard.isValidateForStep(
|
183
|
+
dynamicSteps.hostAccessibility,
|
184
|
+
currentStep.id,
|
185
|
+
nextStep.id
|
186
|
+
)
|
187
|
+
) {
|
188
|
+
const hostsValidation = await validation.checkHostsAccessibilitySync(
|
189
|
+
localization.value,
|
190
|
+
form.value.hosts,
|
191
|
+
wizard,
|
192
|
+
value
|
193
|
+
)
|
194
|
+
|
195
|
+
value = hostsValidation.newValue
|
196
|
+
|
197
|
+
stepHasError = hostsValidation.stepHasError
|
198
|
+
}
|
199
|
+
|
200
|
+
if (
|
201
|
+
wizard.isValidateForStep(dynamicSteps.storage, currentStep.id, nextStep.id)
|
202
|
+
) {
|
203
|
+
const storageValidation = await validation.checkStorageSync(
|
204
|
+
localization.value,
|
205
|
+
form.value.storm_id,
|
206
|
+
wizard,
|
207
|
+
value
|
208
|
+
)
|
209
|
+
|
210
|
+
value = storageValidation.newValue
|
211
|
+
|
212
|
+
stepHasError = storageValidation.stepHasError
|
213
|
+
}
|
214
|
+
|
215
|
+
return {
|
216
|
+
newValue: value,
|
217
|
+
stepHasError,
|
218
|
+
}
|
219
|
+
}
|
220
|
+
|
221
|
+
const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
|
222
|
+
wizard.changeSteps(value, validationFunc)
|
223
|
+
|
224
|
+
// Choosing Scheme
|
225
|
+
watch(
|
226
|
+
() => form.value.type_code,
|
227
|
+
(newValue: UI_T_DatastoreTypeCode) => {
|
228
|
+
const step = getStepScheme(props.project, newValue)
|
229
|
+
if (step !== undefined) {
|
230
|
+
wizard.changeScheme(step)
|
231
|
+
}
|
232
|
+
},
|
233
|
+
{ immediate: true }
|
234
|
+
)
|
235
|
+
|
236
|
+
const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
|
237
|
+
if (!storage) return
|
238
|
+
|
239
|
+
form.value.storm_id = storage.id
|
240
|
+
}
|
241
|
+
|
242
|
+
const onCreate = async (): Promise<void> => {
|
243
|
+
emits('create', form.value)
|
244
|
+
}
|
245
|
+
|
246
|
+
const onHideModal = (): void => {
|
247
|
+
emits('hide')
|
248
|
+
}
|
249
|
+
</script>
|
250
|
+
|
251
|
+
<style scoped lang="scss"></style>
|