fix widget name (#149)

This commit is contained in:
Fine0830 2022-08-29 17:02:42 +08:00 committed by GitHub
parent 82b348a766
commit 1a989a1434
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,15 +40,16 @@ const widgetIds = ref<string[]>(
associate.map((d: { widgetId: string }) => d.widgetId) associate.map((d: { widgetId: string }) => d.widgetId)
); );
const widgets: any = computed(() => { const widgets: any = computed(() => {
const all = getDashboard(dashboardStore.currentDashboard).widgets; const widgetList = getDashboard(dashboardStore.currentDashboard).widgets;
const items = all.filter((d: any) => { const items = [];
for (const d of widgetList) {
const isLinear = ["Bar", "Line", "Area"].includes( const isLinear = ["Bar", "Line", "Area"].includes(
(d.graph && d.graph.type) || "" (d.graph && d.graph.type) || ""
); );
if (isLinear && d.id && dashboardStore.selectedGrid.id !== d.id) { if (isLinear && d.id && dashboardStore.selectedGrid.id !== d.id) {
return { value: d.id, label: (d.widget && d.widget.name) || d.id }; items.push({ value: d.id, label: (d.widget && d.widget.name) || d.id });
} }
}); }
return items; return items;
}); });
function updateWidgetConfig(options: Option[]) { function updateWidgetConfig(options: Option[]) {