diff --git a/src/views/dashboard/Edit.vue b/src/views/dashboard/Edit.vue index cde7b6b1..ed953348 100644 --- a/src/views/dashboard/Edit.vue +++ b/src/views/dashboard/Edit.vue @@ -60,10 +60,10 @@ const p = useRoute().params; const layoutKey = ref(`${p.layerId}_${p.entity}_${p.name}`); setTemplate(); - async function setTemplate() { await dashboardStore.setDashboards(); - if (dashboardStore.currentDashboard) { + + if (!p.entity) { const { layer, entity, name } = dashboardStore.currentDashboard; layoutKey.value = `${layer}_${entity}_${name.split(" ").join("-")}`; } @@ -83,8 +83,6 @@ async function setTemplate() { isRoot: layout.isRoot, }); } - dashboardStore.setLayer(dashboardStore.currentDashboard.layer); - dashboardStore.setEntity(dashboardStore.currentDashboard.entity); } function handleClick(e: any) { e.stopPropagation(); diff --git a/src/views/dashboard/configuration/Widget.vue b/src/views/dashboard/configuration/Widget.vue index c0e569ce..28ada4ce 100644 --- a/src/views/dashboard/configuration/Widget.vue +++ b/src/views/dashboard/configuration/Widget.vue @@ -37,6 +37,7 @@ limitations under the License. --> metrics: dashboardStore.selectedGrid.metrics, metricTypes: dashboardStore.selectedGrid.metricTypes, standard: dashboardStore.selectedGrid.standard, + isEdit: true, }" />
diff --git a/src/views/dashboard/configuration/widget/MetricOptions.vue b/src/views/dashboard/configuration/widget/MetricOptions.vue index 70fd0cd1..8682dae3 100644 --- a/src/views/dashboard/configuration/widget/MetricOptions.vue +++ b/src/views/dashboard/configuration/widget/MetricOptions.vue @@ -179,8 +179,8 @@ async function setMetricType(catalog?: string) { } dashboardStore.selectWidget({ ...dashboardStore.selectedGrid, - metrics, - metricTypes, + metrics: states.metrics, + metricTypes: states.metricTypes, }); states.metricTypeList = []; for (const metric of metrics) { @@ -321,6 +321,9 @@ function changeMetricType(index: number, opt: Option[] | any) { queryMetrics(); } async function queryMetrics() { + if (states.isList) { + return; + } const { standard } = dashboardStore.selectedGrid; const params = useQueryProcessor({ ...states, standard }); if (!params) { diff --git a/src/views/dashboard/controls/Tab.vue b/src/views/dashboard/controls/Tab.vue index c4f8d5fd..90f35349 100644 --- a/src/views/dashboard/controls/Tab.vue +++ b/src/views/dashboard/controls/Tab.vue @@ -173,6 +173,12 @@ export default defineComponent({ function deleteTabItem(e: Event, idx: number) { e.stopPropagation(); dashboardStore.removeTabItem(props.data, idx); + const kids = dashboardStore.layout[l].children[0]; + const arr = (kids && kids.children) || []; + dashboardStore.setCurrentTabItems(arr); + dashboardStore.activeGridItem(0); + activeTabIndex.value = 0; + needQuery.value = true; } function addTabItem() { dashboardStore.addTabItem(props.data); diff --git a/src/views/dashboard/graphs/EndpointList.vue b/src/views/dashboard/graphs/EndpointList.vue index 46b9cac0..38b01fc2 100644 --- a/src/views/dashboard/graphs/EndpointList.vue +++ b/src/views/dashboard/graphs/EndpointList.vue @@ -102,6 +102,7 @@ const props = defineProps({ i: string; metrics: string[]; metricTypes: string[]; + isEdit: boolean; } >, default: () => ({ dashboardName: "", fontSize: 12, i: "" }), @@ -129,6 +130,9 @@ async function queryEndpoints() { } searchEndpoints.value = selectorStore.pods; endpoints.value = selectorStore.pods.splice(0, pageSize); + if (props.config.isEdit) { + return; + } queryEndpointMetrics(endpoints.value); } async function queryEndpointMetrics(currentPods: Endpoint[]) { diff --git a/src/views/dashboard/graphs/InstanceList.vue b/src/views/dashboard/graphs/InstanceList.vue index 781293ea..4d844b69 100644 --- a/src/views/dashboard/graphs/InstanceList.vue +++ b/src/views/dashboard/graphs/InstanceList.vue @@ -99,6 +99,7 @@ const props = defineProps({ i: string; metrics: string[]; metricTypes: string[]; + isEdit: boolean; } >, default: () => ({ @@ -132,6 +133,9 @@ async function queryInstance() { } searchInstances.value = selectorStore.pods; instances.value = searchInstances.value.splice(0, pageSize); + if (props.config.isEdit) { + return; + } queryInstanceMetrics(instances.value); } diff --git a/src/views/dashboard/graphs/ServiceList.vue b/src/views/dashboard/graphs/ServiceList.vue index 57d29f79..f2b78563 100644 --- a/src/views/dashboard/graphs/ServiceList.vue +++ b/src/views/dashboard/graphs/ServiceList.vue @@ -47,7 +47,9 @@ limitations under the License. -->