bfg-common 1.3.391 → 1.3.392

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 (89) hide show
  1. package/assets/img/icons/icons-sprite-dark-1.svg +1 -360
  2. package/assets/img/icons/icons-sprite-dark-2.svg +1 -296
  3. package/assets/img/icons/icons-sprite-dark-3.svg +1 -221
  4. package/assets/img/icons/icons-sprite-dark-4.svg +1 -247
  5. package/assets/img/icons/icons-sprite-light-1.svg +1 -360
  6. package/assets/img/icons/icons-sprite-light-2.svg +1 -296
  7. package/assets/img/icons/icons-sprite-light-3.svg +1 -221
  8. package/assets/img/icons/icons-sprite-light-4.svg +1 -247
  9. package/assets/localization/local_be.json +5 -1
  10. package/assets/localization/local_en.json +5 -1
  11. package/assets/localization/local_hy.json +5 -1
  12. package/assets/localization/local_kk.json +5 -1
  13. package/assets/localization/local_ru.json +5 -1
  14. package/assets/localization/local_zh.json +5 -1
  15. package/assets/scss/common/icons/icons.scss +0 -1
  16. package/components/atoms/loader/Loader.vue +30 -30
  17. package/components/atoms/loader/PreLoader.vue +38 -38
  18. package/components/atoms/switch/Switch.vue +111 -111
  19. package/components/atoms/table/compact/Compact.vue +526 -526
  20. package/components/common/adapterManager/ui/table/Header.vue +93 -93
  21. package/components/common/adapterManager/ui/table/Table.vue +162 -162
  22. package/components/common/context/Context.vue +99 -99
  23. package/components/common/lib/config/states.ts +126 -126
  24. package/components/common/pages/hardwareHealth/tableView/TableView.vue +1 -42
  25. package/components/common/pages/hardwareHealth/tableView/lib/config/alertWarningTable.ts +8 -15
  26. package/components/common/pages/hardwareHealth/tableView/lib/config/sensorTable.ts +1 -1
  27. package/components/common/resource/progressBlock/ProgressBlock.vue +142 -142
  28. package/components/common/split/horizontal/Horizontal.vue +49 -307
  29. package/components/common/split/horizontal/HorizontalOld.vue +307 -0
  30. package/components/common/vm/actions/add/Add.vue +602 -602
  31. package/components/common/vm/actions/clone/Clone.vue +518 -518
  32. package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +273 -273
  33. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +697 -697
  34. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue +256 -256
  35. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +458 -458
  36. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +304 -304
  37. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +167 -167
  38. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +82 -82
  39. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +32 -32
  40. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +182 -182
  41. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptions.vue +114 -114
  42. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +188 -188
  43. package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/Tools.vue +72 -72
  44. package/components/common/vm/actions/common/select/computeResource/ComputeResource.vue +164 -164
  45. package/components/common/vm/actions/common/select/name/Name.vue +235 -235
  46. package/components/common/vm/actions/common/select/storage/Storage.vue +198 -198
  47. package/components/common/vm/actions/editSettings/EditSettings.vue +316 -316
  48. package/components/common/weekSelect/lib/config/options.ts +10 -10
  49. package/components/common/wizards/datastore/add/Add.vue +436 -436
  50. package/components/common/wizards/datastore/add/lib/config/stepItems.ts +191 -191
  51. package/components/common/wizards/datastore/add/lib/models/interfaces.ts +38 -38
  52. package/components/common/wizards/datastore/add/lib/utils.ts +70 -70
  53. package/components/common/wizards/datastore/add/local/createName/CreateName.vue +160 -160
  54. package/components/common/wizards/datastore/add/nfs/Nfs.vue +112 -112
  55. package/components/common/wizards/datastore/add/nfs/accessibility/Accessibility.vue +104 -104
  56. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/compatibleTable.ts +62 -62
  57. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/hostsTableItems.ts +53 -53
  58. package/components/common/wizards/datastore/add/readyComplete/ReadyComplete.vue +86 -86
  59. package/components/common/wizards/datastore/add/readyComplete/lib/config/propertiesDetails.ts +184 -184
  60. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/DeviceSelection.vue +459 -459
  61. package/components/common/wizards/datastore/add/types/Types.vue +80 -80
  62. package/components/common/wizards/datastore/add/types/lib/config/typeOptions.ts +49 -49
  63. package/composables/useAppVersion.ts +21 -21
  64. package/composables/useEnvLanguage.ts +20 -20
  65. package/lib/utils/sendTask.ts +72 -72
  66. package/minify.js +146 -146
  67. package/package.json +1 -1
  68. package/plugins/spice-console/spice.console.ts +147 -147
  69. package/public/spice-console/application/codec.js +263 -263
  70. package/public/spice-console/lib/rasterEngine.js +907 -907
  71. package/public/spice-console/network/spicechannel.js +375 -375
  72. package/store/main/lib/interfaces.ts +9 -9
  73. package/store/tasks/actions.ts +133 -133
  74. package/store/tasks/getters.ts +25 -25
  75. package/store/tasks/lib/models/interfaces.ts +18 -18
  76. package/store/tasks/mutations.ts +58 -58
  77. package/store/tasks/state.ts +16 -16
  78. package/assets/img/icons/icons-sprite-dark-1-old.svg +0 -1
  79. package/assets/img/icons/icons-sprite-dark-2-old.svg +0 -1
  80. package/assets/img/icons/icons-sprite-dark-3-old.svg +0 -1
  81. package/assets/img/icons/icons-sprite-dark-4-old.svg +0 -1
  82. package/assets/img/icons/icons-sprite-dark-7.svg +0 -8
  83. package/assets/img/icons/icons-sprite-light-1-old.svg +0 -1
  84. package/assets/img/icons/icons-sprite-light-2-old.svg +0 -1
  85. package/assets/img/icons/icons-sprite-light-3-old.svg +0 -1
  86. package/assets/img/icons/icons-sprite-light-4-old.svg +0 -1
  87. package/assets/img/icons/icons-sprite-light-7.svg +0 -8
  88. package/assets/scss/common/icons/icons-7.scss +0 -29
  89. package/components/common/pages/hardwareHealth/tableView/modal/sensorWarning.vue +0 -63
@@ -1,191 +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
- }
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
+ }
@@ -1,38 +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
- }
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
+ }
@@ -1,70 +1,70 @@
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/datastore/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
- mode: UI_T_WizardDatastoreMode = 'procurator'
23
- ): Promise<UI_I_DatastoreValidityName> => {
24
- // TODO move to projects!!!
25
-
26
- const kind = 10 // TODO move in global space
27
- const url =
28
- mode === 'procurator'
29
- ? `/ui/ds/validate?name=${name}`
30
- : `/ui/object/validate_name?name=${name}&kind=${kind}`
31
- // @ts-ignore
32
- const { error } = await useMyFetch<null, API_UI_I_Error>(url, {
33
- method: 'GET',
34
- })
35
-
36
- if (error.value && error.value.data.error_code !== 0) {
37
- const existError = error.value.data?.error_message || error.value.data
38
-
39
- return { valid: false, msg: existError }
40
- }
41
-
42
- return { valid: true, msg: null }
43
- }
44
-
45
- // export const getStoragePoolName = async <T>(
46
- // url: string,
47
- // params: T
48
- // ): Promise<T_NullableStoragePoolNameResult> => {
49
- // const { data, error } = await useMyFetch<I_CreateStorageUuid, API_UI_I_Error>(
50
- // url,
51
- // {
52
- // method: 'POST',
53
- // body: params,
54
- // }
55
- // )
56
- //
57
- // if (error.value) return { data: null, msg: error.value }
58
- //
59
- // return { data: data.value, msg: null }
60
- // }
61
-
62
- // export const createDatastore = async <T = UI_I_CreateDatastoreBodyRequest>(
63
- // params: T
64
- // ): Promise<API_UI_I_Error> => {
65
- // const { error } = await useMyFetch<any, API_UI_I_Error>('/api/v1/pn/ds', {
66
- // method: 'POST',
67
- // body: params,
68
- // })
69
- // return error.value
70
- // }
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/datastore/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
+ mode: UI_T_WizardDatastoreMode = 'procurator'
23
+ ): Promise<UI_I_DatastoreValidityName> => {
24
+ // TODO move to projects!!!
25
+
26
+ const kind = 10 // TODO move in global space
27
+ const url =
28
+ mode === 'procurator'
29
+ ? `/ui/ds/validate?name=${name}`
30
+ : `/ui/object/validate_name?name=${name}&kind=${kind}`
31
+ // @ts-ignore
32
+ const { error } = await useMyFetch<null, API_UI_I_Error>(url, {
33
+ method: 'GET',
34
+ })
35
+
36
+ if (error.value && error.value.data.error_code !== 0) {
37
+ const existError = error.value.data?.error_message || error.value.data
38
+
39
+ return { valid: false, msg: existError }
40
+ }
41
+
42
+ return { valid: true, msg: null }
43
+ }
44
+
45
+ // export const getStoragePoolName = async <T>(
46
+ // url: string,
47
+ // params: T
48
+ // ): Promise<T_NullableStoragePoolNameResult> => {
49
+ // const { data, error } = await useMyFetch<I_CreateStorageUuid, API_UI_I_Error>(
50
+ // url,
51
+ // {
52
+ // method: 'POST',
53
+ // body: params,
54
+ // }
55
+ // )
56
+ //
57
+ // if (error.value) return { data: null, msg: error.value }
58
+ //
59
+ // return { data: data.value, msg: null }
60
+ // }
61
+
62
+ // export const createDatastore = async <T = UI_I_CreateDatastoreBodyRequest>(
63
+ // params: T
64
+ // ): Promise<API_UI_I_Error> => {
65
+ // const { error } = await useMyFetch<any, API_UI_I_Error>('/api/v1/pn/ds', {
66
+ // method: 'POST',
67
+ // body: params,
68
+ // })
69
+ // return error.value
70
+ // }