bfg-common 1.3.496 → 1.3.498
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.
- package/components/common/vm/actions/editSettings/EditSettings.vue +16 -16
- package/components/common/wizards/datastoreNew/add/Add.vue +487 -0
- package/components/common/wizards/datastoreNew/add/lib/config/steps.ts +135 -0
- package/components/common/wizards/datastoreNew/add/lib/models/enums.ts +5 -0
- package/components/common/wizards/datastoreNew/add/lib/models/interfaces.ts +12 -0
- package/components/common/wizards/datastoreNew/add/lib/models/types.ts +7 -0
- package/components/common/wizards/datastoreNew/add/lib/utils.ts +31 -0
- package/components/common/wizards/datastoreNew/add/local/Local.vue +44 -0
- package/components/common/wizards/datastoreNew/add/local/createName/CreateName.vue +116 -0
- package/components/common/wizards/datastoreNew/add/nfs/Nfs.vue +67 -0
- package/components/common/wizards/datastoreNew/add/nfs/accessibility/Accessibility.vue +80 -0
- package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/config/tabsPannel.ts +24 -0
- package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/models/interfaces.ts +9 -0
- package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/models/types.ts +5 -0
- package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/TablesView.vue +117 -0
- package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/compatibleTable.ts +62 -0
- package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/incompatibleTable.ts +68 -0
- package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/tableKeys.ts +15 -0
- package/components/common/wizards/datastoreNew/add/nfs/configuration/Configuration.vue +293 -0
- package/components/common/wizards/datastoreNew/add/nfs/configuration/lib/models/interfaces.ts +5 -0
- package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/DeletePopover.vue +100 -0
- package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/ServersList.vue +124 -0
- package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/config/serversListConfig.ts +41 -0
- package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/config/tableKeys.ts +3 -0
- package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/models/interfaces.ts +3 -0
- package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/models/types.ts +1 -0
- package/components/common/wizards/datastoreNew/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +55 -0
- package/components/common/wizards/datastoreNew/add/nfs/kerberosAuthentication/lib/config/radioOptions.ts +27 -0
- package/components/common/wizards/datastoreNew/add/nfs/version/Version.vue +26 -0
- package/components/common/wizards/datastoreNew/add/nfs/version/lib/config/versionOptions.ts +20 -0
- package/components/common/wizards/datastoreNew/add/readyComplete/ReadyComplete.vue +88 -0
- package/components/common/wizards/datastoreNew/add/readyComplete/lib/config/propertiesDetails.ts +183 -0
- package/components/common/wizards/datastoreNew/add/sharedStorm/SharedStorm.vue +85 -0
- package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/DeviceSelection.vue +350 -0
- package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/config/selectOptions.ts +14 -0
- package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces.ts +53 -0
- package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/types.ts +8 -0
- package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/Table.vue +134 -0
- package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/lib/config/hostsTable.ts +87 -0
- package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/lib/config/tableKeys.ts +11 -0
- package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +232 -0
- package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/graphicTooltip/graphicTooltip.vue +64 -0
- package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/lib/config/selectOptions.ts +46 -0
- package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/sizeGraphic/sizeGraphic.vue +225 -0
- package/components/common/wizards/datastoreNew/add/sharedStorm/version/Version.vue +39 -0
- package/components/common/wizards/datastoreNew/add/sharedStorm/version/lib/config/versionOptions.ts +21 -0
- package/components/common/wizards/datastoreNew/add/types/Types.vue +77 -0
- package/components/common/wizards/datastoreNew/add/types/lib/config/typeOptions.ts +49 -0
- package/package.json +1 -1
- package/plugins/binary.ts +7 -9
package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/DeviceSelection.vue
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="device-selection-step">
|
|
3
|
+
<atoms-alert
|
|
4
|
+
v-show="props.alertMessages?.length"
|
|
5
|
+
test-id="device-selection-errors"
|
|
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.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 ng-star-inserted">
|
|
31
|
+
{{ nameErrorText }}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<atoms-alert
|
|
37
|
+
v-show="alertInfo"
|
|
38
|
+
test-id="device-selection-info"
|
|
39
|
+
class="device-selection-step__alert-info"
|
|
40
|
+
status="alert-info"
|
|
41
|
+
:items="[localization.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.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.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 { UI_T_Project } from '~/lib/models/types'
|
|
97
|
+
import { UI_I_ValidationTouchResult } from '~/lib/models/plugins/validation/interfaces'
|
|
98
|
+
import {
|
|
99
|
+
UI_I_Localization,
|
|
100
|
+
UI_I_ArbitraryObject,
|
|
101
|
+
} from '~/lib/models/interfaces'
|
|
102
|
+
import {
|
|
103
|
+
API_UI_I_DataTable,
|
|
104
|
+
UI_I_Pagination,
|
|
105
|
+
UI_I_DataTableQuery,
|
|
106
|
+
} from '~/lib/models/table/interfaces'
|
|
107
|
+
import {
|
|
108
|
+
UI_I_CreateStorageLunDiskItem,
|
|
109
|
+
UI_I_DeviceSelectionSendData,
|
|
110
|
+
UI_I_LunDiskSpherePayload,
|
|
111
|
+
UI_I_SelectHostOptions,
|
|
112
|
+
} from '~/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces'
|
|
113
|
+
import type { UI_I_ErrorFields } from '~/components/atoms/wizard/lib/models/interfaces'
|
|
114
|
+
import { UI_T_DatastoreType } from '~/components/common/wizards/datastoreNew/add/lib/models/types'
|
|
115
|
+
import { hostsOptionsFunc } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/config/selectOptions'
|
|
116
|
+
|
|
117
|
+
const props = defineProps<{
|
|
118
|
+
project: UI_T_Project
|
|
119
|
+
stepId: number
|
|
120
|
+
alertMessages: string[]
|
|
121
|
+
messagesFields: UI_I_ArbitraryObject<UI_I_ErrorFields>
|
|
122
|
+
datastoreType: UI_T_DatastoreType
|
|
123
|
+
datacenterHosts?: UI_I_SelectHostOptions[] | undefined
|
|
124
|
+
isMainFilter?: boolean
|
|
125
|
+
hostId?: string
|
|
126
|
+
}>()
|
|
127
|
+
const model = defineModel<any>()
|
|
128
|
+
const emits = defineEmits<{
|
|
129
|
+
(event: 'hide-alert', value: number): void
|
|
130
|
+
(event: 'submit', value: UI_I_DeviceSelectionSendData): void
|
|
131
|
+
(event: 'main-filter', value: string): void
|
|
132
|
+
}>()
|
|
133
|
+
|
|
134
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
135
|
+
const { $store } = useNuxtApp()
|
|
136
|
+
|
|
137
|
+
const isInitDatastoreNameValidation = ref<boolean>(false)
|
|
138
|
+
const initValidation = (onlyBlur: boolean): void => {
|
|
139
|
+
onlyBlur && (isInitDatastoreNameValidation.value = true)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const nameErrorText = computed<string>(() => {
|
|
143
|
+
if (props.messagesFields?.datastoreName?.field && !model.value.name) {
|
|
144
|
+
return props.messagesFields.datastoreName.field
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (!isInitDatastoreNameValidation.value) return ''
|
|
148
|
+
return !model.value.name ? localization.value.specifyDatastoreName : ''
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
const alertInfo = ref<boolean>(true)
|
|
152
|
+
const onHideAlertInfo = (): void => {
|
|
153
|
+
alertInfo.value = false
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* Lun disk table */
|
|
157
|
+
|
|
158
|
+
const pagination = ref<UI_I_Pagination>({
|
|
159
|
+
page: 1,
|
|
160
|
+
pageSize: 35,
|
|
161
|
+
})
|
|
162
|
+
const sort = ref<string | null>(null)
|
|
163
|
+
|
|
164
|
+
const updatePagination = (event: UI_I_Pagination): void => {
|
|
165
|
+
pagination.value = event
|
|
166
|
+
}
|
|
167
|
+
const sortTable = (event: string): void => {
|
|
168
|
+
sort.value = event
|
|
169
|
+
initLunDisksDataTable()
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const loading = computed<boolean>(() =>
|
|
173
|
+
$store.getters['storage/getLoading']('datastoreHosts')
|
|
174
|
+
)
|
|
175
|
+
const dataTable = computed<API_UI_I_DataTable<
|
|
176
|
+
UI_I_CreateStorageLunDiskItem[]
|
|
177
|
+
> | null>(() => {
|
|
178
|
+
// if (props.project === 'procurator')
|
|
179
|
+
return $store.getters['storage/getNewDatastoreHosts']
|
|
180
|
+
|
|
181
|
+
// if (props.datastoreType === 'local') return []
|
|
182
|
+
//
|
|
183
|
+
// if (props.datastoreType === 'shared-storm') return []
|
|
184
|
+
//
|
|
185
|
+
// if (props.datastoreType === 'nfs') return []
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
/* Select host */
|
|
189
|
+
const hostOptions = computed<UI_I_SelectHostOptions[]>(() =>
|
|
190
|
+
hostsOptionsFunc(localization.value, props.datacenterHosts)
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
const onSelectHost = (): void => {
|
|
194
|
+
if (props.datastoreType !== 'shared-storm') return
|
|
195
|
+
|
|
196
|
+
initLunDisksForSphere(model.value.hosts[0])
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const showValidationErrors = (
|
|
200
|
+
data: UI_I_ValidationTouchResult[],
|
|
201
|
+
_errorText = '',
|
|
202
|
+
_alert = false
|
|
203
|
+
): void => {}
|
|
204
|
+
const validatePropertiesForSphere = (): boolean => {
|
|
205
|
+
|
|
206
|
+
if (props.datastoreType === 'shared-storm') {
|
|
207
|
+
return !model.value.hosts.length || !model.value.lunDisk.length
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return false
|
|
211
|
+
}
|
|
212
|
+
const validationTextForSphere = (): string => {
|
|
213
|
+
if (props.datastoreType === 'shared-storm') {
|
|
214
|
+
return !model.value.hosts.length // !selectedHost.value
|
|
215
|
+
? 'selectHostToContinueAlert'
|
|
216
|
+
: 'selectDiskToContinueAlert'
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return ''
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const collectDataForReview = (
|
|
223
|
+
name: string,
|
|
224
|
+
mode: UI_T_Project
|
|
225
|
+
): UI_I_DeviceSelectionSendData => {
|
|
226
|
+
const data: UI_I_DeviceSelectionSendData = {
|
|
227
|
+
name,
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// if (mode === 'procurator') {
|
|
231
|
+
// data.lunDisk = props.lunDisk.map((lun) => {
|
|
232
|
+
// return { name: lun.name, capacity: lun.capacity_mb }
|
|
233
|
+
// })
|
|
234
|
+
// }
|
|
235
|
+
|
|
236
|
+
if (mode === 'sphere') {
|
|
237
|
+
|
|
238
|
+
if (props.datastoreType === 'shared-storm') {
|
|
239
|
+
data.host = model.value.hosts.length // selectedHost.value
|
|
240
|
+
data.lunDisk = model.value.lunDisk.map((lun) => {
|
|
241
|
+
return { name: lun.name, capacity: lun.capacity_mb }
|
|
242
|
+
})
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return data
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const submit = async (): Promise<void> => {
|
|
250
|
+
const { project } = props
|
|
251
|
+
|
|
252
|
+
const valid = { isValid: false }
|
|
253
|
+
const isShowAlertDanger =
|
|
254
|
+
project === 'procurator'
|
|
255
|
+
? !model.value.lunDisk.length
|
|
256
|
+
: validatePropertiesForSphere()
|
|
257
|
+
|
|
258
|
+
if (!valid.isValid || isShowAlertDanger) {
|
|
259
|
+
const isModeSphere = project === 'sphere' && props.datastoreType === 'local'
|
|
260
|
+
|
|
261
|
+
const errorText =
|
|
262
|
+
localization.value[
|
|
263
|
+
isModeSphere ? 'selectHostToContinueAlert' : validationTextForSphere()
|
|
264
|
+
]
|
|
265
|
+
|
|
266
|
+
showValidationErrors(valid, errorText, isShowAlertDanger)
|
|
267
|
+
return
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (!isShowAlertDanger) {
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const eventData = collectDataForReview('name', project)
|
|
274
|
+
emits('submit', eventData)
|
|
275
|
+
}
|
|
276
|
+
submit()
|
|
277
|
+
|
|
278
|
+
const initLunDisksForSphere = async (host: string): Promise<void> => {
|
|
279
|
+
await $store.dispatch('storage/A_GET_DISKS_LIST', {
|
|
280
|
+
host,
|
|
281
|
+
...pagination.value,
|
|
282
|
+
sortBy: sort.value,
|
|
283
|
+
} as UI_I_LunDiskSpherePayload)
|
|
284
|
+
}
|
|
285
|
+
if (props.hostId) {
|
|
286
|
+
initLunDisksForSphere(props.hostId)
|
|
287
|
+
}
|
|
288
|
+
const initLunDisksDataTable = async (): Promise<void> => {
|
|
289
|
+
await $store.dispatch('storage/A_GET_LUN_DISK_LIST', {
|
|
290
|
+
...pagination.value,
|
|
291
|
+
sortBy: sort.value,
|
|
292
|
+
} as UI_I_DataTableQuery)
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (props.project === 'procurator') {
|
|
296
|
+
// && props.stepId === 2
|
|
297
|
+
initLunDisksDataTable()
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const onHideAlert = (): void => {
|
|
301
|
+
emits('hide-alert', props.stepId)
|
|
302
|
+
}
|
|
303
|
+
</script>
|
|
304
|
+
|
|
305
|
+
<style lang="scss" scoped>
|
|
306
|
+
.device-selection-step {
|
|
307
|
+
display: flex;
|
|
308
|
+
flex-direction: column;
|
|
309
|
+
height: inherit;
|
|
310
|
+
overflow-y: auto;
|
|
311
|
+
overflow-x: hidden;
|
|
312
|
+
&__alert-info {
|
|
313
|
+
:deep(.alert-text) {
|
|
314
|
+
font-size: 11px;
|
|
315
|
+
letter-spacing: normal;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
.dropdown-toggle {
|
|
319
|
+
min-width: 160px;
|
|
320
|
+
}
|
|
321
|
+
.clr-form-control {
|
|
322
|
+
display: flex;
|
|
323
|
+
flex-direction: row;
|
|
324
|
+
|
|
325
|
+
.clr-control-container {
|
|
326
|
+
min-height: 48px;
|
|
327
|
+
&.clr-error {
|
|
328
|
+
.clr-subtext,
|
|
329
|
+
.error-icon {
|
|
330
|
+
display: block;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
.clr-subtext,
|
|
334
|
+
.error-icon {
|
|
335
|
+
display: none;
|
|
336
|
+
}
|
|
337
|
+
.error-icon {
|
|
338
|
+
fill: #db2100;
|
|
339
|
+
width: 24px;
|
|
340
|
+
height: 24px;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
&__disk-list {
|
|
345
|
+
display: flex;
|
|
346
|
+
flex-direction: column;
|
|
347
|
+
height: 100%;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
export const hostsOptionsFunc = (
|
|
5
|
+
localization: UI_I_Localization,
|
|
6
|
+
data: UI_I_SelectHostOptions[] | undefined
|
|
7
|
+
): UI_I_SelectHostOptions[] => {
|
|
8
|
+
if(!data) return []
|
|
9
|
+
|
|
10
|
+
return [
|
|
11
|
+
{ text: localization.selectHost, value: '', disabled: true },
|
|
12
|
+
...data,
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { UI_I_DataTableQuery } from '~/lib/models/table/interfaces'
|
|
2
|
+
|
|
3
|
+
export interface UI_I_LunDiskSpherePayload extends UI_I_DataTableQuery {
|
|
4
|
+
host: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface UI_I_LunDisk {
|
|
8
|
+
name: string
|
|
9
|
+
capacity: string
|
|
10
|
+
}
|
|
11
|
+
export interface UI_I_DeviceSelectionSendData {
|
|
12
|
+
name: string
|
|
13
|
+
lunDisk?: UI_I_LunDisk[]
|
|
14
|
+
host?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface UI_I_SelectHostOptions {
|
|
18
|
+
text: string
|
|
19
|
+
value: string
|
|
20
|
+
disabled?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface UI_I_CreateStorageLunDiskItem {
|
|
24
|
+
name: string
|
|
25
|
+
identifier: string
|
|
26
|
+
lun: number
|
|
27
|
+
capacity_mb: string
|
|
28
|
+
hardware_acceleration: string
|
|
29
|
+
drive_type: string
|
|
30
|
+
sector_format: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface API_UI_I_DatastoreLunDiskItem {
|
|
34
|
+
id: string
|
|
35
|
+
adapter: string
|
|
36
|
+
capacity_mb: string
|
|
37
|
+
datastore: {
|
|
38
|
+
name: string
|
|
39
|
+
type: string
|
|
40
|
+
}
|
|
41
|
+
drive_type: string
|
|
42
|
+
hardware_acceleration: string
|
|
43
|
+
identifier: string
|
|
44
|
+
lun: number
|
|
45
|
+
name: string
|
|
46
|
+
operational_state: string
|
|
47
|
+
owner: string
|
|
48
|
+
perennially_reserved: string
|
|
49
|
+
physical_location: string
|
|
50
|
+
sector_format: string
|
|
51
|
+
transport: string
|
|
52
|
+
type: string
|
|
53
|
+
}
|
package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/Table.vue
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="data-table-view">
|
|
3
|
+
<atoms-table-data-grid
|
|
4
|
+
v-model:selected-row="selectedLunDiskLocal"
|
|
5
|
+
v-model:column-keys="columnKeys"
|
|
6
|
+
v-model:page-size="pagination.pageSize"
|
|
7
|
+
v-model:page="pagination.page"
|
|
8
|
+
type="checkbox"
|
|
9
|
+
class="data-table"
|
|
10
|
+
test-id="host-table"
|
|
11
|
+
:head-items="headItems"
|
|
12
|
+
:body-items="bodyItems"
|
|
13
|
+
:total-items="props.totalItems"
|
|
14
|
+
:total-pages="props.totalPages"
|
|
15
|
+
:loading="loading"
|
|
16
|
+
:is-main-filter="props.isMainFilter"
|
|
17
|
+
:main-filter-placeholder="localization.filter"
|
|
18
|
+
hide-page-size
|
|
19
|
+
@main-filter="onMainFiltering"
|
|
20
|
+
@sorting="sorting"
|
|
21
|
+
>
|
|
22
|
+
<template #icon="{ item }">
|
|
23
|
+
<span :class="['datagrid-cell-icon', item.data.iconClassName]" />
|
|
24
|
+
<span class="text-ellipsis">
|
|
25
|
+
{{ item.text }}
|
|
26
|
+
</span>
|
|
27
|
+
</template>
|
|
28
|
+
</atoms-table-data-grid>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script lang="ts" setup>
|
|
33
|
+
import { useDebounceFn } from '@vueuse/core'
|
|
34
|
+
import {
|
|
35
|
+
UI_I_HeadItem,
|
|
36
|
+
UI_I_ColumnKey,
|
|
37
|
+
UI_I_BodyItem,
|
|
38
|
+
} from '~/components/atoms/table/dataGrid/lib/models/interfaces'
|
|
39
|
+
import { UI_I_Localization } from '~/lib/models/interfaces'
|
|
40
|
+
import { UI_I_Pagination } from '~/lib/models/table/interfaces'
|
|
41
|
+
// import { optionsDefault as itemsPerPage } from '~/node_modules/nuxt-3-uikit/components/atoms/table/dataGrid/config'
|
|
42
|
+
import { UI_I_CreateStorageLunDiskItem } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
|
|
43
|
+
import * as lunDiskTable from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/lib/config/hostsTable'
|
|
44
|
+
|
|
45
|
+
const props = defineProps<{
|
|
46
|
+
dataTable: UI_I_CreateStorageLunDiskItem[]
|
|
47
|
+
loading: boolean
|
|
48
|
+
totalItems: number
|
|
49
|
+
totalPages: number
|
|
50
|
+
pagination: UI_I_Pagination
|
|
51
|
+
isMainFilter?: boolean
|
|
52
|
+
}>()
|
|
53
|
+
const modelLunDisk = defineModel<UI_I_CreateStorageLunDiskItem[]>()
|
|
54
|
+
const emits = defineEmits<{
|
|
55
|
+
(event: 'pagination', value: UI_I_Pagination): void
|
|
56
|
+
(event: 'sort', value: string): void
|
|
57
|
+
(event: 'main-filter', value: string): void
|
|
58
|
+
}>()
|
|
59
|
+
|
|
60
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
61
|
+
|
|
62
|
+
const sorting = (e: [number, boolean]): void => {
|
|
63
|
+
const [column, status] = e
|
|
64
|
+
const direction = status ? 'desc' : 'asc'
|
|
65
|
+
|
|
66
|
+
const sort = `${column}.${direction}`
|
|
67
|
+
|
|
68
|
+
emits('sort', sort)
|
|
69
|
+
}
|
|
70
|
+
const sendFilter = useDebounceFn((searchText: string) => {
|
|
71
|
+
emits('main-filter', searchText)
|
|
72
|
+
}, 1000)
|
|
73
|
+
const onMainFiltering = (data: string): void => {
|
|
74
|
+
sendFilter(data)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const pagination = ref<UI_I_Pagination>({
|
|
78
|
+
page: 1,
|
|
79
|
+
pageSize: 1,
|
|
80
|
+
})
|
|
81
|
+
watch(
|
|
82
|
+
() => props.pagination,
|
|
83
|
+
(newValue) => {
|
|
84
|
+
pagination.value = newValue
|
|
85
|
+
},
|
|
86
|
+
{ immediate: true }
|
|
87
|
+
)
|
|
88
|
+
watch(
|
|
89
|
+
pagination,
|
|
90
|
+
(newValue) => {
|
|
91
|
+
emits('pagination', newValue)
|
|
92
|
+
},
|
|
93
|
+
{ deep: true, immediate: true }
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
const columnKeys = ref<UI_I_ColumnKey[]>(
|
|
97
|
+
lunDiskTable.columnKeys(localization.value)
|
|
98
|
+
)
|
|
99
|
+
const headItems = computed<UI_I_HeadItem[]>(() =>
|
|
100
|
+
lunDiskTable.headItems(localization.value)
|
|
101
|
+
)
|
|
102
|
+
const bodyItems = computed<UI_I_BodyItem[][]>(() => {
|
|
103
|
+
let result: UI_I_BodyItem[][] = []
|
|
104
|
+
if (props.dataTable?.length) {
|
|
105
|
+
result = lunDiskTable.bodyItems(props.dataTable)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return result
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const selectedLunDiskLocal = ref<number[]>()
|
|
112
|
+
watch(
|
|
113
|
+
selectedLunDiskLocal,
|
|
114
|
+
(newValue: number[]) => {
|
|
115
|
+
modelLunDisk.value = props.dataTable.filter((_: any, key: number) =>
|
|
116
|
+
newValue.includes(key)
|
|
117
|
+
)
|
|
118
|
+
},
|
|
119
|
+
{ deep: true, immediate: true }
|
|
120
|
+
)
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<style lang="scss" scoped>
|
|
124
|
+
.data-table-view {
|
|
125
|
+
height: inherit;
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
.data-table {
|
|
128
|
+
height: inherit;
|
|
129
|
+
:deep(.datagrid-outer-wrapper) {
|
|
130
|
+
height: 400px;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
</style>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {
|
|
2
|
+
UI_I_HeadItem,
|
|
3
|
+
UI_I_ColumnKey,
|
|
4
|
+
UI_I_BodyItem,
|
|
5
|
+
} from '~/components/atoms/table/dataGrid/lib/models/interfaces'
|
|
6
|
+
import { UI_I_Localization } from '~/lib/models/interfaces'
|
|
7
|
+
import {
|
|
8
|
+
constructHeadItem,
|
|
9
|
+
constructColumnKey,
|
|
10
|
+
} from '~/components/atoms/table/dataGrid/lib/utils/constructDataTable'
|
|
11
|
+
import { UI_I_CreateStorageLunDiskItem } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
|
|
12
|
+
import { hostTableItemsKeys } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/lib/config/tableKeys'
|
|
13
|
+
|
|
14
|
+
const getItems = (
|
|
15
|
+
localization: UI_I_Localization
|
|
16
|
+
): [string, boolean, string, string][] => {
|
|
17
|
+
return [
|
|
18
|
+
[localization.name, true, '180px', hostTableItemsKeys[0]],
|
|
19
|
+
[localization.identifier, false, '96px', hostTableItemsKeys[1]],
|
|
20
|
+
[localization.lun, true, '96px', hostTableItemsKeys[2]],
|
|
21
|
+
[localization.capacity, true, '96px', hostTableItemsKeys[3]],
|
|
22
|
+
[localization.hardwareAcceleration, true, '96px', hostTableItemsKeys[4]],
|
|
23
|
+
[localization.driveType, true, '96px', hostTableItemsKeys[5]],
|
|
24
|
+
[localization.sectorFormat, true, '96px', hostTableItemsKeys[6]],
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
export const columnKeys = (localization: UI_I_Localization): UI_I_ColumnKey[] => {
|
|
28
|
+
const result: UI_I_ColumnKey[] = []
|
|
29
|
+
getItems(localization).forEach((item, i) => {
|
|
30
|
+
const col = `col${i}`
|
|
31
|
+
result.push(constructColumnKey(col, item[0], item[1]))
|
|
32
|
+
})
|
|
33
|
+
return result
|
|
34
|
+
}
|
|
35
|
+
export const headItems = (localization: UI_I_Localization): UI_I_HeadItem[] => {
|
|
36
|
+
const result: UI_I_HeadItem[] = []
|
|
37
|
+
getItems(localization).forEach((item, i) => {
|
|
38
|
+
const col = `col${i}`
|
|
39
|
+
result.push(constructHeadItem(col, item[0], item[3], false, item[2]))
|
|
40
|
+
})
|
|
41
|
+
return result
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const bodyItems = (data: UI_I_CreateStorageLunDiskItem[]): UI_I_BodyItem[][] => {
|
|
45
|
+
const bodyItems: UI_I_BodyItem[][] = []
|
|
46
|
+
const { $binary } = useNuxtApp()
|
|
47
|
+
data.forEach((host: UI_I_CreateStorageLunDiskItem, key) => {
|
|
48
|
+
bodyItems.push([
|
|
49
|
+
{
|
|
50
|
+
key: 'col0',
|
|
51
|
+
text: host[hostTableItemsKeys[0]],
|
|
52
|
+
id: key,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
key: 'col1',
|
|
56
|
+
text: host[hostTableItemsKeys[1]],
|
|
57
|
+
id: key,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
key: 'col2',
|
|
61
|
+
text: host[hostTableItemsKeys[2]],
|
|
62
|
+
id: key,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
key: 'col3',
|
|
66
|
+
text: $binary.round(host[hostTableItemsKeys[3]]),
|
|
67
|
+
id: key,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
key: 'col4',
|
|
71
|
+
text: host[hostTableItemsKeys[4]],
|
|
72
|
+
id: key,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
key: 'col5',
|
|
76
|
+
text: host[hostTableItemsKeys[5]],
|
|
77
|
+
id: key,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
key: 'col6',
|
|
81
|
+
text: host[hostTableItemsKeys[6]],
|
|
82
|
+
id: key,
|
|
83
|
+
},
|
|
84
|
+
])
|
|
85
|
+
})
|
|
86
|
+
return bodyItems
|
|
87
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UI_T_HostTableItemsKey } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/types'
|
|
2
|
+
|
|
3
|
+
export const hostTableItemsKeys: UI_T_HostTableItemsKey[] = [
|
|
4
|
+
'name',
|
|
5
|
+
'identifier',
|
|
6
|
+
'lun',
|
|
7
|
+
'capacity_mb',
|
|
8
|
+
'hardware_acceleration',
|
|
9
|
+
'drive_type',
|
|
10
|
+
'sector_format',
|
|
11
|
+
]
|