bfg-common 1.4.94 → 1.4.97

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.
@@ -19,12 +19,10 @@
19
19
  :project="props.project"
20
20
  />
21
21
 
22
- <common-wizards-vm-migrate-select-target-server
23
- v-show="currentBlockId === 'select-target-center'"
24
- />
22
+ <common-wizards-vm-migrate-select-target-server v-if="false" />
25
23
 
26
24
  <common-wizards-vm-migrate-select-compute-resource
27
- v-show="currentBlockId === 'select-compute-resource'"
25
+ v-if="false"
28
26
  v-model="form"
29
27
  :submit="selectComputeResourceSubmit"
30
28
  :get-compute-resource-data="props.getComputeResourceData"
@@ -35,15 +33,17 @@
35
33
 
36
34
  <common-wizards-vm-new-migrate-select-storage
37
35
  v-show="selectedStep.id === 3"
36
+ :alert-messages="alertMessages[3]"
38
37
  :submit="selectStorageSubmit"
39
38
  :get-datastore-table-func="props.getDatastoreTableFunc"
40
39
  :datastore="props.datastore"
41
40
  :connected-storage-id-default="connectedStorageIdOnVm"
42
41
  :configure-per-disks="props.configurePerDisks"
42
+ @hide-alert="onHideAlert"
43
43
  />
44
44
 
45
45
  <common-wizards-vm-migrate-select-network
46
- v-if="currentBlockId === 'select-networks'"
46
+ v-if="false"
47
47
  v-model:is-basic-network-mode="
48
48
  dataFormLocal.selectNetwork.isShowNetworkBasic
49
49
  "
@@ -51,7 +51,7 @@
51
51
  />
52
52
 
53
53
  <common-wizards-vm-migrate-select-priority
54
- v-show="currentBlockId === 'select-motion-priority'"
54
+ v-if="false"
55
55
  v-model="selectedVMotionPriority"
56
56
  />
57
57
 
@@ -73,7 +73,7 @@ import Wizard from '~/components/atoms/wizard/lib/utils/utils'
73
73
  import {
74
74
  stepsFunc,
75
75
  stepsSchemeInitial,
76
- } from '~/components/common/wizards/datastore/add/lib/config/steps'
76
+ } from '~/components/common/wizards/vmNew/migrate/lib/config/steps'
77
77
 
78
78
  import type { UI_I_Localization } from '~/lib/models/interfaces'
79
79
  import type { UI_T_Project } from '~/lib/models/types'
@@ -90,6 +90,7 @@ import type { UI_I_StorageConfigurePerDiskItem } from '~/components/common/wizar
90
90
  import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
91
91
  import type { UI_T_SelectVMotionPriority } from '~/components/common/wizards/vm/migrate/select/priority/lib/models/types'
92
92
  import type { UI_I_CollectedDataFormLocal } from '~/components/common/wizards/vm/migrate/lib/models/interfaces'
93
+ import * as validation from '~/components/common/wizards/vmNew/migrate/lib/validations'
93
94
 
94
95
  const props = defineProps<{
95
96
  project: UI_T_Project
@@ -101,8 +102,6 @@ const props = defineProps<{
101
102
  configurePerDisks: UI_I_StorageConfigurePerDiskItem[]
102
103
  computeResourceTableData?: any
103
104
  computeResourceTree?: UI_I_TreeNode
104
- readyCompleteTableInfo?: any // пока так потом если будет нужен изменит или удалить
105
- finishFunc: any
106
105
  }>()
107
106
  const emits = defineEmits<{
108
107
  (event: 'hide'): void
@@ -121,6 +120,7 @@ const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
121
120
 
122
121
  const form = ref<UI_I_MigrateFormLocal>({
123
122
  migrate_type: props.project === 'procurator' ? 'storage' : 'resource',
123
+ storage: ''
124
124
  })
125
125
 
126
126
  const validationFunc = async (
@@ -130,22 +130,17 @@ const validationFunc = async (
130
130
  ): Promise<UI_I_ValidationReturn> => {
131
131
  let stepHasError = false
132
132
 
133
- if (wizard.isValidateForStep(1, currentStep.id, nextStep.id)) {
134
- // const nameValidation = await validation.checkDatastoreNameAsync(
135
- // localization.value,
136
- // value,
137
- // form.value,
138
- // 1,
139
- // 'datastoreName',
140
- // wizard,
141
- // props.project
142
- // )
133
+ if (wizard.isValidateForStep(3, currentStep.id, nextStep.id)) {
134
+ const nameValidation = await validation.checkSelectedDatastoreSync(
135
+ localization.value,
136
+ form.value.storage,
137
+ wizard,
138
+ value
139
+ )
143
140
 
144
- // value = nameValidation.newValue
145
- value = 'nameValidation.newValue'
141
+ value = nameValidation.newValue
146
142
 
147
- // stepHasError = nameValidation.stepHasError
148
- stepHasError = false
143
+ stepHasError = nameValidation.stepHasError
149
144
  }
150
145
 
151
146
  return {
@@ -191,8 +186,6 @@ const vmMigrateType = ref<UI_T_VmMigrateType>(
191
186
  )
192
187
  const dataReadyView = ref<UI_I_TableInfoItem[]>([])
193
188
 
194
- const currentBlockId = computed<string>(() => '')
195
-
196
189
  const connectedStorageIdOnVm = computed<string>(
197
190
  () => props.vmSettings?.storage.id || ''
198
191
  )
@@ -215,6 +208,10 @@ const onFinish = (): void => {
215
208
  const onHideModal = (): void => {
216
209
  emits('hide')
217
210
  }
211
+
212
+ const onHideAlert = (stepId: number): void => {
213
+ wizard.hideAlertMessagesByStepId(stepId)
214
+ }
218
215
  </script>
219
216
 
220
217
  <style scoped lang="scss">
@@ -226,33 +223,4 @@ const onHideModal = (): void => {
226
223
  padding-left: 10px;
227
224
  }
228
225
  }
229
-
230
- //:deep(.has-solid.close-icon.clr-icon) {
231
- // width: 20px;
232
- // top: 0;
233
- //}
234
- //:deep(.modal .modal-dialog .modal-content .modal-footer) {
235
- // flex: unset;
236
- // height: unset;
237
- // min-height: unset;
238
- //}
239
- //:deep(.wizard-modal-titlebar h3) {
240
- // color: #000;
241
- // font-size: 24px;
242
- // font-weight: 200;
243
- // line-height: 27px;
244
- // margin: 0;
245
- // padding: 0;
246
- //}
247
- //:deep(.clr-wizard-stepnav-item) {
248
- // padding-left: 0;
249
- //}
250
- //:deep(.clr-wizard-stepnav
251
- // .clr-wizard-stepnav-item
252
- // button
253
- // .clr-wizard-stepnav-link-title) {
254
- // width: 189px;
255
- // font-weight: 700;
256
- // font-size: 13px;
257
- //}
258
226
  </style>
@@ -18,7 +18,7 @@ export const stepsFunc = (
18
18
  id: 1,
19
19
  title: localization.common.selectTargetVCenterSer,
20
20
  subTitle: localization.common.selectComputeResourceDesc,
21
- status: UI_E_WIZARD_STATUS.SELECTED,
21
+ status: UI_E_WIZARD_STATUS.INACTIVE,
22
22
  fields: {},
23
23
  isValid: true,
24
24
  testId: 'migrate-vm-select-target-server',
@@ -27,7 +27,7 @@ export const stepsFunc = (
27
27
  id: 2,
28
28
  title: localization.common.selectComputeResource,
29
29
  subTitle: localization.common.selectComputeResourceDesc,
30
- status: UI_E_WIZARD_STATUS.SELECTED,
30
+ status: UI_E_WIZARD_STATUS.INACTIVE,
31
31
  fields: {},
32
32
  isValid: true,
33
33
  testId: 'migrate-vm-select-compute-resource',
@@ -36,7 +36,7 @@ export const stepsFunc = (
36
36
  id: 3,
37
37
  title: localization.common.selectStorage,
38
38
  subTitle: localization.common.selectStorageDesc,
39
- status: UI_E_WIZARD_STATUS.SELECTED,
39
+ status: UI_E_WIZARD_STATUS.INACTIVE,
40
40
  fields: {
41
41
  name: {
42
42
  alert: '',
@@ -50,7 +50,7 @@ export const stepsFunc = (
50
50
  id: 4,
51
51
  title: localization.common.selectNetworks,
52
52
  subTitle: localization.common.selectNetworksDesc,
53
- status: UI_E_WIZARD_STATUS.SELECTED,
53
+ status: UI_E_WIZARD_STATUS.INACTIVE,
54
54
  fields: {},
55
55
  isValid: true,
56
56
  testId: 'migrate-vm-select-networks',
@@ -59,7 +59,7 @@ export const stepsFunc = (
59
59
  id: 5,
60
60
  title: localization.common.selectVMotionPriority,
61
61
  subTitle: localization.common.selectVMotionPriorityDesc,
62
- status: UI_E_WIZARD_STATUS.SELECTED,
62
+ status: UI_E_WIZARD_STATUS.INACTIVE,
63
63
  fields: {},
64
64
  isValid: true,
65
65
  testId: 'migrate-vm-select-vMotion-priority',
@@ -7,6 +7,7 @@ import type { UI_T_VmMigrateType } from '~/components/common/wizards/vmNew/migra
7
7
 
8
8
  export interface UI_I_MigrateFormLocal {
9
9
  migrate_type: UI_T_VmMigrateType
10
+ storage: string
10
11
  }
11
12
 
12
13
  export interface UI_I_ChangeStepsSchemes {
@@ -0,0 +1,29 @@
1
+ import { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import type {
3
+ UI_I_ValidationReturn,
4
+ UI_I_WizardStep,
5
+ } from '~/components/atoms/wizard/lib/models/interfaces'
6
+ import type Wizard from '~/components/atoms/wizard/lib/utils/utils'
7
+
8
+ export const checkSelectedDatastoreSync = (
9
+ localization: UI_I_Localization,
10
+ name: string,
11
+ wizard: Wizard,
12
+ value: UI_I_WizardStep[]
13
+ ): UI_I_ValidationReturn => {
14
+ let stepHasError = false
15
+
16
+ if (!name) {
17
+ stepHasError = wizard.setValidation(3, 'name', {
18
+ fieldMessage: '',
19
+ alertMessage: localization.common.selectValidDestinationStorage,
20
+ })
21
+ } else if (wizard.hasMessage(3, 'name')) {
22
+ value = wizard.removeValidation(3, 'name', value)
23
+ }
24
+
25
+ return {
26
+ newValue: value,
27
+ stepHasError,
28
+ }
29
+ }
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <div class="select-storage">
3
3
  <atoms-alert
4
- v-if="errorMessages.length"
4
+ v-show="props.alertMessages?.length"
5
5
  test-id="select-storage-alert"
6
6
  status="alert-danger"
7
- :items="errorMessages"
8
- @remove="onHideErrorMessageAlert"
7
+ :items="props.alertMessages"
8
+ @remove="onHideAlert"
9
9
  />
10
10
 
11
11
  <common-wizards-vm-migrate-select-storage-selected-per-disk
@@ -77,6 +77,7 @@ import type {
77
77
  import { vmMigrateSelectStorageTabsFunc } from '~/components/common/wizards/vm/migrate/select/storage/lib/config/tabsPannel'
78
78
 
79
79
  const props = defineProps<{
80
+ alertMessages: string[]
80
81
  submit: number
81
82
  getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
82
83
  datastore: UI_I_DatastoreTableItem[]
@@ -84,6 +85,7 @@ const props = defineProps<{
84
85
  configurePerDisks: UI_I_StorageConfigurePerDiskItem[]
85
86
  }>()
86
87
  const emits = defineEmits<{
88
+ (event: 'hide-alert', value: number): void
87
89
  (event: 'next-step', value: UI_I_SelectStorageReadyData): void
88
90
  }>()
89
91
 
@@ -94,7 +96,6 @@ const selectStorageTabs = computed<UI_I_CollapseNavItem[]>(() =>
94
96
  vmMigrateSelectStorageTabsFunc(localization.value)
95
97
  )
96
98
 
97
- const errorMessages = ref<string[]>([])
98
99
  const selectStorageDataLocal = ref<UI_I_SelectStorageDataLocal>({
99
100
  vmDiskFormat: 0,
100
101
  storage: null,
@@ -160,18 +161,15 @@ const isHideSelectDiskFormat = computed<boolean>(() => {
160
161
  selectedPerDisks.value[0].file === 'Configuration file'
161
162
  )
162
163
  })
163
- const onHideErrorMessageAlert = (): void => {
164
- errorMessages.value = []
165
- }
166
164
 
167
165
  const checkValidityBlock = (): boolean => {
168
166
  if (!selectStorageDataLocal.value.storage) {
169
167
  const errorText = localization.value.common.selectValidDestinationStorage
168
+ console.log(errorText)
170
169
 
171
- errorMessages.value = [errorText]
172
170
  return false
173
171
  }
174
- onHideErrorMessageAlert()
172
+
175
173
  const isActivePerDiskTab = activeTab.value === 'configure-disk'
176
174
  emits('next-step', {
177
175
  ...selectStorageDataLocal.value,
@@ -189,6 +187,10 @@ watch(
189
187
  checkValidityBlock()
190
188
  }
191
189
  )
190
+
191
+ const onHideAlert = (): void => {
192
+ emits('hide-alert', 3)
193
+ }
192
194
  </script>
193
195
 
194
196
  <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.4.94",
4
+ "version": "1.4.97",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",