From 38dfc716541a90d5b84b309518c2152e2d8e5886 Mon Sep 17 00:00:00 2001 From: Nancy Butler <42977925+mantis-toboggan-md@users.noreply.github.com> Date: Mon, 11 Jul 2022 15:49:19 -0700 Subject: [PATCH] fix conflict --- .../HarvesterBackupTargetValidation.vue | 0 .../components/formatter/HarvesterCPUUsed.vue | 0 .../formatter/HarvesterDiskState.vue | 0 .../formatter/HarvesterHostName.vue | 0 .../formatter/HarvesterIpAddress.vue | 20 +- .../formatter/HarvesterMemoryUsed.vue | 0 .../formatter/HarvesterMigrationState.vue | 0 .../formatter/HarvesterNodeName.vue | 0 .../formatter/HarvesterStorageUsed.vue | 0 .../components/formatter/HarvesterVmState.vue | 0 .../HarvesterHostBasic.vue | 102 +- .../VirtualMachineInstance.vue | 58 +- .../VirtualMachineBasics.vue | 190 +-- .../dialog/HarvesterAddHotplugModal.vue | 78 +- .../harvesterhci.io.virtualmachineimage.vue | 101 +- .../list/kubevirt.io.virtualmachine.vue | 54 +- pkg/harvester/validators/fileRequired.js | 11 - pkg/harvester/validators/imageUrl.js | 24 - pkg/harvester/validators/vmNetworks.js | 70 - shell/core/plugin.ts | 9 + shell/pkg/auto-import.js | 2 +- .../plugins/dashboard-store/resource-class.js | 1253 ++++++----------- shell/store/index.js | 19 - shell/store/type-map.js | 8 +- shell/utils/custom-validators.js | 31 +- .../utils/validators/vm-datavolumes.js | 2 +- shell/utils/validators/vm-image.js | 32 + .../utils/validators/vm.js | 75 +- 28 files changed, 805 insertions(+), 1334 deletions(-) rename {shell => pkg/harvester}/components/formatter/HarvesterBackupTargetValidation.vue (100%) rename {shell => pkg/harvester}/components/formatter/HarvesterCPUUsed.vue (100%) rename {shell => pkg/harvester}/components/formatter/HarvesterDiskState.vue (100%) rename {shell => pkg/harvester}/components/formatter/HarvesterHostName.vue (100%) rename {shell => pkg/harvester}/components/formatter/HarvesterIpAddress.vue (87%) rename {shell => pkg/harvester}/components/formatter/HarvesterMemoryUsed.vue (100%) rename {shell => pkg/harvester}/components/formatter/HarvesterMigrationState.vue (100%) rename {shell => pkg/harvester}/components/formatter/HarvesterNodeName.vue (100%) rename {shell => pkg/harvester}/components/formatter/HarvesterStorageUsed.vue (100%) rename {shell => pkg/harvester}/components/formatter/HarvesterVmState.vue (100%) delete mode 100644 pkg/harvester/validators/fileRequired.js delete mode 100644 pkg/harvester/validators/imageUrl.js delete mode 100644 pkg/harvester/validators/vmNetworks.js rename pkg/harvester/validators/dataVolumeSize.js => shell/utils/validators/vm-datavolumes.js (89%) create mode 100644 shell/utils/validators/vm-image.js rename pkg/harvester/validators/vmDisks.js => shell/utils/validators/vm.js (65%) diff --git a/shell/components/formatter/HarvesterBackupTargetValidation.vue b/pkg/harvester/components/formatter/HarvesterBackupTargetValidation.vue similarity index 100% rename from shell/components/formatter/HarvesterBackupTargetValidation.vue rename to pkg/harvester/components/formatter/HarvesterBackupTargetValidation.vue diff --git a/shell/components/formatter/HarvesterCPUUsed.vue b/pkg/harvester/components/formatter/HarvesterCPUUsed.vue similarity index 100% rename from shell/components/formatter/HarvesterCPUUsed.vue rename to pkg/harvester/components/formatter/HarvesterCPUUsed.vue diff --git a/shell/components/formatter/HarvesterDiskState.vue b/pkg/harvester/components/formatter/HarvesterDiskState.vue similarity index 100% rename from shell/components/formatter/HarvesterDiskState.vue rename to pkg/harvester/components/formatter/HarvesterDiskState.vue diff --git a/shell/components/formatter/HarvesterHostName.vue b/pkg/harvester/components/formatter/HarvesterHostName.vue similarity index 100% rename from shell/components/formatter/HarvesterHostName.vue rename to pkg/harvester/components/formatter/HarvesterHostName.vue diff --git a/shell/components/formatter/HarvesterIpAddress.vue b/pkg/harvester/components/formatter/HarvesterIpAddress.vue similarity index 87% rename from shell/components/formatter/HarvesterIpAddress.vue rename to pkg/harvester/components/formatter/HarvesterIpAddress.vue index cae12e3e9c..8027fa8514 100644 --- a/shell/components/formatter/HarvesterIpAddress.vue +++ b/pkg/harvester/components/formatter/HarvesterIpAddress.vue @@ -1,5 +1,6 @@ diff --git a/shell/components/formatter/HarvesterMemoryUsed.vue b/pkg/harvester/components/formatter/HarvesterMemoryUsed.vue similarity index 100% rename from shell/components/formatter/HarvesterMemoryUsed.vue rename to pkg/harvester/components/formatter/HarvesterMemoryUsed.vue diff --git a/shell/components/formatter/HarvesterMigrationState.vue b/pkg/harvester/components/formatter/HarvesterMigrationState.vue similarity index 100% rename from shell/components/formatter/HarvesterMigrationState.vue rename to pkg/harvester/components/formatter/HarvesterMigrationState.vue diff --git a/shell/components/formatter/HarvesterNodeName.vue b/pkg/harvester/components/formatter/HarvesterNodeName.vue similarity index 100% rename from shell/components/formatter/HarvesterNodeName.vue rename to pkg/harvester/components/formatter/HarvesterNodeName.vue diff --git a/shell/components/formatter/HarvesterStorageUsed.vue b/pkg/harvester/components/formatter/HarvesterStorageUsed.vue similarity index 100% rename from shell/components/formatter/HarvesterStorageUsed.vue rename to pkg/harvester/components/formatter/HarvesterStorageUsed.vue diff --git a/shell/components/formatter/HarvesterVmState.vue b/pkg/harvester/components/formatter/HarvesterVmState.vue similarity index 100% rename from shell/components/formatter/HarvesterVmState.vue rename to pkg/harvester/components/formatter/HarvesterVmState.vue diff --git a/pkg/harvester/detail/harvesterhci.io.host/HarvesterHostBasic.vue b/pkg/harvester/detail/harvesterhci.io.host/HarvesterHostBasic.vue index a64ae66462..7a6ea0ea1c 100644 --- a/pkg/harvester/detail/harvesterhci.io.host/HarvesterHostBasic.vue +++ b/pkg/harvester/detail/harvesterhci.io.host/HarvesterHostBasic.vue @@ -4,9 +4,9 @@ import { Banner } from '@components/Banner'; import { formatSi, exponentNeeded, UNITS } from '@shell/utils/units'; import { HCI as HCI_ANNOTATIONS } from '@shell/config/labels-annotations'; import { LONGHORN, METRIC, HCI } from '@shell/config/types'; -import HarvesterCPUUsed from '@shell/components/formatter/HarvesterCPUUsed'; -import HarvesterMemoryUsed from '@shell/components/formatter/HarvesterMemoryUsed'; -import HarvesterStorageUsed from '@shell/components/formatter/HarvesterStorageUsed'; +import HarvesterCPUUsed from '../../components/formatter/HarvesterCPUUsed'; +import HarvesterMemoryUsed from '../../components/formatter/HarvesterMemoryUsed'; +import HarvesterStorageUsed from '../../components/formatter/HarvesterStorageUsed'; const COMPLETE = 'complete'; const NONE = 'none'; @@ -21,13 +21,13 @@ export default { Banner, HarvesterCPUUsed, HarvesterMemoryUsed, - HarvesterStorageUsed + HarvesterStorageUsed, }, props: { value: { type: Object, - required: true + required: true, }, metrics: { @@ -55,25 +55,18 @@ export default { computed: { customName() { - return this.value.metadata?.annotations?.[ - HCI_ANNOTATIONS.HOST_CUSTOM_NAME - ]; + return this.value.metadata?.annotations?.[HCI_ANNOTATIONS.HOST_CUSTOM_NAME]; }, consoleUrl() { - const consoleUrl = this.value.metadata?.annotations?.[ - HCI_ANNOTATIONS.HOST_CONSOLE_URL - ]; + const consoleUrl = this.value.metadata?.annotations?.[HCI_ANNOTATIONS.HOST_CONSOLE_URL]; let value = consoleUrl; if (!consoleUrl) { return ''; } - if ( - !consoleUrl.startsWith('http://') && - !consoleUrl.startsWith('https://') - ) { + if (!consoleUrl.startsWith('http://') && !consoleUrl.startsWith('https://')) { value = `http://${ consoleUrl }`; } @@ -125,10 +118,7 @@ export default { storageUsage() { const inStore = this.$store.getters['currentProduct'].inStore; - const longhornNode = this.$store.getters[`${ inStore }/byId`]( - LONGHORN.NODES, - `longhorn-system/${ this.value.id }` - ); + const longhornNode = this.$store.getters[`${ inStore }/byId`](LONGHORN.NODES, `longhorn-system/${ this.value.id }`); let out = 0; const diskStatus = longhornNode?.status?.diskStatus || {}; @@ -144,10 +134,7 @@ export default { storageTotal() { const inStore = this.$store.getters['currentProduct'].inStore; - const longhornNode = this.$store.getters[`${ inStore }/byId`]( - LONGHORN.NODES, - `longhorn-system/${ this.value.id }` - ); + const longhornNode = this.$store.getters[`${ inStore }/byId`](LONGHORN.NODES, `longhorn-system/${ this.value.id }`); let out = 0; const diskStatus = longhornNode?.status?.diskStatus || {}; @@ -186,15 +173,8 @@ export default { }, nodeRoleState() { - const isExistRoleStatus = - this.value.metadata?.labels?.[HCI_ANNOTATIONS.NODE_ROLE_MASTER] !== - undefined || - this.value.metadata?.labels?.[ - HCI_ANNOTATIONS.NODE_ROLE_CONTROL_PLANE - ] !== undefined; - const promoteStatus = - this.value.metadata?.annotations?.[HCI_ANNOTATIONS.PROMOTE_STATUS] || - NONE; + const isExistRoleStatus = this.value.metadata?.labels?.[HCI_ANNOTATIONS.NODE_ROLE_MASTER] !== undefined || this.value.metadata?.labels?.[HCI_ANNOTATIONS.NODE_ROLE_CONTROL_PLANE] !== undefined; + const promoteStatus = this.value.metadata?.annotations?.[HCI_ANNOTATIONS.PROMOTE_STATUS] || NONE; if (!isExistRoleStatus && promoteStatus === COMPLETE) { return PROMOTE_RESTART; @@ -227,7 +207,7 @@ export default { const inStore = this.$store.getters['currentProduct'].inStore; return !!this.$store.getters[`${ inStore }/schemaFor`](HCI.NODE_NETWORK); - } + }, }, methods: { @@ -241,7 +221,7 @@ export default { }; return formatSi(value, formatOptions); - } + }, } }; @@ -251,25 +231,16 @@ export default {

{{ t('harvester.host.tabs.overview') }}

- +
- +
- +
@@ -287,28 +258,17 @@ export default {
- +
- +
@@ -321,10 +281,7 @@ export default {
- +
@@ -365,24 +322,15 @@ export default {

{{ t('harvester.host.detail.more') }}

- +
- +
- +
diff --git a/pkg/harvester/detail/harvesterhci.io.host/VirtualMachineInstance.vue b/pkg/harvester/detail/harvesterhci.io.host/VirtualMachineInstance.vue index 115552b31a..15d2914da4 100644 --- a/pkg/harvester/detail/harvesterhci.io.host/VirtualMachineInstance.vue +++ b/pkg/harvester/detail/harvesterhci.io.host/VirtualMachineInstance.vue @@ -2,7 +2,7 @@ import { STATE, AGE, NAME } from '@shell/config/table-headers'; import SortableTable from '@shell/components/SortableTable'; import Loading from '@shell/components/Loading'; -import HarvesterVmState from '@shell/components/formatter/HarvesterVmState'; +import HarvesterVmState from '../../components/formatter/HarvesterVmState'; import { allHash } from '@shell/utils/promise'; import { HCI } from '@shell/config/types'; import { HOSTNAME } from '@shell/config/labels-annotations'; @@ -13,22 +13,22 @@ export default { components: { SortableTable, Loading, - HarvesterVmState + HarvesterVmState, }, props: { node: { type: Object, - required: true - } + required: true, + }, }, async fetch() { const hash = await allHash({ - vms: this.$store.dispatch('harvester/findAll', { type: HCI.VM }), - vmis: this.$store.dispatch('harvester/findAll', { type: HCI.VMI }), - allNodeNetwork: this.$store.dispatch('harvester/findAll', { type: HCI.NODE_NETWORK }), - allClusterNetwork: this.$store.dispatch('harvester/findAll', { type: HCI.CLUSTER_NETWORK }) + vms: this.$store.dispatch('harvester/findAll', { type: HCI.VM }), + vmis: this.$store.dispatch('harvester/findAll', { type: HCI.VMI }), + allNodeNetwork: this.$store.dispatch('harvester/findAll', { type: HCI.NODE_NETWORK }), + allClusterNetwork: this.$store.dispatch('harvester/findAll', { type: HCI.CLUSTER_NETWORK }), }); const instanceMap = {}; @@ -43,10 +43,7 @@ export default { this.allNodeNetwork = hash.allNodeNetwork; this.allClusterNetwork = hash.allClusterNetwork; this.rows = hash.vms.filter((row) => { - return ( - instanceMap[row.metadata?.uid]?.status?.nodeName === - this.node?.metadata?.labels?.[HOSTNAME] - ); + return instanceMap[row.metadata?.uid]?.status?.nodeName === this.node?.metadata?.labels?.[HOSTNAME]; }); }, @@ -64,20 +61,20 @@ export default { STATE, NAME, { - name: 'vmCPU', - labelKey: 'tableHeaders.cpu', - sort: 'vmCPU', - search: false, - value: 'spec.template.spec.domain.cpu.cores', - width: 120 + name: 'vmCPU', + labelKey: 'tableHeaders.cpu', + sort: 'vmCPU', + search: false, + value: 'spec.template.spec.domain.cpu.cores', + width: 120 }, { - name: 'vmRAM', - labelKey: 'glance.memory', - sort: 'vmRAM', - search: false, - value: 'spec.template.spec.domain.resources.limits.memory', - width: 120 + name: 'vmRAM', + labelKey: 'glance.memory', + sort: 'vmRAM', + search: false, + value: 'spec.template.spec.domain.resources.limits.memory', + width: 120 }, { name: 'ip', @@ -88,10 +85,10 @@ export default { }, { ...AGE, - sort: 'metadata.creationTimestamp:desc' + sort: 'metadata.creationTimestamp:desc', } ]; - } + }, }, methods: {} @@ -112,15 +109,10 @@ export default { > - +
diff --git a/pkg/harvester/detail/kubevirt.io.virtualmachine/VirtualMachineTabs/VirtualMachineBasics.vue b/pkg/harvester/detail/kubevirt.io.virtualmachine/VirtualMachineTabs/VirtualMachineBasics.vue index 676c5b5804..32710e3692 100644 --- a/pkg/harvester/detail/kubevirt.io.virtualmachine/VirtualMachineTabs/VirtualMachineBasics.vue +++ b/pkg/harvester/detail/kubevirt.io.virtualmachine/VirtualMachineTabs/VirtualMachineBasics.vue @@ -1,5 +1,5 @@