bfg-common 1.3.328 → 1.3.329

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.
@@ -105,7 +105,7 @@ const emits = defineEmits<{
105
105
  const localization = computed<UI_I_Localization>(() => useLocal())
106
106
 
107
107
  const loading = ref<boolean>(false)
108
- const datastoreType = ref<UI_T_DatastoreType>('local')
108
+ const datastoreType = ref<UI_T_DatastoreType>(props.mode === 'procurator' ? 'local' : 'shared-storm')
109
109
  const nfsVersion = ref<UI_T_NfsType>('nfs-3')
110
110
 
111
111
  const stepPosition = ref<number>(0)
@@ -1,67 +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
-
25
- // @ts-ignore
26
- const { error } = await useMyFetch<null, API_UI_I_Error>(
27
- `/ui/ds/validate?name=${name}`,
28
- {
29
- method: 'GET',
30
- }
31
- )
32
-
33
- if (error.value && error.value.data.error_code !== 0) {
34
- const existError = error.value.data?.error_message || error.value.data
35
-
36
- return { valid: false, msg: existError }
37
- }
38
-
39
- return { valid: true, msg: null }
40
- }
41
-
42
- // export const getStoragePoolName = async <T>(
43
- // url: string,
44
- // params: T
45
- // ): Promise<T_NullableStoragePoolNameResult> => {
46
- // const { data, error } = await useMyFetch<I_CreateStorageUuid, API_UI_I_Error>(
47
- // url,
48
- // {
49
- // method: 'POST',
50
- // body: params,
51
- // }
52
- // )
53
- //
54
- // if (error.value) return { data: null, msg: error.value }
55
- //
56
- // return { data: data.value, msg: null }
57
- // }
58
-
59
- // export const createDatastore = async <T = UI_I_CreateDatastoreBodyRequest>(
60
- // params: T
61
- // ): Promise<API_UI_I_Error> => {
62
- // const { error } = await useMyFetch<any, API_UI_I_Error>('/api/v1/pn/ds', {
63
- // method: 'POST',
64
- // body: params,
65
- // })
66
- // return error.value
67
- // }
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
+ // }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.3.328",
4
+ "version": "1.3.329",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",