From a467269a67155b28a6343677c3fe7c6651f23b53 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Thu, 13 Jan 2022 14:17:31 +0800 Subject: [PATCH] fix: active widgets --- src/views/dashboard/controls/Tab.vue | 5 ++++- src/views/dashboard/controls/Widget.vue | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/views/dashboard/controls/Tab.vue b/src/views/dashboard/controls/Tab.vue index 8fe1c0ee..2f5515b2 100644 --- a/src/views/dashboard/controls/Tab.vue +++ b/src/views/dashboard/controls/Tab.vue @@ -74,7 +74,10 @@ limitations under the License. --> @click="clickTabGrid($event, item)" :class="{ active: activeTabWidget === item.i }" > - +
Please add widgets.
diff --git a/src/views/dashboard/controls/Widget.vue b/src/views/dashboard/controls/Widget.vue index c68111eb..61fe3a6b 100644 --- a/src/views/dashboard/controls/Widget.vue +++ b/src/views/dashboard/controls/Widget.vue @@ -69,7 +69,7 @@ const props = { type: Object as PropType, default: () => ({ widget: {} }), }, - active: { type: Boolean, default: false }, + activeIndex: { type: String, default: "" }, }; export default defineComponent({ name: "Widget", @@ -112,8 +112,14 @@ export default defineComponent({ 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],