fix: set graph options(#80)

This commit is contained in:
Fine0830 2022-05-10 11:07:36 +08:00 committed by GitHub
parent 918b0551ad
commit 024a0fe44c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View File

@ -41,7 +41,6 @@ import { useDashboardStore } from "@/store/modules/dashboard";
const { t } = useI18n();
const dashboardStore = useDashboardStore();
const { selectedGrid } = dashboardStore;
const widget = dashboardStore.selectedGrid.widget || {};
const title = ref<string>(widget.title || "");
const tips = ref<string>(widget.tips || "");
@ -51,6 +50,7 @@ function updateWidgetConfig(param: { [key: string]: string }) {
if (!key) {
return;
}
const { selectedGrid } = dashboardStore;
const widget = {
...dashboardStore.selectedGrid.widget,
[key]: decodeURIComponent(param[key]),

View File

@ -277,6 +277,12 @@ function handleLinkClick(event: any, d: Call) {
layer: dashboardStore.layerId,
entity: `${e}Relation`,
});
if (!p) {
ElMessage.error(
`The dashboard named ${settings.value.linkDashboard} doesn't exist`
);
return;
}
dashboardStore.setEntity(p.entity);
const path = `/dashboard/related/${p.layer}/${e}Relation/${d.source.id}/${d.target.id}/${p.name}`;
const routeUrl = router.resolve({ path });

View File

@ -178,6 +178,12 @@ function goDashboard() {
layer: dashboardStore.layerId,
entity,
});
if (!d) {
ElMessage.error(
`The dashboard named ${settings.value.nodeDashboard} doesn't exist`
);
return;
}
const path = `/dashboard/${d.layer}/${entity}/${topologyStore.node.serviceId}/${topologyStore.node.id}/${d.name}`;
const routeUrl = router.resolve({ path });
window.open(routeUrl.href, "_blank");
@ -216,6 +222,12 @@ function selectNodeLink(d: any) {
layer: dashboardStore.layerId,
entity,
});
if (!p) {
ElMessage.error(
`The dashboard named ${settings.value.linkDashboard} doesn't exist`
);
return;
}
const path = `/dashboard/${p.layer}/${entity}/${sourceObj.serviceId}/${sourceObj.id}/${targetObj.serviceId}/${targetObj.id}/${p.name}`;
const routeUrl = router.resolve({ path });
window.open(routeUrl.href, "_blank");