bfg-common 1.5.635 → 1.5.637

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.
@@ -278,8 +278,8 @@ const isDisabledSize = computed<boolean>(() => {
278
278
  if (isNewHardDisk.value) return false
279
279
  return (
280
280
  props.type === 'exist' ||
281
- (props.type === 'edit' && readOnly.value) ||
282
- (isRunning.value && provisionType.value === 'thick')
281
+ (props.type === 'edit' && readOnly.value)
282
+ // (isRunning.value && provisionType.value === 'thick')
283
283
  )
284
284
  })
285
285
  const isDisabledProvisioning = computed<boolean>(() => {
@@ -57,7 +57,7 @@ const props = defineProps<{
57
57
 
58
58
  const emits = defineEmits<{
59
59
  (event: 'change-order', value: UI_I_DropEvent): void
60
- (event: 'update:boot-list', value: UI_I_BootItem[]): void
60
+ (event: 'update-boot-list', value: UI_I_BootItem[]): void
61
61
  }>()
62
62
 
63
63
  const grabedItem = ref<any>(null)
@@ -81,20 +81,20 @@ const onCheckboxChange = (index: number, isChecked: boolean): void => {
81
81
  localBootList.value[index].isChecked = isChecked
82
82
 
83
83
  // Сохраняем порядок при изменении чекбокса
84
- let currentOrder = 1
85
- localBootList.value.forEach((item) => {
86
- if (item.isChecked) {
87
- item.order = currentOrder++
88
- } else {
89
- item.order = 0
90
- }
91
- })
84
+ // let currentOrder = 1
85
+ // localBootList.value.forEach((item) => {
86
+ // if (item.isChecked) {
87
+ // item.order = currentOrder++
88
+ // } else {
89
+ // item.order = 0
90
+ // }
91
+ // })
92
92
 
93
93
  // Сортируем список
94
- localBootList.value.sort((a, b) => a.order - b.order)
94
+ // localBootList.value.sort((a, b) => a.order - b.order)
95
95
 
96
96
  // Отправляем обновленный список родителю
97
- emits('update:boot-list', localBootList.value)
97
+ emits('update-boot-list', localBootList.value)
98
98
  }
99
99
  </script>
100
100
 
@@ -57,7 +57,7 @@ const props = defineProps<{
57
57
 
58
58
  const emits = defineEmits<{
59
59
  (event: 'change-order', value: UI_I_DropEvent): void
60
- (event: 'update:boot-list', value: UI_I_BootItem[]): void
60
+ (event: 'update-boot-list', value: UI_I_BootItem[]): void
61
61
  }>()
62
62
 
63
63
  // Локальная копия для реактивных изменений
@@ -78,20 +78,20 @@ const onCheckboxChange = (index: number, event: Event): void => {
78
78
  localBootList.value[index].isChecked = target.checked
79
79
 
80
80
  // Сохраняем порядок при изменении чекбокса
81
- let currentOrder = 1
82
- localBootList.value.forEach((item) => {
83
- if (item.isChecked) {
84
- item.order = currentOrder++
85
- } else {
86
- item.order = 0
87
- }
88
- })
81
+ // let currentOrder = 1
82
+ // localBootList.value.forEach((item) => {
83
+ // if (item.isChecked) {
84
+ // item.order = currentOrder++
85
+ // } else {
86
+ // item.order = 0
87
+ // }
88
+ // })
89
89
 
90
90
  // Сортируем список
91
- localBootList.value.sort((a, b) => a.order - b.order)
91
+ // localBootList.value.sort((a, b) => a.order - b.order)
92
92
 
93
93
  // Отправляем обновленный список родителю
94
- emits('update:boot-list', localBootList.value)
94
+ emits('update-boot-list', localBootList.value)
95
95
  }
96
96
  </script>
97
97
 
@@ -1,11 +1,13 @@
1
1
  <template>
2
- <component
3
- :is="currentComponent"
4
- :boot-list="bootList"
5
- :is-disabled="props.isDisabled"
6
- @change-order="onChangeOrder"
7
- @update:boot-list="onBootListUpdate"
8
- />
2
+ <div>
3
+ <component
4
+ :is="currentComponent"
5
+ :boot-list="bootList"
6
+ :is-disabled="props.isDisabled"
7
+ @change-order="onChangeOrder"
8
+ @update-boot-list="onBootListUpdate"
9
+ />
10
+ </div>
9
11
  </template>
10
12
 
11
13
  <script setup lang="ts">
@@ -143,7 +145,7 @@ const updateModelFromBootList = (bootItems: UI_I_BootItem[]): void => {
143
145
  const [source, indexStr] = bootItem.name.split('_')
144
146
  const index = parseInt(indexStr, 10)
145
147
  const disk = model.value.disk_devices?.[index]
146
- if (disk && disk.source === source) {
148
+ if (disk && disk.source+'' === source) {
147
149
  disk.boot_order = currentOrder++
148
150
  }
149
151
  }
@@ -145,7 +145,7 @@ export interface UI_I_CreateVmData {
145
145
  core_per_socket: number
146
146
  model: string
147
147
  reservation_mhz: number
148
- limit_mhz: number
148
+ limit_mhz: number | null
149
149
  shares: number
150
150
  hotplug: boolean
151
151
  }
@@ -153,7 +153,7 @@ export interface UI_I_CreateVmData {
153
153
  size_mb: number
154
154
  hotplug: boolean
155
155
  reservation_mb: number
156
- limit_mb: number
156
+ limit_mb: number | null
157
157
  }
158
158
  storage: {
159
159
  id: string
@@ -1,313 +1,321 @@
1
- <template>
2
- <component
3
- :is="currentComponent"
4
- v-model="vmForm"
5
- v-model:location="location"
6
- :project="props.project"
7
- :ready-complete-table-info="props.readyCompleteTableInfo"
8
- :name-request-url="props.nameRequestUrl"
9
- :wizard="wizard"
10
- :selected-scheme="selectedScheme"
11
- :dynamic-steps="dynamicSteps"
12
- :name-form-submit="nameFormSubmit"
13
- :name-test-ids="nameTestIds"
14
- :allowed-location-kinds="allowedLocationKinds"
15
- :location-description="locationDescription"
16
- :is-sphere="isSphere"
17
- :compute-resource-tree-local="computeResourceTreeLocal"
18
- :compatibility-text="compatibilityText"
19
- :is-loading-compute-tree="isLoadingComputeTree"
20
- :compute-resource-alert="computeResourceAlert"
21
- :location-nodes="props.locationNodes"
22
- @finish="emits('finish')"
23
- @hide="emits('hide')"
24
- @change-steps="onChangeSteps"
25
- @change-name="onChangeName(...$event)"
26
- />
27
- </template>
28
-
29
- <script setup lang="ts">
30
- import type { UI_I_WizardStep } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
31
- import type { UI_I_ValidationReturn } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
32
- import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
33
- import type { UI_I_Localization } from '~/lib/models/interfaces'
34
- import type { UI_T_Project } from '~/lib/models/types'
35
- import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
36
- import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
37
- import type { UI_I_NameTestIds } from '~/components/common/wizards/common/steps/name/lib/models/interfaces'
38
- import type { UI_T_CompatibilityStatus } from '~/components/common/wizards/common/compatibility/lib/models/types'
39
- import {
40
- dynamicSteps,
41
- stepsFunc,
42
- stepsSchemeInitial,
43
- } from '~/components/common/vm/actions/register/lib/config/steps'
44
- import { allowedLocationKinds } from '~/components/common/vm/actions/register/lib/config'
45
-
46
- const vmForm = defineModel<any>({ required: true })
47
-
48
- const props = withDefaults(
49
- defineProps<{
50
- project: UI_T_Project
51
- readyCompleteTableInfo: UI_I_TableInfoItem[]
52
- nameRequestUrl: string
53
- isLoadingComputeTree?: boolean // для сферы
54
- computeResourceAlert?: string[] // для сферы
55
- dataCenter?: UI_I_TreeNode | null // для сферы
56
- computeResourceTree?: UI_I_TreeNode[] // для сферы
57
- locationNodes?: UI_I_TreeNode[] // для сферы
58
- }>(),
59
- {
60
- isLoadingComputeTree: false,
61
- computeResourceAlert: () => [],
62
- dataCenter: null,
63
- computeResourceTree: undefined,
64
- locationNodes: () => [],
65
- }
66
- )
67
-
68
- const emits = defineEmits<{
69
- (event: 'finish'): void
70
- (event: 'hide'): void
71
- (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
72
- (
73
- event: 'get-compute-resource-tree',
74
- value: { id: string | number; cb: () => void }
75
- ): void // для сферы
76
- }>()
77
-
78
- const { $store, $recursion }: any = useNuxtApp()
79
-
80
- const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
81
-
82
- const currentComponent = computed(() =>
83
- isNewView.value
84
- ? defineAsyncComponent(() => import('./New.vue'))
85
- : defineAsyncComponent(() => import('./Old.vue'))
86
- )
87
-
88
- const localization = computed<UI_I_Localization>(() => useLocal())
89
- const isSphere = computed<boolean>(() => props.project === 'sphere')
90
-
91
- const location = ref<UI_I_TreeNode | null>(props.dataCenter) // для сферы
92
-
93
- const wizard: Wizard = new Wizard(
94
- stepsFunc(localization.value, props.project),
95
- stepsSchemeInitial
96
- )
97
- if (isSphere.value) {
98
- wizard.changeScheme(1)
99
- // wizard.selectStepHard(1)
100
- }
101
-
102
- const locationDescription = computed<string>(
103
- () => localization.value.common.selectLocationVirtualMachine
104
- )
105
-
106
- const nameTestIds: UI_I_NameTestIds = {
107
- name: 'virtual-machine-name',
108
- helpIcon: 'show-vm-name-help-icon',
109
- }
110
-
111
- const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
112
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
113
- wizard.changeSteps(value, validationFunc)
114
- }
115
- const validationFunc = async (
116
- value: UI_I_WizardStep[],
117
- currentStep: UI_I_WizardStep,
118
- nextStep: UI_I_WizardStep
119
- ): Promise<UI_I_ValidationReturn> => {
120
- let stepHasError = false
121
- let stepShouldStop = {
122
- ifOnCurrentStep: false,
123
- ifFromAnyStep: false,
124
- stoppageStepId: -1,
125
- }
126
-
127
- wizard.setLoader(true)
128
- if (
129
- wizard.isValidateForStep(
130
- isSphere.value ? dynamicSteps.selectNameFolder : dynamicSteps.selectName,
131
- currentStep.id,
132
- nextStep.id
133
- )
134
- ) {
135
- const nameValidation = await onCheckName(value)
136
-
137
- value = nameValidation.newValue
138
- stepHasError = stepHasError || nameValidation.stepHasError
139
- } else if (
140
- isSphere.value &&
141
- wizard.isValidateForStep(
142
- dynamicSteps.selectComputeResource,
143
- currentStep.id,
144
- nextStep.id
145
- )
146
- ) {
147
- const computeResourceValidation = await checkComputeResource(value)
148
-
149
- value = computeResourceValidation.newValue
150
- stepHasError = stepHasError || computeResourceValidation.stepHasError
151
- }
152
- wizard.setLoader(false)
153
-
154
- return {
155
- newValue: value,
156
- stepHasError,
157
- stepShouldStop,
158
- }
159
- }
160
-
161
- const nameFormSubmit = ref<null | Function>(null)
162
- const onCheckName = async (
163
- value: UI_I_WizardStep[]
164
- ): Promise<UI_I_ValidationReturn> => {
165
- let stepHasError = false
166
-
167
- return new Promise((resolve) => {
168
- const step = isSphere.value
169
- ? dynamicSteps.selectNameFolder
170
- : dynamicSteps.selectName
171
- nameFormSubmit.value = (isValid: boolean) => {
172
- if (!isValid) {
173
- stepHasError = wizard.setValidation(step, 'name', {
174
- fieldMessage: 'aaa',
175
- alertMessage: 'aaa',
176
- })
177
- } else if (wizard.hasMessage(step, 'name')) {
178
- value = wizard.removeValidation(step, 'name', value)
179
- }
180
-
181
- resolve({
182
- stepHasError,
183
- newValue: value,
184
- })
185
- nameFormSubmit.value = null
186
- }
187
- })
188
- }
189
- const compatibilityText = computed<[UI_T_CompatibilityStatus, string]>(() => {
190
- const { computeResource } = vmForm.value
191
-
192
- if (!computeResource)
193
- return [
194
- 'none',
195
- localization.value.vmWizard.noDestinationComputeResourceSelected,
196
- ]
197
-
198
- let res: [UI_T_CompatibilityStatus, string] = [
199
- 'success',
200
- localization.value.common.compatibilityChecksSucceeded,
201
- ]
202
-
203
- if (!['cluster', 'host', 'resource_pool'].includes(computeResource?.type)) {
204
- res = [
205
- 'error',
206
- localization.value.common.selectValidClusterOrHostDestination,
207
- ]
208
- }
209
- if (computeResource?.type === 'cluster') {
210
- const hasHost = !!computeResource.nodes.length
211
- if (!hasHost) {
212
- res = ['error', localization.value.common.clusterNotContainAnyHosts]
213
- }
214
- }
215
-
216
- if (computeResource?.type === 'host') {
217
- if (computeResource.state === 'Error') {
218
- // TODO check Maintenance Mode
219
- res = [
220
- 'error',
221
- localization.value.common.selectedHostDisconnectedMaintenanceMode,
222
- ]
223
- }
224
- }
225
-
226
- return res
227
- })
228
- const computeResourceAlert = ref<string[]>([])
229
- const checkComputeResource = (
230
- value: UI_I_WizardStep[]
231
- ): UI_I_ValidationReturn => {
232
- let stepHasError = false
233
-
234
- const { computeResource } = vmForm.value
235
-
236
- if (
237
- !computeResource ||
238
- // compatibilityText.value[0] !== 1 ||
239
- computeResource.type === 'datacenter' ||
240
- computeResource.type === 'folder' ||
241
- (computeResource.type === 'cluster' && !computeResource.nodes.length)
242
- ) {
243
- computeResourceAlert.value = [
244
- localization.value.common.specifyValidClusterOrHostDestination,
245
- ]
246
- stepHasError = wizard.setValidation(
247
- dynamicSteps.selectComputeResource,
248
- 'computeResource',
249
- {
250
- fieldMessage: 'aaa',
251
- alertMessage: 'aaa',
252
- }
253
- )
254
- } else {
255
- computeResourceAlert.value = []
256
- if (
257
- wizard.hasMessage(dynamicSteps.selectComputeResource, 'computeResource')
258
- ) {
259
- value = wizard.removeValidation(
260
- dynamicSteps.selectComputeResource,
261
- 'computeResource',
262
- value
263
- )
264
- }
265
- }
266
-
267
- return {
268
- stepHasError,
269
- newValue: value,
270
- }
271
- }
272
-
273
- const isLoadingComputeTree = ref<boolean>(false)
274
- const onChangeName = (name: string, node: UI_I_TreeNode | null): void => {
275
- vmForm.value.name = name
276
- if (isSphere.value) {
277
- vmForm.value.locationPath = node.id
278
- vmForm.value.dataCenter = $recursion.findParentByValue(
279
- node,
280
- 'datacenter',
281
- 'type',
282
- 'parent'
283
- )
284
- isLoadingComputeTree.value = true
285
- emits('get-compute-resource-tree', {
286
- id: node.id,
287
- cb: () => {
288
- isLoadingComputeTree.value = false
289
- },
290
- })
291
- }
292
- }
293
-
294
- watch(
295
- () => vmForm.value.computeResource,
296
- (newValue, oldValue) => {
297
- if (newValue && newValue.id !== oldValue?.id) {
298
- onSelectComputeResourceTree(newValue)
299
- }
300
- },
301
- { deep: true }
302
- )
303
- const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
304
- emits('select-compute-resource-tree', node)
305
- }
306
-
307
- const computeResourceTreeLocal = computed<UI_I_TreeNode[]>(() => {
308
- // для сферы
309
- return props.computeResourceTree || []
310
- })
311
- </script>
312
-
313
- <style scoped lang="scss"></style>
1
+ <template>
2
+ <component
3
+ :is="currentComponent"
4
+ v-model="vmForm"
5
+ v-model:location="location"
6
+ :project="props.project"
7
+ :ready-complete-table-info="props.readyCompleteTableInfo"
8
+ :name-request-url="props.nameRequestUrl"
9
+ :wizard="wizard"
10
+ :selected-scheme="selectedScheme"
11
+ :dynamic-steps="dynamicSteps"
12
+ :name-form-submit="nameFormSubmit"
13
+ :name-test-ids="nameTestIds"
14
+ :allowed-location-kinds="allowedLocationKinds"
15
+ :location-description="locationDescription"
16
+ :is-sphere="isSphere"
17
+ :compute-resource-tree-local="computeResourceTreeLocal"
18
+ :compatibility-text="compatibilityText"
19
+ :is-loading-compute-tree="isLoadingComputeTree"
20
+ :compute-resource-alert="computeResourceAlert"
21
+ :location-nodes="props.locationNodes"
22
+ @finish="emits('finish')"
23
+ @hide="emits('hide')"
24
+ @change-steps="onChangeSteps"
25
+ @change-name="onChangeName(...$event)"
26
+ />
27
+ </template>
28
+
29
+ <script setup lang="ts">
30
+ import type { UI_I_WizardStep } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
31
+ import type { UI_I_ValidationReturn } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
32
+ import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
33
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
34
+ import type { UI_T_Project } from '~/lib/models/types'
35
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
36
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
37
+ import type { UI_I_NameTestIds } from '~/components/common/wizards/common/steps/name/lib/models/interfaces'
38
+ import type { UI_T_CompatibilityStatus } from '~/components/common/wizards/common/compatibility/lib/models/types'
39
+ import {
40
+ dynamicSteps,
41
+ stepsFunc,
42
+ stepsSchemeInitial,
43
+ } from '~/components/common/vm/actions/register/lib/config/steps'
44
+ import { allowedLocationKinds } from '~/components/common/vm/actions/register/lib/config'
45
+
46
+ const vmForm = defineModel<any>({ required: true })
47
+
48
+ const props = withDefaults(
49
+ defineProps<{
50
+ project: UI_T_Project
51
+ readyCompleteTableInfo: UI_I_TableInfoItem[]
52
+ nameRequestUrl: string
53
+ isLoadingComputeTree?: boolean // для сферы
54
+ computeResourceAlert?: string[] // для сферы
55
+ dataCenter?: UI_I_TreeNode | null // для сферы
56
+ computeResourceTree?: UI_I_TreeNode[] // для сферы
57
+ locationNodes?: UI_I_TreeNode[] // для сферы
58
+ }>(),
59
+ {
60
+ isLoadingComputeTree: false,
61
+ computeResourceAlert: () => [],
62
+ dataCenter: null,
63
+ computeResourceTree: undefined,
64
+ locationNodes: () => [],
65
+ }
66
+ )
67
+
68
+ const emits = defineEmits<{
69
+ (event: 'finish'): void
70
+ (event: 'hide'): void
71
+ (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
72
+ (
73
+ event: 'get-compute-resource-tree',
74
+ value: { id: string | number; cb: () => void }
75
+ ): void // для сферы
76
+ }>()
77
+
78
+ const { $store, $recursion }: any = useNuxtApp()
79
+
80
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
81
+
82
+ const currentComponent = computed(() =>
83
+ isNewView.value
84
+ ? defineAsyncComponent(() => import('./New.vue'))
85
+ : defineAsyncComponent(() => import('./Old.vue'))
86
+ )
87
+
88
+ const localization = computed<UI_I_Localization>(() => useLocal())
89
+ const isSphere = computed<boolean>(() => props.project === 'sphere')
90
+
91
+ const location = ref<UI_I_TreeNode | null>(null) // для сферы
92
+ watch(
93
+ () => props.dataCenter,
94
+ (newValue) => {
95
+ if (location.value || !newValue) return
96
+
97
+ location.value = newValue
98
+ },
99
+ { immediate: true, deep: true }
100
+ )
101
+ const wizard: Wizard = new Wizard(
102
+ stepsFunc(localization.value, props.project),
103
+ stepsSchemeInitial
104
+ )
105
+ if (isSphere.value) {
106
+ wizard.changeScheme(1)
107
+ // wizard.selectStepHard(1)
108
+ }
109
+
110
+ const locationDescription = computed<string>(
111
+ () => localization.value.common.selectLocationVirtualMachine
112
+ )
113
+
114
+ const nameTestIds: UI_I_NameTestIds = {
115
+ name: 'virtual-machine-name',
116
+ helpIcon: 'show-vm-name-help-icon',
117
+ }
118
+
119
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
120
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
121
+ wizard.changeSteps(value, validationFunc)
122
+ }
123
+ const validationFunc = async (
124
+ value: UI_I_WizardStep[],
125
+ currentStep: UI_I_WizardStep,
126
+ nextStep: UI_I_WizardStep
127
+ ): Promise<UI_I_ValidationReturn> => {
128
+ let stepHasError = false
129
+ let stepShouldStop = {
130
+ ifOnCurrentStep: false,
131
+ ifFromAnyStep: false,
132
+ stoppageStepId: -1,
133
+ }
134
+
135
+ wizard.setLoader(true)
136
+ if (
137
+ wizard.isValidateForStep(
138
+ isSphere.value ? dynamicSteps.selectNameFolder : dynamicSteps.selectName,
139
+ currentStep.id,
140
+ nextStep.id
141
+ )
142
+ ) {
143
+ const nameValidation = await onCheckName(value)
144
+
145
+ value = nameValidation.newValue
146
+ stepHasError = stepHasError || nameValidation.stepHasError
147
+ } else if (
148
+ isSphere.value &&
149
+ wizard.isValidateForStep(
150
+ dynamicSteps.selectComputeResource,
151
+ currentStep.id,
152
+ nextStep.id
153
+ )
154
+ ) {
155
+ const computeResourceValidation = await checkComputeResource(value)
156
+
157
+ value = computeResourceValidation.newValue
158
+ stepHasError = stepHasError || computeResourceValidation.stepHasError
159
+ }
160
+ wizard.setLoader(false)
161
+
162
+ return {
163
+ newValue: value,
164
+ stepHasError,
165
+ stepShouldStop,
166
+ }
167
+ }
168
+
169
+ const nameFormSubmit = ref<null | Function>(null)
170
+ const onCheckName = async (
171
+ value: UI_I_WizardStep[]
172
+ ): Promise<UI_I_ValidationReturn> => {
173
+ let stepHasError = false
174
+
175
+ return new Promise((resolve) => {
176
+ const step = isSphere.value
177
+ ? dynamicSteps.selectNameFolder
178
+ : dynamicSteps.selectName
179
+ nameFormSubmit.value = (isValid: boolean) => {
180
+ if (!isValid) {
181
+ stepHasError = wizard.setValidation(step, 'name', {
182
+ fieldMessage: 'aaa',
183
+ alertMessage: 'aaa',
184
+ })
185
+ } else if (wizard.hasMessage(step, 'name')) {
186
+ value = wizard.removeValidation(step, 'name', value)
187
+ }
188
+
189
+ resolve({
190
+ stepHasError,
191
+ newValue: value,
192
+ })
193
+ nameFormSubmit.value = null
194
+ }
195
+ })
196
+ }
197
+ const compatibilityText = computed<[UI_T_CompatibilityStatus, string]>(() => {
198
+ const { computeResource } = vmForm.value
199
+
200
+ if (!computeResource)
201
+ return [
202
+ 'none',
203
+ localization.value.vmWizard.noDestinationComputeResourceSelected,
204
+ ]
205
+
206
+ let res: [UI_T_CompatibilityStatus, string] = [
207
+ 'success',
208
+ localization.value.common.compatibilityChecksSucceeded,
209
+ ]
210
+
211
+ if (!['cluster', 'host', 'resource_pool'].includes(computeResource?.type)) {
212
+ res = [
213
+ 'error',
214
+ localization.value.common.selectValidClusterOrHostDestination,
215
+ ]
216
+ }
217
+ if (computeResource?.type === 'cluster') {
218
+ const hasHost = !!computeResource.nodes.length
219
+ if (!hasHost) {
220
+ res = ['error', localization.value.common.clusterNotContainAnyHosts]
221
+ }
222
+ }
223
+
224
+ if (computeResource?.type === 'host') {
225
+ if (computeResource.state === 'Error') {
226
+ // TODO check Maintenance Mode
227
+ res = [
228
+ 'error',
229
+ localization.value.common.selectedHostDisconnectedMaintenanceMode,
230
+ ]
231
+ }
232
+ }
233
+
234
+ return res
235
+ })
236
+ const computeResourceAlert = ref<string[]>([])
237
+ const checkComputeResource = (
238
+ value: UI_I_WizardStep[]
239
+ ): UI_I_ValidationReturn => {
240
+ let stepHasError = false
241
+
242
+ const { computeResource } = vmForm.value
243
+
244
+ if (
245
+ !computeResource ||
246
+ // compatibilityText.value[0] !== 1 ||
247
+ computeResource.type === 'datacenter' ||
248
+ computeResource.type === 'folder' ||
249
+ (computeResource.type === 'cluster' && !computeResource.nodes.length)
250
+ ) {
251
+ computeResourceAlert.value = [
252
+ localization.value.common.specifyValidClusterOrHostDestination,
253
+ ]
254
+ stepHasError = wizard.setValidation(
255
+ dynamicSteps.selectComputeResource,
256
+ 'computeResource',
257
+ {
258
+ fieldMessage: 'aaa',
259
+ alertMessage: 'aaa',
260
+ }
261
+ )
262
+ } else {
263
+ computeResourceAlert.value = []
264
+ if (
265
+ wizard.hasMessage(dynamicSteps.selectComputeResource, 'computeResource')
266
+ ) {
267
+ value = wizard.removeValidation(
268
+ dynamicSteps.selectComputeResource,
269
+ 'computeResource',
270
+ value
271
+ )
272
+ }
273
+ }
274
+
275
+ return {
276
+ stepHasError,
277
+ newValue: value,
278
+ }
279
+ }
280
+
281
+ const isLoadingComputeTree = ref<boolean>(false)
282
+ const onChangeName = (name: string, node: UI_I_TreeNode | null): void => {
283
+ vmForm.value.name = name
284
+ if (isSphere.value) {
285
+ vmForm.value.locationPath = node.id
286
+ vmForm.value.dataCenter = $recursion.findParentByValue(
287
+ node,
288
+ 'datacenter',
289
+ 'type',
290
+ 'parent'
291
+ )
292
+ isLoadingComputeTree.value = true
293
+ emits('get-compute-resource-tree', {
294
+ id: node.id,
295
+ cb: () => {
296
+ isLoadingComputeTree.value = false
297
+ },
298
+ })
299
+ }
300
+ }
301
+
302
+ watch(
303
+ () => vmForm.value.computeResource,
304
+ (newValue, oldValue) => {
305
+ if (newValue && newValue.id !== oldValue?.id) {
306
+ onSelectComputeResourceTree(newValue)
307
+ }
308
+ },
309
+ { deep: true }
310
+ )
311
+ const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
312
+ emits('select-compute-resource-tree', node)
313
+ }
314
+
315
+ const computeResourceTreeLocal = computed<UI_I_TreeNode[]>(() => {
316
+ // для сферы
317
+ return props.computeResourceTree || []
318
+ })
319
+ </script>
320
+
321
+ <style scoped lang="scss"></style>
@@ -1,94 +1,94 @@
1
- import type { UI_I_WizardStep } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
2
- import { UI_E_WIZARD_STATUS } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/enums'
3
- import type { UI_I_Localization } from '~/lib/models/interfaces'
4
- import type { UI_T_Project } from '~/lib/models/types'
5
-
6
- export const dynamicSteps = {
7
- selectName: 0,
8
- selectNameFolder: 1,
9
- selectComputeResource: 2,
10
- readyComplete: 3,
11
- }
12
-
13
- export const stepsFunc = (
14
- localization: UI_I_Localization,
15
- project: UI_T_Project
16
- ): UI_I_WizardStep[] => {
17
- return [
18
- // Procurator
19
- {
20
- id: dynamicSteps.selectName,
21
- stepName: '',
22
- title: localization.common.selectName,
23
- subTitle: localization.common.specifyUniqueName,
24
- status:
25
- project === 'procurator'
26
- ? UI_E_WIZARD_STATUS.SELECTED
27
- : UI_E_WIZARD_STATUS.INACTIVE,
28
- isValid: true,
29
- testId: 'vm-select-name',
30
- fields: {
31
- name: {
32
- field: '',
33
- alert: '',
34
- },
35
- },
36
- },
37
- // Sphere
38
- {
39
- id: dynamicSteps.selectNameFolder,
40
- stepName: '',
41
- title: localization.vmWizard.selectNameFolder,
42
- subTitle: localization.common.specifyUniqueNameTargetLocation,
43
- status:
44
- project === 'procurator'
45
- ? UI_E_WIZARD_STATUS.INACTIVE
46
- : UI_E_WIZARD_STATUS.SELECTED,
47
- isValid: true,
48
- testId: 'vm-select-name-folder',
49
- fields: {
50
- name: {
51
- field: '',
52
- alert: '',
53
- },
54
- },
55
- },
56
- // Sphere
57
- {
58
- id: dynamicSteps.selectComputeResource,
59
- stepName: '',
60
- title: localization.vmWizard.selectComputeResource,
61
- subTitle: localization.common.selectDestinationComputeResourceOperation,
62
- status: UI_E_WIZARD_STATUS.INACTIVE,
63
- isValid: true,
64
- testId: 'vm-select-compute-resource',
65
- fields: {
66
- computeResource: {
67
- field: '',
68
- alert: '',
69
- },
70
- },
71
- },
72
- {
73
- id: dynamicSteps.readyComplete,
74
- stepName: '',
75
- title: localization.vmWizard.readyComplete,
76
- subTitle: localization.vmWizard.lastCreateSubtitle,
77
- status: UI_E_WIZARD_STATUS.INACTIVE,
78
- isValid: true,
79
- testId: 'vm-ready-complete',
80
- fields: {},
81
- },
82
- ]
83
- }
84
-
85
- export const stepsSchemeInitial = [
86
- // 0 Procurator
87
- [dynamicSteps.selectName, dynamicSteps.readyComplete],
88
- // 1 Sphere
89
- [
90
- dynamicSteps.selectNameFolder,
91
- dynamicSteps.selectComputeResource,
92
- dynamicSteps.readyComplete,
93
- ],
94
- ]
1
+ import type { UI_I_WizardStep } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
2
+ import { UI_E_WIZARD_STATUS } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/enums'
3
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
4
+ import type { UI_T_Project } from '~/lib/models/types'
5
+
6
+ export const dynamicSteps = {
7
+ selectName: 0,
8
+ selectNameFolder: 1,
9
+ selectComputeResource: 2,
10
+ readyComplete: 3,
11
+ }
12
+
13
+ export const stepsFunc = (
14
+ localization: UI_I_Localization,
15
+ project: UI_T_Project
16
+ ): UI_I_WizardStep[] => {
17
+ return [
18
+ // Procurator
19
+ {
20
+ id: dynamicSteps.selectName,
21
+ stepName: '',
22
+ title: localization.common.selectName,
23
+ subTitle: localization.common.specifyUniqueName,
24
+ status:
25
+ project === 'procurator'
26
+ ? UI_E_WIZARD_STATUS.SELECTED
27
+ : UI_E_WIZARD_STATUS.INACTIVE,
28
+ isValid: true,
29
+ testId: 'vm-select-name',
30
+ fields: {
31
+ name: {
32
+ field: '',
33
+ alert: '',
34
+ },
35
+ },
36
+ },
37
+ // Sphere
38
+ {
39
+ id: dynamicSteps.selectNameFolder,
40
+ stepName: '',
41
+ title: localization.vmWizard.selectNameFolder,
42
+ subTitle: localization.common.specifyUniqueNameTargetLocation,
43
+ status:
44
+ project === 'procurator'
45
+ ? UI_E_WIZARD_STATUS.INACTIVE
46
+ : UI_E_WIZARD_STATUS.SELECTED,
47
+ isValid: true,
48
+ testId: 'vm-select-name-folder',
49
+ fields: {
50
+ name: {
51
+ field: '',
52
+ alert: '',
53
+ },
54
+ },
55
+ },
56
+ // Sphere
57
+ {
58
+ id: dynamicSteps.selectComputeResource,
59
+ stepName: '',
60
+ title: localization.vmWizard.selectComputeResource,
61
+ subTitle: localization.common.selectDestinationComputeResourceOperation,
62
+ status: UI_E_WIZARD_STATUS.INACTIVE,
63
+ isValid: true,
64
+ testId: 'vm-select-compute-resource',
65
+ fields: {
66
+ computeResource: {
67
+ field: '',
68
+ alert: '',
69
+ },
70
+ },
71
+ },
72
+ {
73
+ id: dynamicSteps.readyComplete,
74
+ stepName: '',
75
+ title: localization.vmWizard.readyComplete,
76
+ subTitle: localization.vmWizard.lastCreateSubtitle,
77
+ status: UI_E_WIZARD_STATUS.INACTIVE,
78
+ isValid: true,
79
+ testId: 'vm-ready-complete',
80
+ fields: {},
81
+ },
82
+ ]
83
+ }
84
+
85
+ export const stepsSchemeInitial = [
86
+ // 0 Procurator
87
+ [dynamicSteps.selectName, dynamicSteps.readyComplete],
88
+ // 1 Sphere
89
+ [
90
+ dynamicSteps.selectNameFolder,
91
+ dynamicSteps.selectComputeResource,
92
+ dynamicSteps.readyComplete,
93
+ ],
94
+ ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.635",
4
+ "version": "1.5.637",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -18,7 +18,7 @@
18
18
  "@vueuse/core": "10.1.2",
19
19
  "@vueuse/nuxt": "10.1.2",
20
20
  "bfg-nuxt-3-graph": "1.0.27",
21
- "bfg-uikit": "1.0.533",
21
+ "bfg-uikit": "1.0.531",
22
22
  "eslint-config-prettier": "^8.5.0",
23
23
  "eslint-plugin-myrules": "file:./eslint",
24
24
  "nuxt": "3.11.2",