mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix selected home dashboard should show as selected even though its not starred
This commit is contained in:
parent
9606491f6c
commit
52a71596eb
@ -30,7 +30,6 @@ export class SharedPreferences extends PureComponent<Props, State> {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
console.log('props', props);
|
||||
|
||||
this.state = {
|
||||
homeDashboardId: 0,
|
||||
@ -44,6 +43,13 @@ export class SharedPreferences extends PureComponent<Props, State> {
|
||||
const prefs = await this.backendSrv.get(`/api/${this.props.resourceUri}/preferences`);
|
||||
const dashboards = await this.backendSrv.search({ starred: true });
|
||||
|
||||
if (prefs.homeDashboardId > 0 && !dashboards.find(d => d.id === prefs.homeDashboardId)) {
|
||||
const missing = await this.backendSrv.search({ dashboardIds: [prefs.homeDashboardId] });
|
||||
if (missing && missing.length > 0) {
|
||||
dashboards.push(missing[0]);
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({
|
||||
homeDashboardId: prefs.homeDashboardId,
|
||||
theme: prefs.theme,
|
||||
|
Loading…
Reference in New Issue
Block a user