mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
dashboards: use new *url* prop from dashboard search for linking to dashboards
#7883
This commit is contained in:
parent
8009307c16
commit
f2014223b4
@ -41,10 +41,7 @@ export class SearchSrv {
|
|||||||
.map(orderId => {
|
.map(orderId => {
|
||||||
return _.find(result, { id: orderId });
|
return _.find(result, { id: orderId });
|
||||||
})
|
})
|
||||||
.filter(hit => hit && !hit.isStarred)
|
.filter(hit => hit && !hit.isStarred);
|
||||||
.map(hit => {
|
|
||||||
return this.transformToViewModel(hit);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,17 +78,12 @@ export class SearchSrv {
|
|||||||
score: -2,
|
score: -2,
|
||||||
expanded: this.starredIsOpen,
|
expanded: this.starredIsOpen,
|
||||||
toggle: this.toggleStarred.bind(this),
|
toggle: this.toggleStarred.bind(this),
|
||||||
items: result.map(this.transformToViewModel),
|
items: result,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private transformToViewModel(hit) {
|
|
||||||
hit.url = 'dashboard/db/' + hit.slug;
|
|
||||||
return hit;
|
|
||||||
}
|
|
||||||
|
|
||||||
search(options) {
|
search(options) {
|
||||||
let sections: any = {};
|
let sections: any = {};
|
||||||
let promises = [];
|
let promises = [];
|
||||||
@ -181,7 +173,7 @@ export class SearchSrv {
|
|||||||
}
|
}
|
||||||
|
|
||||||
section.expanded = true;
|
section.expanded = true;
|
||||||
section.items.push(this.transformToViewModel(hit));
|
section.items.push(hit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +190,7 @@ export class SearchSrv {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return this.backendSrv.search(query).then(results => {
|
return this.backendSrv.search(query).then(results => {
|
||||||
section.items = _.map(results, this.transformToViewModel);
|
section.items = results;
|
||||||
return Promise.resolve(section);
|
return Promise.resolve(section);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user