bfg-common 1.5.53 → 1.5.55

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,21 +1,35 @@
1
1
  import type { UI_I_Resources } from '~/components/common/resource/lib/models/interfaces'
2
- export const optionsDefault: UI_I_Resources[] = [
3
- {
4
- type: 'cpu',
5
- free: { text: '0', value: 0 },
6
- used: { text: '0', value: 0 },
7
- capacity: { text: '0', value: 0 },
8
- },
9
- {
10
- type: 'memory',
11
- free: { text: '0', value: 0 },
12
- used: { text: '0', value: 0 },
13
- capacity: { text: '0', value: 0 },
14
- },
15
- {
16
- type: 'storage',
17
- free: { text: '0', value: 0 },
18
- used: { text: '0', value: 0 },
19
- capacity: { text: '0', value: 0 },
20
- },
21
- ]
2
+
3
+ export const optionsDefaultFunc = (
4
+ value: UI_I_Resources[] | null | undefined
5
+ ): UI_I_Resources[] => {
6
+ const defaultValue: UI_I_Resources[] = [
7
+ {
8
+ type: 'cpu',
9
+ free: { text: '0', value: 0 },
10
+ used: { text: '0', value: 0 },
11
+ capacity: { text: '0', value: 0 },
12
+ },
13
+ {
14
+ type: 'memory',
15
+ free: { text: '0', value: 0 },
16
+ used: { text: '0', value: 0 },
17
+ capacity: { text: '0', value: 0 },
18
+ },
19
+ {
20
+ type: 'storage',
21
+ free: { text: '0', value: 0 },
22
+ used: { text: '0', value: 0 },
23
+ capacity: { text: '0', value: 0 },
24
+ },
25
+ ]
26
+ if (!value || value.length === 0) {
27
+ return defaultValue
28
+ }
29
+
30
+ return [
31
+ value[0] || defaultValue[0],
32
+ value[1] || defaultValue[1],
33
+ value[2] || defaultValue[2],
34
+ ]
35
+ }
@@ -1,122 +1,122 @@
1
- <template>
2
- <div class="card">
3
- <div class="card-block">
4
- <div class="clr-row vc-capacity-content">
5
- <div
6
- v-for="item in props.items"
7
- :key="item.type"
8
- class="clr-col-md clr-col-sm-12 clr-col-xs-12 capacity-entity"
9
- >
10
- <div class="capacity-entity-content">
11
- <h3 class="capacity-entity-label">
12
- {{ localization.common[item.type] }}
13
- </h3>
14
- <div class="capacity-entity-metrics-content">
15
- <h4
16
- class="capacity-entity-free"
17
- :data-id="`capacity-entity-free-${item.type}`"
18
- >
19
- {{ item.free.text }} {{ localization.common.free }}
20
- </h4>
21
- <progress
22
- class="progress-block"
23
- :max="item.capacity.value"
24
- :value="item.used.value"
25
- />
26
- <div
27
- class="capacity-entity-used"
28
- :data-id="`capacity-entity-used-${item.type}`"
29
- >
30
- {{ item.used.text }}
31
- {{ localization.common.used?.toLowerCase() }} |
32
- {{ item.capacity.text }}
33
- {{ localization.common.total?.toLowerCase() }}
34
- </div>
35
- </div>
36
- </div>
37
- </div>
38
- </div>
39
- </div>
40
- </div>
41
- </template>
42
- <script setup lang="ts">
43
- import type { UI_I_Localization } from '~/lib/models/interfaces'
44
- import type { UI_I_Resources } from '~/components/common/resource/lib/models/interfaces'
45
-
46
- const props = defineProps<{
47
- items: UI_I_Resources[]
48
- }>()
49
-
50
- const localization = computed<UI_I_Localization>(() => useLocal())
51
- </script>
52
- <style lang="scss" scoped>
53
- .card {
54
- color: var(--global-font-color);
55
- background-color: var(--global-bg-color);
56
-
57
- &-block {
58
- .capacity-entity {
59
- display: flex;
60
- flex-direction: column;
61
- align-items: center;
62
- margin: 0;
63
- padding: 0 10px;
64
- border-left: 1px solid var(--global-border-color);
65
-
66
- &:first-of-type {
67
- border-left: none;
68
- }
69
-
70
- .capacity-entity-content {
71
- min-height: 120px;
72
- display: flex;
73
- flex-direction: column;
74
- justify-content: center;
75
- align-items: center;
76
- width: 100%;
77
-
78
- h3 {
79
- font-size: 18px;
80
- font-weight: 200;
81
- margin-bottom: 5px;
82
- }
83
-
84
- progress.progress-block {
85
- width: 100%;
86
- height: 0.6395rem;
87
- line-height: 24px;
88
- background-color: var(--progress-bg-color);
89
- }
90
- progress::-webkit-progress-value,
91
- progress::-moz-progress-value {
92
- background-color: var(--progress-value-bg-color);
93
- }
94
- progress::-webkit-progress-bar {
95
- background-color: var(--progress-bg-color);
96
- }
97
- .capacity-entity-free {
98
- font-size: 22px;
99
- font-weight: 200;
100
- margin-bottom: 10px;
101
- }
102
- .capacity-entity-used {
103
- font-size: 12px;
104
- }
105
- .capacity-entity-label {
106
- align-self: flex-start;
107
- // font-size: 0.9rem;
108
- }
109
- }
110
- }
111
- }
112
- }
113
- .capacity-entity-content:nth-child(1) {
114
- border-left: none;
115
- }
116
- .capacity-entity-metrics-content {
117
- display: flex;
118
- flex-direction: column;
119
- justify-content: space-between;
120
- align-items: center;
121
- }
122
- </style>
1
+ <template>
2
+ <div class="card">
3
+ <div class="card-block">
4
+ <div class="clr-row vc-capacity-content">
5
+ <div
6
+ v-for="item in props.items"
7
+ :key="item.type"
8
+ class="clr-col-md clr-col-sm-12 clr-col-xs-12 capacity-entity"
9
+ >
10
+ <div class="capacity-entity-content">
11
+ <h3 class="capacity-entity-label">
12
+ {{ localization.common[item.type] }}
13
+ </h3>
14
+ <div class="capacity-entity-metrics-content">
15
+ <h4
16
+ class="capacity-entity-free"
17
+ :data-id="`capacity-entity-free-${item.type}`"
18
+ >
19
+ {{ item.free.text }} {{ localization.common.free }}
20
+ </h4>
21
+ <progress
22
+ class="progress-block"
23
+ :max="item.capacity.value"
24
+ :value="item.used.value"
25
+ />
26
+ <div
27
+ class="capacity-entity-used"
28
+ :data-id="`capacity-entity-used-${item.type}`"
29
+ >
30
+ {{ item.used.text }}
31
+ {{ localization.common.used?.toLowerCase() }} |
32
+ {{ item.capacity.text }}
33
+ {{ localization.common.total?.toLowerCase() }}
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </div>
41
+ </template>
42
+ <script setup lang="ts">
43
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
44
+ import type { UI_I_Resources } from '~/components/common/resource/lib/models/interfaces'
45
+
46
+ const props = defineProps<{
47
+ items: UI_I_Resources[]
48
+ }>()
49
+
50
+ const localization = computed<UI_I_Localization>(() => useLocal())
51
+ </script>
52
+ <style lang="scss" scoped>
53
+ .card {
54
+ color: var(--global-font-color);
55
+ background-color: var(--global-bg-color);
56
+
57
+ &-block {
58
+ .capacity-entity {
59
+ display: flex;
60
+ flex-direction: column;
61
+ align-items: center;
62
+ margin: 0;
63
+ padding: 0 10px;
64
+ border-left: 1px solid var(--global-border-color);
65
+
66
+ &:first-of-type {
67
+ border-left: none;
68
+ }
69
+
70
+ .capacity-entity-content {
71
+ min-height: 120px;
72
+ display: flex;
73
+ flex-direction: column;
74
+ justify-content: center;
75
+ align-items: center;
76
+ width: 100%;
77
+
78
+ h3 {
79
+ font-size: 18px;
80
+ font-weight: 200;
81
+ margin-bottom: 5px;
82
+ }
83
+
84
+ progress.progress-block {
85
+ width: 100%;
86
+ height: 0.6395rem;
87
+ line-height: 24px;
88
+ background-color: var(--progress-bg-color);
89
+ }
90
+ progress::-webkit-progress-value,
91
+ progress::-moz-progress-value {
92
+ background-color: var(--progress-value-bg-color);
93
+ }
94
+ progress::-webkit-progress-bar {
95
+ background-color: var(--progress-bg-color);
96
+ }
97
+ .capacity-entity-free {
98
+ font-size: 22px;
99
+ font-weight: 200;
100
+ margin-bottom: 10px;
101
+ }
102
+ .capacity-entity-used {
103
+ font-size: 12px;
104
+ }
105
+ .capacity-entity-label {
106
+ align-self: flex-start;
107
+ // font-size: 0.9rem;
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ .capacity-entity-content:nth-child(1) {
114
+ border-left: none;
115
+ }
116
+ .capacity-entity-metrics-content {
117
+ display: flex;
118
+ flex-direction: column;
119
+ justify-content: space-between;
120
+ align-items: center;
121
+ }
122
+ </style>
@@ -337,10 +337,10 @@ onUnmounted(() => {
337
337
  z-index: calc(var(--z-default) + 2);
338
338
  }
339
339
 
340
- &:focus {
341
- background-color: var(--gutter-active-bg-color);
342
- outline: none;
343
- }
340
+ //&:focus {
341
+ //background-color: var(--gutter-active-bg-color);
342
+ //outline: none;
343
+ //}
344
344
 
345
345
  &:hover {
346
346
  background-color: var(--new-gutter-hover-bg-color);
@@ -1,6 +1,10 @@
1
1
  <template>
2
2
  <!-- :style="{ 'padding-right': rightSpace + 'px' }"-->
3
- <div :id="id" class="btn-group">
3
+ <div
4
+ :id="id"
5
+ class="btn-group"
6
+ :style="{ paddingRight: spaceForCollapseBtn + 'px' }"
7
+ >
4
8
  <div v-for="(button, key) in props.actions" :key="button.type">
5
9
  <label v-if="button.uploaded" v-development="button.development">
6
10
  <span
@@ -96,8 +100,9 @@ const collapsedItems = computed<UI_I_CollapseNavItem[]>(() => {
96
100
  })
97
101
  watch(
98
102
  () => props.actions,
99
- (newValue) => {
100
- visibleCount.value = newValue.length
103
+ () => {
104
+ // visibleCount.value = newValue.length
105
+ outputSize()
101
106
  },
102
107
  { deep: true }
103
108
  )
@@ -120,6 +125,8 @@ watch(
120
125
  // { deep: true }
121
126
  // )
122
127
 
128
+
129
+ const spaceForCollapseBtn = ref<number>(65)
123
130
  const outputSize = (): void => {
124
131
  const el = document.getElementById(id.value)
125
132
  if (!el) return
@@ -129,14 +136,21 @@ const outputSize = (): void => {
129
136
  const elItems = Array.from(el.children).filter(
130
137
  (item) => !item.classList.contains('nav-tabs')
131
138
  )
132
- const elItemsMarginLeft = parseInt(getComputedStyle(elItems[0]).marginLeft)
133
- const elItemsMarginRight = parseInt(getComputedStyle(elItems[0]).marginRight)
134
- const childrenMarginY = elItemsMarginLeft + elItemsMarginRight
139
+ // const elItemsMarginLeft = parseInt(getComputedStyle(elItems[0]).marginLeft)
140
+ // const elItemsMarginRight = parseInt(getComputedStyle(elItems[0]).marginRight)
141
+ // const childrenMarginX = elItemsMarginLeft + elItemsMarginRight
135
142
 
136
- let childrenWidth = -10 // TODO Найти способ лучше. Не всегда совпадает ширина элементов с шириной родительского элемента
143
+ // let childrenWidth = -10 // TODO Найти способ лучше. Не всегда совпадает ширина элементов с шириной родительского элемента
144
+ let childrenWidth = spaceForCollapseBtn.value // TODO Найти способ лучше. Не всегда совпадает ширина элементов с шириной родительского элемента
137
145
  let count = 0
138
146
  for (let i = 0; i < elItems.length; i++) {
139
- childrenWidth += elItems[i].clientWidth + childrenMarginY
147
+ const elItemsMarginLeft = parseInt(getComputedStyle(elItems[i]).marginLeft)
148
+ const elItemsMarginRight = parseInt(
149
+ getComputedStyle(elItems[i]).marginRight
150
+ )
151
+ const childrenMarginX = elItemsMarginLeft + elItemsMarginRight
152
+
153
+ childrenWidth += elItems[i].clientWidth + childrenMarginX
140
154
  // const isWrap = elWidth - rightSpace.value < childrenWidth
141
155
  const isWrap = elWidth < childrenWidth
142
156
 
@@ -1,12 +1,12 @@
1
1
  <template>
2
2
  <div class="select-compatibility">
3
3
  <p class="select-compatibility-block">
4
- {{
5
- localization.common.hostSupportsMoreVirtualMachineVersionSelectCompatibilityVirtualMachine
6
- }}
4
+ {{ description }}
7
5
  </p>
8
6
  <div class="select-compatibility-block version-select-wrap">
9
- <label for="version-select">{{ localization.common.compatibleWith }}:</label>
7
+ <label for="version-select"
8
+ >{{ localization.common.compatibleWith }}:</label
9
+ >
10
10
 
11
11
  <atoms-tooltip-error
12
12
  :has-error="!!apiError"
@@ -86,6 +86,13 @@ watch(
86
86
  { immediate: true }
87
87
  )
88
88
 
89
+ const config = useRuntimeConfig()
90
+ const description = computed<string>(() => {
91
+ return localization.value.common.hostSupportsMoreVirtualMachineVersionSelectCompatibilityVirtualMachine.replaceAll(
92
+ '{trademark}',
93
+ config.public[`TRADEMARK_${useEnvLanguage()}`]
94
+ )
95
+ })
89
96
  const versionDescription = computed<string>(() => {
90
97
  if (!selectedVersion.value) return ''
91
98
 
@@ -1,80 +1,80 @@
1
- import type { UI_I_ModalPayloadSchedulerData } from '~/components/common/pages/scheduledTasks/lib/models/interfaces'
2
- import type { UI_T_NotificationStatus } from '~/components/atoms/alert/lib/models/types'
3
- import { UI_E_State } from '~/lib/models/enums'
4
-
5
- export interface UI_I_ItemView {
6
- value: number | string
7
- text: string
8
- }
9
- export interface UI_I_HTMLSelectElement extends Event {
10
- target: HTMLInputElement
11
- }
12
-
13
- export interface UI_I_ArbitraryObject<T> {
14
- [key: string]: T
15
- }
16
-
17
- export interface UI_I_Localization {
18
- common: UI_I_ArbitraryObject<string>
19
- auth: UI_I_ArbitraryObject<string>
20
- home: UI_I_ArbitraryObject<string>
21
- tasks: UI_I_ArbitraryObject<string>
22
- layout: UI_I_ArbitraryObject<string>
23
- mainNavigation: UI_I_ArbitraryObject<string>
24
- administration: UI_I_ArbitraryObject<string>
25
- inventoryConfigure: UI_I_ArbitraryObject<string>
26
- datastoreWizard: UI_I_ArbitraryObject<string>
27
- inventorySummary: UI_I_ArbitraryObject<string>
28
- contextMenu: UI_I_ArbitraryObject<string>
29
- networks: UI_I_ArbitraryObject<string>
30
- inventory: UI_I_ArbitraryObject<string>
31
- inventoryMonitor: UI_I_ArbitraryObject<string>
32
- inventoryTabs: UI_I_ArbitraryObject<string>
33
- snapshots: UI_I_ArbitraryObject<string>
34
- importVms: UI_I_ArbitraryObject<string>
35
- migrateVm: UI_I_ArbitraryObject<string>
36
- storageDevice: UI_I_ArbitraryObject<string>
37
- scheduledTasks: UI_I_ArbitraryObject<string>
38
- license: UI_I_ArbitraryObject<string>
39
- events: UI_I_ArbitraryObject<string>
40
- zabbix: UI_I_ArbitraryObject<string>
41
- glpi: UI_I_ArbitraryObject<string>
42
- remoteConsole: UI_I_ArbitraryObject<string>
43
- vmWizard: UI_I_ArbitraryObject<string>
44
- feedback: UI_I_ArbitraryObject<string>
45
- vsphereHa: UI_I_ArbitraryObject<string>
46
- adapter: UI_I_ArbitraryObject<string>
47
- bottomPanel: UI_I_ArbitraryObject<string>
48
- }
49
- export interface UI_I_SendTaskParams {
50
- method: string
51
- target: string
52
- args: any
53
- encode?: boolean
54
- }
55
- export interface UI_I_NotifyBodyMessage {
56
- status: UI_T_NotificationStatus
57
- title: string
58
- desc: string
59
- }
60
-
61
- export interface UI_I_ListIndex {
62
- idx: number
63
- count: number
64
- }
65
-
66
- export interface UI_I_State {
67
- state: UI_E_State
68
- errors: string[]
69
- }
70
-
71
- export interface UI_I_ItemsWithTotalCounts<T> {
72
- total_items: number
73
- total_pages: number
74
- items: T[]
75
- }
76
-
77
- export interface UI_I_ModalPayload<T = any> {
78
- isShow: boolean
79
- scheduler: UI_I_ModalPayloadSchedulerData<T>
80
- }
1
+ import type { UI_I_ModalPayloadSchedulerData } from '~/components/common/pages/scheduledTasks/lib/models/interfaces'
2
+ import type { UI_T_NotificationStatus } from '~/components/atoms/alert/lib/models/types'
3
+ import { UI_E_State } from '~/lib/models/enums'
4
+
5
+ export interface UI_I_ItemView {
6
+ value: number | string
7
+ text: string
8
+ }
9
+ export interface UI_I_HTMLSelectElement extends Event {
10
+ target: HTMLInputElement
11
+ }
12
+
13
+ export interface UI_I_ArbitraryObject<T> {
14
+ [key: string]: T
15
+ }
16
+
17
+ export interface UI_I_Localization {
18
+ common: UI_I_ArbitraryObject<string>
19
+ auth: UI_I_ArbitraryObject<string>
20
+ home: UI_I_ArbitraryObject<string>
21
+ tasks: UI_I_ArbitraryObject<string>
22
+ layout: UI_I_ArbitraryObject<string>
23
+ mainNavigation: UI_I_ArbitraryObject<string>
24
+ administration: UI_I_ArbitraryObject<string>
25
+ inventoryConfigure: UI_I_ArbitraryObject<string>
26
+ datastoreWizard: UI_I_ArbitraryObject<string>
27
+ inventorySummary: UI_I_ArbitraryObject<string>
28
+ contextMenu: UI_I_ArbitraryObject<string>
29
+ networks: UI_I_ArbitraryObject<string>
30
+ inventory: UI_I_ArbitraryObject<string>
31
+ inventoryMonitor: UI_I_ArbitraryObject<string>
32
+ inventoryTabs: UI_I_ArbitraryObject<string>
33
+ snapshots: UI_I_ArbitraryObject<string>
34
+ importVms: UI_I_ArbitraryObject<string>
35
+ migrateVm: UI_I_ArbitraryObject<string>
36
+ storageDevice: UI_I_ArbitraryObject<string>
37
+ scheduledTasks: UI_I_ArbitraryObject<string>
38
+ license: UI_I_ArbitraryObject<string>
39
+ events: UI_I_ArbitraryObject<string>
40
+ zabbix: UI_I_ArbitraryObject<string>
41
+ glpi: UI_I_ArbitraryObject<string>
42
+ remoteConsole: UI_I_ArbitraryObject<string>
43
+ vmWizard: UI_I_ArbitraryObject<string>
44
+ feedback: UI_I_ArbitraryObject<string>
45
+ vsphereHa: UI_I_ArbitraryObject<string>
46
+ adapter: UI_I_ArbitraryObject<string>
47
+ bottomPanel: UI_I_ArbitraryObject<string>
48
+ }
49
+ export interface UI_I_SendTaskParams {
50
+ method: string
51
+ target: string
52
+ args: any
53
+ encode?: boolean
54
+ }
55
+ export interface UI_I_NotifyBodyMessage {
56
+ status: UI_T_NotificationStatus
57
+ title: string
58
+ desc: string
59
+ }
60
+
61
+ export interface UI_I_ListIndex {
62
+ idx: number
63
+ count: number
64
+ }
65
+
66
+ export interface UI_I_State {
67
+ state: UI_E_State
68
+ errors: string[]
69
+ }
70
+
71
+ export interface UI_I_ItemsWithTotalCounts<T> {
72
+ total_items: number
73
+ total_pages: number
74
+ items: T[]
75
+ }
76
+
77
+ export interface UI_I_ModalPayload<T = any> {
78
+ isShow: boolean
79
+ scheduler: UI_I_ModalPayloadSchedulerData<T>
80
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.53",
4
+ "version": "1.5.55",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -35,7 +35,7 @@
35
35
  "@vueuse/components": "^10.1.2",
36
36
  "date-fns": "^2.29.3",
37
37
  "bfg-nuxt-3-graph": "1.0.22",
38
- "bfg-uikit": "1.0.399",
38
+ "bfg-uikit": "1.0.403",
39
39
  "html2canvas": "^1.4.1",
40
40
  "prettier-eslint": "^15.0.1"
41
41
  }
@@ -317,16 +317,30 @@ export default defineNuxtPlugin(() => {
317
317
  }
318
318
  }
319
319
 
320
- self.calcCount = function (arr: any[], itemsProp: string): number {
320
+ self.calcCount = function (
321
+ arr: any[],
322
+ itemsProp: string,
323
+ value?: any[],
324
+ valueProps?: string[]
325
+ ): number {
321
326
  if (!arr) return 0
322
327
  let res = 0
323
328
 
324
329
  for (let i = 0; i < arr.length; i++) {
325
330
  const item: any = arr[i]
326
- res++
331
+
332
+ if (value && valueProps) {
333
+ valueProps.forEach((valueProp) => {
334
+ if (value.includes(item[valueProp])) {
335
+ res++
336
+ }
337
+ })
338
+ } else {
339
+ res++
340
+ }
327
341
 
328
342
  if (item[itemsProp]?.length) {
329
- res += self.calcCount(item[itemsProp], itemsProp)
343
+ res += self.calcCount(item[itemsProp], itemsProp, value, valueProps)
330
344
  }
331
345
  }
332
346
  return res