bfg-common 1.2.203 → 1.2.205

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.
@@ -1,238 +1,238 @@
1
- import type { UI_I_WizardStep } from '~/components/atoms/wizard/models/interfaces'
2
-
3
- import { UI_I_ArbitraryObject } from '~/models/interfaces'
4
- import { UI_E_Fields } from '~/components/common/vm/actions/common/models/enums'
5
- import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
6
- import { UI_I_Localization } from '~/models/interfaces'
7
- import { UI_I_VerticalStepItem } from '~/components/atoms/models/interfaces'
8
- import { UI_T_Project } from '~/models/types'
9
- import { UI_E_WIZARD_STATUS } from '~/components/atoms/wizard/models/enums'
10
- import { checkAllField } from '~/components/common/vm/actions/utils'
11
-
12
- export const objectToOptionItem = (
13
- // TODO переместить в более глобальное место
14
- obj: UI_I_ArbitraryObject<string>
15
- ): UI_I_OptionItem[] => {
16
- const result = []
17
- for (const key in obj) {
18
- result.push({
19
- text: obj[key],
20
- value: key,
21
- })
22
- }
23
- return result
24
- }
25
-
26
- export const getStepPositionByField = (field: string): number => {
27
- if (checkAllField(field)) {
28
- return UI_E_Fields[field]
29
- } else if (field.includes('disk_devices')) {
30
- return UI_E_Fields.disk_devices
31
- } else if (field.includes('network_devices')) {
32
- return UI_E_Fields.network_devices
33
- }
34
- return 5
35
- }
36
-
37
- export const stepItemsFunc = (
38
- localization: UI_I_Localization,
39
- project: UI_T_Project
40
- ): UI_I_VerticalStepItem[] => {
41
- if (project === 'sphere') {
42
- return [
43
- {
44
- text: localization.selectCreationType,
45
- disabled: false,
46
- complete: false,
47
- },
48
- {
49
- text: localization.selectNameFolder,
50
- disabled: true,
51
- complete: false,
52
- },
53
- {
54
- text: localization.selectComputeResource,
55
- disabled: true,
56
- complete: false,
57
- },
58
- { text: localization.selectStorage, disabled: true, complete: false },
59
- { text: localization.compatibility, disabled: true, complete: false },
60
- { text: localization.selectGuestOS, disabled: true, complete: false },
61
- {
62
- text: localization.customizeHardware,
63
- disabled: true,
64
- complete: false,
65
- },
66
- { text: localization.readyComplete, disabled: true, complete: false },
67
- ]
68
- }
69
- return [
70
- {
71
- text: localization.selectCreationType,
72
- disabled: false,
73
- complete: false,
74
- },
75
- {
76
- text: localization.selectName,
77
- disabled: true,
78
- complete: false,
79
- },
80
- { text: localization.selectStorage, disabled: true, complete: false },
81
- { text: localization.compatibility, disabled: true, complete: false },
82
- {
83
- text: localization.selectGuestOSMachineType,
84
- disabled: true,
85
- complete: false,
86
- },
87
- {
88
- text: localization.customizeHardware,
89
- disabled: true,
90
- complete: false,
91
- },
92
- { text: localization.readyComplete, disabled: true, complete: false },
93
- ]
94
- }
95
-
96
- export const subTitleFunc = (
97
- localization: UI_I_Localization,
98
- project: UI_T_Project
99
- ): string[] => {
100
- if (project === 'sphere') {
101
- return [
102
- localization.howWouldLikeCreateVirtualMachine,
103
- localization.specifyUniqueNameTargetLocation,
104
- localization.selectDestinationComputeResourceOperation,
105
- localization.selectStorageConfigurationDiskFiles,
106
- localization.selectCompatibilityVmDependingHostsEnvironment,
107
- localization.chooseGuestOSInstalledVM,
108
- localization.configureVirtualMachineHardware,
109
- localization.clickFinishStartCreation,
110
- ]
111
- }
112
- return [
113
- localization.howWouldLikeCreateVirtualMachine,
114
- localization.specifyUniqueName,
115
- localization.selectStorageConfigurationDiskFiles,
116
- localization.selectCompatibilityVmDependingHostsEnvironment,
117
- localization.chooseGuestOSInstalledVmAndMachineTypeUsedCreateVm,
118
- localization.configureVirtualMachineHardware,
119
- localization.clickFinishStartCreation,
120
- ]
121
- }
122
-
123
- export const wizardSteps = (
124
- localization: UI_I_Localization
125
- ): UI_I_WizardStep[] => {
126
- return [
127
- {
128
- id: 0,
129
- stepName: '',
130
- title: localization.selectCreationType,
131
- subTitle: localization.howWouldLikeCreateVirtualMachine,
132
- status: UI_E_WIZARD_STATUS.SELECTED,
133
- isValid: true,
134
- fields: {},
135
- },
136
- // Procurator
137
- {
138
- id: 1,
139
- stepName: '',
140
- title: localization.selectName,
141
- subTitle: localization.specifyUniqueName,
142
- status: UI_E_WIZARD_STATUS.INACTIVE,
143
- isValid: true,
144
- fields: {
145
- name: {
146
- field: '',
147
- alert: '',
148
- },
149
- },
150
- },
151
- // Sphere
152
- {
153
- id: 2,
154
- stepName: '',
155
- title: localization.selectNameFolder,
156
- subTitle: localization.specifyUniqueNameTargetLocation,
157
- status: UI_E_WIZARD_STATUS.INACTIVE,
158
- isValid: true,
159
- fields: {},
160
- },
161
- // Sphere
162
- {
163
- id: 3,
164
- stepName: '',
165
- title: localization.selectComputeResource,
166
- subTitle: localization.selectDestinationComputeResourceOperation,
167
- status: UI_E_WIZARD_STATUS.INACTIVE,
168
- isValid: true,
169
- fields: {},
170
- },
171
- {
172
- id: 4,
173
- stepName: '',
174
- title: localization.selectStorage,
175
- subTitle: localization.selectStorageConfigurationDiskFiles,
176
- status: UI_E_WIZARD_STATUS.INACTIVE,
177
- isValid: true,
178
- fields: {
179
- storage: {
180
- field: '',
181
- alert: '',
182
- },
183
- },
184
- },
185
- {
186
- id: 5,
187
- stepName: '',
188
- title: localization.compatibility,
189
- subTitle: localization.selectCompatibilityVmDependingHostsEnvironment,
190
- status: UI_E_WIZARD_STATUS.INACTIVE,
191
- isValid: true,
192
- fields: {},
193
- },
194
- // Procurator
195
- {
196
- id: 6,
197
- stepName: '',
198
- title: localization.selectGuestOSMachineType,
199
- subTitle: localization.chooseGuestOSInstalledVmAndMachineTypeUsedCreateVm,
200
- status: UI_E_WIZARD_STATUS.INACTIVE,
201
- isValid: true,
202
- fields: {},
203
- },
204
- // Sphere
205
- {
206
- id: 7,
207
- stepName: '',
208
- title: localization.selectGuestOS,
209
- subTitle: localization.chooseGuestOSInstalledVM,
210
- status: UI_E_WIZARD_STATUS.INACTIVE,
211
- isValid: true,
212
- fields: {},
213
- },
214
- {
215
- id: 8,
216
- stepName: '',
217
- title: localization.customizeHardware,
218
- subTitle: localization.configureVirtualMachineHardware,
219
- status: UI_E_WIZARD_STATUS.INACTIVE,
220
- isValid: true,
221
- fields: {
222
- customizeHardware: {
223
- field: '',
224
- alert: '',
225
- },
226
- },
227
- },
228
- {
229
- id: 9,
230
- stepName: '',
231
- title: localization.readyComplete,
232
- subTitle: localization.clickFinishStartCreation,
233
- status: UI_E_WIZARD_STATUS.INACTIVE,
234
- isValid: true,
235
- fields: {},
236
- },
237
- ]
238
- }
1
+ import type { UI_I_WizardStep } from '~/components/atoms/wizard/models/interfaces'
2
+
3
+ import { UI_I_ArbitraryObject } from '~/models/interfaces'
4
+ import { UI_E_Fields } from '~/components/common/vm/actions/common/models/enums'
5
+ import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
6
+ import { UI_I_Localization } from '~/models/interfaces'
7
+ import { UI_I_VerticalStepItem } from '~/components/atoms/models/interfaces'
8
+ import { UI_T_Project } from '~/models/types'
9
+ import { UI_E_WIZARD_STATUS } from '~/components/atoms/wizard/models/enums'
10
+ import { checkAllField } from '~/components/common/vm/actions/utils'
11
+
12
+ export const objectToOptionItem = (
13
+ // TODO переместить в более глобальное место
14
+ obj: UI_I_ArbitraryObject<string>
15
+ ): UI_I_OptionItem[] => {
16
+ const result = []
17
+ for (const key in obj) {
18
+ result.push({
19
+ text: obj[key],
20
+ value: key,
21
+ })
22
+ }
23
+ return result
24
+ }
25
+
26
+ export const getStepPositionByField = (field: string): number => {
27
+ if (checkAllField(field)) {
28
+ return UI_E_Fields[field]
29
+ } else if (field.includes('disk_devices')) {
30
+ return UI_E_Fields.disk_devices
31
+ } else if (field.includes('network_devices')) {
32
+ return UI_E_Fields.network_devices
33
+ }
34
+ return 5
35
+ }
36
+
37
+ export const stepItemsFunc = (
38
+ localization: UI_I_Localization,
39
+ project: UI_T_Project
40
+ ): UI_I_VerticalStepItem[] => {
41
+ if (project === 'sphere') {
42
+ return [
43
+ {
44
+ text: localization.selectCreationType,
45
+ disabled: false,
46
+ complete: false,
47
+ },
48
+ {
49
+ text: localization.selectNameFolder,
50
+ disabled: true,
51
+ complete: false,
52
+ },
53
+ {
54
+ text: localization.selectComputeResource,
55
+ disabled: true,
56
+ complete: false,
57
+ },
58
+ { text: localization.selectStorage, disabled: true, complete: false },
59
+ { text: localization.compatibility, disabled: true, complete: false },
60
+ { text: localization.selectGuestOS, disabled: true, complete: false },
61
+ {
62
+ text: localization.customizeHardware,
63
+ disabled: true,
64
+ complete: false,
65
+ },
66
+ { text: localization.readyComplete, disabled: true, complete: false },
67
+ ]
68
+ }
69
+ return [
70
+ {
71
+ text: localization.selectCreationType,
72
+ disabled: false,
73
+ complete: false,
74
+ },
75
+ {
76
+ text: localization.selectName,
77
+ disabled: true,
78
+ complete: false,
79
+ },
80
+ { text: localization.selectStorage, disabled: true, complete: false },
81
+ { text: localization.compatibility, disabled: true, complete: false },
82
+ {
83
+ text: localization.selectGuestOSMachineType,
84
+ disabled: true,
85
+ complete: false,
86
+ },
87
+ {
88
+ text: localization.customizeHardware,
89
+ disabled: true,
90
+ complete: false,
91
+ },
92
+ { text: localization.readyComplete, disabled: true, complete: false },
93
+ ]
94
+ }
95
+
96
+ export const subTitleFunc = (
97
+ localization: UI_I_Localization,
98
+ project: UI_T_Project
99
+ ): string[] => {
100
+ if (project === 'sphere') {
101
+ return [
102
+ localization.howWouldLikeCreateVirtualMachine,
103
+ localization.specifyUniqueNameTargetLocation,
104
+ localization.selectDestinationComputeResourceOperation,
105
+ localization.selectStorageConfigurationDiskFiles,
106
+ localization.selectCompatibilityVmDependingHostsEnvironment,
107
+ localization.chooseGuestOSInstalledVM,
108
+ localization.configureVirtualMachineHardware,
109
+ localization.clickFinishStartCreation,
110
+ ]
111
+ }
112
+ return [
113
+ localization.howWouldLikeCreateVirtualMachine,
114
+ localization.specifyUniqueName,
115
+ localization.selectStorageConfigurationDiskFiles,
116
+ localization.selectCompatibilityVmDependingHostsEnvironment,
117
+ localization.chooseGuestOSInstalledVmAndMachineTypeUsedCreateVm,
118
+ localization.configureVirtualMachineHardware,
119
+ localization.clickFinishStartCreation,
120
+ ]
121
+ }
122
+
123
+ export const wizardSteps = (
124
+ localization: UI_I_Localization
125
+ ): UI_I_WizardStep[] => {
126
+ return [
127
+ {
128
+ id: 0,
129
+ stepName: '',
130
+ title: localization.selectCreationType,
131
+ subTitle: localization.howWouldLikeCreateVirtualMachine,
132
+ status: UI_E_WIZARD_STATUS.SELECTED,
133
+ isValid: true,
134
+ fields: {},
135
+ },
136
+ // Procurator
137
+ {
138
+ id: 1,
139
+ stepName: '',
140
+ title: localization.selectName,
141
+ subTitle: localization.specifyUniqueName,
142
+ status: UI_E_WIZARD_STATUS.INACTIVE,
143
+ isValid: true,
144
+ fields: {
145
+ name: {
146
+ field: '',
147
+ alert: '',
148
+ },
149
+ },
150
+ },
151
+ // Sphere
152
+ {
153
+ id: 2,
154
+ stepName: '',
155
+ title: localization.selectNameFolder,
156
+ subTitle: localization.specifyUniqueNameTargetLocation,
157
+ status: UI_E_WIZARD_STATUS.INACTIVE,
158
+ isValid: true,
159
+ fields: {},
160
+ },
161
+ // Sphere
162
+ {
163
+ id: 3,
164
+ stepName: '',
165
+ title: localization.selectComputeResource,
166
+ subTitle: localization.selectDestinationComputeResourceOperation,
167
+ status: UI_E_WIZARD_STATUS.INACTIVE,
168
+ isValid: true,
169
+ fields: {},
170
+ },
171
+ {
172
+ id: 4,
173
+ stepName: '',
174
+ title: localization.selectStorage,
175
+ subTitle: localization.selectStorageConfigurationDiskFiles,
176
+ status: UI_E_WIZARD_STATUS.INACTIVE,
177
+ isValid: true,
178
+ fields: {
179
+ storage: {
180
+ field: '',
181
+ alert: '',
182
+ },
183
+ },
184
+ },
185
+ {
186
+ id: 5,
187
+ stepName: '',
188
+ title: localization.compatibility,
189
+ subTitle: localization.selectCompatibilityVmDependingHostsEnvironment,
190
+ status: UI_E_WIZARD_STATUS.INACTIVE,
191
+ isValid: true,
192
+ fields: {},
193
+ },
194
+ // Procurator
195
+ {
196
+ id: 6,
197
+ stepName: '',
198
+ title: localization.selectGuestOSMachineType,
199
+ subTitle: localization.chooseGuestOSInstalledVmAndMachineTypeUsedCreateVm,
200
+ status: UI_E_WIZARD_STATUS.INACTIVE,
201
+ isValid: true,
202
+ fields: {},
203
+ },
204
+ // Sphere
205
+ {
206
+ id: 7,
207
+ stepName: '',
208
+ title: localization.selectGuestOS,
209
+ subTitle: localization.chooseGuestOSInstalledVM,
210
+ status: UI_E_WIZARD_STATUS.INACTIVE,
211
+ isValid: true,
212
+ fields: {},
213
+ },
214
+ {
215
+ id: 8,
216
+ stepName: '',
217
+ title: localization.customizeHardware,
218
+ subTitle: localization.configureVirtualMachineHardware,
219
+ status: UI_E_WIZARD_STATUS.INACTIVE,
220
+ isValid: true,
221
+ fields: {
222
+ customizeHardware: {
223
+ field: '',
224
+ alert: '',
225
+ },
226
+ },
227
+ },
228
+ {
229
+ id: 9,
230
+ stepName: '',
231
+ title: localization.readyComplete,
232
+ subTitle: localization.clickFinishStartCreation,
233
+ status: UI_E_WIZARD_STATUS.INACTIVE,
234
+ isValid: true,
235
+ fields: {},
236
+ },
237
+ ]
238
+ }