bfg-common 1.5.74 → 1.5.75

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.
@@ -32,17 +32,18 @@ import type {
32
32
  UI_I_ValidationReturn,
33
33
  } from '~/components/atoms/wizard/lib/models/interfaces'
34
34
  import Wizard from '~/components/atoms/wizard/lib/utils/utils'
35
- import {
36
- stepsFunc,
37
- stepsSchemeInitial,
38
- } from '~/components/common/wizards/datastore/add/lib/config/steps'
39
35
  import type { UI_I_Localization } from '~/lib/models/interfaces'
40
36
  import type { UI_T_Project } from '~/lib/models/types'
41
37
  import type { UI_T_DatastoreTypeCode } from '~/components/common/wizards/datastore/add/lib/models/types'
42
38
  import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
43
39
  import type { UI_I_DetailsItem } from '~/components/common/details/lib/models/interfaces'
44
40
  import type { UI_I_CreateDatastoreHosts } from '~/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/models/interfaces'
45
- import type { UI_I_ChangeStepsSchemes } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
41
+ import {
42
+ stepsFunc,
43
+ stepsSchemeInitial,
44
+ getStepScheme,
45
+ } from '~/components/common/wizards/datastore/add/lib/config/steps'
46
+ import { datastoreDefaultFormFunc } from '~/components/common/wizards/datastore/add/lib/config/createDatastore'
46
47
  import { constructDataReadyViewFunc } from '~/components/common/wizards/datastore/add/readyComplete/lib/config/propertiesDetails'
47
48
  import * as validation from '~/components/common/wizards/datastore/add/lib/validations'
48
49
 
@@ -73,21 +74,9 @@ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
73
74
 
74
75
  const title = computed<string>(() => localization.value.common.addHost)
75
76
 
76
- // const datastoreType = ref<UI_T_DatastoreTypeCode>(
77
- // props.project === 'procurator' ? 'local' : 'shared-storm'
78
- // )
79
- const datastoreType = ref<UI_T_DatastoreTypeCode>(2)
80
- const form = ref<UI_I_CreateDatastoreForm>({
81
- name: 'Datastore',
82
- lunDisk: [],
83
- hosts: props.hostId ? [props?.hostId] : [],
84
- type_code: 2,
85
- nfsVersion: 'nfs-4.1',
86
- readonly: false,
87
- server: '',
88
- folder: '',
89
- })
90
-
77
+ const form = ref<UI_I_CreateDatastoreForm>(
78
+ useDeepCopy(datastoreDefaultFormFunc(props.hostId))
79
+ )
91
80
  const validationFunc = async (
92
81
  value: UI_I_WizardStep[],
93
82
  currentStep: UI_I_WizardStep,
@@ -196,26 +185,14 @@ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
196
185
 
197
186
  // Choosing Scheme
198
187
  watch(
199
- datastoreType,
188
+ () => form.value.type_code,
200
189
  (newValue: UI_T_DatastoreTypeCode) => {
201
- const schemes: UI_I_ChangeStepsSchemes = {
202
- procurator: {
203
- '2': 0,
204
- '4': 1,
205
- },
206
- sphere: {
207
- '2': 2,
208
- '4': !props.hostId ? 3 : 1,
209
- },
210
- }
211
-
212
- const projectSchemes = schemes[props.project]
213
-
214
- if (projectSchemes && projectSchemes[newValue] !== undefined) {
215
- wizard.changeScheme(projectSchemes[newValue] as number)
190
+ const step = getStepScheme(props.project, newValue, props.hostId)
191
+ if (step !== undefined) {
192
+ wizard.changeScheme(step)
216
193
  }
217
194
  },
218
- { deep: true, immediate: true }
195
+ { immediate: true }
219
196
  )
220
197
 
221
198
  const dataReadyView = computed<UI_I_DetailsItem>(() =>
@@ -1,9 +1,11 @@
1
1
  import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
2
- export const datastoreDefaultFormFunc = (): UI_I_CreateDatastoreForm => {
2
+ export const datastoreDefaultFormFunc = (
3
+ hostId?: string
4
+ ): UI_I_CreateDatastoreForm => {
3
5
  return {
4
6
  name: 'Datastore',
5
7
  lunDisk: [],
6
- hosts: [],
8
+ hosts: hostId ? [hostId] : [],
7
9
  type_code: 2,
8
10
  nfsVersion: 'nfs-4.1',
9
11
  readonly: false,
@@ -1,7 +1,9 @@
1
1
  import type { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import type { UI_T_Project } from '~/lib/models/types'
2
3
  import type { UI_I_WizardStep } from '~/components/atoms/wizard/lib/models/interfaces'
3
4
  import { UI_E_WIZARD_STATUS } from '~/components/atoms/wizard/lib/models/enums'
4
-
5
+ import type { UI_I_ChangeStepsSchemes } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
6
+ import type { UI_T_DatastoreTypeCode } from '~/components/common/wizards/datastore/add/lib/models/types'
5
7
  export const dynamicSteps = {
6
8
  type: 0,
7
9
  nameAndDevice: 1,
@@ -146,3 +148,22 @@ export const stepsSchemeInitial: number[][] = [
146
148
  [dynamicSteps.type, dynamicSteps.nameAndDevice, 11], // Sphere Scheme for "shared-storm" type
147
149
  [dynamicSteps.type, 4, 5, 11], // Sphere Scheme for "nfs" type
148
150
  ]
151
+
152
+ export const getStepScheme = (
153
+ project: UI_T_Project,
154
+ typeCode: UI_T_DatastoreTypeCode,
155
+ hostId?: string
156
+ ): number | undefined => {
157
+ const schemes: UI_I_ChangeStepsSchemes = {
158
+ procurator: {
159
+ '2': 0,
160
+ '4': 1,
161
+ },
162
+ sphere: {
163
+ '2': 2,
164
+ '4': !hostId ? 3 : 1,
165
+ },
166
+ }
167
+
168
+ return schemes[project]?.[typeCode]
169
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.74",
4
+ "version": "1.5.75",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",