From 4be3634c8297da364f533723f2c9c508739d4181 Mon Sep 17 00:00:00 2001 From: Yiya Chen Date: Wed, 4 Mar 2026 11:47:00 +0800 Subject: [PATCH] feat: add VPC network topology in detail page (#721) * feat: add topology Signed-off-by: Yi-Ya Chen * feat: add provider info Signed-off-by: Yi-Ya Chen * refactor: remove comments Signed-off-by: Yi-Ya Chen * fix: exclude default network Signed-off-by: Yi-Ya Chen * feat: add VPC peering Signed-off-by: Yi-Ya Chen * refactor: remove regex Signed-off-by: Yi-Ya Chen * refactor: adjust row height Signed-off-by: Yi-Ya Chen * feat: introduce auto layout Signed-off-by: Yi-Ya Chen --------- Signed-off-by: Yi-Ya Chen --- .github/workflows/run-lint.yaml | 2 +- package.json | 5 + pkg/harvester/detail/kubeovn.io.vpc.vue | 1446 +++++++++++++++++++++++ pkg/harvester/index.ts | 1 + pkg/harvester/l10n/en-us.yaml | 20 +- pkg/harvester/list/kubeovn.io.vpc.vue | 17 + pkg/harvester/styles/vue-flow.scss | 4 + pkg/harvester/types.ts | 1 + yarn.lock | 74 +- 9 files changed, 1564 insertions(+), 6 deletions(-) create mode 100644 pkg/harvester/detail/kubeovn.io.vpc.vue create mode 100644 pkg/harvester/styles/vue-flow.scss diff --git a/.github/workflows/run-lint.yaml b/.github/workflows/run-lint.yaml index 827386d8..a2cc22f4 100644 --- a/.github/workflows/run-lint.yaml +++ b/.github/workflows/run-lint.yaml @@ -1,7 +1,7 @@ name: Tests on: - workflow_call: # This tells GH that the workflow is reusable + workflow_call: # This tells GH that the workflow is reusable push: branches: - main diff --git a/package.json b/package.json index 7926df38..256ce3e8 100644 --- a/package.json +++ b/package.json @@ -8,10 +8,15 @@ "dependencies": { "@babel/plugin-transform-class-static-block": "7.28.6", "@rancher/shell": "3.0.9-rc.1", + "@vue-flow/background": "^1.3.0", + "@vue-flow/controls": "^1.1.1", + "@vue-flow/core": "^1.33.5", + "@vue-flow/minimap": "^1.4.0", "cache-loader": "^4.1.0", "color": "4.2.3", "ip": "2.0.1", "node-polyfill-webpack-plugin": "^3.0.0", + "elkjs": "^0.10.0", "vue-draggable-next": "^2.2.1", "yaml": "^2.5.1" }, diff --git a/pkg/harvester/detail/kubeovn.io.vpc.vue b/pkg/harvester/detail/kubeovn.io.vpc.vue new file mode 100644 index 00000000..51a23834 --- /dev/null +++ b/pkg/harvester/detail/kubeovn.io.vpc.vue @@ -0,0 +1,1446 @@ + + + + + diff --git a/pkg/harvester/index.ts b/pkg/harvester/index.ts index 5dfdf3c7..8acd4354 100644 --- a/pkg/harvester/index.ts +++ b/pkg/harvester/index.ts @@ -7,6 +7,7 @@ import harvesterStore from './store/harvester-store'; import customValidators from './validators'; import { PRODUCT_NAME } from './config/harvester'; import { defineAsyncComponent } from 'vue'; +import './styles/vue-flow.scss'; // Init the package export default function (plugin: IPlugin) { diff --git a/pkg/harvester/l10n/en-us.yaml b/pkg/harvester/l10n/en-us.yaml index ab99cc26..0713e744 100644 --- a/pkg/harvester/l10n/en-us.yaml +++ b/pkg/harvester/l10n/en-us.yaml @@ -195,7 +195,6 @@ harvester: title: Restart Virtual Machine tip: Restart the virtual machine for configuration changes to take effect. cancel: Save - notification: title: succeed: Succeed @@ -1147,6 +1146,25 @@ harvester: banner: The supported field in ACL match can refer to KubeOvn Subnet ACL document vpc: + viewTopology: Topology + topology: + loading: Loading topology... + empty: No resources found + visibility: + vpc: VPC + subnets: Subnets + overlayNetworks: Overlay Networks + vms: VMs + labels: + cidr: CIDR + provider: Provider + type: Type + clusterNetwork: Cluster Network + network: Network + subnet: Subnet + ip: IP + mac: MAC + peering: Peering noAddonEnabled: prefix: The kubeovn-operator add-on is not enabled, click middle: here diff --git a/pkg/harvester/list/kubeovn.io.vpc.vue b/pkg/harvester/list/kubeovn.io.vpc.vue index c63b72bb..363f4fd0 100644 --- a/pkg/harvester/list/kubeovn.io.vpc.vue +++ b/pkg/harvester/list/kubeovn.io.vpc.vue @@ -155,6 +155,15 @@ export default { return location; }, + viewTopology(group) { + const vpc = group.key; + const resource = this.$store.getters[`harvester/byId`](HCI.VPC, vpc); + + if (resource && resource.goToDetail) { + resource.goToDetail(); + } + }, + showVpcAction(event, group) { const vpc = group.key; @@ -218,6 +227,14 @@ export default { > {{ t('harvester.vpc.createSubnet') }} +