feat: active controls

This commit is contained in:
Qiuxia Fan
2022-01-09 14:24:11 +08:00
parent a94c5ff4cb
commit 7cdd57325a
5 changed files with 46 additions and 22 deletions

View File

@@ -31,7 +31,7 @@ limitations under the License. -->
</span>
<span class="add-Item" @click="addTabItem">
<Icon size="sm" iconName="add" />
<Icon size="middle" iconName="add" />
</span>
</div>
<div class="operations">
@@ -71,6 +71,7 @@ const props = defineProps({
type: Object as PropType<{ type: string; children: any[] }>,
default: () => ({ children: [] }),
},
active: { type: Boolean, default: false },
});
const dashboardStore = useDashboardStore();
const state = reactive<{ layout: any[]; activeTab: number }>({

View File

@@ -51,6 +51,7 @@ const props = {
type: Object as PropType<LayoutConfig>,
default: () => ({ widget: {} }),
},
active: { type: Boolean, default: false },
};
export default defineComponent({
name: "Widget",
@@ -73,6 +74,9 @@ export default defineComponent({
const json = await dashboardStore.fetchMetricValue(props.data);
loadingInstance.close();
if (!json) {
return;
}
if (json.error) {
ElMessage.error(json.error);
return;
@@ -90,11 +94,11 @@ export default defineComponent({
}
function removeWidget() {
dashboardStore.removeControls(data);
dashboardStore.removeControls(props.data);
}
function setConfig() {
dashboardStore.setConfigPanel(true);
dashboardStore.selectWidget(data);
dashboardStore.selectWidget(props.data);
}
return {
state,