+
+ {{ t("hierarchyNodeDashboard") }}
+
+
- {{ t("hierarchyNodeMetrics") }}
+ {{ t("hierarchyNodeMetrics") }}
@@ -238,10 +226,14 @@ limitations under the License. -->
}
async function saveMQE() {
+ if (!currentRow.value.expressionsConfig) {
+ return;
+ }
const items: DashboardItem[] = [];
loading.value = true;
for (const d of dashboardStore.dashboards) {
if (d.id === currentRow.value.id) {
+ d.isDefault = currentRow.value.isDefault || false;
d.expressions = currentRow.value.expressions;
d.expressionsConfig = currentRow.value.expressionsConfig;
const key = [d.layer, d.entity, d.name].join("_");
@@ -269,6 +261,38 @@ limitations under the License. -->
loading.value = false;
return;
}
+ } else {
+ if (
+ d.layer === currentRow.value.layer &&
+ [EntityType[0].value].includes(d.entity) &&
+ !currentRow.value.isDefault &&
+ d.isDefault
+ ) {
+ d.isDefault = false;
+ const key = [d.layer, d.entity, d.name].join("_");
+ const layout = sessionStorage.getItem(key) || "{}";
+ const c = {
+ ...JSON.parse(layout).configuration,
+ ...d,
+ };
+ const setting = {
+ id: d.id,
+ configuration: JSON.stringify(c),
+ };
+ const res = await dashboardStore.updateDashboard(setting);
+ if (res.data.changeTemplate.status) {
+ sessionStorage.setItem(
+ key,
+ JSON.stringify({
+ id: d.id,
+ configuration: c,
+ }),
+ );
+ } else {
+ loading.value = false;
+ return;
+ }
+ }
}
items.push(d);
}
@@ -497,71 +521,7 @@ limitations under the License. -->
searchDashboards(currentPage.value);
loading.value = false;
}
- async function handleTopLevel(row: DashboardItem) {
- const items: DashboardItem[] = [];
- loading.value = true;
- for (const d of dashboardStore.dashboards) {
- if (d.id === row.id) {
- d.isDefault = !row.isDefault;
- const key = [d.layer, d.entity, d.name].join("_");
- const layout = sessionStorage.getItem(key) || "{}";
- const c = {
- ...JSON.parse(layout).configuration,
- ...d,
- };
- delete c.id;
- const setting = {
- id: d.id,
- configuration: JSON.stringify(c),
- };
- const res = await dashboardStore.updateDashboard(setting);
- if (res.data.changeTemplate.status) {
- sessionStorage.setItem(
- key,
- JSON.stringify({
- id: d.id,
- configuration: c,
- }),
- );
- } else {
- loading.value = false;
- return;
- }
- } else {
- if (d.layer === row.layer && [EntityType[0].value].includes(d.entity) && !row.isDefault && d.isDefault) {
- d.isDefault = false;
- const key = [d.layer, d.entity, d.name].join("_");
- const layout = sessionStorage.getItem(key) || "{}";
- const c = {
- ...JSON.parse(layout).configuration,
- ...d,
- };
- const setting = {
- id: d.id,
- configuration: JSON.stringify(c),
- };
- const res = await dashboardStore.updateDashboard(setting);
- if (res.data.changeTemplate.status) {
- sessionStorage.setItem(
- key,
- JSON.stringify({
- id: d.id,
- configuration: c,
- }),
- );
- } else {
- loading.value = false;
- return;
- }
- }
- }
- items.push(d);
- }
- dashboardStore.resetDashboards(items);
- searchDashboards(currentPage.value);
- loading.value = false;
- }
function handleRename(row: DashboardItem) {
ElMessageBox.prompt("Please input dashboard name", "Edit", {
confirmButtonText: "OK",
@@ -724,10 +684,14 @@ limitations under the License. -->
.placeholder {
display: inline-block;
- width: 75px;
+ width: 136px;
}
.expressions {
height: 300px;
}
+
+ .label {
+ font-size: 12px;
+ }
diff --git a/src/views/dashboard/related/topology/pod/InstanceMap.vue b/src/views/dashboard/related/topology/pod/InstanceMap.vue
index 02befe96..e6df446e 100644
--- a/src/views/dashboard/related/topology/pod/InstanceMap.vue
+++ b/src/views/dashboard/related/topology/pod/InstanceMap.vue
@@ -152,16 +152,18 @@ limitations under the License. -->
const origin = dashboardStore.entity;
event.stopPropagation();
hideTip();
- const dashboard =
- getDashboard(
- {
- layer: d.layer || "",
- entity: EntityType[3].value,
- },
- ConfigFieldTypes.ISDEFAULT,
- ).dashboard || {};
+ const { dashboard } = getDashboard(
+ {
+ layer: d.layer || "",
+ entity: EntityType[3].value,
+ },
+ ConfigFieldTypes.ISDEFAULT,
+ );
+ if (!dashboard) {
+ return;
+ }
const name = dashboard.name;
- const path = `/dashboard/${dashboardStore.layerId}/${EntityType[3].value}/${d.serviceId}/${d.key}/${name}`;
+ const path = `/dashboard/${dashboard.layer}/${EntityType[3].value}/${d.serviceId}/${d.key}/${name}`;
const routeUrl = router.resolve({ path });
window.open(routeUrl.href, "_blank");
diff --git a/src/views/dashboard/related/topology/service/HierarchyMap.vue b/src/views/dashboard/related/topology/service/HierarchyMap.vue
index 6a936045..cece4a5c 100644
--- a/src/views/dashboard/related/topology/service/HierarchyMap.vue
+++ b/src/views/dashboard/related/topology/service/HierarchyMap.vue
@@ -160,16 +160,19 @@ limitations under the License. -->
const origin = dashboardStore.entity;
event.stopPropagation();
hideTip();
- const dashboard =
- getDashboard(
- {
- layer: d.layer || "",
- entity: EntityType[0].value,
- },
- ConfigFieldTypes.ISDEFAULT,
- ).dashboard || {};
+ const { dashboard } = getDashboard(
+ {
+ layer: d.layer || "",
+ entity: EntityType[0].value,
+ },
+ ConfigFieldTypes.ISDEFAULT,
+ );
+ if (!dashboard) {
+ return;
+ }
+
const name = dashboard.name;
- const path = `/dashboard/${dashboardStore.layerId}/${EntityType[0].value}/${d.key}/${name}`;
+ const path = `/dashboard/${dashboard.layer}/${EntityType[0].value}/${d.key}/${name}`;
const routeUrl = router.resolve({ path });
window.open(routeUrl.href, "_blank");