bfg-common 1.3.440 → 1.3.442

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.
Files changed (56) hide show
  1. package/components/common/vm/actions/editSettings/EditSettings.vue +30 -30
  2. package/components/common/wizards/datastoreNew/add/Add.vue +611 -0
  3. package/components/common/wizards/datastoreNew/add/lib/config/stepItems.ts +191 -0
  4. package/components/common/wizards/datastoreNew/add/lib/config/steps.ts +202 -0
  5. package/components/common/wizards/datastoreNew/add/lib/models/interfaces.ts +38 -0
  6. package/components/common/wizards/datastoreNew/add/lib/models/types.ts +14 -0
  7. package/components/common/wizards/datastoreNew/add/lib/utils.ts +72 -0
  8. package/components/common/wizards/datastoreNew/add/local/Local.vue +44 -0
  9. package/components/common/wizards/datastoreNew/add/local/createName/CreateName.vue +129 -0
  10. package/components/common/wizards/datastoreNew/add/local/createName/lib/config/defaultForm.ts +15 -0
  11. package/components/common/wizards/datastoreNew/add/nfs/Nfs.vue +99 -0
  12. package/components/common/wizards/datastoreNew/add/nfs/accessibility/Accessibility.vue +104 -0
  13. package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/config/tabsPannel.ts +24 -0
  14. package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/models/interfaces.ts +9 -0
  15. package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/models/types.ts +5 -0
  16. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/TablesView.vue +142 -0
  17. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/compatibleTable.ts +62 -0
  18. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/hostsTableItems.ts +53 -0
  19. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/incompatibleTable.ts +68 -0
  20. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/tableKeys.ts +15 -0
  21. package/components/common/wizards/datastoreNew/add/nfs/configuration/Configuration.vue +385 -0
  22. package/components/common/wizards/datastoreNew/add/nfs/configuration/lib/config/defaultForm.ts +33 -0
  23. package/components/common/wizards/datastoreNew/add/nfs/configuration/lib/models/interfaces.ts +12 -0
  24. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/DeletePopover.vue +100 -0
  25. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/ServersList.vue +124 -0
  26. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/config/serversListConfig.ts +41 -0
  27. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/config/tableKeys.ts +3 -0
  28. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/models/interfaces.ts +11 -0
  29. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/models/types.ts +1 -0
  30. package/components/common/wizards/datastoreNew/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +55 -0
  31. package/components/common/wizards/datastoreNew/add/nfs/kerberosAuthentication/lib/config/radioOptions.ts +27 -0
  32. package/components/common/wizards/datastoreNew/add/nfs/version/Version.vue +42 -0
  33. package/components/common/wizards/datastoreNew/add/nfs/version/lib/config/versionOptions.ts +20 -0
  34. package/components/common/wizards/datastoreNew/add/readyComplete/ReadyComplete.vue +88 -0
  35. package/components/common/wizards/datastoreNew/add/readyComplete/lib/config/propertiesDetails.ts +175 -0
  36. package/components/common/wizards/datastoreNew/add/readyComplete/lib/models/interfaces.ts +4 -0
  37. package/components/common/wizards/datastoreNew/add/sharedStorm/SharedStorm.vue +90 -0
  38. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/DeviceSelection.vue +424 -0
  39. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/config/defaultForm.ts +18 -0
  40. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/config/selectOptions.ts +14 -0
  41. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces.ts +58 -0
  42. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/types.ts +14 -0
  43. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/Table.vue +134 -0
  44. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/lib/config/hostsTable.ts +87 -0
  45. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/lib/config/tableKeys.ts +11 -0
  46. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +232 -0
  47. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/graphicTooltip/graphicTooltip.vue +64 -0
  48. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/lib/config/selectOptions.ts +46 -0
  49. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/sizeGraphic/sizeGraphic.vue +225 -0
  50. package/components/common/wizards/datastoreNew/add/sharedStorm/version/Version.vue +39 -0
  51. package/components/common/wizards/datastoreNew/add/sharedStorm/version/lib/config/versionOptions.ts +21 -0
  52. package/components/common/wizards/datastoreNew/add/types/Types.vue +71 -0
  53. package/components/common/wizards/datastoreNew/add/types/lib/config/typeOptions.ts +49 -0
  54. package/lib/models/interfaces.ts +1 -0
  55. package/lib/utils/sendTask.ts +2 -1
  56. package/package.json +1 -1
@@ -0,0 +1,191 @@
1
+ import type { UI_I_VerticalStepItem } from '~/components/atoms/lib/models/interfaces'
2
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
3
+ import type {
4
+ UI_T_WizardDatastoreMode,
5
+ UI_T_DatastoreType,
6
+ UI_T_NfsType,
7
+ } from '~/components/common/wizards/datastore/add/lib/models/types'
8
+
9
+ const stepFromSharedStorm = (
10
+ localization: UI_I_Localization,
11
+ mode: UI_T_WizardDatastoreMode
12
+ ): UI_I_VerticalStepItem[] => {
13
+ const steps = [
14
+ // { text: localization.type, disabled: false, complete: false },
15
+ {
16
+ text: localization.nameAndDeviceSelection,
17
+ disabled: true,
18
+ complete: false,
19
+ },
20
+ // {
21
+ // text: localization.vmfsVersion,
22
+ // disabled: true,
23
+ // complete: false,
24
+ // }, <!-- TODO в shared-storm пока верси не будет -->
25
+ // {
26
+ // text: localization.partitionConfiguration,
27
+ // disabled: true,
28
+ // complete: false,
29
+ // },
30
+ ]
31
+ // TODO refactoring
32
+ if (mode === 'procurator') {
33
+ steps.push({
34
+ text: localization.partitionConfiguration,
35
+ disabled: true,
36
+ complete: false,
37
+ })
38
+ }
39
+ steps.push({
40
+ text: localization.readyComplete,
41
+ disabled: true,
42
+ complete: false,
43
+ })
44
+ return steps
45
+ }
46
+
47
+ const stepFromNfs = (
48
+ localization: UI_I_Localization,
49
+ mode: UI_T_WizardDatastoreMode
50
+ ): UI_I_VerticalStepItem[] => {
51
+ const steps = [
52
+ { text: localization.type, disabled: false, complete: false },
53
+ { text: localization.nfsVersion, disabled: true, complete: false },
54
+ {
55
+ text: localization.nameAndConfiguration,
56
+ disabled: true,
57
+ complete: false,
58
+ },
59
+ // {
60
+ // text: localization.kerberosAuthentication,
61
+ // disabled: true,
62
+ // complete: false,
63
+ // permissions: ['nfs-4.1'],
64
+ // },// TODO Пока что не будет чут попоже
65
+ // { text: localization.hostsAccessibility, disabled: true, complete: false }, // Он будет когда будем делать групповое
66
+ // { text: localization.readyComplete, disabled: true, complete: false },
67
+ ]
68
+
69
+ if (mode === 'sphere') {
70
+ steps.push({
71
+ text: localization.hostsAccessibility,
72
+ disabled: true,
73
+ complete: false,
74
+ })
75
+ }
76
+
77
+ steps.push({
78
+ text: localization.readyComplete,
79
+ disabled: true,
80
+ complete: false,
81
+ })
82
+
83
+ return steps
84
+
85
+ // console.log(position, 'position')
86
+
87
+ // nfsItems = nfsItems.filter((item) => {
88
+ // // return item.permissions
89
+ // // ? type !== null
90
+ // // ? item.permissions.includes(type)
91
+ // // : true
92
+ // // : false
93
+ // return item.permissions ? item.permissions.includes(type) : true
94
+ // })
95
+ // nfsItems.forEach((x, key) => {
96
+ // if (key <= position) {
97
+ // // console.log(key, 'key')
98
+ // x.complete = true
99
+ // x.disabled = false
100
+ // }
101
+ // })
102
+
103
+ // console.log(type, 'typeeeeee')
104
+ }
105
+
106
+ // const stemFromVvol = (localization: UI_I_Localization): UI_I_VerticalStepItem[] => {
107
+ // return [
108
+ // { text: localization.type, disabled: false, complete: false },
109
+ // {
110
+ // text: localization.nameAndContainerSelection,
111
+ // disabled: true,
112
+ // complete: false,
113
+ // },
114
+ // { text: localization.hostsAccessibility, disabled: true, complete: false },
115
+ // { text: localization.readyComplete, disabled: true, complete: false },
116
+ // ]
117
+ // }
118
+ const stemFromLocal = (
119
+ localization: UI_I_Localization,
120
+ mode: UI_T_WizardDatastoreMode
121
+ ): UI_I_VerticalStepItem[] => {
122
+ const isModeProcurator = mode === 'procurator'
123
+ return [
124
+ { text: localization.type, disabled: false, complete: false },
125
+ {
126
+ text: localization[
127
+ isModeProcurator ? 'selectDatastoreName' : 'nameAndDeviceSelection'
128
+ ],
129
+ disabled: true,
130
+ complete: false,
131
+ },
132
+ { text: localization.readyComplete, disabled: true, complete: false },
133
+ ]
134
+ }
135
+
136
+ export const stepItemsFunc = (
137
+ localization: UI_I_Localization,
138
+ type: UI_T_DatastoreType,
139
+ mode: UI_T_WizardDatastoreMode
140
+ ): UI_I_VerticalStepItem[] => {
141
+ const handlers = {
142
+ 'shared-storm': stepFromSharedStorm,
143
+ nfs: stepFromNfs,
144
+ local: stemFromLocal,
145
+ }
146
+
147
+ return handlers[type](localization, mode)
148
+ }
149
+
150
+ interface SubTitles {
151
+ 'shared-storm': string[]
152
+ nfs: string[]
153
+ local: string[]
154
+ }
155
+
156
+ export const subTitleFunc = (
157
+ localization: UI_I_Localization,
158
+ type: UI_T_DatastoreType,
159
+ position: number,
160
+ version?: UI_T_NfsType
161
+ ): string => {
162
+ position = position - 1
163
+
164
+ if (type === 'nfs' && version === 'nfs-3' && position === 2) {
165
+ position = position + 1
166
+ }
167
+
168
+ const description: string[] = [
169
+ localization.selectNfsVersion,
170
+ localization.nameAndConfigurationDesc,
171
+ // localization.kerberosAuthenticationDesc.replace(
172
+ // '{0}',
173
+ // version?.toUpperCase() || ''
174
+ // ),
175
+ // localization.hostsAccessibilityDesc,
176
+ ]
177
+
178
+ const sharedStormDesc: string[] = [
179
+ localization.nameAndDeviceSelectionDesc,
180
+ // localization.vmfsVersionDesc,
181
+ localization.partitionConfigurationDesc,
182
+ ]
183
+
184
+ const subTitles: SubTitles = {
185
+ nfs: description,
186
+ 'shared-storm': sharedStormDesc,
187
+ local: [],
188
+ }
189
+
190
+ return subTitles[type][position]
191
+ }
@@ -0,0 +1,202 @@
1
+ import { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import { UI_I_WizardStep } from '~/components/atoms/wizard/lib/models/interfaces'
3
+ import { UI_E_WIZARD_STATUS } from '~/components/atoms/wizard/lib/models/enums'
4
+
5
+ export const stepsFunc = (
6
+ localization: UI_I_Localization
7
+ ): UI_I_WizardStep[] => [
8
+ {
9
+ id: 0,
10
+ title: localization.type,
11
+ status: UI_E_WIZARD_STATUS.SELECTED,
12
+ fields: {},
13
+ isValid: true,
14
+ testId: 'select-datastore-type',
15
+ },
16
+
17
+ {
18
+ id: 1,
19
+ title: localization.selectDatastoreName,
20
+ status: UI_E_WIZARD_STATUS.INACTIVE,
21
+ fields: {
22
+ datastoreName: {
23
+ alert: '',
24
+ field: '',
25
+ },
26
+ },
27
+ isValid: true,
28
+ testId: 'select-datastore-name',
29
+ },
30
+ {
31
+ id: 2,
32
+ title: localization.nameAndDeviceSelection,
33
+ subTitle: localization.nameAndDeviceSelectionDesc,
34
+ status: UI_E_WIZARD_STATUS.INACTIVE,
35
+ fields: {},
36
+ isValid: true,
37
+ testId: 'select-name-and-device-selection',
38
+ },
39
+
40
+ {
41
+ id: 3,
42
+ title: localization.partitionConfiguration,
43
+ subTitle: localization.partitionConfigurationDesc,
44
+ status: UI_E_WIZARD_STATUS.INACTIVE,
45
+ fields: {},
46
+ isValid: true,
47
+ testId: 'select-partition-configuration',
48
+ },
49
+
50
+ {
51
+ id: 4,
52
+ title: localization.nfsVersion,
53
+ subTitle: localization.selectNfsVersion,
54
+ status: UI_E_WIZARD_STATUS.INACTIVE,
55
+ fields: {},
56
+ isValid: true,
57
+ testId: 'select-nfs-version',
58
+ },
59
+ {
60
+ id: 5,
61
+ title: localization.nameAndConfiguration,
62
+ subTitle: localization.nameAndConfigurationDesc,
63
+ status: UI_E_WIZARD_STATUS.INACTIVE,
64
+ fields: {},
65
+ isValid: true,
66
+ testId: 'select-name-and-configuration',
67
+ },
68
+
69
+ {
70
+ id: 6,
71
+ title: localization.hostsAccessibility,
72
+ subTitle: localization.hostsAccessibilityDesc,
73
+ status: UI_E_WIZARD_STATUS.INACTIVE,
74
+ fields: {},
75
+ isValid: true,
76
+ testId: 'select-hosts-accessibility',
77
+ },
78
+
79
+ // {
80
+ // id: 1,
81
+ // title: localization.selectTargetDevice,
82
+ // subTitle: localization.selectTargetDeviceForNewConnection,
83
+ // status: UI_E_WIZARD_STATUS.INACTIVE,
84
+ // fields: {
85
+ // [UI_E_ValidationFields.TARGET_DEVICE_STANDARD_SWITCH]: {
86
+ // alert: '',
87
+ // field: '',
88
+ // },
89
+ // [UI_E_ValidationFields.TARGET_DEVICE_NETWORK]: {
90
+ // alert: '',
91
+ // field: '',
92
+ // },
93
+ // [UI_E_ValidationFields.TARGET_DEVICE_SWITCH]: {
94
+ // alert: '',
95
+ // field: '',
96
+ // },
97
+ // [UI_E_ValidationFields.TARGET_DEVICE_MTU]: {
98
+ // alert: '',
99
+ // field: '',
100
+ // },
101
+ // },
102
+ // isValid: true,
103
+ // testId: 'select-target-device',
104
+ // },
105
+ // {
106
+ // id: 2,
107
+ // title: localization.createStandardSwitch,
108
+ // subTitle: localization.assignFreePhysicalNetworkAdaptersToTheNewSwitch,
109
+ // status: UI_E_WIZARD_STATUS.INACTIVE,
110
+ // fields: {},
111
+ // isValid: true,
112
+ // testId: 'create-standard-switch',
113
+ // },
114
+ // {
115
+ // id: 3,
116
+ // title: localization.portProperties,
117
+ // subTitle: localization.specifyVMkernelPortSettings,
118
+ // status: UI_E_WIZARD_STATUS.INACTIVE,
119
+ // fields: {
120
+ // [UI_E_ValidationFields.PORT_PROPERTIES_NETWORK]: {
121
+ // field: '',
122
+ // alert: '',
123
+ // },
124
+ // [UI_E_ValidationFields.PORT_PROPERTIES_VLAN]: {
125
+ // field: '',
126
+ // alert: '',
127
+ // },
128
+ // [UI_E_ValidationFields.PORT_PROPERTIES_MTU]: {
129
+ // field: '',
130
+ // alert: '',
131
+ // },
132
+ // },
133
+ // isValid: true,
134
+ // testId: 'port-properties',
135
+ // },
136
+ // {
137
+ // id: 4,
138
+ // title: localization.ipV4Settings,
139
+ // subTitle: localization.specifyVMkernelIPv4Settings,
140
+ // status: UI_E_WIZARD_STATUS.INACTIVE,
141
+ // fields: {
142
+ // [UI_E_ValidationFields.IPV_SETTINGS_IPV]: {
143
+ // field: '',
144
+ // alert: '',
145
+ // },
146
+ // [UI_E_ValidationFields.IPV_SETTINGS_MASK]: {
147
+ // field: '',
148
+ // alert: '',
149
+ // },
150
+ // [UI_E_ValidationFields.IPV_SETTINGS_GATEWAY]: {
151
+ // field: '',
152
+ // alert: '',
153
+ // },
154
+ // },
155
+ // isValid: true,
156
+ // testId: 'ipv4-settings',
157
+ // },
158
+ // {
159
+ // id: 5,
160
+ // title: localization.connectionSettings,
161
+ // subTitle:
162
+ // localization.useNetworkLabelsToIdentifyMigrationCompatibleTwoHosts,
163
+ // status: UI_E_WIZARD_STATUS.INACTIVE,
164
+ // fields: {
165
+ // [UI_E_ValidationFields.CONNECTION_SETTINGS_NETWORK]: {
166
+ // field: '',
167
+ // alert: '',
168
+ // },
169
+ // [UI_E_ValidationFields.CONNECTION_SETTINGS_VLAN]: {
170
+ // field: '',
171
+ // alert: '',
172
+ // },
173
+ // },
174
+ // isValid: true,
175
+ // testId: 'connection-settings',
176
+ // },
177
+ // {
178
+ // id: 6,
179
+ // title: localization.addPhysicalNetworkAdapter,
180
+ // subTitle: localization.assignPhysicalNetworkAdaptersToTheSwitch,
181
+ // status: UI_E_WIZARD_STATUS.INACTIVE,
182
+ // fields: {},
183
+ // isValid: true,
184
+ // testId: 'add-physical-network-adapter',
185
+ // },
186
+ {
187
+ id: 11,
188
+ title: localization.readyComplete,
189
+ subTitle: localization.readyCompleteDesc,
190
+ status: UI_E_WIZARD_STATUS.INACTIVE,
191
+ fields: {},
192
+ isValid: true,
193
+ testId: 'ready-complete',
194
+ },
195
+ ]
196
+
197
+ export const stepsSchemeInitial: number[][] = [
198
+ [0, 1, 11], // Procurator Scheme for "local" type
199
+ [0, 2, 3, 11], // Procurator Scheme for "shared-storm" type
200
+ [0, 4, 5, 11], // Procurator Scheme for "nfs" type
201
+ [0, 2, 11], // Sphere
202
+ ]
@@ -0,0 +1,38 @@
1
+ import { UI_T_NfsType } from '~/components/common/wizards/datastore/add/lib/models/types'
2
+
3
+ // TODO refactoring
4
+ export interface UI_I_NfsPoolNameForm<T = number> {
5
+ server: string
6
+ folder: string
7
+ version: T
8
+ readonly: boolean
9
+ hosts: string[]
10
+ }
11
+ export interface UI_I_CreateDatastoreBodyRequest {
12
+ name: string
13
+ pool_name: string
14
+ type_code: number
15
+ }
16
+ interface I_NfsForm extends UI_I_NfsPoolNameForm<UI_T_NfsType> {
17
+ name: string
18
+ type_code: number
19
+ }
20
+ interface I_SharedStorm extends UI_I_CreateDatastoreBodyRequest {
21
+ dev_names: string[]
22
+ hosts: string[]
23
+ }
24
+
25
+ export interface UI_I_CreateDatastoreForm {
26
+ local: {
27
+ name: string
28
+ hosts: string[]
29
+ type_code: number
30
+ }
31
+ sharedStorm: I_SharedStorm
32
+ nfs: I_NfsForm
33
+ }
34
+
35
+ export interface UI_I_CreateStorageUuid {
36
+ code: number
37
+ pool_name: string
38
+ }
@@ -0,0 +1,14 @@
1
+ export type UI_T_DatastoreType = 'local' | 'shared-storm' | 'nfs'
2
+ export type UI_T_NfsType = 'nfs-3' | 'nfs-4.1'
3
+ export type UI_T_VmfsType = 'vmfs-6' | 'vmfs-5'
4
+ export type UI_T_KerberosAuthentication =
5
+ | 'dont-use'
6
+ | 'use-only-krb5'
7
+ | 'use-integrity'
8
+
9
+ // export type UI_T_WizardDatastoreMode = 'procurator' | 'sphere'
10
+
11
+ // export interface UI_I_DatastoreValidityName {
12
+ // valid: boolean
13
+ // msg: any
14
+ // }
@@ -0,0 +1,72 @@
1
+ import { API_UI_I_Error } from '~/lib/models/store/interfaces'
2
+ import {
3
+ // UI_I_DatastoreValidityName,
4
+ UI_T_WizardDatastoreMode,
5
+ } from '~/components/common/wizards/datastoreNew/add/lib/models/types'
6
+ // import {
7
+ // UI_I_CreateDatastoreBodyRequest,
8
+ // I_CreateStorageUuid,
9
+ // } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
10
+
11
+ // type T_StoragePoolNameResult = {
12
+ // data: I_CreateStorageUuid
13
+ // msg: API_UI_I_Error
14
+ // }
15
+
16
+ // type T_NullableStoragePoolNameResult = {
17
+ // [K in keyof T_StoragePoolNameResult]: T_StoragePoolNameResult[K] | null
18
+ // }
19
+
20
+ export const checkValidityName = async (
21
+ name: string,
22
+ sendMessage: (message: string) => void,
23
+ mode: UI_T_WizardDatastoreMode = 'procurator'
24
+ ): Promise<void> => {
25
+ // TODO move to projects!!!
26
+
27
+ const kind = 10 // TODO move in global space
28
+ const url =
29
+ mode === 'procurator'
30
+ ? `/ui/ds/validate?name=${name}`
31
+ : `/ui/object/validate_name?name=${name}&kind=${kind}`
32
+ // @ts-ignore
33
+ const { error } = await useMyFetch<null, API_UI_I_Error>(url, {
34
+ method: 'GET',
35
+ })
36
+
37
+ if (error.value && error.value.data.error_code !== 0) {
38
+ const existError = error.value.data?.error_message || error.value.data
39
+ sendMessage(existError)
40
+ return
41
+ // return { valid: false, msg: existError }
42
+ }
43
+ sendMessage('')
44
+ // return { valid: true, msg: null }
45
+ }
46
+
47
+ // export const getStoragePoolName = async <T>(
48
+ // url: string,
49
+ // params: T
50
+ // ): Promise<T_NullableStoragePoolNameResult> => {
51
+ // const { data, error } = await useMyFetch<I_CreateStorageUuid, API_UI_I_Error>(
52
+ // url,
53
+ // {
54
+ // method: 'POST',
55
+ // body: params,
56
+ // }
57
+ // )
58
+ //
59
+ // if (error.value) return { data: null, msg: error.value }
60
+ //
61
+ // return { data: data.value, msg: null }
62
+ // }
63
+
64
+ // export const createDatastore = async <T = UI_I_CreateDatastoreBodyRequest>(
65
+ // params: T
66
+ // ): Promise<API_UI_I_Error> => {
67
+ // const { error } = await useMyFetch<any, API_UI_I_Error>('/api/v1/pn/ds', {
68
+ // method: 'POST',
69
+ // body: params,
70
+ // })
71
+ // return error.value
72
+ // }
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <div class="local-step">
3
+ <common-wizards-datastore-new-add-local-create-name
4
+ v-if="isShowCreateLocalNameBlock"
5
+ v-model="model.name"
6
+ :alert-messages="props.alertMessages"
7
+ :messages-fields="props.messagesFields"
8
+ @hide-alert="(e) => emits('hide-alert', e)"
9
+ />
10
+ </div>
11
+ </template>
12
+
13
+ <script lang="ts" setup>
14
+ import type { UI_T_Project } from '~/lib/models/types'
15
+ import type { UI_I_ArbitraryObject } from '~/lib/models/interfaces'
16
+ import type { UI_T_DatastoreType } from '~/components/common/wizards/datastore/add/lib/models/types'
17
+ import type { UI_I_ErrorFields } from '~/components/atoms/wizard/lib/models/interfaces'
18
+
19
+ const props = defineProps<{
20
+ project: UI_T_Project
21
+ stepId: number
22
+ datastoreType: UI_T_DatastoreType
23
+ alertMessages: string[]
24
+ messagesFields: UI_I_ArbitraryObject<UI_I_ErrorFields>
25
+ }>()
26
+ const model = defineModel<any>()
27
+ const emits = defineEmits<{
28
+ (event: 'hide-alert', value: number): void
29
+ }>()
30
+
31
+ const isShowCreateLocalNameBlock = computed<boolean>(
32
+ () => props.project === 'procurator' && props.stepId === 1
33
+ )
34
+ </script>
35
+
36
+ <style lang="scss" scoped>
37
+ .local-step {
38
+ display: flex;
39
+ flex-direction: column;
40
+ overflow-y: auto;
41
+ overflow-x: hidden;
42
+ height: 100%;
43
+ }
44
+ </style>
@@ -0,0 +1,129 @@
1
+ <template>
2
+ <div class="create-datastore-name">
3
+ <atoms-alert
4
+ v-show="props.alertMessages.length"
5
+ test-id="datastore-creat-name"
6
+ status="alert-danger"
7
+ :items="props.alertMessages"
8
+ @remove="onHideAlert"
9
+ />
10
+
11
+ <div class="clr-form-control clr-row">
12
+ <label for="datastore-name" class="clr-control-label clr-col-md-2">
13
+ {{ localization.datastoreName }}
14
+ </label>
15
+
16
+ <div class="clr-control-container" :class="nameErrorText && 'clr-error'">
17
+ <div class="flex-align-center">
18
+ <input
19
+ id="datastore-name"
20
+ v-model.trim="createDatastoreNameLocal"
21
+ data-id="datastore-name-input"
22
+ type="text"
23
+ class="clr-input"
24
+ @blur="initValidation(true)"
25
+ @input="initValidation(false)"
26
+ />
27
+ <atoms-the-icon class="error-icon" name="info-circle" />
28
+ </div>
29
+
30
+ <div class="clr-subtext ng-star-inserted">
31
+ {{ nameErrorText }}
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </template>
37
+
38
+ <script lang="ts" setup>
39
+ import type {
40
+ UI_I_Localization,
41
+ UI_I_ArbitraryObject,
42
+ } from '~/lib/models/interfaces'
43
+ import type { UI_I_ValidationTouchResult } from '~/lib/models/plugins/validation/interfaces'
44
+ import type { UI_I_ErrorFields } from '~/components/atoms/wizard/lib/models/interfaces'
45
+ import type { UI_I_FormValidationDataStore } from '~/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces'
46
+ import { defaultFormFunc } from '~/components/common/wizards/datastoreNew/add/local/createName/lib/config/defaultForm'
47
+
48
+ const props = defineProps<{
49
+ alertMessages: string[]
50
+ messagesFields: UI_I_ArbitraryObject<UI_I_ErrorFields>
51
+ }>()
52
+ const createDatastoreNameLocal = defineModel<string>()
53
+ const emits = defineEmits<{
54
+ (event: 'hide-alert', value: number): void
55
+ }>()
56
+
57
+ const localization = computed<UI_I_Localization>(() => useLocal())
58
+ const { $validation } = useNuxtApp()
59
+
60
+ const validation = $validation.call({})
61
+ const defaultForm: UI_I_FormValidationDataStore = defaultFormFunc(
62
+ localization.value
63
+ )
64
+ const form = ref<UI_I_FormValidationDataStore>(useDeepCopy(defaultForm))
65
+
66
+ const setForm = () => {
67
+ form.value = useDeepCopy(defaultForm)
68
+ validation.setForm(form)
69
+ }
70
+ setForm()
71
+
72
+ const validForm = ref<UI_I_ValidationTouchResult | null>(null)
73
+
74
+ /* Validation for Name input */
75
+ const isInitNameValidation = ref<boolean>(false)
76
+ const initValidation = (onlyBlur = false): void => {
77
+ validForm.value = validation.touch()
78
+ onlyBlur && (isInitNameValidation.value = true)
79
+ }
80
+ const nameErrorText = computed<string>(() => {
81
+ if (props.messagesFields.datastoreName.field) {
82
+ return props.messagesFields.datastoreName.field
83
+ }
84
+
85
+ if (!isInitNameValidation.value) return ''
86
+ return validForm.value?.errors?.name?.[0] || ''
87
+ })
88
+
89
+ const onHideAlert = (): void => {
90
+ emits('hide-alert', 1)
91
+ }
92
+ </script>
93
+
94
+ <style lang="scss" scoped>
95
+ .create-datastore-name {
96
+ &__alert-info {
97
+ :deep(.alert-text) {
98
+ font-size: 11px;
99
+ letter-spacing: normal;
100
+ }
101
+ }
102
+ .clr-form-control {
103
+ display: flex;
104
+ flex-direction: row;
105
+
106
+ .clr-control-container {
107
+ min-height: 48px;
108
+ input {
109
+ width: 375px;
110
+ }
111
+ &.clr-error {
112
+ .clr-subtext,
113
+ .error-icon {
114
+ display: block;
115
+ }
116
+ }
117
+ .clr-subtext,
118
+ .error-icon {
119
+ display: none;
120
+ }
121
+ .error-icon {
122
+ fill: #db2100;
123
+ width: 24px;
124
+ height: 24px;
125
+ }
126
+ }
127
+ }
128
+ }
129
+ </style>