bfg-common 1.6.111 → 1.6.112

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 (28) hide show
  1. package/assets/localization/local_be.json +1 -2
  2. package/assets/localization/local_en.json +1 -2
  3. package/assets/localization/local_hy.json +1 -2
  4. package/assets/localization/local_kk.json +1 -2
  5. package/assets/localization/local_ru.json +4 -5
  6. package/assets/localization/local_zh.json +1 -2
  7. package/components/common/configure/advancedSystemSettings/AdvancedSystemSettings.vue +17 -25
  8. package/components/common/configure/advancedSystemSettings/modals/edit/Edit.vue +4 -4
  9. package/components/common/configure/advancedSystemSettings/modals/edit/New.vue +23 -42
  10. package/components/common/configure/advancedSystemSettings/modals/edit/Old.vue +3 -5
  11. package/components/common/configure/advancedSystemSettings/tableView/TableView.vue +2 -27
  12. package/components/common/configure/advancedSystemSettings/tableView/new/New.vue +130 -60
  13. package/components/common/configure/advancedSystemSettings/tableView/new/lib/config/hostTable.ts +308 -0
  14. package/components/common/configure/advancedSystemSettings/tableView/old/Old.vue +41 -14
  15. package/components/common/configure/advancedSystemSettings/tableView/{field → old/field}/Field.vue +50 -20
  16. package/components/common/configure/advancedSystemSettings/tableView/old/field/lib/models/enums.ts +14 -0
  17. package/components/common/configure/advancedSystemSettings/tools/New.vue +3 -64
  18. package/components/common/configure/advancedSystemSettings/tools/Old.vue +2 -2
  19. package/components/common/configure/advancedSystemSettings/tools/Tools.vue +2 -2
  20. package/components/common/monitor/advanced/tools/chartOptionsModal/ChartOptionsModal.vue +569 -569
  21. package/package.json +1 -1
  22. package/components/common/configure/advancedSystemSettings/New.vue +0 -37
  23. package/components/common/configure/advancedSystemSettings/Old.vue +0 -36
  24. package/components/common/configure/advancedSystemSettings/tableView/field/New.vue +0 -88
  25. package/components/common/configure/advancedSystemSettings/tableView/field/Old.vue +0 -73
  26. package/components/common/configure/advancedSystemSettings/tableView/field/lib/config/index.ts +0 -10
  27. package/components/common/configure/advancedSystemSettings/tableView/field/lib/models/enums.ts +0 -14
  28. package/components/common/configure/advancedSystemSettings/tableView/new/lib/config/index.ts +0 -112
@@ -0,0 +1,308 @@
1
+ import type {
2
+ UI_I_DataTableBody,
3
+ UI_I_DataTableOptions,
4
+ UI_I_DataTableHeader,
5
+ } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
6
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
7
+ import type { UI_I_HostTableItem } from '~/components/common/wizards/vm/migrate/steps/computeResource/tableView/lib/models/interfaces'
8
+ import {
9
+ UI_E_DeviceStatus,
10
+ UI_E_DeviceStatusChipColor,
11
+ UI_E_DeviceStatusIcon,
12
+ } from '~/components/common/wizards/vm/migrate/steps/computeResource/tableView/new/lib/models/enums'
13
+ import {
14
+ hostIconByState,
15
+ hostLocalizationByState,
16
+ } from '~/components/common/lib/config/states'
17
+
18
+ // Маппинг для статусов
19
+ const STATUS_MAPPING = {
20
+ [UI_E_DeviceStatus.Unknown]: {
21
+ icon: UI_E_DeviceStatusIcon.HelpIcon,
22
+ chipColor: UI_E_DeviceStatusChipColor.Primary,
23
+ },
24
+ [UI_E_DeviceStatus.Supported]: {
25
+ icon: UI_E_DeviceStatusIcon.StatusCheck,
26
+ chipColor: UI_E_DeviceStatusChipColor.Green,
27
+ },
28
+ [UI_E_DeviceStatus.NotSupported]: {
29
+ icon: UI_E_DeviceStatusIcon.Close,
30
+ chipColor: UI_E_DeviceStatusChipColor.Red,
31
+ },
32
+ }
33
+
34
+ export const getHeaderDataFunc = (
35
+ localization: UI_I_Localization
36
+ ): UI_I_DataTableHeader[] => [
37
+ {
38
+ col: 'col0',
39
+ colName: 'name',
40
+ text: localization.common.name,
41
+ isSortable: true,
42
+ sort: 'asc',
43
+ width: '180px',
44
+ show: true,
45
+ filter: false,
46
+ },
47
+ {
48
+ col: 'col1',
49
+ colName: 'state',
50
+ text: localization.inventorySummary.state,
51
+ isSortable: true,
52
+ sort: 'asc',
53
+ width: '96px',
54
+ show: true,
55
+ filter: false,
56
+ },
57
+ {
58
+ col: 'col2',
59
+ colName: 'cluster',
60
+ text: localization.common.cluster,
61
+ isSortable: true,
62
+ sort: 'asc',
63
+ width: '96px',
64
+ show: true,
65
+ filter: false,
66
+ },
67
+ {
68
+ col: 'col3',
69
+ colName: 'fault_domain',
70
+ text: localization.common.faultDomain,
71
+ isSortable: true,
72
+ sort: 'asc',
73
+ width: '96px',
74
+ show: true,
75
+ filter: false,
76
+ },
77
+ {
78
+ col: 'col4',
79
+ colName: 'consumed_cpu',
80
+ text: `${localization.common.consumedCpu} %`,
81
+ isSortable: true,
82
+ sort: 'asc',
83
+ width: '96px',
84
+ show: true,
85
+ filter: false,
86
+ },
87
+ {
88
+ col: 'col5',
89
+ colName: 'consumed_mem',
90
+ text: `${localization.common.consumedMemory} %`,
91
+ isSortable: true,
92
+ sort: 'asc',
93
+ width: '96px',
94
+ show: true,
95
+ filter: false,
96
+ },
97
+ {
98
+ col: 'col6',
99
+ colName: 'ha_state',
100
+ text: localization.common.haState,
101
+ isSortable: true,
102
+ sort: 'asc',
103
+ width: '96px',
104
+ show: true,
105
+ filter: false,
106
+ },
107
+ {
108
+ col: 'col7',
109
+ colName: 'uptime',
110
+ text: localization.inventorySummary.uptime,
111
+ isSortable: true,
112
+ sort: 'asc',
113
+ width: '96px',
114
+ show: true,
115
+ filter: false,
116
+ },
117
+ {
118
+ col: 'col8',
119
+ colName: 'cert_valid_to',
120
+ text: localization.common.certificateValidTo,
121
+ isSortable: true,
122
+ sort: 'asc',
123
+ width: '96px',
124
+ show: true,
125
+ filter: false,
126
+ },
127
+ {
128
+ col: 'col9',
129
+ colName: 'mem_size',
130
+ text: `${localization.common.memorySize} (${localization.common.mb})`,
131
+ isSortable: true,
132
+ sort: 'asc',
133
+ width: '96px',
134
+ show: true,
135
+ filter: false,
136
+ },
137
+ {
138
+ col: 'col10',
139
+ colName: 'cpus',
140
+ text: localization.common.cpus,
141
+ isSortable: true,
142
+ sort: 'asc',
143
+ width: '96px',
144
+ show: true,
145
+ filter: false,
146
+ },
147
+ {
148
+ col: 'col11',
149
+ colName: 'nics',
150
+ text: localization.inventorySummary.nics,
151
+ isSortable: true,
152
+ sort: 'asc',
153
+ width: '96px',
154
+ show: true,
155
+ filter: false,
156
+ },
157
+ {
158
+ col: 'col12',
159
+ colName: 'version',
160
+ text: localization.common.version,
161
+ isSortable: true,
162
+ sort: 'asc',
163
+ width: '96px',
164
+ show: true,
165
+ filter: false,
166
+ },
167
+ {
168
+ col: 'col13',
169
+ colName: 'alarm_action',
170
+ text: localization.common.alarmActions,
171
+ isSortable: true,
172
+ sort: 'asc',
173
+ width: '96px',
174
+ show: true,
175
+ filter: false,
176
+ },
177
+ ]
178
+ export const options: UI_I_DataTableOptions = {
179
+ perPageOptions: [{ text: '10', value: 100, default: true }],
180
+ isSelectable: true,
181
+ selectType: 'radio',
182
+ showPagination: false,
183
+ showPageInfo: false,
184
+ isSortable: true,
185
+ server: true,
186
+ isResizable: true,
187
+ showSelectedRows: false,
188
+ showColumnManager: true,
189
+ inModal: true,
190
+ inBlock: false,
191
+ // isFocusable: false,
192
+ // showPaginationOnTop: false,
193
+ // showSearch: false,
194
+ // withActions: false,
195
+ // showExport: false,
196
+ // withCollapse: false,
197
+ }
198
+
199
+ export const getBodyDataFunc = (
200
+ bodyData: UI_I_HostTableItem[],
201
+ localization: UI_I_Localization
202
+ ): UI_I_DataTableBody[] => {
203
+ const { $number } = useNuxtApp() as any
204
+
205
+ return bodyData.map((host, index: number) => {
206
+ const statusKey = host.state
207
+ ? UI_E_DeviceStatus.Unknown
208
+ : UI_E_DeviceStatus.Supported
209
+ const statusData = {
210
+ ...STATUS_MAPPING[statusKey],
211
+ testId: `${host.name}-${index}-status`,
212
+ }
213
+
214
+ return {
215
+ row: index,
216
+ collapse: false,
217
+ isHiddenCollapse: false,
218
+ collapseToggle: false,
219
+
220
+ data: [
221
+ {
222
+ key: 'icon',
223
+ col: 'col0',
224
+ text: host.name,
225
+ data: `vsphere-icon-${hostIconByState[host.state]}`,
226
+ testId: `migrate-host-table-item-${index}`,
227
+ },
228
+
229
+ {
230
+ key: 'status',
231
+ col: 'col1',
232
+ text: localization.common[hostLocalizationByState[host.state]],
233
+ testId: `migrate-host-table-item-${index}`,
234
+ data: statusData,
235
+ },
236
+ {
237
+ col: 'col2',
238
+ text: host.cluster,
239
+ testId: `migrate-host-table-item-${index}`,
240
+ },
241
+ {
242
+ col: 'col3',
243
+ text: host.fault_domain,
244
+ testId: `migrate-host-table-item-${index}`,
245
+ },
246
+ {
247
+ key: 'progress',
248
+ col: 'col4',
249
+ text: `${host.consumed_cpu.toFixed(2)}%`,
250
+ data: host.consumed_cpu,
251
+ testId: `migrate-host-table-item-${index}`,
252
+ },
253
+ {
254
+ key: 'progress',
255
+ col: 'col5',
256
+ text: `${host.consumed_mem.toFixed(2)}%`,
257
+ data: host.consumed_mem,
258
+ testId: `migrate-host-table-item-${index}`,
259
+ },
260
+ {
261
+ col: 'col6',
262
+ text: host.ha_state,
263
+ testId: `migrate-host-table-item-${index}`,
264
+ },
265
+ {
266
+ col: 'col7',
267
+ text: host.uptime + '',
268
+ testId: `migrate-host-table-item-${index}`,
269
+ },
270
+ {
271
+ col: 'col8',
272
+ text: host.cert_valid_to,
273
+ testId: `migrate-host-table-item-${index}`,
274
+ },
275
+
276
+ {
277
+ col: 'col9',
278
+ text: `${$number.format(host.mem_size, 'en')} ${
279
+ localization.common.mb
280
+ }`,
281
+ testId: `migrate-host-table-item-${index}`,
282
+ },
283
+ {
284
+ col: 'col10',
285
+ text: host.cpus + '',
286
+ testId: `migrate-host-table-item-${index}`,
287
+ },
288
+ {
289
+ col: 'col11',
290
+ text: host.nics + '',
291
+ testId: `migrate-host-table-item-${index}`,
292
+ },
293
+ {
294
+ col: 'col12',
295
+ text: host.version,
296
+ testId: `migrate-host-table-item-${index}`,
297
+ },
298
+ {
299
+ key: 'status',
300
+ col: 'col13',
301
+ text: host.alarm_action,
302
+ data: statusData,
303
+ testId: `migrate-host-table-item-${index}`,
304
+ },
305
+ ],
306
+ }
307
+ })
308
+ }
@@ -13,10 +13,10 @@
13
13
  server-off
14
14
  >
15
15
  <template #value="{ item }">
16
- <common-configure-advanced-system-settings-table-view-field
16
+ <common-configure-advanced-system-settings-table-view-old-field
17
17
  :data="item.data"
18
- @change="emits('change-setting', $event, item.data.key)"
19
- @error-message="emits('update-invalid-fields', $event, item.data.key)"
18
+ @change="onChangeSetting($event, item.data.key)"
19
+ @error-message="onUpdateInvalidFields($event, item.data.key)"
20
20
  />
21
21
  </template>
22
22
  </atoms-table-data-grid>
@@ -29,12 +29,26 @@ import type {
29
29
  UI_I_HeadItem,
30
30
  UI_I_BodyItem,
31
31
  } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
32
- import type { UI_I_Localization } from '~/lib/models/interfaces'
33
- import type { UI_I_Pagination } from '~/lib/models/table/interfaces'
32
+ import type {
33
+ UI_I_ArbitraryObject,
34
+ UI_I_Localization,
35
+ } from '~/lib/models/interfaces'
36
+ import type {
37
+ API_UI_I_DataTable,
38
+ UI_I_Pagination,
39
+ } from '~/lib/models/table/interfaces'
34
40
  import type { UI_I_AdvancedSystemSetting } from '~/store/inventory/modules/configure/advancedSystemSettings/lib/models/interfaces'
35
41
  import type { UI_I_AdvancedSystemSettingsEditData } from '~/components/common/configure/advancedSystemSettings/tableView/old/lib/models/interfaces'
36
42
  import * as table from '~/components/common/configure/advancedSystemSettings/tableView/old/lib/config/table'
37
43
 
44
+ const settings = defineModel<API_UI_I_DataTable<UI_I_AdvancedSystemSetting[]>>(
45
+ 'settings',
46
+ { required: true }
47
+ )
48
+ const invalidFields = defineModel<string[]>('invalid-fields', {
49
+ required: false,
50
+ })
51
+
38
52
  const props = defineProps<{
39
53
  dataTable: UI_I_AdvancedSystemSetting[]
40
54
  totalItems: number
@@ -42,17 +56,29 @@ const props = defineProps<{
42
56
  isEdit: boolean
43
57
  }>()
44
58
 
45
- const emits = defineEmits<{
46
- (
47
- event: 'change-setting',
48
- value1: UI_I_AdvancedSystemSettingsEditData['value'],
49
- value2: string
50
- ): void
51
- (event: 'update-invalid-fields', value1: string, value2: string): void
52
- }>()
53
-
54
59
  const localization = computed<UI_I_Localization>(() => useLocal())
55
60
 
61
+ const onChangeSetting = (
62
+ value: UI_I_AdvancedSystemSettingsEditData['value'],
63
+ key: string
64
+ ): void => {
65
+ settings.value.items = settings.value.items.map((item) => {
66
+ if (item.key === key) {
67
+ item.value = value
68
+ }
69
+ return item
70
+ })
71
+ }
72
+
73
+ const invalidFieldsLocal = ref<UI_I_ArbitraryObject<string>>({})
74
+ const onUpdateInvalidFields = (value: string, key: string): void => {
75
+ invalidFieldsLocal.value[key] = value
76
+ if (invalidFields.value)
77
+ invalidFields.value = Object.values(invalidFieldsLocal.value).filter(
78
+ (error) => error
79
+ )
80
+ }
81
+
56
82
  const paginationLocal = ref<UI_I_Pagination>({
57
83
  page: 1,
58
84
  pageSize: 100,
@@ -82,6 +108,7 @@ watch(
82
108
  @include flex($dir: column);
83
109
  overflow: hidden;
84
110
  height: inherit;
111
+ max-height: 250px;
85
112
  .data-table {
86
113
  @include flex($dir: column);
87
114
  flex-direction: column;
@@ -1,37 +1,67 @@
1
1
  <template>
2
- <component
3
- :is="currentComponent"
4
- v-model:value="valueLocal"
5
- :data="props.data"
6
- :invalid="invalid"
7
- :error-message="errorMessage"
8
- @change="onChangeSetting"
9
- />
2
+ <atoms-tooltip-error :has-error="invalid">
3
+ <template #elem>
4
+ <div v-if="props.data.type === 'number'">
5
+ <input
6
+ v-model="valueLocal"
7
+ type="number"
8
+ :class="{ 'has-error': invalid }"
9
+ @input="onChangeSetting($event)"
10
+ />
11
+ </div>
12
+ <div v-if="props.data.type === 'string'">
13
+ <input
14
+ v-model="valueLocal"
15
+ type="text"
16
+ :class="{ 'has-error': invalid }"
17
+ @input="onChangeSetting($event)"
18
+ />
19
+ </div>
20
+ <div v-if="props.data.type === 'boolean'" class="select">
21
+ <select
22
+ v-model="valueLocal"
23
+ @change="onChangeSetting($event)"
24
+ :class="{ 'has-error': invalid }"
25
+ >
26
+ <option value="false">false</option>
27
+ <option value="true">true</option>
28
+ </select>
29
+ </div>
30
+ <!-- <div v-if="props.data.type === 'select'" class="select">-->
31
+ <!-- <select-->
32
+ <!-- v-model="valueLocal"-->
33
+ <!-- @change="onChangeSetting($event)"-->
34
+ <!-- :class="{ 'has-error': invalid }"-->
35
+ <!-- >-->
36
+ <!-- <option-->
37
+ <!-- v-for="item2 in props.data.options"-->
38
+ <!-- :key="item2.key"-->
39
+ <!-- :value="item2.key"-->
40
+ <!-- >-->
41
+ <!-- {{ item2.value }}-->
42
+ <!-- </option>-->
43
+ <!-- </select>-->
44
+ <!-- </div>-->
45
+ </template>
46
+ <template #content>
47
+ {{ errorMessage }}
48
+ </template>
49
+ </atoms-tooltip-error>
10
50
  </template>
11
51
 
12
52
  <script setup lang="ts">
13
53
  import type { UI_I_AdvancedSystemSettingsEditData } from '~/components/common/configure/advancedSystemSettings/tableView/old/lib/models/interfaces'
14
- import { UI_E_Format } from '~/components/common/configure/advancedSystemSettings/tableView/field/lib/models/enums'
54
+ import { E_Format } from '~/components/common/configure/advancedSystemSettings/tableView/old/field/lib/models/enums'
15
55
  import { allRegExp } from '~/lib/config/regExp'
16
56
 
17
57
  const props = defineProps<{
18
58
  data: UI_I_AdvancedSystemSettingsEditData
19
59
  }>()
20
-
21
60
  const emits = defineEmits<{
22
61
  (event: 'change', value: UI_I_AdvancedSystemSettingsEditData['value']): void
23
62
  (event: 'error-message', value: string): void
24
63
  }>()
25
64
 
26
- const { $store }: any = useNuxtApp()
27
-
28
- const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
29
- const currentComponent = computed(() =>
30
- isNewView.value
31
- ? defineAsyncComponent(() => import('./New.vue'))
32
- : defineAsyncComponent(() => import('./Old.vue'))
33
- )
34
-
35
65
  const valueLocal = ref<UI_I_AdvancedSystemSettingsEditData['value']>(
36
66
  props.data.value
37
67
  )
@@ -88,7 +118,7 @@ const onChangeSetting = (event: Event): void => {
88
118
  if (invalid.value) return
89
119
 
90
120
  if (validation.Format) {
91
- const format = UI_E_Format[validation.Format]
121
+ const format = E_Format[validation.Format]
92
122
  invalid.value = !allRegExp[format].test(value)
93
123
  errorMessage.value = invalid.value ? `Value must be ${format}` : ''
94
124
  }
@@ -0,0 +1,14 @@
1
+ export enum E_Format {
2
+ 'unix path' = 'unixPath',
3
+ 'win path' = 'winPath',
4
+ 'mac' = 'mac',
5
+ 'ip4' = 'ip4',
6
+ 'ip6' = 'ip6',
7
+ 'url' = 'url',
8
+ 'uuid' = 'uuid',
9
+ 'semver' = 'semver',
10
+ 'domain' = 'domain',
11
+ 'base64' = 'base64',
12
+ 'regex' = 'regex',
13
+ 'hex color' = 'hexColor',
14
+ }
@@ -1,66 +1,5 @@
1
- <template>
2
- <div class="flex flex-wrap justify-between gap-4 mb-4">
3
- <h3 class="advanced-system-settings-title text-[18px] font-[500]">
4
- {{ props.title }}
5
- </h3>
1
+ <template>New</template>
6
2
 
7
- <ui-button
8
- test-id="advanced-system-settings-edit-toggle"
9
- variant="text"
10
- is-without-sizes
11
- is-without-height
12
- @click="emits('show-edit-modal')"
13
- >
14
- <ui-icon name="settings" width="18px" height="18px" />
15
- </ui-button>
16
- </div>
17
- </template>
3
+ <script setup lang="ts"></script>
18
4
 
19
- <script setup lang="ts">
20
- const props = defineProps<{
21
- title: string
22
- }>()
23
-
24
- const emits = defineEmits<{
25
- (event: 'show-edit-modal'): void
26
- }>()
27
- </script>
28
-
29
- <style>
30
- :root {
31
- --advanced-system-settings-title: #4d5d69;
32
- --advanced-system-settings-edit-border: #e9ebed;
33
- --advanced-system-settings-edit-bg: #ffffff;
34
- --advanced-system-settings-edit-color: #213444;
35
- --advanced-system-settings-edit-hover-bg: #f6f7f8;
36
- --advanced-system-settings-edit-hover-color: #1b2a37;
37
- }
38
- :root.dark-theme {
39
- --advanced-system-settings-title: #e9eaec;
40
- --advanced-system-settings-edit-border: #e9ebed1f;
41
- --advanced-system-settings-edit-bg: #1b2a373d;
42
- --advanced-system-settings-edit-color: #e9eaec;
43
- --advanced-system-settings-edit-hover-bg: #283948;
44
- --advanced-system-settings-edit-hover-color: #ffffff;
45
- }
46
- </style>
47
-
48
- <style scoped lang="scss">
49
- .advanced-system-settings-title {
50
- color: var(--advanced-system-settings-title);
51
- }
52
-
53
- #advanced-system-settings-edit-toggle {
54
- padding: 8px;
55
- width: 34px;
56
- height: 34px;
57
- border: 1px solid var(--advanced-system-settings-edit-border);
58
- color: var(--advanced-system-settings-edit-color);
59
- background-color: var(--advanced-system-settings-edit-bg);
60
-
61
- &:hover {
62
- background-color: var(--advanced-system-settings-edit-hover-bg);
63
- color: var(--advanced-system-settings-edit-hover-color);
64
- }
65
- }
66
- </style>
5
+ <style scoped lang="scss"></style>
@@ -3,7 +3,7 @@
3
3
  <template #action>
4
4
  <button
5
5
  class="btn btn-sm btn-secondary ng-star-inserted"
6
- @click="emits('show-edit-modal')"
6
+ @click="emits('show-edit')"
7
7
  >
8
8
  {{ localization.common.edit }}...
9
9
  </button>
@@ -19,7 +19,7 @@ const props = defineProps<{
19
19
  }>()
20
20
 
21
21
  const emits = defineEmits<{
22
- (event: 'show-edit-modal'): void
22
+ (event: 'show-edit'): void
23
23
  }>()
24
24
 
25
25
  const localization = computed<UI_I_Localization>(() => useLocal())
@@ -2,7 +2,7 @@
2
2
  <component
3
3
  :is="currentComponent"
4
4
  :title="localization.common.advancedSystemSettings"
5
- @show-edit-modal="emits('show-edit-modal')"
5
+ @show-edit="emits('show-edit')"
6
6
  />
7
7
  </template>
8
8
 
@@ -10,7 +10,7 @@
10
10
  import type { UI_I_Localization } from '~/lib/models/interfaces'
11
11
 
12
12
  const emits = defineEmits<{
13
- (event: 'show-edit-modal'): void
13
+ (event: 'show-edit'): void
14
14
  }>()
15
15
 
16
16
  const { $store }: any = useNuxtApp()