bfg-common 1.3.426 → 1.3.428
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/wizards/datastoreNew/add/Add.vue +40 -74
- package/components/common/wizards/datastoreNew/add/lib/models/types.ts +4 -4
- package/components/common/wizards/datastoreNew/add/lib/utils.ts +9 -7
- package/components/common/wizards/datastoreNew/add/local/Local.vue +1 -3
- package/components/common/wizards/datastoreNew/add/local/createName/CreateName.vue +16 -40
- package/package.json +1 -1
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
:alert-messages="alertMessages[1]"
|
|
30
30
|
:messages-fields="selectedStep.fields"
|
|
31
31
|
@hide-alert="onHideAlert"
|
|
32
|
-
@loading="(e) => (loading = e)"
|
|
33
32
|
/>
|
|
34
33
|
|
|
35
34
|
<common-wizards-datastore-new-add-shared-storm
|
|
@@ -72,6 +71,7 @@
|
|
|
72
71
|
import type {
|
|
73
72
|
UI_I_WizardStep,
|
|
74
73
|
UI_I_ValidationReturn,
|
|
74
|
+
UI_I_AsyncCheckReturn,
|
|
75
75
|
} from '~/components/atoms/wizard/lib/models/interfaces'
|
|
76
76
|
import Wizard from '~/components/atoms/wizard/lib/utils/utils'
|
|
77
77
|
import {
|
|
@@ -94,6 +94,7 @@ import {
|
|
|
94
94
|
} from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
|
|
95
95
|
// import { stepItemsFunc } from '~/components/common/wizards/datastore/add/lib/config/stepItems'
|
|
96
96
|
import { constructDataReadyViewFunc } from '~/components/common/wizards/datastore/add/readyComplete/lib/config/propertiesDetails'
|
|
97
|
+
import { checkValidityName } from '~/components/common/wizards/datastoreNew/add/lib/utils'
|
|
97
98
|
|
|
98
99
|
const props = defineProps<{
|
|
99
100
|
project: UI_T_Project
|
|
@@ -159,18 +160,45 @@ const datastoreForm = ref<UI_I_CreateDatastoreForm>({
|
|
|
159
160
|
},
|
|
160
161
|
})
|
|
161
162
|
|
|
162
|
-
const
|
|
163
|
+
const checkNetwork = async (
|
|
164
|
+
label: string,
|
|
165
|
+
localization: UI_I_Localization
|
|
166
|
+
// emits: UI_I_AddNetworkingEmits
|
|
167
|
+
): Promise<UI_I_AsyncCheckReturn> => {
|
|
168
|
+
if (label) {
|
|
169
|
+
return new Promise((resolve, _reject) =>
|
|
170
|
+
checkValidityName(label, (message: string) => {
|
|
171
|
+
resolve({
|
|
172
|
+
isValid: message === '',
|
|
173
|
+
message: message === '' ? '' : message,
|
|
174
|
+
})
|
|
175
|
+
})
|
|
176
|
+
)
|
|
177
|
+
} else {
|
|
178
|
+
return {
|
|
179
|
+
isValid: false,
|
|
180
|
+
message: localization.specifyDatastoreName,
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const checkNameAsync = async (
|
|
163
186
|
localization: UI_I_Localization,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
): UI_I_ValidationReturn => {
|
|
187
|
+
value: UI_I_WizardStep[],
|
|
188
|
+
label: string,
|
|
189
|
+
wizard: Wizard
|
|
190
|
+
): Promise<UI_I_ValidationReturn> => {
|
|
168
191
|
let stepHasError = false
|
|
169
192
|
|
|
170
|
-
|
|
193
|
+
const labelValidation: {
|
|
194
|
+
isValid: boolean
|
|
195
|
+
message: string
|
|
196
|
+
} = await checkNetwork(label, localization)
|
|
197
|
+
|
|
198
|
+
if (!labelValidation.isValid) {
|
|
171
199
|
stepHasError = wizard.setValidation(1, 'datastoreName', {
|
|
172
|
-
fieldMessage:
|
|
173
|
-
alertMessage: '',
|
|
200
|
+
fieldMessage: labelValidation.message,
|
|
201
|
+
alertMessage: label ? labelValidation.message : '',
|
|
174
202
|
})
|
|
175
203
|
} else if (wizard.hasMessage(1, 'datastoreName')) {
|
|
176
204
|
value = wizard.removeValidation(1, 'datastoreName', value)
|
|
@@ -182,68 +210,6 @@ const checkIpFourSettingsSync = (
|
|
|
182
210
|
}
|
|
183
211
|
}
|
|
184
212
|
|
|
185
|
-
// const checkNetwork = async (
|
|
186
|
-
// label: string,
|
|
187
|
-
// localization: UI_I_Localization,
|
|
188
|
-
// emits: UI_I_AddNetworkingEmits
|
|
189
|
-
// ): Promise<UI_I_AsyncCheckReturn> => {
|
|
190
|
-
// if (label) {
|
|
191
|
-
// return new Promise((resolve, _reject) =>
|
|
192
|
-
// emits('check-network-label', label, (message: string) => {
|
|
193
|
-
// if (message === '') {
|
|
194
|
-
// resolve({
|
|
195
|
-
// isValid: true,
|
|
196
|
-
// message: '',
|
|
197
|
-
// })
|
|
198
|
-
// }
|
|
199
|
-
//
|
|
200
|
-
// if (message !== '') {
|
|
201
|
-
// resolve({
|
|
202
|
-
// isValid: false,
|
|
203
|
-
// message,
|
|
204
|
-
// })
|
|
205
|
-
// }
|
|
206
|
-
// })
|
|
207
|
-
// )
|
|
208
|
-
// } else {
|
|
209
|
-
// return {
|
|
210
|
-
// isValid: false,
|
|
211
|
-
// message: localization.networkLabelInvalidMessage,
|
|
212
|
-
// }
|
|
213
|
-
// }
|
|
214
|
-
// }
|
|
215
|
-
|
|
216
|
-
// export const checkNetworkAsync = async (
|
|
217
|
-
// value: UI_I_WizardStep[],
|
|
218
|
-
// label: string,
|
|
219
|
-
// stepId: number,
|
|
220
|
-
// fieldName: string,
|
|
221
|
-
// emits: UI_I_AddNetworkingEmits,
|
|
222
|
-
// localization: UI_I_Localization,
|
|
223
|
-
// wizard: Wizard
|
|
224
|
-
// ): Promise<UI_I_ValidationReturn> => {
|
|
225
|
-
// let stepHasError = false
|
|
226
|
-
//
|
|
227
|
-
// const labelValidation: {
|
|
228
|
-
// isValid: boolean
|
|
229
|
-
// message: string
|
|
230
|
-
// } = await checkNetwork(label, localization, emits)
|
|
231
|
-
//
|
|
232
|
-
// if (!labelValidation.isValid) {
|
|
233
|
-
// stepHasError = wizard.setValidation(stepId, fieldName, {
|
|
234
|
-
// fieldMessage: labelValidation.message,
|
|
235
|
-
// alertMessage: labelValidation.message,
|
|
236
|
-
// })
|
|
237
|
-
// } else if (wizard.hasMessage(stepId, fieldName)) {
|
|
238
|
-
// value = wizard.removeValidation(stepId, fieldName, value)
|
|
239
|
-
// }
|
|
240
|
-
//
|
|
241
|
-
// return {
|
|
242
|
-
// newValue: value,
|
|
243
|
-
// stepHasError,
|
|
244
|
-
// }
|
|
245
|
-
// }
|
|
246
|
-
|
|
247
213
|
const validationFunc = async (
|
|
248
214
|
value: UI_I_WizardStep[],
|
|
249
215
|
currentStep: UI_I_WizardStep,
|
|
@@ -252,11 +218,11 @@ const validationFunc = async (
|
|
|
252
218
|
let stepHasError = false
|
|
253
219
|
|
|
254
220
|
if (wizard.isValidateForStep(1, currentStep.id, nextStep.id)) {
|
|
255
|
-
const nameValidation =
|
|
221
|
+
const nameValidation = await checkNameAsync(
|
|
256
222
|
localization.value,
|
|
223
|
+
value,
|
|
257
224
|
form.value.name,
|
|
258
|
-
wizard
|
|
259
|
-
value
|
|
225
|
+
wizard
|
|
260
226
|
)
|
|
261
227
|
|
|
262
228
|
value = nameValidation.newValue
|
|
@@ -8,7 +8,7 @@ export type UI_T_KerberosAuthentication =
|
|
|
8
8
|
|
|
9
9
|
export type UI_T_WizardDatastoreMode = 'procurator' | 'sphere'
|
|
10
10
|
|
|
11
|
-
export interface UI_I_DatastoreValidityName {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
11
|
+
// export interface UI_I_DatastoreValidityName {
|
|
12
|
+
// valid: boolean
|
|
13
|
+
// msg: any
|
|
14
|
+
// }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { API_UI_I_Error } from '~/lib/models/store/interfaces'
|
|
2
2
|
import {
|
|
3
|
-
UI_I_DatastoreValidityName,
|
|
3
|
+
// UI_I_DatastoreValidityName,
|
|
4
4
|
UI_T_WizardDatastoreMode,
|
|
5
|
-
} from '~/components/common/wizards/
|
|
5
|
+
} from '~/components/common/wizards/datastoreNew/add/lib/models/types'
|
|
6
6
|
// import {
|
|
7
7
|
// UI_I_CreateDatastoreBodyRequest,
|
|
8
8
|
// I_CreateStorageUuid,
|
|
@@ -19,8 +19,9 @@ import {
|
|
|
19
19
|
|
|
20
20
|
export const checkValidityName = async (
|
|
21
21
|
name: string,
|
|
22
|
+
sendMessage: (message: string) => void,
|
|
22
23
|
mode: UI_T_WizardDatastoreMode = 'procurator'
|
|
23
|
-
): Promise<
|
|
24
|
+
): Promise<void> => {
|
|
24
25
|
// TODO move to projects!!!
|
|
25
26
|
|
|
26
27
|
const kind = 10 // TODO move in global space
|
|
@@ -35,11 +36,12 @@ export const checkValidityName = async (
|
|
|
35
36
|
|
|
36
37
|
if (error.value && error.value.data.error_code !== 0) {
|
|
37
38
|
const existError = error.value.data?.error_message || error.value.data
|
|
38
|
-
|
|
39
|
-
return
|
|
39
|
+
sendMessage(existError)
|
|
40
|
+
return
|
|
41
|
+
// return { valid: false, msg: existError }
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
return { valid: true, msg: null }
|
|
43
|
+
sendMessage('')
|
|
44
|
+
// return { valid: true, msg: null }
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
// export const getStoragePoolName = async <T>(
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
<div class="local-step">
|
|
3
3
|
<common-wizards-datastore-new-add-local-create-name
|
|
4
4
|
v-if="isShowCreateLocalNameBlock"
|
|
5
|
+
v-model="model.name"
|
|
5
6
|
:alert-messages="props.alertMessages"
|
|
6
7
|
:messages-fields="props.messagesFields"
|
|
7
8
|
@hide-alert="(e) => emits('hide-alert', e)"
|
|
8
|
-
@loading="(e) => emits('loading', e)"
|
|
9
9
|
/>
|
|
10
10
|
</div>
|
|
11
11
|
</template>
|
|
@@ -25,9 +25,7 @@ const props = defineProps<{
|
|
|
25
25
|
}>()
|
|
26
26
|
const model = defineModel<any>()
|
|
27
27
|
const emits = defineEmits<{
|
|
28
|
-
(event: 'loading', value: boolean): void
|
|
29
28
|
(event: 'hide-alert', value: number): void
|
|
30
|
-
(event: 'main-filter', value: string): void
|
|
31
29
|
}>()
|
|
32
30
|
|
|
33
31
|
const isShowCreateLocalNameBlock = computed<boolean>(
|
|
@@ -9,20 +9,20 @@
|
|
|
9
9
|
/>
|
|
10
10
|
|
|
11
11
|
<div class="clr-form-control clr-row">
|
|
12
|
-
<label for="datastore-name" class="clr-control-label clr-col-md-2">
|
|
13
|
-
localization.datastoreName
|
|
14
|
-
|
|
12
|
+
<label for="datastore-name" class="clr-control-label clr-col-md-2">
|
|
13
|
+
{{ localization.datastoreName }}
|
|
14
|
+
</label>
|
|
15
15
|
|
|
16
16
|
<div class="clr-control-container" :class="nameErrorText && 'clr-error'">
|
|
17
17
|
<div class="flex-align-center">
|
|
18
18
|
<input
|
|
19
19
|
id="datastore-name"
|
|
20
|
-
v-model.trim="
|
|
20
|
+
v-model.trim="createDatastoreNameLocal"
|
|
21
21
|
data-id="datastore-name-input"
|
|
22
22
|
type="text"
|
|
23
23
|
class="clr-input"
|
|
24
|
-
@blur="
|
|
25
|
-
@input="
|
|
24
|
+
@blur="initValidation(true)"
|
|
25
|
+
@input="initValidation"
|
|
26
26
|
/>
|
|
27
27
|
<atoms-the-icon class="error-icon" name="info-circle" />
|
|
28
28
|
</div>
|
|
@@ -36,24 +36,22 @@
|
|
|
36
36
|
</template>
|
|
37
37
|
|
|
38
38
|
<script lang="ts" setup>
|
|
39
|
-
import type { UI_I_ValidationTouchResult } from '~/lib/models/plugins/validation/interfaces'
|
|
40
39
|
import type {
|
|
41
40
|
UI_I_Localization,
|
|
42
41
|
UI_I_ArbitraryObject,
|
|
43
42
|
} from '~/lib/models/interfaces'
|
|
44
|
-
import type {
|
|
43
|
+
import type { UI_I_ValidationTouchResult } from '~/lib/models/plugins/validation/interfaces'
|
|
45
44
|
import type { UI_I_ErrorFields } from '~/components/atoms/wizard/lib/models/interfaces'
|
|
46
|
-
import {
|
|
47
|
-
|
|
45
|
+
import type { UI_I_FormValidationDataStore } from '~/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces'
|
|
46
|
+
import { defaultFormFunc } from '~/components/common/wizards/datastoreNew/add/local/createName/lib/config/defaultForm'
|
|
48
47
|
|
|
49
48
|
const props = defineProps<{
|
|
50
49
|
alertMessages: string[]
|
|
51
50
|
messagesFields: UI_I_ArbitraryObject<UI_I_ErrorFields>
|
|
52
51
|
}>()
|
|
52
|
+
const createDatastoreNameLocal = defineModel<string>()
|
|
53
53
|
const emits = defineEmits<{
|
|
54
54
|
(event: 'hide-alert', value: number): void
|
|
55
|
-
(event: 'loading', value: boolean): void
|
|
56
|
-
(event: 'submit', value: string): void
|
|
57
55
|
}>()
|
|
58
56
|
|
|
59
57
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
@@ -75,40 +73,18 @@ const validForm = ref<UI_I_ValidationTouchResult | null>(null)
|
|
|
75
73
|
|
|
76
74
|
/* Validation for Name input */
|
|
77
75
|
const isInitNameValidation = ref<boolean>(false)
|
|
78
|
-
const
|
|
79
|
-
validForm.value = validation.touch()
|
|
80
|
-
isInitNameValidation.value = true
|
|
81
|
-
}
|
|
82
|
-
const onInputName = () => {
|
|
76
|
+
const initValidation = (onlyBlur = false): void => {
|
|
83
77
|
validForm.value = validation.touch()
|
|
78
|
+
onlyBlur && (isInitNameValidation.value = true)
|
|
84
79
|
}
|
|
85
80
|
const nameErrorText = computed<string>(() => {
|
|
81
|
+
if (props.messagesFields.datastoreName.field) {
|
|
82
|
+
return props.messagesFields.datastoreName.field
|
|
83
|
+
}
|
|
84
|
+
|
|
86
85
|
if (!isInitNameValidation.value) return ''
|
|
87
86
|
return validForm.value?.errors?.name?.[0] || ''
|
|
88
87
|
})
|
|
89
|
-
/* Validation Name input end */
|
|
90
|
-
// const submit = async (): Promise<void> => {
|
|
91
|
-
// const name = form.value.name.value
|
|
92
|
-
//
|
|
93
|
-
// if (!name) {
|
|
94
|
-
// validForm.value = validation.touch()
|
|
95
|
-
// isInitNameValidation.value = true
|
|
96
|
-
// if (nameErrorText.value) return
|
|
97
|
-
// }
|
|
98
|
-
//
|
|
99
|
-
// if (name) {
|
|
100
|
-
// emits('loading', true)
|
|
101
|
-
//
|
|
102
|
-
// const { valid } = await checkValidityName(name)
|
|
103
|
-
//
|
|
104
|
-
// emits('loading', false)
|
|
105
|
-
//
|
|
106
|
-
// if (!valid) {
|
|
107
|
-
// return
|
|
108
|
-
// }
|
|
109
|
-
// }
|
|
110
|
-
// emits('submit', name)
|
|
111
|
-
// }
|
|
112
88
|
|
|
113
89
|
const onHideAlert = (): void => {
|
|
114
90
|
emits('hide-alert', 1)
|