Frontend: adds folder name in home dash choose menu (#18346)

* Frontend:adds folder name in choose home dash menu(#18293)

* Frontend:adds folder name in choose home dash menu(#18293)
This commit is contained in:
Elykov Alexandr 2019-08-06 19:22:45 +03:00 committed by Torkel Ödegaard
parent 832b67db38
commit 54f3e873a4

View File

@ -97,6 +97,13 @@ export class SharedPreferences extends PureComponent<Props, State> {
this.setState({ homeDashboardId: dashboardId });
};
getFullDashName = (dashboard: DashboardSearchHit) => {
if (typeof dashboard.folderTitle === 'undefined' || dashboard.folderTitle === '') {
return dashboard.title;
}
return dashboard.folderTitle + ' / ' + dashboard.title;
};
render() {
const { theme, timezone, homeDashboardId, dashboards } = this.state;
@ -123,7 +130,7 @@ export class SharedPreferences extends PureComponent<Props, State> {
<Select
value={dashboards.find(dashboard => dashboard.id === homeDashboardId)}
getOptionValue={i => i.id}
getOptionLabel={i => i.title}
getOptionLabel={this.getFullDashName}
onChange={(dashboard: DashboardSearchHit) => this.onHomeDashboardChanged(dashboard.id)}
options={dashboards}
placeholder="Choose default dashboard"