Commit 435d0f22 by bergquist

fix(dashlist): better handling of invalid dashboard ids

parent dc2738af
......@@ -150,7 +150,7 @@ func SearchDashboards(query *search.FindPersistedDashboardsQuery) error {
sql.WriteString(" AND (")
for i, dashboardId := range query.DashboardIds {
if i != 0 {
sql.WriteString("OR")
sql.WriteString(" OR")
}
sql.WriteString(" dashboard.id = ?")
......@@ -167,6 +167,7 @@ func SearchDashboards(query *search.FindPersistedDashboardsQuery) error {
sql.WriteString(fmt.Sprintf(" ORDER BY dashboard.title ASC LIMIT 1000"))
var res []DashboardSearchProjection
err := x.Sql(sql.String(), params...).Find(&res)
if err != nil {
return err
......
......@@ -28,8 +28,15 @@ export class ImpressionsStore {
}
getDashboardOpened() {
var impressions = store.get("dashboard_impressions");
return JSON.parse(impressions || "[]");
var impressions = store.get("dashboard_impressions") || "[]";
impressions = JSON.parse(impressions);
impressions = _.filter(impressions, el => {
return _.isNumber(el);
});
return impressions;
}
}
......
......@@ -49,11 +49,12 @@ class DashListCtrl extends PanelCtrl {
dashboardIds: impressions.getDashboardOpened(),
limit: this.panel.limit
}).then(result => {
this.dashList = dashboardIds.map(orderId => {
return _.find(result, dashboard => {
return dashboard.id === orderId;
});
}).filter(el => {
return el !== undefined;
});
this.renderingCompleted();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment