bfg-common 1.4.681 → 1.4.683

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.
@@ -13,10 +13,10 @@
13
13
 
14
14
  <script setup lang="ts">
15
15
  import type { UI_I_Localization } from '~/lib/models/interfaces'
16
- import type { UI_I_Card } from '~/components/common/pages/home/lib/models/interfaces'
16
+ import type { UI_I_Hosts } from '~/components/common/pages/home/lib/models/interfaces'
17
17
 
18
18
  const props = defineProps<{
19
- items: UI_I_Card
19
+ items: UI_I_Hosts
20
20
  }>()
21
21
  const localization = computed<UI_I_Localization>(() => useLocal())
22
22
  </script>
@@ -7,12 +7,14 @@ export interface UI_I_Hosts {
7
7
  connected: number
8
8
  disconnected: number
9
9
  maintenance: number
10
+ total: number
10
11
  }
11
12
 
12
13
  export interface UI_I_Vms {
13
14
  powered_on: number
14
15
  powered_off: number
15
16
  suspended: number
17
+ total: number
16
18
  }
17
19
 
18
20
  export interface UI_I_Alert {
@@ -42,4 +44,5 @@ export interface UI_I_HomeInfo {
42
44
  export interface UI_I_Card {
43
45
  text: string
44
46
  value: number
47
+ icon?: string
45
48
  }
@@ -1,16 +1,14 @@
1
1
  <template>
2
2
  <common-pages-home-widgets-hosts-new
3
3
  v-if="isNewView"
4
- :items="defaultHosts"
5
- :total-hosts="totalHosts"
4
+ :hosts="props.hosts"
6
5
  :loading="props.loading"
7
- ></common-pages-home-widgets-hosts-new>
6
+ />
8
7
 
9
8
  <common-pages-home-widgets-hosts-old
10
9
  v-else
11
10
  :hosts="props.hosts"
12
- :total-hosts="totalHosts"
13
- ></common-pages-home-widgets-hosts-old>
11
+ />
14
12
  </template>
15
13
 
16
14
  <script lang="ts" setup>
@@ -24,33 +22,6 @@ const props = defineProps<{
24
22
  const { $store }: any = useNuxtApp()
25
23
 
26
24
  const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
27
-
28
- const totalHosts = computed<number>(
29
- () =>
30
- props.hosts.connected +
31
- props.hosts.maintenance +
32
- props.hosts.disconnected || 0
33
- )
34
-
35
- const defaultHosts = ref([
36
- // временно
37
- {
38
- value: 0,
39
- text: 'connected',
40
- icon: 'vsphere-icon-Host_Connect',
41
- },
42
- {
43
- value: 0,
44
- text: 'disconnected',
45
- icon: 'vsphere-icon-Host_Disconnect',
46
- },
47
-
48
- {
49
- value: 0,
50
- text: 'maintenance',
51
- icon: 'vsphere-icon-host-maintenance',
52
- },
53
- ])
54
25
  </script>
55
26
 
56
27
  <style lang="scss" scoped></style>
@@ -6,14 +6,11 @@
6
6
  <div v-else class="card-content">
7
7
  <div class="card-content__title">
8
8
  <h1>{{ localization.common.hosts }}</h1>
9
- <span>({{ props.totalHosts }})</span>
9
+ <span>({{ props.hosts.total }})</span>
10
10
  </div>
11
11
 
12
12
  <div class="card-content__container">
13
- <template
14
- v-for="({ text, value, icon }, key) in props.items"
15
- :key="key"
16
- >
13
+ <template v-for="({ text, value, icon }, key) in itemsLocal" :key="key">
17
14
  <div v-if="key > 0" class="divider"></div>
18
15
 
19
16
  <div class="card-content-item">
@@ -29,15 +26,20 @@
29
26
 
30
27
  <script lang="ts" setup>
31
28
  import type { UI_I_Localization } from '~/lib/models/interfaces'
32
- import type { UI_I_Card } from '~/components/common/pages/home/lib/models/interfaces'
29
+ import type {
30
+ UI_I_Card,
31
+ UI_I_Hosts,
32
+ } from '~/components/common/pages/home/lib/models/interfaces'
33
+ import { itemsFunc } from '~/components/common/pages/home/widgets/hosts/lib/config/items'
33
34
 
34
35
  const props = defineProps<{
35
- items: UI_I_Card[]
36
- totalHosts: number
36
+ hosts: UI_I_Hosts
37
37
  loading: boolean
38
38
  }>()
39
39
 
40
40
  const localization = computed<UI_I_Localization>(() => useLocal())
41
+
42
+ const itemsLocal = computed<UI_I_Card[]>(() => itemsFunc(props.hosts))
41
43
  </script>
42
44
 
43
45
  <style lang="scss" scoped>
@@ -3,7 +3,7 @@
3
3
  <div class="entity-status">
4
4
  <common-pages-home-card
5
5
  :title="localization.common.hosts"
6
- :count="props.totalHosts"
6
+ :count="props.hosts.total"
7
7
  icon-name="vsphere-icon-host"
8
8
  >
9
9
  <common-pages-home-status-content :items="props.hosts" />
@@ -17,7 +17,6 @@ import type { UI_I_Localization } from '~/lib/models/interfaces'
17
17
  import type { UI_I_Hosts } from '~/components/common/pages/home/lib/models/interfaces'
18
18
  const props = defineProps<{
19
19
  hosts: UI_I_Hosts
20
- totalHosts: number
21
20
  }>()
22
21
 
23
22
  const localization = computed<UI_I_Localization>(() => useLocal())
@@ -0,0 +1,23 @@
1
+ import type {
2
+ UI_I_Card,
3
+ UI_I_Hosts,
4
+ } from '~/components/common/pages/home/lib/models/interfaces'
5
+
6
+ export const itemsFunc = (hosts: UI_I_Hosts): UI_I_Card[] => [
7
+ {
8
+ value: hosts.connected,
9
+ text: 'connected',
10
+ icon: 'vsphere-icon-Host_Connect',
11
+ },
12
+ {
13
+ value: hosts.disconnected,
14
+ text: 'disconnected',
15
+ icon: 'vsphere-icon-Host_Disconnect',
16
+ },
17
+
18
+ {
19
+ value: hosts.maintenance,
20
+ text: 'maintenance',
21
+ icon: 'vsphere-icon-host-maintenance',
22
+ },
23
+ ]
@@ -1,16 +1,14 @@
1
1
  <template>
2
2
  <common-pages-home-widgets-vms-new
3
3
  v-if="isNewView"
4
- :items="defaultVms"
5
- :total-vms="totalVms"
4
+ :vms="props.vms"
6
5
  :loading="props.loading"
7
- ></common-pages-home-widgets-vms-new>
6
+ />
8
7
 
9
8
  <common-pages-home-widgets-vms-old
10
9
  v-else
11
10
  :vms="props.vms"
12
- :total-vms="totalVms"
13
- ></common-pages-home-widgets-vms-old>
11
+ />
14
12
  </template>
15
13
 
16
14
  <script lang="ts" setup>
@@ -24,30 +22,6 @@ const props = defineProps<{
24
22
  const { $store }: any = useNuxtApp()
25
23
 
26
24
  const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
27
-
28
- const totalVms = computed<number>(
29
- () => props.vms.powered_on + props.vms.powered_off + props.vms.suspended || 0
30
- )
31
-
32
- const defaultVms = ref([
33
- // временно
34
- {
35
- value: 0,
36
- text: 'powered_on',
37
- icon: 'vsphere-icon-vm-on',
38
- },
39
- {
40
- value: 0,
41
- text: 'powered_off',
42
- icon: 'icon-vm-power-off',
43
- },
44
-
45
- {
46
- value: 0,
47
- text: 'suspended',
48
- icon: 'vsphere-icon-vm-suspended',
49
- },
50
- ])
51
25
  </script>
52
26
 
53
27
  <style lang="scss" scoped></style>
@@ -6,14 +6,11 @@
6
6
  <div v-else class="card-content">
7
7
  <div class="card-content__title">
8
8
  <h1>{{ localization.common.vms }}</h1>
9
- <span>({{ props.totalVms }})</span>
9
+ <span>({{ props.vms.total }})</span>
10
10
  </div>
11
11
 
12
12
  <div class="card-content__container">
13
- <template
14
- v-for="({ text, value, icon }, key) in props.items"
15
- :key="key"
16
- >
13
+ <template v-for="({ text, value, icon }, key) in itemsLocal" :key="key">
17
14
  <div v-if="key > 0" class="divider"></div>
18
15
 
19
16
  <div class="card-content-item">
@@ -29,15 +26,20 @@
29
26
 
30
27
  <script lang="ts" setup>
31
28
  import type { UI_I_Localization } from '~/lib/models/interfaces'
32
- import type { UI_I_Card } from '~/components/common/pages/home/lib/models/interfaces'
29
+ import type {
30
+ UI_I_Card,
31
+ UI_I_Vms,
32
+ } from '~/components/common/pages/home/lib/models/interfaces'
33
+ import { itemsFunc } from '~/components/common/pages/home/widgets/vms/lib/config/items'
33
34
 
34
35
  const props = defineProps<{
35
- items: UI_I_Card[]
36
- totalVms: number
36
+ vms: UI_I_Vms
37
37
  loading: boolean
38
38
  }>()
39
39
 
40
40
  const localization = computed<UI_I_Localization>(() => useLocal())
41
+
42
+ const itemsLocal = computed<UI_I_Card[]>(() => itemsFunc(props.vms))
41
43
  </script>
42
44
 
43
45
  <style lang="scss" scoped>
@@ -3,7 +3,7 @@
3
3
  <div class="entity-status">
4
4
  <common-pages-home-card
5
5
  :title="localization.common.vms"
6
- :count="props.totalVms"
6
+ :count="props.vms.total"
7
7
  icon-name="vsphere-icon-vm"
8
8
  >
9
9
  <common-pages-home-status-content :items="props.vms" />
@@ -17,7 +17,6 @@ import type { UI_I_Localization } from '~/lib/models/interfaces'
17
17
  import type { UI_I_Vms } from '~/components/common/pages/home/lib/models/interfaces'
18
18
  const props = defineProps<{
19
19
  vms: UI_I_Vms
20
- totalVms: number
21
20
  }>()
22
21
 
23
22
  const localization = computed<UI_I_Localization>(() => useLocal())
@@ -0,0 +1,20 @@
1
+ import type {UI_I_Card, UI_I_Vms} from "~/components/common/pages/home/lib/models/interfaces";
2
+
3
+ export const itemsFunc = (vms: UI_I_Vms): UI_I_Card[] => [
4
+ {
5
+ value: vms.powered_on,
6
+ text: 'powered_on',
7
+ icon: 'vsphere-icon-vm-on',
8
+ },
9
+ {
10
+ value: vms.powered_off,
11
+ text: 'powered_off',
12
+ icon: 'icon-vm-power-off',
13
+ },
14
+
15
+ {
16
+ value: vms.suspended,
17
+ text: 'suspended',
18
+ icon: 'vsphere-icon-vm-suspended',
19
+ },
20
+ ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.681",
4
+ "version": "1.4.683",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",