bfg-common 1.3.433 → 1.3.435

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.
@@ -37,10 +37,13 @@
37
37
  :project="props.project"
38
38
  :step-id="selectedStep.id"
39
39
  :datastore-type="datastoreType"
40
+ :alert-messages="alertMessages[selectedStep.id]"
41
+ :messages-fields="selectedStep.fields"
40
42
  :device-selection-submit="deviceSelectionSubmit"
41
43
  :datacenter-hosts="props.datacenterHosts"
42
44
  :is-main-filter="props.isMainFilter"
43
45
  :host-id="props.hostId"
46
+ @hide-alert="onHideAlert"
44
47
  @loading="(e) => (loading = e)"
45
48
  @submit="onSaveAndNextSharedStorm"
46
49
  @main-filter="emits('main-filter', $event)"
@@ -137,7 +140,7 @@ const stepPosition = ref<number>(0)
137
140
 
138
141
  const form = ref({
139
142
  name: '',
140
- lunDisk: []
143
+ lunDisk: [],
141
144
  })
142
145
  const datastoreForm = ref<UI_I_CreateDatastoreForm>({
143
146
  local: {
@@ -213,6 +216,58 @@ const checkNameAsync = async (
213
216
  }
214
217
  }
215
218
 
219
+ const checkNetwork2 = async (
220
+ form: any,
221
+ localization: UI_I_Localization
222
+ // emits: UI_I_AddNetworkingEmits
223
+ ): Promise<UI_I_AsyncCheckReturn> => {
224
+ console.log(form, 'sdsdf')
225
+ if (form.name && form.lunDisk.length) {
226
+ return new Promise((resolve, _reject) =>
227
+ checkValidityName(form.name, (message: string) => {
228
+ resolve({
229
+ isValid: message === '',
230
+ message: message === '' ? '' : message,
231
+ })
232
+ })
233
+ )
234
+ } else {
235
+ return {
236
+ isValid: false,
237
+ message: !form.lunDisk.length
238
+ ? localization.selectHostToContinueAlert
239
+ : localization.specifyDatastoreName,
240
+ }
241
+ }
242
+ }
243
+ const checkName2Async = async (
244
+ localization: UI_I_Localization,
245
+ value: UI_I_WizardStep[],
246
+ form: any,
247
+ wizard: Wizard
248
+ ): Promise<UI_I_ValidationReturn> => {
249
+ let stepHasError = false
250
+
251
+ const labelValidation: {
252
+ isValid: boolean
253
+ message: string
254
+ } = await checkNetwork2(form, localization)
255
+
256
+ if (!labelValidation.isValid) {
257
+ stepHasError = wizard.setValidation(1, 'datastoreName', {
258
+ fieldMessage: labelValidation.message,
259
+ alertMessage: form.name ? labelValidation.message : '',
260
+ })
261
+ } else if (wizard.hasMessage(1, 'datastoreName')) {
262
+ value = wizard.removeValidation(1, 'datastoreName', value)
263
+ }
264
+
265
+ return {
266
+ newValue: value,
267
+ stepHasError,
268
+ }
269
+ }
270
+
216
271
  const validationFunc = async (
217
272
  value: UI_I_WizardStep[],
218
273
  currentStep: UI_I_WizardStep,
@@ -233,6 +288,19 @@ const validationFunc = async (
233
288
  stepHasError = nameValidation.stepHasError
234
289
  }
235
290
 
291
+ if (wizard.isValidateForStep(2, currentStep.id, nextStep.id)) {
292
+ const nameValidation = await checkName2Async(
293
+ localization.value,
294
+ value,
295
+ form.value,
296
+ wizard
297
+ )
298
+
299
+ value = nameValidation.newValue
300
+
301
+ stepHasError = nameValidation.stepHasError
302
+ }
303
+
236
304
  return {
237
305
  newValue: value,
238
306
  stepHasError,
@@ -3,14 +3,17 @@
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
+ :alert-messages="props.alertMessages"
9
+ :messages-fields="props.messagesFields"
8
10
  :device-selection-submit="0"
9
11
  :datastore-type="props.datastoreType"
10
12
  :project="props.project"
11
13
  :datacenter-hosts="props.datacenterHosts"
12
14
  :is-main-filter="props.isMainFilter"
13
15
  :host-id="props.hostId"
16
+ @hide-alert="(e) => emits('hide-alert', e)"
14
17
  @loading="(e) => emits('loading', e)"
15
18
  @main-filter="emits('main-filter', $event)"
16
19
  />
@@ -30,21 +33,27 @@
30
33
  </template>
31
34
 
32
35
  <script lang="ts" setup>
33
- import { UI_I_Localization } from '~/lib/models/interfaces'
36
+ import {
37
+ UI_I_Localization,
38
+ UI_I_ArbitraryObject,
39
+ } from '~/lib/models/interfaces'
34
40
  import { UI_T_Project } from '~/lib/models/types'
41
+ import type { UI_I_ErrorFields } from '~/components/atoms/wizard/lib/models/interfaces'
35
42
  import {
36
43
  UI_T_DatastoreType,
37
44
  UI_T_VmfsType,
38
45
  } from '~/components/common/wizards/datastore/add/lib/models/types'
39
46
  import {
40
47
  UI_I_SelectHostOptions,
41
- UI_I_CreateStorageLunDiskItem,
48
+ // UI_I_CreateStorageLunDiskItem,
42
49
  } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
43
50
 
44
51
  const props = defineProps<{
45
52
  project: UI_T_Project
46
53
  stepId: number
47
54
  datastoreType: UI_T_DatastoreType
55
+ alertMessages: string[]
56
+ messagesFields: UI_I_ArbitraryObject<UI_I_ErrorFields>
48
57
  datacenterHosts?: UI_I_SelectHostOptions[]
49
58
  isMainFilter?: boolean
50
59
  hostId?: string
@@ -52,6 +61,7 @@ const props = defineProps<{
52
61
  const model = defineModel<any>()
53
62
  const emits = defineEmits<{
54
63
  // (event: 'submit', value: { name: string; lunDisk: string[] }): void
64
+ (event: 'hide-alert', value: boolean): void
55
65
  (event: 'loading', value: boolean): void
56
66
  (event: 'main-filter', value: string): void
57
67
  }>()
@@ -59,15 +69,11 @@ const emits = defineEmits<{
59
69
  const localization = computed<UI_I_Localization>(() => useLocal())
60
70
 
61
71
  const vmfsVersion = ref<UI_T_VmfsType>('vmfs-6')
62
- const selectedLunDisk = ref<UI_I_CreateStorageLunDiskItem[]>([])
63
72
 
64
73
  const lunDiskTotalCapacity = computed<number>(() => {
65
- console.log(model.value, 'model.value')
66
- console.log(selectedLunDisk.value, 'selectedLunDisk.value')
67
-
68
- if (!selectedLunDisk.value.length) return 0
74
+ if (!model.value.lunDisk.length) return 0
69
75
 
70
- return +selectedLunDisk.value
76
+ return +model.value.lunDisk
71
77
  .map((disk) => disk.capacity_mb)
72
78
  .reduce((acc, cur) => acc + cur)
73
79
  })
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <div class="device-selection">
3
3
  <atoms-alert
4
- v-show="errors.length"
4
+ v-show="props.alertMessages.length"
5
5
  test-id="device-selection-errors"
6
6
  status="alert-danger"
7
- :items="errors"
8
- @remove="onCloseAlertDanger"
7
+ :items="props.alertMessages"
8
+ @remove="onHideAlert"
9
9
  />
10
10
 
11
11
  <div class="clr-form-control clr-row">
@@ -99,7 +99,10 @@
99
99
  import { UI_T_Project } from '~/lib/models/types'
100
100
  import { UI_I_ValidationTouchResult } from '~/lib/models/plugins/validation/interfaces'
101
101
  // import { UI_I_SchemaTablePayload } from '~/lib/models/store/interfaces'
102
- import { UI_I_Localization } from '~/lib/models/interfaces'
102
+ import {
103
+ UI_I_Localization,
104
+ UI_I_ArbitraryObject,
105
+ } from '~/lib/models/interfaces'
103
106
  import {
104
107
  API_UI_I_DataTable,
105
108
  UI_I_Pagination,
@@ -112,18 +115,20 @@ import {
112
115
  UI_I_LunDiskSpherePayload,
113
116
  UI_I_SelectHostOptions,
114
117
  } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
118
+ import type { UI_I_ErrorFields } from '~/components/atoms/wizard/lib/models/interfaces'
115
119
  // import { Ui_T_HostSelectedType } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/types'
116
120
  import { UI_T_DatastoreType } from '~/components/common/wizards/datastoreNew/add/lib/models/types'
117
121
  import { defaultFormFunc } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/config/defaultForm'
118
122
  import { hostsOptionsFunc } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/config/selectOptions'
119
- import { checkValidityName } from '~/components/common/wizards/datastore/add/lib/utils'
123
+ import { checkValidityName } from '~/components/common/wizards/datastoreNew/add/lib/utils'
120
124
 
121
125
  const props = defineProps<{
122
126
  project: UI_T_Project
123
127
  stepId: number
128
+ alertMessages: string[]
129
+ messagesFields: UI_I_ArbitraryObject<UI_I_ErrorFields>
124
130
  deviceSelectionSubmit: number
125
131
  lunDisk: UI_I_CreateStorageLunDiskItem[]
126
- stepPosition: number
127
132
  datastoreType: UI_T_DatastoreType
128
133
  datacenterHosts?: UI_I_SelectHostOptions[] | undefined
129
134
  isMainFilter?: boolean
@@ -132,6 +137,7 @@ const props = defineProps<{
132
137
  const model = defineModel<any>()
133
138
  const emits = defineEmits<{
134
139
  (event: 'loading', value: boolean): void
140
+ (event: 'hide-alert', value: number): void
135
141
  (event: 'submit', value: UI_I_DeviceSelectionSendData): void
136
142
  (event: 'main-filter', value: string): void
137
143
  }>()
@@ -184,7 +190,7 @@ const pagination = ref<UI_I_Pagination>({
184
190
  })
185
191
  const sort = ref<string | null>(null)
186
192
 
187
- const selectedLunDisk = ref<number[]>([])
193
+ // const selectedLunDisk = ref<number[]>([])
188
194
 
189
195
  const updatePagination = (event: UI_I_Pagination): void => {
190
196
  pagination.value = event
@@ -239,9 +245,6 @@ const resetValidation = (): void => {
239
245
  const removeInputValidation = (): void => {
240
246
  formErrors.value = []
241
247
  }
242
- const onCloseAlertDanger = (): void => {
243
- errors.value = []
244
- }
245
248
  const validatePropertiesForSphere = (): boolean => {
246
249
  if (props.datastoreType === 'local') {
247
250
  return !selectedHost.value
@@ -370,9 +373,14 @@ const initLunDisksDataTable = async (): Promise<void> => {
370
373
  } as UI_I_DataTableQuery)
371
374
  }
372
375
 
373
- if (props.project === 'procurator' && props.stepId === 2) {
376
+ if (props.project === 'procurator') {
377
+ // && props.stepId === 2
374
378
  initLunDisksDataTable()
375
379
  }
380
+
381
+ const onHideAlert = (): void => {
382
+ emits('hide-alert', props.stepId)
383
+ }
376
384
  </script>
377
385
 
378
386
  <style lang="scss" scoped>
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.435",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",