bfg-common 1.4.46 → 1.4.47

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 (52) hide show
  1. package/components/common/wizards/datastore/add/nfs/accessibility/lib/models/interfaces.ts +4 -0
  2. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/config/selectOptions.ts +15 -6
  3. package/components/common/wizards/datastoreNew/add/Add.vue +464 -0
  4. package/components/common/wizards/datastoreNew/add/lib/config/steps.ts +135 -0
  5. package/components/common/wizards/datastoreNew/add/lib/models/enums.ts +5 -0
  6. package/components/common/wizards/datastoreNew/add/lib/models/interfaces.ts +12 -0
  7. package/components/common/wizards/datastoreNew/add/lib/models/types.ts +7 -0
  8. package/components/common/wizards/datastoreNew/add/lib/utils.ts +31 -0
  9. package/components/common/wizards/datastoreNew/add/local/Local.vue +44 -0
  10. package/components/common/wizards/datastoreNew/add/local/createName/CreateName.vue +116 -0
  11. package/components/common/wizards/datastoreNew/add/nfs/Nfs.vue +67 -0
  12. package/components/common/wizards/datastoreNew/add/nfs/accessibility/Accessibility.vue +63 -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 +85 -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/incompatibleTable.ts +68 -0
  19. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/tableKeys.ts +15 -0
  20. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/models/interfaces.ts +11 -0
  21. package/components/common/wizards/datastoreNew/add/nfs/configuration/Configuration.vue +301 -0
  22. package/components/common/wizards/datastoreNew/add/nfs/configuration/lib/models/interfaces.ts +5 -0
  23. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/DeletePopover.vue +100 -0
  24. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/ServersList.vue +124 -0
  25. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/config/serversListConfig.ts +41 -0
  26. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/config/tableKeys.ts +3 -0
  27. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/models/interfaces.ts +3 -0
  28. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/models/types.ts +1 -0
  29. package/components/common/wizards/datastoreNew/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +55 -0
  30. package/components/common/wizards/datastoreNew/add/nfs/kerberosAuthentication/lib/config/radioOptions.ts +27 -0
  31. package/components/common/wizards/datastoreNew/add/nfs/version/Version.vue +26 -0
  32. package/components/common/wizards/datastoreNew/add/nfs/version/lib/config/versionOptions.ts +22 -0
  33. package/components/common/wizards/datastoreNew/add/readyComplete/ReadyComplete.vue +88 -0
  34. package/components/common/wizards/datastoreNew/add/readyComplete/lib/config/propertiesDetails.ts +192 -0
  35. package/components/common/wizards/datastoreNew/add/sharedStorm/SharedStorm.vue +83 -0
  36. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/DeviceSelection.vue +262 -0
  37. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/config/selectOptions.ts +23 -0
  38. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces.ts +48 -0
  39. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/types.ts +8 -0
  40. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/Table.vue +134 -0
  41. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/lib/config/hostsTable.ts +87 -0
  42. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/lib/config/tableKeys.ts +11 -0
  43. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +236 -0
  44. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/graphicTooltip/graphicTooltip.vue +64 -0
  45. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/lib/config/selectOptions.ts +46 -0
  46. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/sizeGraphic/sizeGraphic.vue +225 -0
  47. package/components/common/wizards/datastoreNew/add/sharedStorm/version/Version.vue +39 -0
  48. package/components/common/wizards/datastoreNew/add/sharedStorm/version/lib/config/versionOptions.ts +21 -0
  49. package/components/common/wizards/datastoreNew/add/types/Types.vue +78 -0
  50. package/components/common/wizards/datastoreNew/add/types/lib/config/typeOptions.ts +49 -0
  51. package/lib/models/interfaces.ts +1 -0
  52. package/package.json +1 -1
@@ -0,0 +1,22 @@
1
+ import { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import { UI_I_RadioOption } from '~/components/common/select/radio/lib/models/interfaces'
3
+ export const nfsVersionFunc = (
4
+ localization: UI_I_Localization
5
+ ): UI_I_RadioOption[] => {
6
+ return [
7
+ {
8
+ label: 'NFS 3',
9
+ value: 'nfs-3',
10
+ disabled: false,
11
+ description: localization.nfsVersionDesc1,
12
+ testId: 'datastore-nfs-version-3',
13
+ },
14
+ {
15
+ label: 'NFS 4.1',
16
+ value: 'nfs-4.1',
17
+ disabled: false,
18
+ description: localization.nfsVersionDesc2,
19
+ testId: 'datastore-nfs-version-4.1',
20
+ },
21
+ ]
22
+ }
@@ -0,0 +1,88 @@
1
+ <template>
2
+ <div class="ready-complete">
3
+ <common-details-list :items="properties" class="ready-complete__list list">
4
+ <template #default="{ item }">
5
+ <common-details-item :has-children="true" open-by-default>
6
+ <template #stackBlockKey>
7
+ <span class="list__labels">
8
+ {{ localization.chosenDatastoreName }}
9
+ </span>
10
+ </template>
11
+
12
+ <template #stackChildren>
13
+ <template
14
+ v-for="(item2, key2) in item.items"
15
+ :key="`${item2}_${key2}`"
16
+ >
17
+ <common-details-item
18
+ :has-children="false"
19
+ :test-id="item2.testId"
20
+ class="list__default-style"
21
+ >
22
+ <template #stackBlockKey>
23
+ <div>
24
+ {{ item2.label }}
25
+ </div>
26
+ </template>
27
+ <template #stackBlockContent>
28
+ <div v-if="item2.data">
29
+ <div
30
+ v-for="item3 in item2.data"
31
+ :key="item3"
32
+ class="flex-align-center"
33
+ >
34
+ <div class="vsphere-icon-host"></div>
35
+ <span>{{ item3 }}</span>
36
+ </div>
37
+ </div>
38
+ <span v-else>
39
+ {{ item2.value }}
40
+ </span>
41
+ </template>
42
+ </common-details-item>
43
+ </template>
44
+ </template>
45
+ </common-details-item>
46
+ </template>
47
+ </common-details-list>
48
+ </div>
49
+ </template>
50
+
51
+ <script lang="ts" setup>
52
+ import { UI_I_DetailsItem } from '~/components/common/details/lib/models/interfaces'
53
+ import { UI_I_Localization } from '~/lib/models/interfaces'
54
+
55
+ const props = defineProps<{
56
+ dataReadyView: UI_I_DetailsItem[]
57
+ }>()
58
+
59
+ const localization = computed<UI_I_Localization>(() => useLocal())
60
+
61
+ const properties = computed<UI_I_DetailsItem[]>(() => props.dataReadyView)
62
+ </script>
63
+
64
+ <style lang="scss" scoped>
65
+ @import '~/assets/scss/common/mixins.scss';
66
+ .ready-complete {
67
+ &__list {
68
+ @include flex($dir: column);
69
+ padding: 12px 0;
70
+ row-gap: 15px;
71
+ }
72
+ }
73
+ .list {
74
+ &__labels {
75
+ @include text($fs: 13px, $fw: 700);
76
+ }
77
+ :deep(.list__default-style) {
78
+ .stack-block {
79
+ &__label {
80
+ align-items: flex-start;
81
+ }
82
+ &-content {
83
+ white-space: pre-line;
84
+ }
85
+ }
86
+ }
87
+ }
88
+ </style>
@@ -0,0 +1,192 @@
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import type { UI_I_DetailsItem } from '~/components/common/details/lib/models/interfaces'
3
+ import type { UI_T_Project } from '~/lib/models/types'
4
+ import type { UI_I_CreateStorageLunDiskItem } from '~/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces'
5
+ import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastoreNew/add/lib/models/interfaces'
6
+ import type { UI_I_CreateDatastoreHosts } from '~/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/models/interfaces'
7
+ const constructLunDiskItems = (
8
+ disks: UI_I_CreateStorageLunDiskItem[]
9
+ ): string => {
10
+ const { $binary } = useNuxtApp() as any
11
+
12
+ let result = ''
13
+ disks.forEach((disk: UI_I_CreateStorageLunDiskItem) => {
14
+ const capacity = $binary.round(disk.capacity_mb)
15
+ result += `${disk.name} - ${capacity} \n`
16
+ })
17
+ return result
18
+ }
19
+
20
+ const nfsDetailsFunc = (
21
+ localization: UI_I_Localization,
22
+ data: UI_I_CreateDatastoreForm,
23
+ project: UI_T_Project,
24
+ nfsHosts: UI_I_CreateDatastoreHosts
25
+ ): UI_I_DetailsItem[] => {
26
+ const { name, server, folder, nfsVersion, hosts } = data
27
+ // const accessMode = readonly ? 'Read-only' : 'Read-write'
28
+
29
+ const details: UI_I_DetailsItem[] = [
30
+ {
31
+ label: localization.vmfsVersion,
32
+ value: '',
33
+ items: [
34
+ {
35
+ label: localization.version,
36
+ value: nfsVersion.toUpperCase(),
37
+ items: [],
38
+ testId: 'view-selected-nfs-version-in-complete'
39
+ },
40
+ ],
41
+ actions: [],
42
+ },
43
+ {
44
+ label: localization.nameAndConfiguration,
45
+ value: '',
46
+ items: [
47
+ {
48
+ label: localization.datastoreName,
49
+ value: name,
50
+ items: [],
51
+ testId: 'view-storage-name-in-complete',
52
+ },
53
+ {
54
+ label: localization.common.server,
55
+ value: server,
56
+ items: [],
57
+ testId: 'view-server-name-in-complete',
58
+ },
59
+ {
60
+ label: localization.folder,
61
+ value: folder,
62
+ items: [],
63
+ testId: 'view-folder-name-in-complete'
64
+ },
65
+ // {
66
+ // label: localization.accessMode,
67
+ // value: accessMode,
68
+ // items: [],
69
+ // },
70
+ ],
71
+ actions: [],
72
+ },
73
+ ]
74
+
75
+ if (project === 'sphere') {
76
+ const hostsNames = nfsHosts
77
+ ? nfsHosts.items
78
+ .filter((host) => data.hosts.includes(host.id))
79
+ .map((host) => host.host)
80
+ : []
81
+ details.push({
82
+ label: localization.hostsAccessibility,
83
+ value: '',
84
+ items: [
85
+ {
86
+ label: localization.hosts,
87
+ value: '',
88
+ data: hostsNames,
89
+ items: [],
90
+ testId: ''
91
+ },
92
+ ],
93
+ actions: [],
94
+ })
95
+ }
96
+
97
+ return details
98
+ }
99
+
100
+ const localDetailsFunc = (
101
+ localization: UI_I_Localization,
102
+ data: UI_I_CreateDatastoreForm
103
+ ): UI_I_DetailsItem[] => {
104
+ const { name } = data
105
+
106
+ return [
107
+ {
108
+ label: localization.selectName,
109
+ value: '',
110
+ items: [
111
+ {
112
+ label: localization.datastoreName,
113
+ value: name,
114
+ items: [],
115
+ testId: 'view-storage-name-in-complete'
116
+ },
117
+ ],
118
+ actions: [],
119
+ },
120
+ ]
121
+ }
122
+
123
+ const sharedStormDetailsFunc = (
124
+ localization: UI_I_Localization,
125
+ data: UI_I_CreateDatastoreForm
126
+ ): UI_I_DetailsItem[] => {
127
+ const { name, lunDisk } = data
128
+
129
+ return [
130
+ {
131
+ label: localization.nameAndDeviceSelection,
132
+ value: '',
133
+ items: [
134
+ {
135
+ label: localization.datastoreName,
136
+ value: name,
137
+ items: [],
138
+ testId: 'view-storage-name-in-complete',
139
+ },
140
+ {
141
+ label: localization.diskLun,
142
+ value: constructLunDiskItems(lunDisk),
143
+ items: [],
144
+ testId: 'view-selected-lun-disks-in-complete',
145
+ },
146
+ ],
147
+ actions: [],
148
+ },
149
+ // {
150
+ // label: localization.partitionConfiguration,
151
+ // value: '',
152
+ // items: [
153
+ // {
154
+ // label: localization.method,
155
+ // value: 'None',
156
+ // items: [],
157
+ // },
158
+ // {
159
+ // label: localization.partitionFormat,
160
+ // value: 'None',
161
+ // items: [],
162
+ // },
163
+ // {
164
+ // label: localization.blockSize,
165
+ // value: 'None',
166
+ // items: [],
167
+ // },
168
+ // {
169
+ // label: localization.spaceReclamationGranularity,
170
+ // value: 'None',
171
+ // items: [],
172
+ // },
173
+ // ],
174
+ // actions: [],
175
+ // }, /* TODO данные с нее пока никуда не вставляем */
176
+ ]
177
+ }
178
+
179
+ export const constructDataReadyViewFunc = (
180
+ localization: UI_I_Localization,
181
+ data: UI_I_CreateDatastoreForm,
182
+ project: UI_T_Project,
183
+ nfsHosts: UI_I_CreateDatastoreHosts
184
+ ): UI_I_DetailsItem[] => {
185
+ const details = {
186
+ 1: localDetailsFunc,
187
+ 2: sharedStormDetailsFunc,
188
+ 4: nfsDetailsFunc,
189
+ }
190
+
191
+ return details[data.type_code](localization, data, project, nfsHosts)
192
+ }
@@ -0,0 +1,83 @@
1
+ <template>
2
+ <div class="shared-storm-container">
3
+ <common-wizards-datastore-new-add-shared-storm-device-selection
4
+ v-show="props.stepId === 2"
5
+ v-model="model"
6
+ :step-id="props.stepId"
7
+ :alert-messages="props.alertMessages"
8
+ :messages-fields="props.messagesFields"
9
+ :datastore-type="props.datastoreType"
10
+ :project="props.project"
11
+ :hosts="props.hosts"
12
+ :is-main-filter="props.isMainFilter"
13
+ :host-id="props.hostId"
14
+ @hide-alert="(e) => emits('hide-alert', e)"
15
+ @main-filter="emits('main-filter', $event)"
16
+ />
17
+
18
+ <!-- <templates-home-datastore-actions-add-vmfs-version-->
19
+ <!-- v-show="props.stepPosition === 2"-->
20
+ <!-- v-models:version="vmfsVersion"-->
21
+ <!-- />-->
22
+ <!-- TODO в shared-storm пока верси не будет -->
23
+
24
+ <common-wizards-datastore-add-shared-storm-partition-configuration
25
+ v-show="props.project === 'procurator' && props.stepId === 3"
26
+ :vmfs-version="vmfsVersion"
27
+ :selected-lun-disk-size="lunDiskTotalCapacity"
28
+ />
29
+ </div>
30
+ </template>
31
+
32
+ <script lang="ts" setup>
33
+ import {
34
+ UI_I_Localization,
35
+ UI_I_ArbitraryObject,
36
+ } from '~/lib/models/interfaces'
37
+ import { UI_T_Project } from '~/lib/models/types'
38
+ import type { UI_I_ErrorFields } from '~/components/atoms/wizard/lib/models/interfaces'
39
+ import {
40
+ UI_T_DatastoreType,
41
+ UI_T_VmfsType,
42
+ } from '~/components/common/wizards/datastore/add/lib/models/types'
43
+ import type { UI_I_CreateStorageLunDiskItem } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
44
+ import type { UI_I_CreateDatastoreHosts } from '~/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/models/interfaces'
45
+
46
+ const props = defineProps<{
47
+ project: UI_T_Project
48
+ stepId: number
49
+ datastoreType: UI_T_DatastoreType
50
+ alertMessages: string[]
51
+ messagesFields: UI_I_ArbitraryObject<UI_I_ErrorFields>
52
+ hosts?: UI_I_CreateDatastoreHosts
53
+ isMainFilter?: boolean
54
+ hostId?: string
55
+ }>()
56
+ const model = defineModel<any>()
57
+ const emits = defineEmits<{
58
+ (event: 'hide-alert', value: boolean): void
59
+ (event: 'main-filter', value: string): void
60
+ }>()
61
+
62
+ const localization = computed<UI_I_Localization>(() => useLocal())
63
+
64
+ const vmfsVersion = ref<UI_T_VmfsType>('vmfs-6')
65
+
66
+ const lunDiskTotalCapacity = computed<number>(() => {
67
+ if (!model.value.lunDisk.length) return 0
68
+
69
+ return +model.value.lunDisk
70
+ .map((disk: UI_I_CreateStorageLunDiskItem) => disk.capacity_mb)
71
+ .reduce((acc, cur) => acc + cur)
72
+ })
73
+ </script>
74
+
75
+ <style lang="scss" scoped>
76
+ .shared-storm-container {
77
+ display: flex;
78
+ flex-direction: column;
79
+ overflow-y: auto;
80
+ overflow-x: hidden;
81
+ height: inherit;
82
+ }
83
+ </style>
@@ -0,0 +1,262 @@
1
+ <template>
2
+ <div class="device-selection-step">
3
+ <atoms-alert
4
+ v-show="props.alertMessages?.length"
5
+ test-id="device-selection-alert-error"
6
+ status="alert-danger"
7
+ :items="props.alertMessages"
8
+ @remove="onHideAlert"
9
+ />
10
+
11
+ <div class="clr-form-control clr-row">
12
+ <label for="" class="clr-control-label clr-col-md-2">
13
+ {{ localization.common.name }}
14
+ </label>
15
+
16
+ <div class="clr-control-container" :class="nameErrorText && 'clr-error'">
17
+ <div class="flex-align-center">
18
+ <input
19
+ id="device-selection-input"
20
+ v-model="model.name"
21
+ data-id="device-selection-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" data-id="storm-datastore-name-field-require">
31
+ {{ nameErrorText }}
32
+ </div>
33
+ </div>
34
+ </div>
35
+
36
+ <atoms-alert
37
+ v-show="alertInfo"
38
+ test-id="device-selection-information-alert"
39
+ class="device-selection-step__alert-info"
40
+ status="alert-info"
41
+ :items="[localization.common.nameAndDeviceSelectionAlertInfo]"
42
+ @remove="onHideAlertInfo"
43
+ />
44
+
45
+ <div
46
+ v-if="props.project === 'sphere' && !props.hostId"
47
+ class="clr-form-control clr-row"
48
+ >
49
+ <label class="clr-control-label clr-col-12 clr-col-md-2">
50
+ {{ localization.common.selectHost }}
51
+ </label>
52
+
53
+ <div>
54
+ <div class="clr-select-wrapper">
55
+ <select
56
+ id="device-host-select"
57
+ v-model="model.hosts"
58
+ data-id="device-host-select"
59
+ class="dropdown-toggle"
60
+ @change="onSelectHost"
61
+ >
62
+ <option
63
+ v-for="(item, index) in hostOptions"
64
+ :key="index"
65
+ :value="[item.value]"
66
+ :disabled="item.disabled"
67
+ >
68
+ {{ item.text }}
69
+ </option>
70
+ </select>
71
+ </div>
72
+ <div class="clr-subtext">
73
+ {{ localization.common.selectHostToViewAccessible }}
74
+ </div>
75
+ </div>
76
+ </div>
77
+
78
+ <div class="device-selection-step__disk-list">
79
+ <common-wizards-datastore-new-add-shared-storm-device-selection-table
80
+ v-model="model.lunDisk"
81
+ :data-table="dataTable?.items || []"
82
+ :total-items="dataTable?.total_items || 0"
83
+ :total-pages="dataTable?.total_pages || 1"
84
+ :pagination="pagination"
85
+ :loading="loading"
86
+ :is-main-filter="props.isMainFilter"
87
+ @pagination="updatePagination"
88
+ @sort="sortTable"
89
+ @main-filter="emits('main-filter', $event)"
90
+ />
91
+ </div>
92
+ </div>
93
+ </template>
94
+
95
+ <script lang="ts" setup>
96
+ import type { UI_T_Project } from '~/lib/models/types'
97
+ import type {
98
+ UI_I_Localization,
99
+ UI_I_ArbitraryObject,
100
+ } from '~/lib/models/interfaces'
101
+ import {
102
+ API_UI_I_DataTable,
103
+ UI_I_Pagination,
104
+ UI_I_DataTableQuery,
105
+ } from '~/lib/models/table/interfaces'
106
+ import type {
107
+ UI_I_CreateStorageLunDiskItem,
108
+ UI_I_LunDiskSpherePayload,
109
+ UI_I_SelectHostOptions,
110
+ } from '~/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces'
111
+ import type { UI_I_ErrorFields } from '~/components/atoms/wizard/lib/models/interfaces'
112
+ import type { UI_I_CreateDatastoreHosts } from '~/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/models/interfaces'
113
+ import { UI_T_DatastoreType } from '~/components/common/wizards/datastoreNew/add/lib/models/types'
114
+ import { hostsOptionsFunc } from '~/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/config/selectOptions'
115
+
116
+ const props = defineProps<{
117
+ project: UI_T_Project
118
+ stepId: number
119
+ alertMessages: string[]
120
+ messagesFields: UI_I_ArbitraryObject<UI_I_ErrorFields>
121
+ datastoreType: UI_T_DatastoreType
122
+ hosts?: UI_I_CreateDatastoreHosts | undefined
123
+ isMainFilter?: boolean
124
+ hostId?: string
125
+ }>()
126
+ const model = defineModel<any>()
127
+ const emits = defineEmits<{
128
+ (event: 'hide-alert', value: number): void
129
+ (event: 'main-filter', value: string): void
130
+ }>()
131
+
132
+ const localization = computed<UI_I_Localization>(() => useLocal())
133
+ const { $store } = useNuxtApp()
134
+
135
+ const isInitDatastoreNameValidation = ref<boolean>(false)
136
+ const initValidation = (onlyBlur: boolean): void => {
137
+ onlyBlur && (isInitDatastoreNameValidation.value = true)
138
+ }
139
+
140
+ const nameErrorText = computed<string>(() => {
141
+ if (props.messagesFields?.datastoreName?.field && !model.value.name) {
142
+ return props.messagesFields.datastoreName.field
143
+ }
144
+
145
+ if (!isInitDatastoreNameValidation.value) return ''
146
+ return !model.value.name ? localization.value.common.specifyDatastoreName : ''
147
+ })
148
+
149
+ const alertInfo = ref<boolean>(true)
150
+ const onHideAlertInfo = (): void => {
151
+ alertInfo.value = false
152
+ }
153
+
154
+ /* Lun disk table */
155
+
156
+ const pagination = ref<UI_I_Pagination>({
157
+ page: 1,
158
+ pageSize: 35,
159
+ })
160
+ const sort = ref<string | null>(null)
161
+
162
+ const updatePagination = (event: UI_I_Pagination): void => {
163
+ pagination.value = event
164
+ }
165
+ const sortTable = (event: string): void => {
166
+ sort.value = event
167
+ initLunDisksDataTable()
168
+ }
169
+
170
+ const loading = computed<boolean>(() =>
171
+ $store.getters['storage/getLoading']('datastoreHosts')
172
+ )
173
+ const dataTable = computed<API_UI_I_DataTable<
174
+ UI_I_CreateStorageLunDiskItem[]
175
+ > | null>(() => {
176
+ return $store.getters['storage/getNewDatastoreHosts']
177
+ })
178
+
179
+ /* Select host */
180
+ const hostOptions = computed<UI_I_SelectHostOptions[]>(() =>
181
+ hostsOptionsFunc(localization.value, props.hosts?.items)
182
+ )
183
+
184
+ const onSelectHost = (): void => {
185
+ if (props.datastoreType !== 'shared-storm') return // TODO рефакторинг ( удалить проверку )
186
+
187
+ initLunDisksForSphere(model.value.hosts[0])
188
+ }
189
+
190
+ const initLunDisksForSphere = async (host: string): Promise<void> => {
191
+ await $store.dispatch('storage/A_GET_DISKS_LIST', {
192
+ host,
193
+ ...pagination.value,
194
+ sortBy: sort.value,
195
+ } as UI_I_LunDiskSpherePayload)
196
+ }
197
+ if (props.hostId) {
198
+ initLunDisksForSphere(props.hostId)
199
+ }
200
+ const initLunDisksDataTable = async (): Promise<void> => {
201
+ await $store.dispatch('storage/A_GET_LUN_DISK_LIST', {
202
+ ...pagination.value,
203
+ sortBy: sort.value,
204
+ } as UI_I_DataTableQuery)
205
+ }
206
+
207
+ if (props.project === 'procurator') {
208
+ // && props.stepId === 2
209
+ initLunDisksDataTable()
210
+ }
211
+
212
+ const onHideAlert = (): void => {
213
+ emits('hide-alert', props.stepId)
214
+ }
215
+ </script>
216
+
217
+ <style lang="scss" scoped>
218
+ .device-selection-step {
219
+ display: flex;
220
+ flex-direction: column;
221
+ height: inherit;
222
+ overflow-y: auto;
223
+ overflow-x: hidden;
224
+ &__alert-info {
225
+ :deep(.alert-text) {
226
+ font-size: 11px;
227
+ letter-spacing: normal;
228
+ }
229
+ }
230
+ .dropdown-toggle {
231
+ min-width: 160px;
232
+ }
233
+ .clr-form-control {
234
+ display: flex;
235
+ flex-direction: row;
236
+
237
+ .clr-control-container {
238
+ min-height: 48px;
239
+ &.clr-error {
240
+ .clr-subtext,
241
+ .error-icon {
242
+ display: block;
243
+ }
244
+ }
245
+ .clr-subtext,
246
+ .error-icon {
247
+ display: none;
248
+ }
249
+ .error-icon {
250
+ fill: #db2100;
251
+ width: 24px;
252
+ height: 24px;
253
+ }
254
+ }
255
+ }
256
+ &__disk-list {
257
+ display: flex;
258
+ flex-direction: column;
259
+ height: 100%;
260
+ }
261
+ }
262
+ </style>
@@ -0,0 +1,23 @@
1
+ import { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import { UI_I_SelectHostOptions } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
3
+
4
+ const constructHostListFunc = (
5
+ data: { host: string; id: string }[]
6
+ ): UI_I_SelectHostOptions[] => {
7
+ return data.map((item) => ({
8
+ text: item.host,
9
+ value: item.id,
10
+ disabled: false,
11
+ }))
12
+ }
13
+
14
+ export const hostsOptionsFunc = (
15
+ localization: UI_I_Localization,
16
+ hosts: { host: string; id: string }[] | undefined
17
+ ): UI_I_SelectHostOptions[] => {
18
+ if (!hosts) return []
19
+
20
+ const data = constructHostListFunc(hosts)
21
+
22
+ return [{ text: localization.common.selectHost, value: '', disabled: true }, ...data]
23
+ }