bfg-common 1.5.526 → 1.5.528

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.
@@ -1,320 +1,330 @@
1
- <template>
2
- <div :class="['select-storage', { 'in-wizard': isInWizard }]">
3
- <Teleport v-if="!props.hideAlert" to="#storage-alert-wrapper">
4
- <ui-alert
5
- v-show="props.errors.length"
6
- :messages="props.errors"
7
- :items="props.errors"
8
- status="alert-danger"
9
- test-id="storage-alert"
10
- size="md"
11
- @hide="emits('remove-error')"
12
- />
13
- </Teleport>
14
-
15
- <div class="table-wrap">
16
- <ui-data-table
17
- :data="data"
18
- :options="tableOptionsLocal"
19
- :loading="props.isDatastoreLoading"
20
- :default-layout="false"
21
- :texts="tableTexts"
22
- :skeleton="skeletonData"
23
- test-id="select-storage-data-table"
24
- server-off
25
- size="sm"
26
- @select-row="onSelectRow"
27
- >
28
- <template v-if="!props.isInWizard" #skeleton-header>
29
- <div class="flex justify-between items-center">
30
- <ui-skeleton-item width="80" height="20" />
31
- <ui-skeleton-item width="88" height="22" border-radius="6px" />
32
- </div>
33
- </template>
34
- <template v-if="!props.isInWizard" #insteadOfTitleActions>
35
- <h3 class="storage-count">
36
- {{ storageCount }}
37
- </h3>
38
- </template>
39
- <template #name="{ item }">
40
- <ui-icon
41
- name="datastores"
42
- width="18"
43
- height="18"
44
- class="mr-1 row-datastores-icon"
45
- />
46
- {{ item.text }}
47
- </template>
48
- <template #state="{ item }">
49
- <ui-chip :color="item.data.color" size="sm" rounded>
50
- <ui-icon :name="item.data.iconClassName" width="12" height="12" />
51
- {{ item.data.text }}
52
- </ui-chip>
53
- </template>
54
- </ui-data-table>
55
- </div>
56
-
57
- <div v-if="!props.hideCompatibility" class="compatibility-wrap">
58
- <p class="compatibility">
59
- {{ localization.inventorySummary.compatibility }}
60
- </p>
61
- <div class="compatibility-message flex-align-start">
62
- <ui-skeleton-item v-if="loading" width="160px" height="16px" />
63
- <template v-else>
64
- <template v-if="props.selectedStorage">
65
- <ui-icon
66
- name="success-fill"
67
- width="16"
68
- height="16"
69
- class="icon-compatibility-alert"
70
- />
71
- <span class="compatibility-message-description">{{
72
- localization.common.compatibilityChecksSucceeded
73
- }}</span>
74
- </template>
75
- <template v-else>
76
- <!-- <ui-icon name="error" width="16" height="16" />-->
77
- <span class="compatibility-message-description empty">{{
78
- localization.vmWizard.noStorageSelected
79
- }}</span>
80
- </template>
81
- </template>
82
- </div>
83
- </div>
84
- </div>
85
- </template>
86
-
87
- <script setup lang="ts">
88
- import type {
89
- UI_I_DataTableOptions,
90
- UI_I_DataTableSkeleton,
91
- } from 'bfg-uikit/components/ui/dataTable/models/interfaces'
92
- import type {
93
- UI_I_DataTable,
94
- UI_I_TableTexts,
95
- } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
96
- import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
97
- import type { UI_I_Localization } from '~/lib/models/interfaces'
98
- import {
99
- tableBodyFunc,
100
- tableDataFunc,
101
- tableOptions,
102
- } from '~/components/common/vm/actions/common/select/storage/new/lib/config/table'
103
- import { tableTextsFunc } from '~/lib/config/uiTable'
104
-
105
- const selectedRow = defineModel<number | null>('selectedRow')
106
-
107
- const props = withDefaults(
108
- defineProps<{
109
- datastore: UI_I_DatastoreTableItem[]
110
- isDatastoreLoading: boolean
111
- errors: string[]
112
- selectedStorage: UI_I_DatastoreTableItem | null
113
- hideCompatibility?: boolean
114
- hideAlert?: boolean
115
- isInWizard?: boolean
116
- tableOptions?: UI_I_DataTableOptions
117
- }>(),
118
- {
119
- hideCompatibility: undefined,
120
- hideAlert: undefined,
121
- isInWizard: undefined,
122
- tableOptions: undefined,
123
- }
124
- )
125
- const emits = defineEmits<{
126
- (event: 'remove-error'): void
127
- (event: 'change-storage', value: number): void
128
- }>()
129
-
130
- const tableOptionsLocal = computed<UI_I_DataTableOptions>(
131
- () => props.tableOptions || tableOptions
132
- )
133
-
134
- const localization = computed<UI_I_Localization>(() => useLocal())
135
-
136
- const tableTexts = computed<UI_I_TableTexts>(() =>
137
- tableTextsFunc(localization.value)
138
- )
139
-
140
- const storageCount = computed<string>(() =>
141
- localization.value.vmWizard.storageCount.replace(
142
- '{0}',
143
- data.value.body.length.toString()
144
- )
145
- )
146
- // const loading = ref<boolean>(true)
147
- const data = ref<UI_I_DataTable>(tableDataFunc(localization.value))
148
-
149
- watch(
150
- () => props.datastore,
151
- (newValue: UI_I_DatastoreTableItem[]) => {
152
- // loading.value = true
153
-
154
- // if (!newValue.length || data.value.body.length) return
155
-
156
- data.value.body = tableBodyFunc(
157
- newValue,
158
- localization.value,
159
- selectedRow.value
160
- )
161
-
162
- // loading.value = false
163
- },
164
- { immediate: true, deep: true }
165
- // { deep: true }
166
- )
167
-
168
- const onSelectRow = (selectedData: UI_I_DataTable): void => {
169
- const selectedId = selectedData[0]?.data[0]?.data.id
170
- const selectedItemIndex = props.datastore.findIndex(
171
- (item) => item.id === selectedId
172
- )
173
-
174
- emits('change-storage', selectedItemIndex)
175
- }
176
-
177
- const skeletonData = ref<UI_I_DataTableSkeleton>({
178
- columnsCount: 5,
179
- headColumns: [],
180
- bodyColumns: [],
181
- })
182
- </script>
183
-
184
- <style>
185
- :root {
186
- --select-storage-border-color: #e9ebed;
187
- --select-storage-bg-color: #ffffff;
188
- --select-storage-title-color: #4d5d69;
189
- --select-storage-compatibility-bg-color: #ffffff;
190
- --select-storage-compatibility-description-color: #4d5d69;
191
- --select-storage-compatibility-empty-description-color: #9da6ad;
192
- --select-storage-compatibility-table-column-button-hover-bg: #f6f7f8;
193
- --select-storage-compatibility-table-column-button-active-hover-bg: #f0f8fd;
194
- }
195
- :root.dark-theme {
196
- --select-storage-border-color: #e9ebed1f;
197
- --select-storage-bg-color: var(--wizard-right-bg);
198
- --select-storage-title-color: #e9eaec;
199
- --select-storage-compatibility-bg-color: #1b2a371f;
200
- --select-storage-compatibility-description-color: #e9eaec;
201
- --select-storage-compatibility-empty-description-color: #9da6ad;
202
- --select-storage-compatibility-table-column-button-hover-bg: linear-gradient(
203
- 0deg,
204
- rgba(233, 234, 236, 0.04) 0%,
205
- rgba(233, 234, 236, 0.04) 100%
206
- ),
207
- rgba(27, 42, 55, 0.24);
208
- --select-storage-compatibility-table-column-button-active-hover-bg: linear-gradient(
209
- 0deg,
210
- rgba(43, 162, 222, 0.08) 0%,
211
- rgba(43, 162, 222, 0.08) 100%
212
- ),
213
- rgba(27, 42, 55, 0.24);
214
- }
215
- </style>
216
- <style scoped lang="scss">
217
- //:root.dark-theme {
218
- // .select-storage {
219
- // &.in-wizard {
220
- // :deep(.column-manager-button) {
221
- // &:hover {
222
- // background: #b8bcc10a;
223
- // }
224
- // &.active:hover {
225
- // background-color: #2785b614;
226
- // }
227
- // }
228
- // }
229
- // }
230
- //}
231
- .select-storage {
232
- padding-top: 12px;
233
- //padding-bottom: 16px;
234
-
235
- :deep(.title-sm) {
236
- font-size: 12px;
237
- }
238
-
239
- :deep(.table-container.default-layout) {
240
- box-shadow: unset;
241
- padding: 0;
242
- }
243
- .storage-count {
244
- font-size: 16px;
245
- font-weight: 500;
246
- color: var(--select-storage-title-color);
247
- }
248
-
249
- :deep(.column-manager-button) {
250
- span {
251
- font-size: 12px;
252
- font-weight: 500;
253
- }
254
- //&:not(.active):hover {
255
- // background-color: var(
256
- // --select-storage-compatibility-table-column-button-hover-bg
257
- // );
258
- // color: var(--btn-table-manager-color);
259
- //}
260
- //&.active:hover {
261
- // background-color: var(
262
- // --select-storage-compatibility-table-column-button-active-hover-bg
263
- // );
264
- //}
265
- }
266
-
267
- &:not(.in-wizard) {
268
- :deep(.bottom-grid-content) {
269
- border: 1px solid var(--select-storage-border-color);
270
- border-radius: 8px;
271
- padding: 12px;
272
- //background-color: var(--select-storage-bg-color);
273
- }
274
- :deep(.select-row-item) {
275
- background-color: var(--select-storage-bg-color);
276
- }
277
- }
278
-
279
- :deep(.table-title-actions-container) {
280
- justify-content: flex-start;
281
- }
282
- :deep(.table-container .table-title) {
283
- margin-bottom: 12px;
284
- }
285
-
286
- .compatibility-wrap {
287
- margin-top: 24px;
288
-
289
- .compatibility {
290
- font-size: 16px;
291
- font-weight: 500;
292
- color: var(--select-storage-title-color);
293
- margin-bottom: 16px;
294
- }
295
- .compatibility-message {
296
- border-radius: 8px;
297
- border: 1px solid var(--select-storage-border-color);
298
- padding: 12px;
299
- background-color: var(--select-storage-compatibility-bg-color);
300
- gap: 10px;
301
-
302
- .icon-compatibility-alert {
303
- min-width: 16px;
304
- min-height: 16px;
305
- }
306
- .compatibility-message-description {
307
- font-size: 13px;
308
- color: var(--select-storage-compatibility-description-color);
309
-
310
- &.empty {
311
- color: var(--select-storage-compatibility-empty-description-color);
312
- }
313
- }
314
- }
315
- }
316
- .row-datastores-icon {
317
- min-width: 18px;
318
- }
319
- }
320
- </style>
1
+ <template>
2
+ <div :class="['select-storage', { 'in-wizard': isInWizard }]">
3
+ <Teleport v-if="!props.hideAlert" to="#storage-alert-wrapper">
4
+ <ui-alert
5
+ v-show="props.errors.length"
6
+ :messages="props.errors"
7
+ :items="props.errors"
8
+ status="alert-danger"
9
+ test-id="storage-alert"
10
+ size="md"
11
+ @hide="emits('remove-error')"
12
+ />
13
+ </Teleport>
14
+
15
+ <div class="table-wrap">
16
+ <ui-data-table
17
+ :data="data"
18
+ :options="tableOptionsLocal"
19
+ :loading="props.isDatastoreLoading"
20
+ :default-layout="false"
21
+ :texts="tableTexts"
22
+ :skeleton="skeletonData"
23
+ test-id="select-storage-data-table"
24
+ server-off
25
+ size="sm"
26
+ @select-row="onSelectRow"
27
+ >
28
+ <template v-if="!props.isInWizard" #skeleton-header>
29
+ <div class="flex justify-between items-center">
30
+ <ui-skeleton-item width="80" height="20" />
31
+ <ui-skeleton-item width="88" height="22" border-radius="6px" />
32
+ </div>
33
+ </template>
34
+ <template v-if="!props.isInWizard" #insteadOfTitleActions>
35
+ <h3 class="storage-count">
36
+ {{ storageCount }}
37
+ </h3>
38
+ </template>
39
+ <template #name="{ item }">
40
+ <ui-icon
41
+ name="datastores"
42
+ width="18"
43
+ height="18"
44
+ class="mr-1 row-datastores-icon"
45
+ />
46
+ {{ item.text }}
47
+ </template>
48
+ <template #state="{ item }">
49
+ <ui-chip :color="item.data.color" size="sm" rounded>
50
+ <ui-icon :name="item.data.iconClassName" width="12" height="12" />
51
+ {{ item.data.text }}
52
+ </ui-chip>
53
+ </template>
54
+ </ui-data-table>
55
+ </div>
56
+
57
+ <div v-if="!props.hideCompatibility" class="compatibility-wrap">
58
+ <p class="compatibility">
59
+ {{ localization.inventorySummary.compatibility }}
60
+ </p>
61
+ <div class="compatibility-message flex-align-start">
62
+ <ui-skeleton-item v-if="loading" width="160px" height="16px" />
63
+ <template v-else>
64
+ <template v-if="props.selectedStorage">
65
+ <ui-icon
66
+ name="success-fill"
67
+ width="16"
68
+ height="16"
69
+ class="icon-compatibility-alert"
70
+ />
71
+ <span class="compatibility-message-description">{{
72
+ localization.common.compatibilityChecksSucceeded
73
+ }}</span>
74
+ </template>
75
+ <template v-else>
76
+ <!-- <ui-icon name="error" width="16" height="16" />-->
77
+ <span class="compatibility-message-description empty">{{
78
+ localization.vmWizard.noStorageSelected
79
+ }}</span>
80
+ </template>
81
+ </template>
82
+ </div>
83
+ </div>
84
+ </div>
85
+ </template>
86
+
87
+ <script setup lang="ts">
88
+ import type {
89
+ UI_I_DataTableOptions,
90
+ UI_I_DataTableSkeleton,
91
+ } from 'bfg-uikit/components/ui/dataTable/models/interfaces'
92
+ import type {
93
+ UI_I_DataTable,
94
+ UI_I_TableTexts,
95
+ } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
96
+ import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
97
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
98
+ import {
99
+ tableBodyFunc,
100
+ tableDataFunc,
101
+ tableOptions,
102
+ } from '~/components/common/vm/actions/common/select/storage/new/lib/config/table'
103
+ import { tableTextsFunc } from '~/lib/config/uiTable'
104
+
105
+ const selectedRow = defineModel<number | null>('selectedRow')
106
+
107
+ const props = withDefaults(
108
+ defineProps<{
109
+ datastore: UI_I_DatastoreTableItem[]
110
+ isDatastoreLoading: boolean
111
+ errors: string[]
112
+ selectedStorage: UI_I_DatastoreTableItem | null
113
+ hideCompatibility?: boolean
114
+ hideAlert?: boolean
115
+ isInWizard?: boolean
116
+ tableOptions?: UI_I_DataTableOptions
117
+ }>(),
118
+ {
119
+ hideCompatibility: undefined,
120
+ hideAlert: undefined,
121
+ isInWizard: undefined,
122
+ tableOptions: undefined,
123
+ }
124
+ )
125
+ const emits = defineEmits<{
126
+ (event: 'remove-error'): void
127
+ (event: 'change-storage', value: number): void
128
+ }>()
129
+
130
+ const tableOptionsLocal = computed<UI_I_DataTableOptions>(
131
+ () => props.tableOptions || tableOptions
132
+ )
133
+
134
+ const localization = computed<UI_I_Localization>(() => useLocal())
135
+
136
+ const tableTexts = computed<UI_I_TableTexts>(() =>
137
+ tableTextsFunc(localization.value)
138
+ )
139
+
140
+ const storageCount = computed<string>(() =>
141
+ localization.value.vmWizard.storageCount.replace(
142
+ '{0}',
143
+ data.value.body.length.toString()
144
+ )
145
+ )
146
+ // const loading = ref<boolean>(true)
147
+ const data = ref<UI_I_DataTable>(tableDataFunc(localization.value))
148
+
149
+ watch(
150
+ () => props.datastore,
151
+ (newValue: UI_I_DatastoreTableItem[]) => {
152
+ // loading.value = true
153
+
154
+ // if (!newValue.length || data.value.body.length) return
155
+
156
+ data.value.body = tableBodyFunc(
157
+ newValue,
158
+ localization.value,
159
+ selectedRow.value
160
+ )
161
+
162
+ // loading.value = false
163
+ },
164
+ { immediate: true, deep: true }
165
+ // { deep: true }
166
+ )
167
+
168
+ watch(selectedRow, (newValue) => {
169
+ if (newValue && props.datastore.length) {
170
+ data.value.body = tableBodyFunc(
171
+ props.datastore,
172
+ localization.value,
173
+ newValue
174
+ )
175
+ }
176
+ })
177
+
178
+ const onSelectRow = (selectedData: UI_I_DataTable): void => {
179
+ const selectedId = selectedData[0]?.data[0]?.data.id
180
+ const selectedItemIndex = props.datastore.findIndex(
181
+ (item) => item.id === selectedId
182
+ )
183
+
184
+ emits('change-storage', selectedItemIndex)
185
+ }
186
+
187
+ const skeletonData = ref<UI_I_DataTableSkeleton>({
188
+ columnsCount: 5,
189
+ headColumns: [],
190
+ bodyColumns: [],
191
+ })
192
+ </script>
193
+
194
+ <style>
195
+ :root {
196
+ --select-storage-border-color: #e9ebed;
197
+ --select-storage-bg-color: #ffffff;
198
+ --select-storage-title-color: #4d5d69;
199
+ --select-storage-compatibility-bg-color: #ffffff;
200
+ --select-storage-compatibility-description-color: #4d5d69;
201
+ --select-storage-compatibility-empty-description-color: #9da6ad;
202
+ --select-storage-compatibility-table-column-button-hover-bg: #f6f7f8;
203
+ --select-storage-compatibility-table-column-button-active-hover-bg: #f0f8fd;
204
+ }
205
+ :root.dark-theme {
206
+ --select-storage-border-color: #e9ebed1f;
207
+ --select-storage-bg-color: var(--wizard-right-bg);
208
+ --select-storage-title-color: #e9eaec;
209
+ --select-storage-compatibility-bg-color: #1b2a371f;
210
+ --select-storage-compatibility-description-color: #e9eaec;
211
+ --select-storage-compatibility-empty-description-color: #9da6ad;
212
+ --select-storage-compatibility-table-column-button-hover-bg: linear-gradient(
213
+ 0deg,
214
+ rgba(233, 234, 236, 0.04) 0%,
215
+ rgba(233, 234, 236, 0.04) 100%
216
+ ),
217
+ rgba(27, 42, 55, 0.24);
218
+ --select-storage-compatibility-table-column-button-active-hover-bg: linear-gradient(
219
+ 0deg,
220
+ rgba(43, 162, 222, 0.08) 0%,
221
+ rgba(43, 162, 222, 0.08) 100%
222
+ ),
223
+ rgba(27, 42, 55, 0.24);
224
+ }
225
+ </style>
226
+ <style scoped lang="scss">
227
+ //:root.dark-theme {
228
+ // .select-storage {
229
+ // &.in-wizard {
230
+ // :deep(.column-manager-button) {
231
+ // &:hover {
232
+ // background: #b8bcc10a;
233
+ // }
234
+ // &.active:hover {
235
+ // background-color: #2785b614;
236
+ // }
237
+ // }
238
+ // }
239
+ // }
240
+ //}
241
+ .select-storage {
242
+ padding-top: 12px;
243
+ //padding-bottom: 16px;
244
+
245
+ :deep(.title-sm) {
246
+ font-size: 12px;
247
+ }
248
+
249
+ :deep(.table-container.default-layout) {
250
+ box-shadow: unset;
251
+ padding: 0;
252
+ }
253
+ .storage-count {
254
+ font-size: 16px;
255
+ font-weight: 500;
256
+ color: var(--select-storage-title-color);
257
+ }
258
+
259
+ :deep(.column-manager-button) {
260
+ span {
261
+ font-size: 12px;
262
+ font-weight: 500;
263
+ }
264
+ //&:not(.active):hover {
265
+ // background-color: var(
266
+ // --select-storage-compatibility-table-column-button-hover-bg
267
+ // );
268
+ // color: var(--btn-table-manager-color);
269
+ //}
270
+ //&.active:hover {
271
+ // background-color: var(
272
+ // --select-storage-compatibility-table-column-button-active-hover-bg
273
+ // );
274
+ //}
275
+ }
276
+
277
+ &:not(.in-wizard) {
278
+ :deep(.bottom-grid-content) {
279
+ border: 1px solid var(--select-storage-border-color);
280
+ border-radius: 8px;
281
+ padding: 12px;
282
+ //background-color: var(--select-storage-bg-color);
283
+ }
284
+ :deep(.select-row-item) {
285
+ background-color: var(--select-storage-bg-color);
286
+ }
287
+ }
288
+
289
+ :deep(.table-title-actions-container) {
290
+ justify-content: flex-start;
291
+ }
292
+ :deep(.table-container .table-title) {
293
+ margin-bottom: 12px;
294
+ }
295
+
296
+ .compatibility-wrap {
297
+ margin-top: 24px;
298
+
299
+ .compatibility {
300
+ font-size: 16px;
301
+ font-weight: 500;
302
+ color: var(--select-storage-title-color);
303
+ margin-bottom: 16px;
304
+ }
305
+ .compatibility-message {
306
+ border-radius: 8px;
307
+ border: 1px solid var(--select-storage-border-color);
308
+ padding: 12px;
309
+ background-color: var(--select-storage-compatibility-bg-color);
310
+ gap: 10px;
311
+
312
+ .icon-compatibility-alert {
313
+ min-width: 16px;
314
+ min-height: 16px;
315
+ }
316
+ .compatibility-message-description {
317
+ font-size: 13px;
318
+ color: var(--select-storage-compatibility-description-color);
319
+
320
+ &.empty {
321
+ color: var(--select-storage-compatibility-empty-description-color);
322
+ }
323
+ }
324
+ }
325
+ }
326
+ .row-datastores-icon {
327
+ min-width: 18px;
328
+ }
329
+ }
330
+ </style>
@@ -48,7 +48,7 @@ const buildValidationUrl = (
48
48
  params.set('kind', String(UI_E_Kind.STORAGE_VALIDATION_NAME))
49
49
  if (datacenterId) params.set('datacenter', datacenterId)
50
50
 
51
- return `/ui/object/validate_name?${params.toString()}`
51
+ return `/ui/object/validate_name_datacenter?${params.toString()}`
52
52
  }
53
53
 
54
54
  export const validateNameAndGenerateDataId = (