bfg-common 1.5.490 → 1.5.492

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.
@@ -29,7 +29,7 @@
29
29
  selectedStep.id === dynamicSteps.selectNameFolder
30
30
  "
31
31
  :name-form-submit="nameFormSubmit"
32
- :project="props.project"
32
+ :has-location="props.project === 'sphere'"
33
33
  :data-center="props.dataCenter"
34
34
  @submit="onChangeName(...$event)"
35
35
  @check-name="emits('check-name', $event)"
@@ -27,7 +27,7 @@
27
27
  v-show="selectedStep.id === dynamicSteps.selectName"
28
28
  :show="selectedStep.id === dynamicSteps.selectName"
29
29
  :name-form-submit="nameFormSubmit"
30
- :project="props.project"
30
+ :has-location="props.project === 'sphere'"
31
31
  @submit="onChangeName(...$event)"
32
32
  @check-name="emits('check-name', $event)"
33
33
  />
@@ -3,7 +3,7 @@
3
3
  v-if="isNewView"
4
4
  v-model:vm-name="vmName"
5
5
  v-model:is-show-help="isShowHelp"
6
- :project="props.project"
6
+ :has-location="props.hasLocation"
7
7
  :errors="errors"
8
8
  :data-center="props.dataCenter"
9
9
  @remove-validation-errors="onRemoveValidationErrors"
@@ -13,7 +13,7 @@
13
13
  v-else
14
14
  v-model:vm-name="vmName"
15
15
  v-model:is-show-help="isShowHelp"
16
- :project="props.project"
16
+ :has-location="props.hasLocation"
17
17
  :is-vmt="props.isVmt"
18
18
  :errors="errors"
19
19
  :data-center="props.dataCenter"
@@ -25,22 +25,22 @@
25
25
  <script setup lang="ts">
26
26
  // import { API_UI_I_Error } from '~/lib/models/store/interfaces'
27
27
  import type { UI_I_Localization } from '~/lib/models/interfaces'
28
- import type { UI_T_Project } from '~/lib/models/types'
29
28
  import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
30
29
 
31
30
  const props = withDefaults(
32
31
  defineProps<{
33
32
  nameFormSubmit: null | Function
34
33
  show: boolean
35
- project: UI_T_Project
34
+ hasLocation?: boolean
36
35
  isVmt?: boolean
37
36
  validateEmptyName?: boolean
38
37
  dataCenter?: UI_I_TreeNode // для сферы
39
38
  existName?: string
40
39
  }>(),
41
40
  {
42
- validateEmptyName: false,
41
+ hasLocation: false,
43
42
  isVmt: false,
43
+ validateEmptyName: false,
44
44
  dataCenter: undefined,
45
45
  existName: undefined,
46
46
  }
@@ -100,7 +100,7 @@ const submit = async (cb: Function): Promise<void> => {
100
100
  }
101
101
  }
102
102
 
103
- if (props.project === 'sphere') {
103
+ if (props.hasLocation) {
104
104
  // const isDatacenterFolder = isParentDatacenter(selectedNode.value)
105
105
 
106
106
  if (
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :class="['select-name', { 'pb-6': props.project === 'sphere' }]">
2
+ <div :class="['select-name', { 'pb-6': props.hasLocation }]">
3
3
  <client-only>
4
4
  <Teleport to="#name-alert-wrapper">
5
5
  <ui-alert
@@ -41,7 +41,7 @@
41
41
  </div>
42
42
  </div>
43
43
 
44
- <template v-if="props.project === 'sphere'">
44
+ <template v-if="props.hasLocation">
45
45
  <div class="location">
46
46
  <span class="location-label">{{ localization.common.location }}</span>
47
47
 
@@ -66,7 +66,6 @@
66
66
  <script setup lang="ts">
67
67
  // import { API_UI_I_Error } from '~/lib/models/store/interfaces'
68
68
  import type { UI_I_Localization } from '~/lib/models/interfaces'
69
- import type { UI_T_Project } from '~/lib/models/types'
70
69
  import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
71
70
 
72
71
  const vmName = defineModel<string>('vmName', { required: true })
@@ -74,7 +73,7 @@ const vmName = defineModel<string>('vmName', { required: true })
74
73
 
75
74
  const props = withDefaults(
76
75
  defineProps<{
77
- project: UI_T_Project
76
+ hasLocation: boolean
78
77
  errors: string[]
79
78
  dataCenter?: UI_I_TreeNode // для сферы
80
79
  }>(),
@@ -40,7 +40,7 @@
40
40
  </div>
41
41
  </form>
42
42
 
43
- <template v-if="props.project === 'sphere'">
43
+ <template v-if="props.hasLocation">
44
44
  <p class="new-vm-name-and-folder-instructions mt-1">
45
45
  {{ locationDescription }}
46
46
  </p>
@@ -57,7 +57,6 @@
57
57
  <script setup lang="ts">
58
58
  // import { API_UI_I_Error } from '~/lib/models/store/interfaces'
59
59
  import type { UI_I_Localization } from '~/lib/models/interfaces'
60
- import type { UI_T_Project } from '~/lib/models/types'
61
60
  import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
62
61
 
63
62
  const vmName = defineModel<string>('vmName', { required: true })
@@ -65,13 +64,13 @@ const isShowHelp = defineModel<boolean>('isShowHelp', { required: true })
65
64
 
66
65
  const props = withDefaults(
67
66
  defineProps<{
68
- project: UI_T_Project
67
+ hasLocation: boolean
69
68
  errors: string[]
70
69
  isVmt: boolean
71
- dataCenter?: UI_I_TreeNode // для сферы
70
+ dataCenter?: UI_I_TreeNode | null // для сферы
72
71
  }>(),
73
72
  {
74
- dataCenter: undefined,
73
+ dataCenter: null,
75
74
  }
76
75
  )
77
76
  const emits = defineEmits<{
@@ -28,7 +28,7 @@
28
28
  selectedStep.id === dynamicSteps.selectNameFolder
29
29
  "
30
30
  :name-form-submit="nameFormSubmit"
31
- :project="props.project"
31
+ :has-location="props.project === 'sphere'"
32
32
  :data-center="props.dataCenter"
33
33
  @submit="onChangeName(...$event)"
34
34
  @check-name="emits('check-name', $event)"
@@ -1,224 +1,228 @@
1
- <template>
2
- <common-wizards-datastore-add-new
3
- v-if="isNewView"
4
- v-model="form"
5
- :project="props.project"
6
- :wizard="wizard"
7
- :alert-messages="alertMessages"
8
- :selected-scheme="selectedScheme"
9
- :selected-node="props.selectedNode"
10
- :title="title"
11
- :nfs-hosts="props.nfsHosts"
12
- :host-id="props.hostId"
13
- @change-steps="onChangeSteps"
14
- @hide="onHideModal"
15
- @submit="onCreateDatastore"
16
- />
17
- <common-wizards-datastore-add-old
18
- v-else
19
- v-model="form"
20
- :project="props.project"
21
- :wizard="wizard"
22
- :alert-messages="alertMessages"
23
- :selected-scheme="selectedScheme"
24
- :title="title"
25
- :nfs-hosts="props.nfsHosts"
26
- :host-id="props.hostId"
27
- @change-steps="onChangeSteps"
28
- @hide-alert="onHideAlert"
29
- @hide="onHideModal"
30
- @submit="onCreateDatastore"
31
- />
32
- </template>
33
-
34
- <script setup lang="ts">
35
- import type {
36
- UI_I_WizardStep,
37
- UI_I_ValidationReturn,
38
- } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
39
- import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
40
- import type { UI_I_Localization } from '~/lib/models/interfaces'
41
- import type { UI_T_Project } from '~/lib/models/types'
42
- import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
43
- import type { UI_T_DatastoreTypeCode } from '~/components/common/wizards/datastore/add/lib/models/types'
44
- import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
45
- import type { UI_I_CompatibleHosts } from '~/components/common/wizards/datastore/add/steps/hostAccessibility/table/lib/models/interfaces'
46
- import {
47
- stepsFunc,
48
- stepsSchemeInitial,
49
- getStepScheme,
50
- dynamicSteps,
51
- } from '~/components/common/wizards/datastore/add/lib/config/steps'
52
- import { datastoreDefaultFormFunc } from '~/components/common/wizards/datastore/add/lib/config/createDatastore'
53
- import * as validation from '~/components/common/wizards/datastore/add/lib/validations'
54
-
55
- const props = withDefaults(
56
- defineProps<{
57
- project: UI_T_Project
58
- selectedNode: UI_I_TreeNode
59
- nfsHosts?: UI_I_CompatibleHosts
60
- hostId?: string
61
- isMainFilter?: boolean
62
- }>(),
63
- {
64
- nfsHosts: undefined,
65
- hostId: undefined,
66
- isMainFilter: undefined,
67
- }
68
- )
69
- const emits = defineEmits<{
70
- (event: 'hide'): void
71
- (event: 'finish', value: UI_I_CreateDatastoreForm): void
72
- (event: 'main-filter', value: string): void
73
- }>()
74
-
75
- const localization = computed<UI_I_Localization>(() => useLocal())
76
- const { $store }: any = useNuxtApp()
77
-
78
- const wizard: Wizard = new Wizard(
79
- stepsFunc(localization.value),
80
- stepsSchemeInitial
81
- )
82
-
83
- const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
84
- const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
85
-
86
- const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
87
-
88
- const title = computed<string>(() => localization.value.common.newDatastore)
89
-
90
- const form = ref<UI_I_CreateDatastoreForm>(
91
- useDeepCopy(datastoreDefaultFormFunc(props.hostId))
92
- )
93
- const validationFunc = async (
94
- value: UI_I_WizardStep[],
95
- currentStep: UI_I_WizardStep,
96
- nextStep: UI_I_WizardStep
97
- ): Promise<UI_I_ValidationReturn> => {
98
- let stepHasError = false
99
-
100
- if (
101
- wizard.isValidateForStep(
102
- dynamicSteps.nameAndDevice,
103
- currentStep.id,
104
- nextStep.id
105
- )
106
- ) {
107
- const nameValidation = await validation.checkDatastoreNameAsync(
108
- localization.value,
109
- value,
110
- form.value,
111
- dynamicSteps.nameAndDevice,
112
- 'datastoreName',
113
- wizard,
114
- props.project
115
- )
116
-
117
- value = nameValidation.newValue
118
-
119
- const lunDiskValidation = validation.checkSelectedLunDiskSync(
120
- localization.value,
121
- form.value,
122
- wizard,
123
- value,
124
- props.project,
125
- props.hostId
126
- )
127
-
128
- value = lunDiskValidation.newValue
129
-
130
- stepHasError = nameValidation.stepHasError || lunDiskValidation.stepHasError
131
- }
132
-
133
- if (
134
- wizard.isValidateForStep(
135
- dynamicSteps.nameAndConfigure,
136
- currentStep.id,
137
- nextStep.id
138
- )
139
- ) {
140
- const nameValidation = await validation.checkDatastoreNameAsync(
141
- localization.value,
142
- value,
143
- form.value,
144
- dynamicSteps.nameAndConfigure,
145
- 'name',
146
- wizard,
147
- props.project
148
- )
149
- value = nameValidation.newValue
150
-
151
- const folderValidation = validation.checkNfsFolderSync(
152
- localization.value,
153
- form.value.folder,
154
- wizard,
155
- value
156
- )
157
- value = folderValidation.newValue
158
-
159
- const serverValidation = validation.checkNfsServerSync(
160
- localization.value,
161
- form.value.server,
162
- wizard,
163
- value
164
- )
165
- value = serverValidation.newValue
166
-
167
- stepHasError =
168
- nameValidation.stepHasError ||
169
- folderValidation.stepHasError ||
170
- serverValidation.stepHasError
171
- }
172
-
173
- if (
174
- wizard.isValidateForStep(
175
- dynamicSteps.hostAccessibility,
176
- currentStep.id,
177
- nextStep.id
178
- )
179
- ) {
180
- const nameValidation = await validation.checkHostsAccessibilitySync(
181
- localization.value,
182
- form.value.hosts,
183
- wizard,
184
- value
185
- )
186
-
187
- value = nameValidation.newValue
188
-
189
- stepHasError = nameValidation.stepHasError
190
- }
191
-
192
- return {
193
- newValue: value,
194
- stepHasError,
195
- }
196
- }
197
-
198
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
199
- wizard.changeSteps(value, validationFunc)
200
-
201
- // Choosing Scheme
202
- watch(
203
- () => form.value.type_code,
204
- (newValue: UI_T_DatastoreTypeCode) => {
205
- const step = getStepScheme(props.project, newValue, props.hostId)
206
- if (step !== undefined) {
207
- wizard.changeScheme(step)
208
- }
209
- },
210
- { immediate: true }
211
- )
212
-
213
- const onHideAlert = (stepId: number): void => {
214
- wizard.hideAlertMessagesByStepId(stepId)
215
- }
216
- const onHideModal = (): void => {
217
- emits('hide')
218
- }
219
- const onCreateDatastore = (): void => {
220
- emits('finish', form.value)
221
- }
222
- </script>
223
-
224
- <style scoped lang="scss"></style>
1
+ <template>
2
+ <common-wizards-datastore-add-new
3
+ v-if="isNewView"
4
+ v-model="form"
5
+ :project="props.project"
6
+ :wizard="wizard"
7
+ :alert-messages="alertMessages"
8
+ :selected-scheme="selectedScheme"
9
+ :selected-node="props.selectedNode"
10
+ :title="title"
11
+ :nfs-hosts="props.nfsHosts"
12
+ :host-id="props.hostId"
13
+ @change-steps="onChangeSteps"
14
+ @hide="onHideModal"
15
+ @submit="onCreateDatastore"
16
+ />
17
+ <common-wizards-datastore-add-old
18
+ v-else
19
+ v-model="form"
20
+ :project="props.project"
21
+ :wizard="wizard"
22
+ :alert-messages="alertMessages"
23
+ :selected-scheme="selectedScheme"
24
+ :title="title"
25
+ :nfs-hosts="props.nfsHosts"
26
+ :host-id="props.hostId"
27
+ @change-steps="onChangeSteps"
28
+ @hide-alert="onHideAlert"
29
+ @hide="onHideModal"
30
+ @submit="onCreateDatastore"
31
+ />
32
+ </template>
33
+
34
+ <script setup lang="ts">
35
+ import type {
36
+ UI_I_WizardStep,
37
+ UI_I_ValidationReturn,
38
+ } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
39
+ import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
40
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
41
+ import type { UI_T_Project } from '~/lib/models/types'
42
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
43
+ import type { UI_T_DatastoreTypeCode } from '~/components/common/wizards/datastore/add/lib/models/types'
44
+ import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
45
+ import type { UI_I_CompatibleHosts } from '~/components/common/wizards/datastore/add/steps/hostAccessibility/table/lib/models/interfaces'
46
+ import {
47
+ stepsFunc,
48
+ stepsSchemeInitial,
49
+ getStepScheme,
50
+ dynamicSteps,
51
+ } from '~/components/common/wizards/datastore/add/lib/config/steps'
52
+ import { datastoreDefaultFormFunc } from '~/components/common/wizards/datastore/add/lib/config/createDatastore'
53
+ import * as validation from '~/components/common/wizards/datastore/add/lib/validations'
54
+
55
+ const props = withDefaults(
56
+ defineProps<{
57
+ project: UI_T_Project
58
+ selectedNode: UI_I_TreeNode
59
+ nfsHosts?: UI_I_CompatibleHosts
60
+ hostId?: string
61
+ isMainFilter?: boolean
62
+ datacenterId?: string // For Sphere
63
+ }>(),
64
+ {
65
+ nfsHosts: undefined,
66
+ hostId: undefined,
67
+ isMainFilter: undefined,
68
+ datacenterId: '',
69
+ }
70
+ )
71
+ const emits = defineEmits<{
72
+ (event: 'hide'): void
73
+ (event: 'finish', value: UI_I_CreateDatastoreForm): void
74
+ (event: 'main-filter', value: string): void
75
+ }>()
76
+
77
+ const localization = computed<UI_I_Localization>(() => useLocal())
78
+ const { $store }: any = useNuxtApp()
79
+
80
+ const wizard: Wizard = new Wizard(
81
+ stepsFunc(localization.value),
82
+ stepsSchemeInitial
83
+ )
84
+
85
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
86
+ const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
87
+
88
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
89
+
90
+ const title = computed<string>(() => localization.value.common.newDatastore)
91
+
92
+ const form = ref<UI_I_CreateDatastoreForm>(
93
+ useDeepCopy(datastoreDefaultFormFunc(props.hostId))
94
+ )
95
+ const validationFunc = async (
96
+ value: UI_I_WizardStep[],
97
+ currentStep: UI_I_WizardStep,
98
+ nextStep: UI_I_WizardStep
99
+ ): Promise<UI_I_ValidationReturn> => {
100
+ let stepHasError = false
101
+
102
+ if (
103
+ wizard.isValidateForStep(
104
+ dynamicSteps.nameAndDevice,
105
+ currentStep.id,
106
+ nextStep.id
107
+ )
108
+ ) {
109
+ const nameValidation = await validation.checkDatastoreNameAsync(
110
+ localization.value,
111
+ value,
112
+ form.value,
113
+ dynamicSteps.nameAndDevice,
114
+ 'datastoreName',
115
+ wizard,
116
+ props.project,
117
+ props.datacenterId
118
+ )
119
+
120
+ value = nameValidation.newValue
121
+
122
+ const lunDiskValidation = validation.checkSelectedLunDiskSync(
123
+ localization.value,
124
+ form.value,
125
+ wizard,
126
+ value,
127
+ props.project,
128
+ props.hostId
129
+ )
130
+
131
+ value = lunDiskValidation.newValue
132
+
133
+ stepHasError = nameValidation.stepHasError || lunDiskValidation.stepHasError
134
+ }
135
+
136
+ if (
137
+ wizard.isValidateForStep(
138
+ dynamicSteps.nameAndConfigure,
139
+ currentStep.id,
140
+ nextStep.id
141
+ )
142
+ ) {
143
+ const nameValidation = await validation.checkDatastoreNameAsync(
144
+ localization.value,
145
+ value,
146
+ form.value,
147
+ dynamicSteps.nameAndConfigure,
148
+ 'name',
149
+ wizard,
150
+ props.project,
151
+ props.datacenterId
152
+ )
153
+ value = nameValidation.newValue
154
+
155
+ const folderValidation = validation.checkNfsFolderSync(
156
+ localization.value,
157
+ form.value.folder,
158
+ wizard,
159
+ value
160
+ )
161
+ value = folderValidation.newValue
162
+
163
+ const serverValidation = validation.checkNfsServerSync(
164
+ localization.value,
165
+ form.value.server,
166
+ wizard,
167
+ value
168
+ )
169
+ value = serverValidation.newValue
170
+
171
+ stepHasError =
172
+ nameValidation.stepHasError ||
173
+ folderValidation.stepHasError ||
174
+ serverValidation.stepHasError
175
+ }
176
+
177
+ if (
178
+ wizard.isValidateForStep(
179
+ dynamicSteps.hostAccessibility,
180
+ currentStep.id,
181
+ nextStep.id
182
+ )
183
+ ) {
184
+ const nameValidation = await validation.checkHostsAccessibilitySync(
185
+ localization.value,
186
+ form.value.hosts,
187
+ wizard,
188
+ value
189
+ )
190
+
191
+ value = nameValidation.newValue
192
+
193
+ stepHasError = nameValidation.stepHasError
194
+ }
195
+
196
+ return {
197
+ newValue: value,
198
+ stepHasError,
199
+ }
200
+ }
201
+
202
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
203
+ wizard.changeSteps(value, validationFunc)
204
+
205
+ // Choosing Scheme
206
+ watch(
207
+ () => form.value.type_code,
208
+ (newValue: UI_T_DatastoreTypeCode) => {
209
+ const step = getStepScheme(props.project, newValue, props.hostId)
210
+ if (step !== undefined) {
211
+ wizard.changeScheme(step)
212
+ }
213
+ },
214
+ { immediate: true }
215
+ )
216
+
217
+ const onHideAlert = (stepId: number): void => {
218
+ wizard.hideAlertMessagesByStepId(stepId)
219
+ }
220
+ const onHideModal = (): void => {
221
+ emits('hide')
222
+ }
223
+ const onCreateDatastore = (): void => {
224
+ emits('finish', form.value)
225
+ }
226
+ </script>
227
+
228
+ <style scoped lang="scss"></style>