reset entity

This commit is contained in:
Qiuxia Fan 2022-03-21 17:33:32 +08:00
parent 96116fa17d
commit 53ea5c4a0f
5 changed files with 44 additions and 20 deletions

View File

@ -33,17 +33,13 @@ limitations under the License. -->
<el-table v-loading="chartLoading" :data="endpoints" style="width: 100%"> <el-table v-loading="chartLoading" :data="endpoints" style="width: 100%">
<el-table-column label="Endpoints"> <el-table-column label="Endpoints">
<template #default="scope"> <template #default="scope">
<router-link <span
class="link" class="link"
:to="`/dashboard/${dashboardStore.layerId}/${ @click="clickEndpoint"
EntityType[2].value
}/${selectorStore.currentService.id}/${
scope.row.id
}/${config.dashboardName.split(' ').join('-')}`"
:style="{ fontSize: `${config.fontSize}px` }" :style="{ fontSize: `${config.fontSize}px` }"
> >
{{ scope.row.label }} {{ scope.row.label }}
</router-link> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -94,6 +90,7 @@ import { useQueryPodsMetrics, usePodsSource } from "@/hooks/useProcessor";
import Line from "./Line.vue"; import Line from "./Line.vue";
import Card from "./Card.vue"; import Card from "./Card.vue";
import { EntityType } from "../data"; import { EntityType } from "../data";
import router from "@/router";
/*global defineProps */ /*global defineProps */
const props = defineProps({ const props = defineProps({
@ -159,6 +156,14 @@ async function queryEndpointMetrics(currentPods: Endpoint[]) {
} }
endpoints.value = currentPods; endpoints.value = currentPods;
} }
function clickEndpoint(scope: any) {
dashboardStore.setEntity(EntityType[2].value);
router.push(
`/dashboard/${dashboardStore.layerId}/${EntityType[2].value}/${
selectorStore.currentService.id
}/${scope.row.id}/${props.config.dashboardName.split(" ").join("-")}`
);
}
function changePage(pageIndex: number) { function changePage(pageIndex: number) {
endpoints.value = searchEndpoints.value.splice(pageIndex - 1, pageSize); endpoints.value = searchEndpoints.value.splice(pageIndex - 1, pageSize);
} }

View File

@ -33,17 +33,13 @@ limitations under the License. -->
<el-table v-loading="chartLoading" :data="instances" style="width: 100%"> <el-table v-loading="chartLoading" :data="instances" style="width: 100%">
<el-table-column label="Service Instances"> <el-table-column label="Service Instances">
<template #default="scope"> <template #default="scope">
<router-link <span
class="link" class="link"
:to="`/dashboard/${dashboardStore.layerId}/${ @click="clickInstance"
EntityType[3].value
}/${selectorStore.currentService.id}/${
scope.row.id
}/${config.dashboardName.split(' ').join('-')}`"
:style="{ fontSize: `${config.fontSize}px` }" :style="{ fontSize: `${config.fontSize}px` }"
> >
{{ scope.row.label }} {{ scope.row.label }}
</router-link> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -94,6 +90,7 @@ import { InstanceListConfig } from "@/types/dashboard";
import { Instance } from "@/types/selector"; import { Instance } from "@/types/selector";
import { useQueryPodsMetrics, usePodsSource } from "@/hooks/useProcessor"; import { useQueryPodsMetrics, usePodsSource } from "@/hooks/useProcessor";
import { EntityType } from "../data"; import { EntityType } from "../data";
import router from "@/router";
/*global defineProps */ /*global defineProps */
const props = defineProps({ const props = defineProps({
@ -164,6 +161,15 @@ async function queryInstanceMetrics(currentInstances: Instance[]) {
instances.value = currentInstances; instances.value = currentInstances;
} }
function clickInstance(scope: any) {
dashboardStore.setEntity(EntityType[3].value);
router.push(
`/dashboard/${dashboardStore.layerId}/${EntityType[3].value}/${
selectorStore.currentService.id
}/${scope.row.id}/${props.config.dashboardName.split(" ").join("-")}`
);
}
function changePage(pageIndex: number) { function changePage(pageIndex: number) {
instances.value = searchInstances.value.splice(pageIndex - 1, pageSize); instances.value = searchInstances.value.splice(pageIndex - 1, pageSize);
} }

View File

@ -45,16 +45,13 @@ limitations under the License. -->
</el-table-column> </el-table-column>
<el-table-column label="Service Names"> <el-table-column label="Service Names">
<template #default="scope"> <template #default="scope">
<router-link <span
class="link" class="link"
:to="`/dashboard/${dashboardStore.layerId}/${
EntityType[0].value
}/${scope.row.id}/${config.dashboardName.split(' ').join('-')}`"
:key="1"
:style="{ fontSize: `${config.fontSize}px` }" :style="{ fontSize: `${config.fontSize}px` }"
@click="clickService(scope)"
> >
{{ scope.row.label }} {{ scope.row.label }}
</router-link> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -105,6 +102,7 @@ import { useDashboardStore } from "@/store/modules/dashboard";
import { Service } from "@/types/selector"; import { Service } from "@/types/selector";
import { useQueryPodsMetrics, usePodsSource } from "@/hooks/useProcessor"; import { useQueryPodsMetrics, usePodsSource } from "@/hooks/useProcessor";
import { EntityType } from "../data"; import { EntityType } from "../data";
import router from "@/router";
/*global defineProps */ /*global defineProps */
const props = defineProps({ const props = defineProps({
@ -173,6 +171,15 @@ async function queryServices() {
} }
queryServiceMetrics(services.value); queryServiceMetrics(services.value);
} }
function clickService(scope: any) {
dashboardStore.setEntity(EntityType[0].value);
const path = `/dashboard/${dashboardStore.layerId}/${EntityType[0].value}/${
scope.row.id
}/${props.config.dashboardName.split(" ").join("-")}`;
router.push(path);
}
async function queryServiceMetrics(currentServices: Service[]) { async function queryServiceMetrics(currentServices: Service[]) {
const { metrics } = props.config; const { metrics } = props.config;

View File

@ -239,6 +239,7 @@ function handleLinkClick(event: any, d: Call) {
dashboardStore.entity === EntityType[1].value dashboardStore.entity === EntityType[1].value
? EntityType[0].value ? EntityType[0].value
: dashboardStore.entity; : dashboardStore.entity;
dashboardStore.setEntity(`${e}Relation`);
const path = `/dashboard/${dashboardStore.layerId}/${e}Relation/${ const path = `/dashboard/${dashboardStore.layerId}/${e}Relation/${
d.source.id d.source.id
}/${d.target.id}/${settings.value.linkDashboard.split(" ").join("-")}`; }/${d.target.id}/${settings.value.linkDashboard.split(" ").join("-")}`;
@ -373,6 +374,7 @@ async function handleInspect() {
update(); update();
} }
function handleGoEndpoint(name: string) { function handleGoEndpoint(name: string) {
dashboardStore.setEntity(EntityType[2].value);
const path = `/dashboard/${dashboardStore.layerId}/Endpoint/${ const path = `/dashboard/${dashboardStore.layerId}/Endpoint/${
topologyStore.node.id topologyStore.node.id
}/${name.split(" ").join("-")}`; }/${name.split(" ").join("-")}`;
@ -381,6 +383,7 @@ function handleGoEndpoint(name: string) {
window.open(routeUrl.href, "_blank"); window.open(routeUrl.href, "_blank");
} }
function handleGoInstance(name: string) { function handleGoInstance(name: string) {
dashboardStore.setEntity(EntityType[3].value);
const path = `/dashboard/${dashboardStore.layerId}/ServiceInstance/${ const path = `/dashboard/${dashboardStore.layerId}/ServiceInstance/${
topologyStore.node.id topologyStore.node.id
}/${name.split(" ").join("-")}`; }/${name.split(" ").join("-")}`;
@ -389,6 +392,7 @@ function handleGoInstance(name: string) {
window.open(routeUrl.href, "_blank"); window.open(routeUrl.href, "_blank");
} }
function handleGoDashboard(name: string) { function handleGoDashboard(name: string) {
dashboardStore.setEntity(EntityType[0].value);
const path = `/dashboard/${dashboardStore.layerId}/Service/${ const path = `/dashboard/${dashboardStore.layerId}/Service/${
topologyStore.node.id topologyStore.node.id
}/${name.split(" ").join("-")}`; }/${name.split(" ").join("-")}`;

View File

@ -150,6 +150,7 @@ function goDashboard() {
dashboardStore.entity === EntityType[2].value dashboardStore.entity === EntityType[2].value
? EntityType[2].value ? EntityType[2].value
: EntityType[3].value; : EntityType[3].value;
dashboardStore.setEntity(entity);
const path = `/dashboard/${dashboardStore.layerId}/${entity}/${topologyStore.node.serviceId}/${topologyStore.node.id}/${settings.value.nodeDashboard}`; const path = `/dashboard/${dashboardStore.layerId}/${entity}/${topologyStore.node.serviceId}/${topologyStore.node.id}/${settings.value.nodeDashboard}`;
const routeUrl = router.resolve({ path }); const routeUrl = router.resolve({ path });
window.open(routeUrl.href, "_blank"); window.open(routeUrl.href, "_blank");
@ -182,6 +183,7 @@ function selectNodeLink(d: any) {
dashboardStore.entity === EntityType[2].value dashboardStore.entity === EntityType[2].value
? EntityType[6].value ? EntityType[6].value
: EntityType[5].value; : EntityType[5].value;
dashboardStore.setEntity(entity);
const path = `/dashboard/${dashboardStore.layerId}/${entity}/${sourceObj.serviceId}/${sourceObj.id}/${targetObj.serviceId}/${targetObj.id}/${settings.value.linkDashboard}`; const path = `/dashboard/${dashboardStore.layerId}/${entity}/${sourceObj.serviceId}/${sourceObj.id}/${targetObj.serviceId}/${targetObj.id}/${settings.value.linkDashboard}`;
const routeUrl = router.resolve({ path }); const routeUrl = router.resolve({ path });
window.open(routeUrl.href, "_blank"); window.open(routeUrl.href, "_blank");