bfg-common 1.3.433 → 1.3.434

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.
@@ -137,7 +137,7 @@ const stepPosition = ref<number>(0)
137
137
 
138
138
  const form = ref({
139
139
  name: '',
140
- lunDisk: []
140
+ lunDisk: [],
141
141
  })
142
142
  const datastoreForm = ref<UI_I_CreateDatastoreForm>({
143
143
  local: {
@@ -213,6 +213,58 @@ const checkNameAsync = async (
213
213
  }
214
214
  }
215
215
 
216
+ const checkNetwork2 = async (
217
+ form: any,
218
+ localization: UI_I_Localization
219
+ // emits: UI_I_AddNetworkingEmits
220
+ ): Promise<UI_I_AsyncCheckReturn> => {
221
+ console.log(form, 'sdsdf')
222
+ if (form.name && form.lunDisk.length) {
223
+ return new Promise((resolve, _reject) =>
224
+ checkValidityName(form.name, (message: string) => {
225
+ resolve({
226
+ isValid: message === '',
227
+ message: message === '' ? '' : message,
228
+ })
229
+ })
230
+ )
231
+ } else {
232
+ return {
233
+ isValid: false,
234
+ message: !form.lunDisk.length
235
+ ? localization.selectHostToContinueAlert
236
+ : localization.specifyDatastoreName,
237
+ }
238
+ }
239
+ }
240
+ const checkName2Async = async (
241
+ localization: UI_I_Localization,
242
+ value: UI_I_WizardStep[],
243
+ form: any,
244
+ wizard: Wizard
245
+ ): Promise<UI_I_ValidationReturn> => {
246
+ let stepHasError = false
247
+
248
+ const labelValidation: {
249
+ isValid: boolean
250
+ message: string
251
+ } = await checkNetwork2(form, localization)
252
+
253
+ if (!labelValidation.isValid) {
254
+ stepHasError = wizard.setValidation(1, 'datastoreName', {
255
+ fieldMessage: labelValidation.message,
256
+ alertMessage: form.name ? labelValidation.message : '',
257
+ })
258
+ } else if (wizard.hasMessage(1, 'datastoreName')) {
259
+ value = wizard.removeValidation(1, 'datastoreName', value)
260
+ }
261
+
262
+ return {
263
+ newValue: value,
264
+ stepHasError,
265
+ }
266
+ }
267
+
216
268
  const validationFunc = async (
217
269
  value: UI_I_WizardStep[],
218
270
  currentStep: UI_I_WizardStep,
@@ -233,6 +285,19 @@ const validationFunc = async (
233
285
  stepHasError = nameValidation.stepHasError
234
286
  }
235
287
 
288
+ if (wizard.isValidateForStep(2, currentStep.id, nextStep.id)) {
289
+ const nameValidation = await checkName2Async(
290
+ localization.value,
291
+ value,
292
+ form.value,
293
+ wizard
294
+ )
295
+
296
+ value = nameValidation.newValue
297
+
298
+ stepHasError = nameValidation.stepHasError
299
+ }
300
+
236
301
  return {
237
302
  newValue: value,
238
303
  stepHasError,
@@ -3,7 +3,7 @@
3
3
  <common-wizards-datastore-new-add-shared-storm-device-selection
4
4
  v-show="props.stepId === 2"
5
5
  v-model="model"
6
- v-model:lun-disk="selectedLunDisk"
6
+ v-model:lun-disk="[]"
7
7
  :step-id="props.stepId"
8
8
  :device-selection-submit="0"
9
9
  :datastore-type="props.datastoreType"
@@ -59,15 +59,11 @@ const emits = defineEmits<{
59
59
  const localization = computed<UI_I_Localization>(() => useLocal())
60
60
 
61
61
  const vmfsVersion = ref<UI_T_VmfsType>('vmfs-6')
62
- const selectedLunDisk = ref<UI_I_CreateStorageLunDiskItem[]>([])
63
62
 
64
63
  const lunDiskTotalCapacity = computed<number>(() => {
65
- console.log(model.value, 'model.value')
66
- console.log(selectedLunDisk.value, 'selectedLunDisk.value')
64
+ if (!model.value.lunDisk.length) return 0
67
65
 
68
- if (!selectedLunDisk.value.length) return 0
69
-
70
- return +selectedLunDisk.value
66
+ return +model.value.lunDisk
71
67
  .map((disk) => disk.capacity_mb)
72
68
  .reduce((acc, cur) => acc + cur)
73
69
  })
@@ -116,14 +116,13 @@ import {
116
116
  import { UI_T_DatastoreType } from '~/components/common/wizards/datastoreNew/add/lib/models/types'
117
117
  import { defaultFormFunc } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/config/defaultForm'
118
118
  import { hostsOptionsFunc } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/config/selectOptions'
119
- import { checkValidityName } from '~/components/common/wizards/datastore/add/lib/utils'
119
+ import { checkValidityName } from '~/components/common/wizards/datastoreNew/add/lib/utils'
120
120
 
121
121
  const props = defineProps<{
122
122
  project: UI_T_Project
123
123
  stepId: number
124
124
  deviceSelectionSubmit: number
125
125
  lunDisk: UI_I_CreateStorageLunDiskItem[]
126
- stepPosition: number
127
126
  datastoreType: UI_T_DatastoreType
128
127
  datacenterHosts?: UI_I_SelectHostOptions[] | undefined
129
128
  isMainFilter?: boolean
@@ -370,7 +369,7 @@ const initLunDisksDataTable = async (): Promise<void> => {
370
369
  } as UI_I_DataTableQuery)
371
370
  }
372
371
 
373
- if (props.project === 'procurator' && props.stepId === 2) {
372
+ if (props.project === 'procurator' ) { // && props.stepId === 2
374
373
  initLunDisksDataTable()
375
374
  }
376
375
  </script>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.3.433",
4
+ "version": "1.3.434",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",