fix: active widgets
diff --git a/src/views/dashboard/controls/Tab.vue b/src/views/dashboard/controls/Tab.vue
index 8fe1c0e..2f5515b 100644
--- a/src/views/dashboard/controls/Tab.vue
+++ b/src/views/dashboard/controls/Tab.vue
@@ -74,7 +74,10 @@
@click="clickTabGrid($event, item)"
:class="{ active: activeTabWidget === item.i }"
>
- <Widget :data="item" :active="activeTabWidget === item.i" />
+ <Widget
+ :data="item"
+ :activeIndex="`${data.i}-${activeTabIndex}-${item.i}`"
+ />
</grid-item>
</grid-layout>
<div class="no-data-tips" v-else>Please add widgets.</div>
diff --git a/src/views/dashboard/controls/Widget.vue b/src/views/dashboard/controls/Widget.vue
index c68111e..61fe3a6 100644
--- a/src/views/dashboard/controls/Widget.vue
+++ b/src/views/dashboard/controls/Widget.vue
@@ -69,7 +69,7 @@
type: Object as PropType<LayoutConfig>,
default: () => ({ widget: {} }),
},
- active: { type: Boolean, default: false },
+ activeIndex: { type: String, default: "" },
};
export default defineComponent({
name: "Widget",
@@ -112,8 +112,14 @@
dashboardStore.removeControls(props.data);
}
function editConfig() {
+ console.log(props.data);
dashboardStore.setConfigPanel(true);
dashboardStore.selectWidget(props.data);
+ if (props.activeIndex) {
+ dashboardStore.activeGridItem(props.activeIndex);
+ } else {
+ dashboardStore.activeGridItem(props.data.i);
+ }
}
watch(
() => [props.data.queryMetricType, props.data.metrics],