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,385 @@
1
+ <template>
2
+ <div class="configuration">
3
+ <div>
4
+ <atoms-alert
5
+ v-show="errors.length"
6
+ test-id="configuration-error"
7
+ status="alert-danger"
8
+ :items="errors"
9
+ @remove="onCloseAlertDanger"
10
+ />
11
+
12
+ <atoms-alert
13
+ v-show="alertInfo"
14
+ test-id="configuration-info"
15
+ status="alert-info"
16
+ :items="[localization.nameAndConfigurationAlertInfo]"
17
+ @remove="alertInfo = false"
18
+ />
19
+ <h6 class="nd-mt-0">{{ localization.nfsShareDetails }}</h6>
20
+
21
+ <div class="clr-form-control clr-row">
22
+ <label for="" class="clr-control-label clr-col-md-2">{{
23
+ localization.name
24
+ }}</label>
25
+
26
+ <div
27
+ class="clr-control-container"
28
+ :class="nameErrorText && 'clr-error'"
29
+ >
30
+ <div class="flex-align-center">
31
+ <input
32
+ id="configuration-name-input"
33
+ v-model="form.name.value"
34
+ data-id="configuration-name-input"
35
+ type="text"
36
+ class="clr-input"
37
+ @blur="onBlurInputName"
38
+ @input="onInputName"
39
+ />
40
+ <atoms-the-icon class="error-icon" name="info-circle" />
41
+ </div>
42
+
43
+ <div class="clr-subtext ng-star-inserted">
44
+ {{ nameErrorText }}
45
+ </div>
46
+ </div>
47
+ </div>
48
+
49
+ <div class="clr-form-control clr-row">
50
+ <label class="clr-control-label clr-col-md-2">{{
51
+ localization.folder
52
+ }}</label>
53
+
54
+ <div
55
+ class="clr-control-container"
56
+ :class="folderErrorText && 'clr-error'"
57
+ >
58
+ <div class="flex-align-center">
59
+ <input
60
+ id="configuration-folder-input"
61
+ v-model="form.folder.value"
62
+ data-id="configuration-folder-input"
63
+ type="text"
64
+ class="clr-input"
65
+ @blur="onBlurInputFolder"
66
+ @input="onInputFolder"
67
+ />
68
+ <atoms-the-icon class="error-icon" name="info-circle" />
69
+ </div>
70
+
71
+ <div v-if="folderErrorText" class="clr-subtext">
72
+ {{ folderErrorText }}
73
+ </div>
74
+ <div v-else class="clr-subtext">E.g: /vols/vol0/datastore-001</div>
75
+ </div>
76
+ </div>
77
+
78
+ <div class="nd-mt-0 clr-form-control clr-row">
79
+ <label class="clr-control-label clr-col-md-2">{{
80
+ localization.server
81
+ }}</label>
82
+
83
+ <div
84
+ class="clr-control-container"
85
+ :class="serverErrorText && 'clr-error'"
86
+ >
87
+ <div class="flex-align-center input-action-wrapper">
88
+ <input
89
+ id="configuration-folder-input"
90
+ v-model="form.server.value"
91
+ data-id="configuration-folder-input"
92
+ type="text"
93
+ class="clr-input"
94
+ @blur="onBlurInputServer"
95
+ @input="onInputServer"
96
+ />
97
+ <atoms-the-icon class="error-icon" name="info-circle" />
98
+ </div>
99
+ <div v-if="serverErrorText" class="clr-subtext">
100
+ {{ serverErrorText }}
101
+ </div>
102
+ <div v-else class="clr-subtext">
103
+ E.g: nas, nas.it.com or 192.168.0.1
104
+ </div>
105
+ </div>
106
+
107
+ <!-- <button-->
108
+ <!-- v-show="props.nfsVersion === 'nfs-4.1' && false"-->
109
+ <!-- class="btn btn-sm nd-mt-0"-->
110
+ <!-- @click="onAddServerToList"-->
111
+ <!-- >-->
112
+ <!-- {{ localization.add }}-->
113
+ <!-- </button>-->
114
+ </div>
115
+
116
+ <div
117
+ v-show="props.nfsVersion === 'nfs-4.1' && false"
118
+ class="configuration__servers-list"
119
+ >
120
+ <common-wizards-datastore-add-nfs-configuration-servers-list
121
+ v-model:data-table="dataServers"
122
+ />
123
+ </div>
124
+ </div>
125
+
126
+ <div v-if="false" class="clr-form-control clr-row mt-1">
127
+ <label for="" class="clr-control-label clr-col-md-2">{{
128
+ localization.accessMode
129
+ }}</label>
130
+
131
+ <div class="clr-col-md-10 clr-col-12 clr-checkbox-wrapper">
132
+ <input
133
+ id="playback-compression"
134
+ v-model="accessMode"
135
+ data-id="playback-compression-checkbox"
136
+ type="checkbox"
137
+ />
138
+ <label for="playback-compression" class="clr-control-label">{{
139
+ localization.mountNfsReadOnly
140
+ }}</label>
141
+ </div>
142
+ </div>
143
+ </div>
144
+ </template>
145
+
146
+ <script lang="ts" setup>
147
+ import { UI_I_ValidationTouchResult } from '~/lib/models/plugins/validation/interfaces'
148
+ import { UI_I_Localization } from '~/lib/models/interfaces'
149
+ import {
150
+ UI_I_DataServersListItem,
151
+ UI_I_FormValidationConfiguration,
152
+ } from '~/components/common/wizards/datastore/add/nfs/configuration/serversList/lib/models/interfaces'
153
+ import {
154
+ UI_T_NfsType,
155
+ UI_T_WizardDatastoreMode,
156
+ } from '~/components/common/wizards/datastore/add/lib/models/types'
157
+ import { UI_I_ConfigurationSendDataNfs } from '~/components/common/wizards/datastore/add/nfs/configuration/lib/models/interfaces'
158
+ import { defaultFormFunc } from '~/components/common/wizards/datastore/add/nfs/configuration/lib/config/defaultForm'
159
+ import { checkValidityName } from '~/components/common/wizards/datastore/add/lib/utils'
160
+
161
+ const props = defineProps<{
162
+ mode: UI_T_WizardDatastoreMode
163
+ nfsVersion: UI_T_NfsType
164
+ nfsConfigurationSubmit: number
165
+ }>()
166
+ const localization = computed<UI_I_Localization>(() => useLocal())
167
+ const emits = defineEmits<{
168
+ (event: 'loading', value: boolean): void
169
+ (event: 'next', value: UI_I_ConfigurationSendDataNfs): void
170
+ }>()
171
+ const { $validation } = useNuxtApp()
172
+
173
+ const validation = $validation.call({})
174
+ const defaultForm: UI_I_FormValidationConfiguration = defaultFormFunc(
175
+ localization.value
176
+ )
177
+ const form = ref<UI_I_FormValidationConfiguration>(useDeepCopy(defaultForm))
178
+ const setForm = () => {
179
+ form.value = useDeepCopy(defaultForm)
180
+ validation.setForm(form)
181
+ }
182
+ setForm()
183
+
184
+ const validForm = ref<UI_I_ValidationTouchResult | null>(null)
185
+
186
+ /* Validation for Name input */
187
+ const isInitNameValidation = ref<boolean>(false)
188
+ const onBlurInputName = (): void => {
189
+ validForm.value = validation.touch()
190
+ isInitNameValidation.value = true
191
+ }
192
+ const onInputName = (): void => {
193
+ validForm.value = validation.touch()
194
+ }
195
+
196
+ const nameErrorText = computed<string>(() => {
197
+ if (!isInitNameValidation.value) return ''
198
+ return validForm.value?.errors?.name?.[0] || ''
199
+ })
200
+ /* Validation Name input end */
201
+
202
+ /* Validation for Folder input */
203
+ const isInitFolderValidation = ref<boolean>(false)
204
+ const onBlurInputFolder = (): void => {
205
+ validForm.value = validation.touch()
206
+ isInitFolderValidation.value = true
207
+ }
208
+ const onInputFolder = (): void => {
209
+ validForm.value = validation.touch()
210
+ }
211
+
212
+ const folderErrorText = computed<string>(() => {
213
+ if (!isInitFolderValidation.value) return ''
214
+ return validForm.value?.errors?.folder?.[0] || ''
215
+ })
216
+ /* Validation Folder input end */
217
+
218
+ /* Validation for Server input */
219
+ const isInitServerValidation = ref<boolean>(false)
220
+ const onBlurInputServer = (): void => {
221
+ validForm.value = validation.touch()
222
+ isInitServerValidation.value = true
223
+ }
224
+ const onInputServer = (): void => {
225
+ validForm.value = validation.touch()
226
+ isInitServerValidation.value = true
227
+ }
228
+
229
+ const serverErrorText = computed<string>(() => {
230
+ // if (!isInitServerValidation.value || dataServers.value.length) return ''
231
+ if (!isInitServerValidation.value) return ''
232
+ return validForm.value?.errors?.server?.[0] || ''
233
+ })
234
+
235
+ /* Validation Folder Server end */
236
+
237
+ const accessMode = ref<boolean>(false)
238
+
239
+ const dataServers = ref<UI_I_DataServersListItem[]>([])
240
+ // const onAddServerToList = (): void => {
241
+ // const { server } = form.value
242
+ // // const { nfsVersion } = props
243
+ //
244
+ // if (!dataServers.value.length && !server.value) {
245
+ // validForm.value = validation.touch()
246
+ // isInitServerValidation.value = true
247
+ //
248
+ // return
249
+ // }
250
+ //
251
+ // // if (dataServers.value.length && !server.value) return
252
+ //
253
+ // const data: UI_I_DataServersListItem = {
254
+ // server_name: server.value,
255
+ // }
256
+ //
257
+ // const hasEqualItem = !!dataServers.value.find(
258
+ // (server: UI_I_DataServersListItem) => server.server_name === data.server_name
259
+ // )
260
+ //
261
+ // !hasEqualItem && dataServers.value.push(data)
262
+ //
263
+ // // if (nfsVersion === 'nfs-4.1') server.value = ''
264
+ // }
265
+
266
+ const alertInfo = ref<boolean>(props.mode === 'procurator')
267
+
268
+ const resetValidation = (): void => {
269
+ isInitNameValidation.value =
270
+ isInitFolderValidation.value =
271
+ isInitServerValidation.value =
272
+ false
273
+ validForm.value = null
274
+ errors.value = []
275
+ }
276
+
277
+ watch(
278
+ () => props.nfsConfigurationSubmit,
279
+ () => {
280
+ submit()
281
+ }
282
+ )
283
+ const submit = async (): Promise<void> => {
284
+ const { name, server, folder } = form.value
285
+
286
+ validForm.value = validation.touch()
287
+ isInitNameValidation.value =
288
+ isInitFolderValidation.value =
289
+ isInitServerValidation.value =
290
+ true
291
+
292
+ if (nameErrorText.value || folderErrorText.value || serverErrorText.value) {
293
+ return
294
+ }
295
+
296
+ emits('loading', true)
297
+
298
+ const { valid, msg } = await checkValidityName(name.value, props.mode)
299
+
300
+ emits('loading', false)
301
+
302
+ if (!valid) {
303
+ showValidationErrors(msg)
304
+ return
305
+ }
306
+
307
+ // if (server.value) onAddServerToList()
308
+
309
+ resetValidation()
310
+
311
+ const configurationData: UI_I_ConfigurationSendDataNfs = {
312
+ name: name.value,
313
+ folder: folder.value,
314
+ server: server.value,
315
+ }
316
+
317
+ emits('next', configurationData)
318
+ // if (props.nfsVersion !== 'nfs-4.1') {
319
+ // dataServers.value = []
320
+ // }
321
+ }
322
+
323
+ const errors = ref<string[]>([])
324
+
325
+ const showValidationErrors = (errorText: string): void => {
326
+ errors.value = [errorText]
327
+ }
328
+ const onCloseAlertDanger = (): void => {
329
+ errors.value = []
330
+ }
331
+ </script>
332
+
333
+ <style lang="scss" scoped>
334
+ @import '~/assets/scss/common/mixins.scss';
335
+ .configuration {
336
+ @include flex($dir: column, $just: space-between);
337
+ height: 100%;
338
+ & > h6 {
339
+ font-weight: 500;
340
+ font-size: 14px;
341
+ padding-top: 6px;
342
+ }
343
+
344
+ &__alert-info {
345
+ :deep(.alert-text) {
346
+ font-size: 11px;
347
+ letter-spacing: normal;
348
+ }
349
+ }
350
+ .clr-form-control {
351
+ margin-top: 0;
352
+ display: flex;
353
+ flex-direction: row;
354
+
355
+ .clr-control-container {
356
+ min-height: 48px;
357
+ &.clr-error {
358
+ .clr-subtext,
359
+ .error-icon {
360
+ display: block;
361
+ }
362
+ }
363
+ .error-icon {
364
+ display: none;
365
+ }
366
+ .error-icon {
367
+ fill: #db2100;
368
+ width: 24px;
369
+ height: 24px;
370
+ }
371
+ }
372
+ }
373
+ &__servers-list {
374
+ height: 170px;
375
+ }
376
+ }
377
+ .flex-align-center {
378
+ &.input-action-wrapper {
379
+ width: 260px;
380
+ }
381
+ input {
382
+ width: 210px;
383
+ }
384
+ }
385
+ </style>
@@ -0,0 +1,33 @@
1
+ import { UI_I_Localization } from '~/lib/models/interfaces'
2
+
3
+ export const defaultFormFunc = (localization: UI_I_Localization): any => {
4
+ return {
5
+ name: {
6
+ value: 'Datastore',
7
+ validations: [
8
+ {
9
+ value: 'required',
10
+ errorText: localization.specifyDatastoreName,
11
+ },
12
+ ],
13
+ },
14
+ folder: {
15
+ value: '',
16
+ validations: [
17
+ {
18
+ value: 'required',
19
+ errorText: localization.specifyFolderName,
20
+ },
21
+ ],
22
+ },
23
+ server: {
24
+ value: '',
25
+ validations: [
26
+ {
27
+ value: 'required',
28
+ errorText: localization.specifyServerName,
29
+ },
30
+ ],
31
+ },
32
+ }
33
+ }
@@ -0,0 +1,12 @@
1
+ import { UI_I_DataServersListItem } from '~/components/common/wizards/datastore/add/nfs/configuration/serversList/lib/models/interfaces'
2
+
3
+ // export interface I_ServerNfs {
4
+ // server_name: string
5
+ // }
6
+ export interface UI_I_ConfigurationSendDataNfs {
7
+ name: string
8
+ folder: string
9
+ server: UI_I_DataServersListItem[]
10
+
11
+ // readonly: boolean
12
+ }
@@ -0,0 +1,100 @@
1
+ <template>
2
+ <div class="popover">
3
+ <slot>
4
+ <span
5
+ class="popover__item"
6
+ data-id="delete-popover-text"
7
+ @click="onClickItem"
8
+ >{{ localization.removeMember }}</span
9
+ >
10
+ </slot>
11
+ </div>
12
+ </template>
13
+
14
+ <script lang="ts" setup>
15
+ import { UI_I_Localization } from '~/lib/models/interfaces'
16
+
17
+ const emits = defineEmits<{
18
+ (event: 'hide'): void
19
+ (event: 'click-item'): void
20
+ }>()
21
+
22
+ const localization = computed<UI_I_Localization>(() => useLocal())
23
+ const onClickItem = (): void => {
24
+ emits('click-item')
25
+ }
26
+ const hide = (): void => {
27
+ emits('hide')
28
+ }
29
+ const windowClick = (): void => {
30
+ hide()
31
+ }
32
+
33
+ onMounted(() => {
34
+ setTimeout(() => {
35
+ window.addEventListener('click', windowClick)
36
+ })
37
+ })
38
+ onUnmounted(() => {
39
+ window.removeEventListener('click', windowClick)
40
+ })
41
+ </script>
42
+
43
+ <style lang="scss" scoped>
44
+ @import '~/assets/scss/common/mixins.scss';
45
+
46
+ .popover {
47
+ @include flex($align: center, $just: space-between);
48
+ height: 38px;
49
+ background: var(--block-view-bg-color2);
50
+ padding: 0.3rem;
51
+ margin-left: 0.3rem;
52
+ border: 0.05rem solid var(--block-border-color);
53
+ box-shadow: 0 0.05rem 0.15rem hsl(0deg 0% 55% / 25%);
54
+ transform: translateY(-50%);
55
+ border-radius: 0.15rem;
56
+ font-weight: 400;
57
+ white-space: nowrap;
58
+ z-index: 600;
59
+ &:before,
60
+ &:after {
61
+ content: '';
62
+ position: absolute;
63
+ top: 50%;
64
+ right: 100%;
65
+ width: 0;
66
+ height: 0;
67
+ }
68
+ &:before {
69
+ margin-top: -0.3rem;
70
+ border-bottom: 0.3rem solid transparent;
71
+ border-top: 0.3rem solid transparent;
72
+ border-left: 0;
73
+ border-right: 0.3rem solid var(--block-border-color);
74
+ }
75
+ &:after {
76
+ margin-top: -0.25rem;
77
+ border-right: 0.25rem solid var(--block-view-bg-color2);
78
+ border-top: 0.25rem solid transparent;
79
+ border-bottom: 0.25rem solid transparent;
80
+ }
81
+ &__item {
82
+ @include text($fs: 14px, $c: var(--global-font-color3));
83
+ line-height: 1.15rem;
84
+ padding: 0.05rem 1.2rem 0;
85
+ &:hover {
86
+ background-color: var(--popover-hover-bg-color);
87
+ cursor: pointer;
88
+ }
89
+ }
90
+ }
91
+ </style>
92
+
93
+ <style>
94
+ :root {
95
+ --popover-hover-bg-color: #e8e8e8;
96
+ }
97
+ :root.dark-theme {
98
+ --popover-hover-bg-color: #28404d;
99
+ }
100
+ </style>
@@ -0,0 +1,124 @@
1
+ <template>
2
+ <div class="servers-list">
3
+ <atoms-table-data-grid
4
+ v-model:selected-row="selectedDisk"
5
+ v-model:page-size="pagination.pageSize"
6
+ v-model:page="pagination.page"
7
+ type="any"
8
+ class="data-table"
9
+ test-id="servers-list-table"
10
+ :head-items="headItems"
11
+ :body-items="bodyItems"
12
+ :total-items="1"
13
+ :total-pages="1"
14
+ off-select-by-row
15
+ :loading="loading"
16
+ hide-footer
17
+ >
18
+ <template #type="{ item }">
19
+ <div class="data-table__action-icon">
20
+ <atoms-popover
21
+ test-id="servers-list"
22
+ @click="onShowTooltipForRemove(item)"
23
+ >
24
+ <template #elem>
25
+ <atoms-the-icon name="ellipsis-vertical" />
26
+ </template>
27
+ <template #content>
28
+ <common-wizards-datastore-add-nfs-configuration-servers-list-delete-popover
29
+ v-if="showTooltip && item[0].id === selectedServerForRemove"
30
+ class="data-table__popover"
31
+ @hide="showTooltip = false"
32
+ @click-item="onRemoveServerFromList(item)"
33
+ />
34
+ </template>
35
+ </atoms-popover>
36
+ </div>
37
+ </template>
38
+ </atoms-table-data-grid>
39
+ </div>
40
+ </template>
41
+
42
+ <script lang="ts" setup>
43
+ import {
44
+ UI_I_HeadItem,
45
+ UI_I_BodyItem,
46
+ } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
47
+ import { UI_I_Localization } from '~/lib/models/interfaces'
48
+ import { UI_I_Pagination } from '~/lib/models/table/interfaces'
49
+ import { UI_I_DataServersListItem } from '~/components/common/wizards/datastore/add/nfs/configuration/serversList/lib/models/interfaces'
50
+ import * as serversTable from '~/components/common/wizards/datastore/add/nfs/configuration/serversList/lib/config/serversListConfig'
51
+
52
+ const props = defineProps<{
53
+ dataTable: UI_I_DataServersListItem[] | []
54
+ loading?: boolean
55
+ }>()
56
+ const emits = defineEmits<{
57
+ (event: 'update:data-table', value: UI_I_DataServersListItem[]): void
58
+ }>()
59
+
60
+ const localization = computed<UI_I_Localization>(() => useLocal())
61
+
62
+ const selectedDisk = ref<number | null>(null)
63
+
64
+ const pagination = ref<UI_I_Pagination>({
65
+ page: 1,
66
+ pageSize: 34,
67
+ })
68
+
69
+ // const columnKeys = ref<UI_I_ColumnKey[]>(serversTable.columnKeys(localization.value))
70
+ const headItems = computed<UI_I_HeadItem[]>(() =>
71
+ serversTable.headItems(localization.value)
72
+ )
73
+
74
+ const bodyItems = ref<UI_I_BodyItem[][]>([])
75
+ watch(
76
+ () => props.dataTable,
77
+ (newValue) => {
78
+ if (!newValue?.length) {
79
+ bodyItems.value = []
80
+ return
81
+ }
82
+
83
+ bodyItems.value = serversTable.bodyItems(newValue)
84
+ },
85
+ { deep: true, immediate: true }
86
+ )
87
+
88
+ const selectedServerForRemove = ref<number | null>(null)
89
+ const showTooltip = ref<boolean>(false)
90
+ const onShowTooltipForRemove = (server: UI_I_BodyItem[]): void => {
91
+ selectedServerForRemove.value = server[0].id
92
+ showTooltip.value = true
93
+ }
94
+ const onRemoveServerFromList = (removeItem: UI_I_BodyItem[]): void => {
95
+ const { text } = removeItem[0]
96
+
97
+ const serverList = props.dataTable.filter(
98
+ (server: UI_I_DataServersListItem) => server.server_name !== text
99
+ )
100
+ emits('update:data-table', serverList)
101
+ showTooltip.value = false
102
+ }
103
+ </script>
104
+
105
+ <style lang="scss" scoped>
106
+ .servers-list {
107
+ height: inherit;
108
+ .data-table {
109
+ &__action-icon {
110
+ width: 16px;
111
+ height: 16px;
112
+ cursor: pointer;
113
+ position: relative;
114
+ fill: var(--ellipsis-vertical-icon-color);
115
+ }
116
+
117
+ height: inherit;
118
+ :deep(.datagrid-outer-wrapper) {
119
+ height: inherit;
120
+ padding-top: 0;
121
+ }
122
+ }
123
+ }
124
+ </style>
@@ -0,0 +1,41 @@
1
+ import {
2
+ UI_I_HeadItem,
3
+ UI_I_BodyItem,
4
+ } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
5
+ import {
6
+ constructHeadItem,
7
+ } from '~/components/atoms/table/dataGrid/lib/utils/constructDataTable'
8
+ import { UI_I_Localization } from '~/lib/models/interfaces'
9
+ import { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
10
+ import { serversTableItemsKeys } from '~/components/common/wizards/datastore/add/nfs/configuration/serversList/lib/config/tableKeys'
11
+
12
+ const getItems = (
13
+ localization: UI_I_Localization
14
+ ): [string, boolean, string, string][] => {
15
+ return [
16
+ [localization.serversToBeAdded, true, '96px', serversTableItemsKeys[0]],
17
+ ]
18
+ }
19
+
20
+ export const headItems = (localization: UI_I_Localization): UI_I_HeadItem[] => {
21
+ const result: UI_I_HeadItem[] = []
22
+ getItems(localization).forEach((item) => {
23
+ const col = 'type'
24
+ result.push(constructHeadItem(col, item[0], item[3], false, item[2]))
25
+ })
26
+ return result
27
+ }
28
+
29
+ export const bodyItems = (data: any[]): UI_I_BodyItem[][] => {
30
+ const bodyItems: UI_I_BodyItem[][] = []
31
+ data.forEach((server, key) => {
32
+ bodyItems.push([
33
+ {
34
+ key: 'col0',
35
+ text: server[serversTableItemsKeys[0]],
36
+ id: key,
37
+ },
38
+ ])
39
+ })
40
+ return bodyItems
41
+ }
@@ -0,0 +1,3 @@
1
+ import { T_ServersTableItemsTuple } from '~/components/common/wizards/datastore/add/nfs/configuration/serversList/lib/models/types'
2
+
3
+ export const serversTableItemsKeys: T_ServersTableItemsTuple = ['server_name']