bfg-common 1.5.215 → 1.5.217

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,219 +1,200 @@
1
- <template>
2
- <div class="select-storage">
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
- @remove="emits('remove-error')"
12
- />
13
- </Teleport>
14
-
15
- <div class="table-wrap">
16
- <ui-data-table
17
- :data="data"
18
- :options="tableOptions"
19
- :loading="loading"
20
- :default-layout="false"
21
- :texts="tableTexts"
22
- test-id="select-storage-data-table"
23
- server-off
24
- size="sm"
25
- @select-row="onSelectRow"
26
- >
27
- <template #insteadOfTitleActions
28
- ><h3 class="storage-count">
29
- {{ storageCount }}
30
- </h3></template
31
- >
32
- <template #state="{ item }">
33
- <ui-chip :color="item.data.color" rounded>
34
- <ui-icon :name="item.data.iconClassName" width="14" height="14" />
35
- {{ item.data.text }}
36
- </ui-chip>
37
- </template>
38
- </ui-data-table>
39
- </div>
40
-
41
- <div v-if="!props.hideCompatibility" class="compatibility-wrap">
42
- <p class="compatibility">
43
- {{ localization.inventorySummary.compatibility }}
44
- </p>
45
- <div class="compatibility-message flex-align-center">
46
- <ui-skeleton-item v-if="loading" width="160px" height="16px" />
47
- <template v-else>
48
- <template v-if="props.selectedStorage">
49
- <ui-icon
50
- name="success-fill"
51
- width="16"
52
- height="16"
53
- class="icon-compatibility-alert"
54
- />
55
- <span class="compatibility-message-description">{{
56
- localization.common.compatibilityChecksSucceeded
57
- }}</span>
58
- </template>
59
- <template v-else>
60
- <!-- <ui-icon name="error" width="16" height="16" />-->
61
- <span class="compatibility-message-description">{{
62
- localization.vmWizard.noStorageSelected
63
- }}</span>
64
- </template>
65
- </template>
66
- </div>
67
- </div>
68
- </div>
69
- </template>
70
-
71
- <script setup lang="ts">
72
- import type {
73
- UI_I_DataTable,
74
- UI_I_TableTexts,
75
- } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
76
- import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
77
- import type { UI_I_Localization } from '~/lib/models/interfaces'
78
- import {
79
- tableBodyFunc,
80
- tableDataFunc,
81
- tableOptions,
82
- } from '~/components/common/vm/actions/common/select/storage/new/lib/config/table'
83
- import { tableTextsFunc } from '~/lib/config/uiTable'
84
-
85
- const selectedRow = defineModel<number | null>('selectedRow')
86
-
87
- const props = defineProps<{
88
- datastore: UI_I_DatastoreTableItem[]
89
- errors: string[]
90
- selectedStorage: UI_I_DatastoreTableItem | null
91
- hideCompatibility?: boolean
92
- hideAlert?: boolean
93
- }>()
94
- const emits = defineEmits<{
95
- (event: 'remove-error'): void
96
- (event: 'change-storage', value: number): void
97
- }>()
98
-
99
- const localization = computed<UI_I_Localization>(() => useLocal())
100
-
101
- const tableTexts = computed<UI_I_TableTexts>(() =>
102
- tableTextsFunc(localization.value)
103
- )
104
-
105
- const storageCount = computed<string>(() =>
106
- localization.value.vmWizard.storageCount.replace(
107
- '{0}',
108
- data.value.body.length.toString()
109
- )
110
- )
111
- const loading = ref<boolean>(true)
112
- const data = ref<UI_I_DataTable>(tableDataFunc(localization.value))
113
-
114
- watch(
115
- () => props.datastore,
116
- (newValue: UI_I_DatastoreTableItem[]) => {
117
- loading.value = true
118
-
119
- // if (!newValue.length || data.value.body.length) return
120
-
121
- data.value.body = tableBodyFunc(
122
- newValue,
123
- localization.value,
124
- selectedRow.value
125
- )
126
-
127
- loading.value = false
128
- },
129
- { immediate: true, deep: true }
130
- // { deep: true }
131
- )
132
-
133
- const onSelectRow = (selectedData: UI_I_DataTable): void => {
134
- const selectedId = selectedData[0]?.data[0]?.key
135
- const selectedItemIndex = props.datastore.findIndex(
136
- (item) => item.id === selectedId
137
- )
138
-
139
- emits('change-storage', selectedItemIndex)
140
- }
141
- </script>
142
-
143
- <style>
144
- :root {
145
- --select-storage-border-color: #e9ebed;
146
- --select-storage-bg-color: #ffffff;
147
- --select-storage-title-color: #4d5d69;
148
- --select-storage-compatibility-bg-color: #ffffff;
149
- --select-storage-compatibility-description-color: #4d5d69;
150
- --select-storage-compatibility-empty-description-color: #9da6ad;
151
- }
152
- :root.dark-theme {
153
- --select-storage-border-color: #e9ebed1f;
154
- --select-storage-bg-color: var(--wizard-right-bg);
155
- --select-storage-title-color: #e9eaec;
156
- --select-storage-compatibility-bg-color: #1b2a371f;
157
- --select-storage-compatibility-description-color: #9da6ad;
158
- --select-storage-compatibility-empty-description-color: #9da6ad;
159
- }
160
- </style>
161
- <style scoped lang="scss">
162
- .select-storage {
163
- padding-top: 12px;
164
- padding-bottom: 22px;
165
-
166
- .storage-count {
167
- font-size: 16px;
168
- font-weight: 500;
169
- color: var(--select-storage-title-color);
170
- }
171
-
172
- :deep(.bottom-grid-content) {
173
- border: 1px solid var(--select-storage-border-color);
174
- border-radius: 8px;
175
- padding: 12px;
176
- background-color: var(--select-storage-bg-color);
177
- }
178
- :deep(.select-row-item) {
179
- background-color: var(--select-storage-bg-color);
180
- }
181
- :deep(.table-title-actions-container) {
182
- justify-content: flex-start;
183
- }
184
- :deep(.table-container .table-title) {
185
- margin-bottom: 12px;
186
- }
187
-
188
- .compatibility-wrap {
189
- margin-top: 24px;
190
-
191
- .compatibility {
192
- font-size: 16px;
193
- font-weight: 500;
194
- color: var(--select-storage-title-color);
195
- margin-bottom: 16px;
196
- }
197
- .compatibility-message {
198
- border-radius: 8px;
199
- border: 1px solid var(--select-storage-border-color);
200
- padding: 12px;
201
- background-color: var(--select-storage-compatibility-bg-color);
202
- gap: 10px;
203
-
204
- .icon-compatibility-alert {
205
- min-width: 16px;
206
- min-height: 16px;
207
- }
208
- .compatibility-message-description {
209
- font-size: 13px;
210
- color: var(--select-storage-compatibility-description-color);
211
-
212
- &.empty {
213
- color: var(--select-storage-compatibility-empty-description-color);
214
- }
215
- }
216
- }
217
- }
218
- }
219
- </style>
1
+ <template>
2
+ <div class="select-storage">
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
+ @remove="emits('remove-error')"
11
+ />
12
+ </Teleport>
13
+
14
+ <div class="table-wrap">
15
+ <ui-data-table
16
+ :data="data"
17
+ :options="tableOptions"
18
+ :loading="loading"
19
+ :default-layout="false"
20
+ :texts="tableTexts"
21
+ test-id="select-storage-data-table"
22
+ server-off
23
+ size="sm"
24
+ @select-row="onSelectRow"
25
+ >
26
+ <template #insteadOfTitleActions
27
+ ><h3 class="storage-count">
28
+ {{ storageCount }}
29
+ </h3></template
30
+ >
31
+ <template #state="{ item }">
32
+ <ui-chip :color="item.data.color" rounded>
33
+ <ui-icon :name="item.data.iconClassName" width="14" height="14" />
34
+ {{ item.data.text }}
35
+ </ui-chip>
36
+ </template>
37
+ </ui-data-table>
38
+ </div>
39
+
40
+ <div v-if="!props.hideCompatibility" class="compatibility-wrap">
41
+ <p class="compatibility">
42
+ {{ localization.inventorySummary.compatibility }}
43
+ </p>
44
+ <div class="compatibility-message flex-align-center">
45
+ <ui-skeleton-item v-if="loading" width="160px" height="16px" />
46
+ <template v-else>
47
+ <template v-if="props.selectedStorage">
48
+ <ui-icon name="success-fill" width="16" height="16" />
49
+ <span class="compatibility-message-description">{{
50
+ localization.common.compatibilityChecksSucceeded
51
+ }}</span>
52
+ </template>
53
+ <template v-else>
54
+ <!-- <ui-icon name="error" width="16" height="16" />-->
55
+ <span class="compatibility-message-description">{{
56
+ localization.vmWizard.noStorageSelected
57
+ }}</span>
58
+ </template>
59
+ </template>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ </template>
64
+
65
+ <script setup lang="ts">
66
+ import type {
67
+ UI_I_DataTable,
68
+ UI_I_TableTexts,
69
+ } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
70
+ import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
71
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
72
+ import {
73
+ tableBodyFunc,
74
+ tableDataFunc,
75
+ tableOptions,
76
+ } from '~/components/common/vm/actions/common/select/storage/new/lib/config/table'
77
+ import { tableTextsFunc } from '~/lib/config/uiTable'
78
+
79
+ const selectedRow = defineModel<number | null>('selectedRow')
80
+
81
+ const props = defineProps<{
82
+ datastore: UI_I_DatastoreTableItem[]
83
+ errors: string[]
84
+ selectedStorage: UI_I_DatastoreTableItem | null
85
+ hideCompatibility?: boolean
86
+ hideAlert?: boolean
87
+ }>()
88
+ const emits = defineEmits<{
89
+ (event: 'remove-error'): void
90
+ (event: 'change-storage', value: number): void
91
+ }>()
92
+
93
+ const localization = computed<UI_I_Localization>(() => useLocal())
94
+
95
+ const tableTexts = computed<UI_I_TableTexts>(() =>
96
+ tableTextsFunc(localization.value)
97
+ )
98
+
99
+ const storageCount = computed<string>(() =>
100
+ localization.value.vmWizard.storageCount.replace(
101
+ '{0}',
102
+ data.value.body.length.toString()
103
+ )
104
+ )
105
+ const loading = ref<boolean>(true)
106
+ const data = ref<UI_I_DataTable>(tableDataFunc(localization.value))
107
+
108
+ watch(
109
+ () => props.datastore,
110
+ (newValue: UI_I_DatastoreTableItem[]) => {
111
+ loading.value = true
112
+
113
+ // if (!newValue.length || data.value.body.length) return
114
+
115
+ data.value.body = tableBodyFunc(
116
+ newValue,
117
+ localization.value,
118
+ selectedRow.value
119
+ )
120
+
121
+ loading.value = false
122
+ },
123
+ { immediate: true, deep: true }
124
+ // { deep: true }
125
+ )
126
+
127
+ const onSelectRow = (selectedData: UI_I_DataTable): void => {
128
+ const selectedId = selectedData[0]?.data[0]?.key
129
+ const selectedItemIndex = props.datastore.findIndex(
130
+ (item) => item.id === selectedId
131
+ )
132
+
133
+ emits('change-storage', selectedItemIndex)
134
+ }
135
+ </script>
136
+
137
+ <style>
138
+ :root {
139
+ --select-storage-border-color: #e9ebed;
140
+ --select-storage-bg-color: #ffffff;
141
+ --select-storage-title-color: #4d5d69;
142
+ --select-storage-compatibility-description-color: #4d5d69;
143
+ }
144
+ :root.dark-theme {
145
+ --select-storage-border-color: #e9ebed1f;
146
+ --select-storage-bg-color: var(--wizard-right-bg);
147
+ --select-storage-title-color: #e9eaec;
148
+ --select-storage-compatibility-description-color: #9da6ad;
149
+ }
150
+ </style>
151
+ <style scoped lang="scss">
152
+ .select-storage {
153
+ padding-top: 16px;
154
+
155
+ .storage-count {
156
+ font-size: 16px;
157
+ font-weight: 500;
158
+ color: var(--select-storage-title-color);
159
+ }
160
+
161
+ :deep(.bottom-grid-content) {
162
+ border: 1px solid var(--select-storage-border-color);
163
+ border-radius: 8px;
164
+ padding: 12px;
165
+ background-color: var(--select-storage-bg-color);
166
+ }
167
+ :deep(.select-row-item) {
168
+ background-color: var(--select-storage-bg-color);
169
+ }
170
+ :deep(.table-title-actions-container) {
171
+ justify-content: flex-start;
172
+ }
173
+ :deep(.table-container .table-title) {
174
+ margin-bottom: 12px;
175
+ }
176
+
177
+ .compatibility-wrap {
178
+ margin-top: 24px;
179
+
180
+ .compatibility {
181
+ font-size: 16px;
182
+ font-weight: 500;
183
+ color: var(--select-storage-title-color);
184
+ margin-bottom: 16px;
185
+ }
186
+ .compatibility-message {
187
+ border-radius: 8px;
188
+ border: 1px solid var(--select-storage-border-color);
189
+ padding: 12px;
190
+ background-color: var(--select-storage-bg-color);
191
+ gap: 12px;
192
+
193
+ .compatibility-message-description {
194
+ font-size: 13px;
195
+ color: var(--select-storage-compatibility-description-color);
196
+ }
197
+ }
198
+ }
199
+ }
200
+ </style>