From ea895c3a501522ecb6f4951a7cf5ca925f3a6108 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Fri, 11 Feb 2022 17:14:04 +0800 Subject: [PATCH] feat: set custom configs for topology --- src/router/dashboard.ts | 10 ++ .../dashboard/related/topology/Graph.vue | 18 ++-- .../dashboard/related/topology/Settings.vue | 99 ++++++++++++++++++- 3 files changed, 116 insertions(+), 11 deletions(-) diff --git a/src/router/dashboard.ts b/src/router/dashboard.ts index 0bb9e519..5b18caab 100644 --- a/src/router/dashboard.ts +++ b/src/router/dashboard.ts @@ -67,6 +67,16 @@ export const routesDashboard: Array = [ notShow: true, }, }, + { + path: "/dashboard/:layerId/:entity/:serviceId/:destServiceId/:name", + component: () => import("@/views/dashboard/Edit.vue"), + name: "CreateServiceRelation", + meta: { + title: "dashboardEdit", + exact: false, + notShow: true, + }, + }, { path: "/dashboard/:layerId/:entity/:serviceId/:podId/:name", component: () => import("@/views/dashboard/Edit.vue"), diff --git a/src/views/dashboard/related/topology/Graph.vue b/src/views/dashboard/related/topology/Graph.vue index b17a8845..7f587542 100644 --- a/src/views/dashboard/related/topology/Graph.vue +++ b/src/views/dashboard/related/topology/Graph.vue @@ -20,7 +20,7 @@ limitations under the License. --> :style="`height: ${height}`" >
- +
(null); const tools = ref(null); const legend = ref(null); const showSetting = ref(false); +const settings = ref({}); onMounted(async () => { loading.value = true; @@ -188,8 +190,9 @@ function handleLinkClick(event: any, d: Call) { event.stopPropagation(); topologyStore.setNode({}); topologyStore.setLink(d); - // const path = `/dashboard/${states.selectedLayer}/${states.entity}/${name}`; - // router.push(path); + const path = `/dashboard/${dashboardStore.layerId}/${dashboardStore.entity}Relation/${d.source.id}/${d.target.id}/${settings.value.linkDashboard}`; + const routeUrl = router.resolve({ path }); + window.open(routeUrl.href, "_blank"); } function update() { // node element @@ -265,6 +268,9 @@ function update() { } } } +function updateSettings(config: any) { + settings.value = config; +} onBeforeUnmount(() => { window.removeEventListener("resize", resize); }); @@ -287,9 +293,9 @@ watch( height: 700px; background-color: #2b3037; overflow: auto; - padding: 10px; + padding: 0 10px; border-radius: 4px; - color: #ddd; + color: #ccc; transition: all 0.5ms linear; } @@ -297,7 +303,7 @@ watch( position: absolute; top: 22px; right: 0; - color: #aaa; + color: #ccc; cursor: pointer; transition: all 0.5ms linear; } diff --git a/src/views/dashboard/related/topology/Settings.vue b/src/views/dashboard/related/topology/Settings.vue index df98030c..60ab2f38 100644 --- a/src/views/dashboard/related/topology/Settings.vue +++ b/src/views/dashboard/related/topology/Settings.vue @@ -14,30 +14,119 @@ See the License for the specific language governing permissions and limitations under the License. -->