bfg-common 1.3.458 → 1.3.460

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.
@@ -83,12 +83,7 @@ import {
83
83
 
84
84
  import type { UI_I_Localization } from '~/lib/models/interfaces'
85
85
  import type { UI_T_Project } from '~/lib/models/types'
86
- // import { UI_I_VerticalStepItem } from '~/components/atoms/lib/models/interfaces'
87
- import type {
88
- UI_T_DatastoreType,
89
- UI_T_NfsType,
90
- // UI_T_WizardDatastoreMode,
91
- } from '~/components/common/wizards/datastore/add/lib/models/types'
86
+ import type { UI_T_DatastoreType } from '~/components/common/wizards/datastoreNew/add/lib/models/types'
92
87
  import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastoreNew/add/lib/models/interfaces'
93
88
  import type {
94
89
  UI_I_LunDisk,
@@ -101,11 +96,6 @@ import { checkValidityName } from '~/components/common/wizards/datastoreNew/add/
101
96
 
102
97
  const props = defineProps<{
103
98
  project: UI_T_Project
104
- finishFunc: (
105
- datastoreForm: UI_I_CreateDatastoreForm,
106
- datastoreType: UI_T_DatastoreType,
107
- version: UI_T_NfsType
108
- ) => Promise<void>
109
99
  datacenterHosts?: UI_I_SelectHostOptions[]
110
100
  nfsHosts?: any
111
101
  isMainFilter?: boolean
@@ -130,10 +120,8 @@ const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
130
120
  const datastoreType = ref<UI_T_DatastoreType>(
131
121
  props.project === 'procurator' ? 'local' : 'shared-storm'
132
122
  )
133
- // const nfsVersion = ref<UI_T_NfsType>('nfs-3')
134
- // const dataReadyView = ref<any>([])
135
123
 
136
- const form = ref<any>({
124
+ const form = ref<UI_I_CreateDatastoreForm>({
137
125
  name: '',
138
126
  lunDisk: [],
139
127
  type_code: E_DatastoreTypeKode[datastoreType.value],
@@ -193,7 +181,7 @@ const checkName = async (
193
181
  } else {
194
182
  return {
195
183
  isValid: false,
196
- message: localization.specifyDatastoreName,
184
+ message: !label ? localization.specifyDatastoreName : '',
197
185
  }
198
186
  }
199
187
  }
@@ -226,59 +214,6 @@ const checkDatastoreNameAsync = async (
226
214
  stepHasError,
227
215
  }
228
216
  }
229
-
230
- const checkNameAndDevice = async (
231
- form: any,
232
- localization: UI_I_Localization,
233
- wizard: Wizard
234
- // emits: UI_I_AddNetworkingEmits
235
- ): Promise<UI_I_AsyncCheckReturn> => {
236
- if (form.name && form.lunDisk.length) {
237
- return new Promise((resolve, _reject) =>
238
- checkValidityName(form.name, wizard, (message: string) => {
239
- resolve({
240
- isValid: message === '',
241
- message: message === '' ? '' : message,
242
- })
243
- })
244
- )
245
- } else {
246
- return {
247
- isValid: false,
248
- message: !form.name
249
- ? localization.specifyDatastoreName
250
- : localization.selectHostToContinueAlert,
251
- }
252
- }
253
- }
254
- const checkNameAndDeviceAsync = async (
255
- localization: UI_I_Localization,
256
- value: UI_I_WizardStep[],
257
- form: any,
258
- wizard: Wizard
259
- ): Promise<UI_I_ValidationReturn> => {
260
- let stepHasError = false
261
-
262
- const labelValidation: {
263
- isValid: boolean
264
- message: string
265
- } = await checkNameAndDevice(form, localization, wizard)
266
-
267
- if (!labelValidation.isValid) {
268
- stepHasError = wizard.setValidation(2, 'datastoreName', {
269
- fieldMessage: labelValidation.message,
270
- alertMessage: form.name ? labelValidation.message : '',
271
- })
272
- } else if (wizard.hasMessage(2, 'datastoreName')) {
273
- value = wizard.removeValidation(2, 'datastoreName', value)
274
- }
275
-
276
- return {
277
- newValue: value,
278
- stepHasError,
279
- }
280
- }
281
-
282
217
  const checkNfsFolderSync = (
283
218
  localization: UI_I_Localization,
284
219
  name: string,
@@ -347,15 +282,19 @@ const validationFunc = async (
347
282
  }
348
283
 
349
284
  if (wizard.isValidateForStep(2, currentStep.id, nextStep.id)) {
350
- const nameValidation = await checkNameAndDeviceAsync(
285
+ const nameValidation = await checkDatastoreNameAsync(
351
286
  localization.value,
352
287
  value,
353
- form.value,
288
+ form.value.name,
289
+ 2,
290
+ 'datastoreName',
354
291
  wizard
355
292
  )
356
293
 
357
294
  value = nameValidation.newValue
358
295
 
296
+ //selectHostToContinueAlert
297
+
359
298
  stepHasError = nameValidation.stepHasError
360
299
  }
361
300
 
@@ -380,14 +319,14 @@ const validationFunc = async (
380
319
 
381
320
  const serverValidation = checkNfsServerSync(
382
321
  localization.value,
383
- form.value.folder,
322
+ form.value.server,
384
323
  wizard,
385
324
  value
386
325
  )
387
326
 
388
327
  stepHasError =
389
- folderValidation.stepHasError ||
390
328
  nameValidation.stepHasError ||
329
+ folderValidation.stepHasError ||
391
330
  serverValidation.stepHasError
392
331
  }
393
332
 
@@ -422,11 +361,7 @@ watch(
422
361
  )
423
362
 
424
363
  const dataReadyView = computed<UI_I_DetailsItem>(() =>
425
- constructDataReadyViewFunc(
426
- localization.value,
427
- datastoreType.value,
428
- form.value
429
- )
364
+ constructDataReadyViewFunc(localization.value, form.value)
430
365
  )
431
366
  const onNextStep = (_force = false): void => {}
432
367
 
@@ -1,38 +1,11 @@
1
- import { UI_T_NfsType } from '~/components/common/wizards/datastore/add/lib/models/types'
2
-
3
- // TODO refactoring
4
- export interface UI_I_NfsPoolNameForm<T = number> {
1
+ import type { UI_T_NfsType } from '~/components/common/wizards/datastoreNew/add/lib/models/types'
2
+ export interface UI_I_CreateDatastoreForm {
3
+ name: string
4
+ lunDisk: any
5
+ nfsVersion: UI_T_NfsType
6
+ type_code: 1 | 2 | 4
7
+ readonly: boolean
5
8
  server: string
6
9
  folder: string
7
- version: T
8
- readonly: boolean
9
- hosts: string[]
10
- }
11
- export interface UI_I_CreateDatastoreBodyRequest {
12
- name: string
13
- pool_name: string
14
- type_code: number
15
- }
16
- interface I_NfsForm extends UI_I_NfsPoolNameForm<UI_T_NfsType> {
17
- name: string
18
- type_code: number
19
- }
20
- interface I_SharedStorm extends UI_I_CreateDatastoreBodyRequest {
21
- dev_names: string[]
22
- hosts: string[]
23
- }
24
-
25
- export interface UI_I_CreateDatastoreForm {
26
- local: {
27
- name: string
28
- hosts: string[]
29
- type_code: number
30
- }
31
- sharedStorm: I_SharedStorm
32
- nfs: I_NfsForm
33
- }
34
-
35
- export interface UI_I_CreateStorageUuid {
36
- code: number
37
- pool_name: string
10
+ hosts?: string[]
38
11
  }
@@ -11,6 +11,7 @@
11
11
  :project="props.project"
12
12
  :alert-messages="props.alertMessages"
13
13
  :messages-fields="props.messagesFields"
14
+ @hide-alert="(e) => emits('hide-alert', e)"
14
15
  @next="onChangeConfigurationAndNext"
15
16
  />
16
17
 
@@ -49,6 +50,7 @@ const props = defineProps<{
49
50
  }>()
50
51
  const model = defineModel<any>()
51
52
  const emits = defineEmits<{
53
+ (event: 'hide-alert', value: number): void
52
54
  (event: 'submit', value: UI_I_ConfigurationSendDataNfs): void
53
55
  }>()
54
56
 
@@ -1,9 +1,7 @@
1
1
  import type { UI_I_Localization } from '~/lib/models/interfaces'
2
2
  import type { UI_I_DetailsItem } from '~/components/common/details/lib/models/interfaces'
3
3
  import type { UI_I_CreateStorageLunDiskItem } from '~/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces'
4
- import { UI_T_DatastoreType } from '~/components/common/wizards/datastore/add/lib/models/types'
5
- // import { UI_I_ReadyDataForLocal } from '~/components/common/wizards/datastore/add/readyComplete/lib/models/interfaces'
6
-
4
+ import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastoreNew/add/lib/models/interfaces'
7
5
  const constructLunDiskItems = (
8
6
  disks: UI_I_CreateStorageLunDiskItem[]
9
7
  ): string => {
@@ -19,7 +17,7 @@ const constructLunDiskItems = (
19
17
 
20
18
  const nfsDetailsFunc = (
21
19
  localization: UI_I_Localization,
22
- data: any,
20
+ data: UI_I_CreateDatastoreForm,
23
21
  isSphereWizard: boolean
24
22
  ): UI_I_DetailsItem[] => {
25
23
  const { name, server, folder, nfsVersion, hosts } = data
@@ -88,9 +86,9 @@ const nfsDetailsFunc = (
88
86
 
89
87
  const localDetailsFunc = (
90
88
  localization: UI_I_Localization,
91
- event: any
89
+ data: UI_I_CreateDatastoreForm
92
90
  ): UI_I_DetailsItem[] => {
93
- const { name } = event
91
+ const { name } = data
94
92
 
95
93
  return [
96
94
  {
@@ -110,7 +108,7 @@ const localDetailsFunc = (
110
108
 
111
109
  const sharedStormDetailsFunc = (
112
110
  localization: UI_I_Localization,
113
- data: { name: string; lunDisk: UI_I_CreateStorageLunDiskItem[] } // пока так ставляем тип но надо будет поменять когда будем добавлять осталние настройки
111
+ data: UI_I_CreateDatastoreForm
114
112
  ): UI_I_DetailsItem[] => {
115
113
  const { name, lunDisk } = data
116
114
 
@@ -164,14 +162,13 @@ const sharedStormDetailsFunc = (
164
162
 
165
163
  export const constructDataReadyViewFunc = (
166
164
  localization: UI_I_Localization,
167
- type: UI_T_DatastoreType,
168
- data: any
165
+ data: UI_I_CreateDatastoreForm
169
166
  ): UI_I_DetailsItem[] => {
170
167
  const details = {
171
- local: localDetailsFunc,
172
- 'shared-storm': sharedStormDetailsFunc,
173
- nfs: nfsDetailsFunc,
168
+ 1: localDetailsFunc,
169
+ 2: sharedStormDetailsFunc,
170
+ 4: nfsDetailsFunc,
174
171
  }
175
172
 
176
- return details[type](localization, data, false)
173
+ return details[data.type_code](localization, data, false)
177
174
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.3.458",
4
+ "version": "1.3.460",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -1,4 +0,0 @@
1
- export interface UI_I_ReadyDataForLocal {
2
- name: string
3
- host: string
4
- }