mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fixed mutability issue in dashboard dropdowns
This commit is contained in:
parent
1194ff282e
commit
03cf238fa7
@ -42,7 +42,10 @@ export class OrgPreferences extends PureComponent<Props> {
|
||||
setOrganizationTheme,
|
||||
} = this.props;
|
||||
|
||||
starredDashboards.unshift({ id: 0, title: 'Default', tags: [], type: '', uid: '', uri: '', url: '' });
|
||||
const dashboards: DashboardSearchHit[] = [
|
||||
{ id: 0, title: 'Default', tags: [], type: '', uid: '', uri: '', url: '' },
|
||||
...starredDashboards,
|
||||
];
|
||||
|
||||
return (
|
||||
<form className="section gf-form-group" onSubmit={this.onSubmitForm}>
|
||||
@ -66,11 +69,11 @@ export class OrgPreferences extends PureComponent<Props> {
|
||||
Home Dashboard
|
||||
</Label>
|
||||
<SimplePicker
|
||||
defaultValue={starredDashboards.find(dashboard => dashboard.id === preferences.homeDashboardId)}
|
||||
defaultValue={dashboards.find(dashboard => dashboard.id === preferences.homeDashboardId)}
|
||||
getOptionValue={i => i.id}
|
||||
getOptionLabel={i => i.title}
|
||||
onSelected={(dashboard: DashboardSearchHit) => setOrganizationHomeDashboard(dashboard.id)}
|
||||
options={starredDashboards}
|
||||
options={dashboards}
|
||||
placeholder="Chose default dashboard"
|
||||
width={20}
|
||||
/>
|
||||
|
@ -31,7 +31,10 @@ export class TeamPreferences extends PureComponent<Props> {
|
||||
render() {
|
||||
const { preferences, starredDashboards, setTeamHomeDashboard, setTeamTimezone, setTeamTheme } = this.props;
|
||||
|
||||
starredDashboards.unshift({ id: 0, title: 'Default', tags: [], type: '', uid: '', uri: '', url: '' });
|
||||
const dashboards: DashboardSearchHit[] = [
|
||||
{ id: 0, title: 'Default', tags: [], type: '', uid: '', uri: '', url: '' },
|
||||
...starredDashboards,
|
||||
];
|
||||
|
||||
return (
|
||||
<form className="section gf-form-group" onSubmit={this.onSubmitForm}>
|
||||
@ -55,11 +58,11 @@ export class TeamPreferences extends PureComponent<Props> {
|
||||
Home Dashboard
|
||||
</Label>
|
||||
<SimplePicker
|
||||
defaultValue={starredDashboards.find(dashboard => dashboard.id === preferences.homeDashboardId)}
|
||||
defaultValue={dashboards.find(dashboard => dashboard.id === preferences.homeDashboardId)}
|
||||
getOptionValue={i => i.id}
|
||||
getOptionLabel={i => i.title}
|
||||
onSelected={(dashboard: DashboardSearchHit) => setTeamHomeDashboard(dashboard.id)}
|
||||
options={starredDashboards}
|
||||
options={dashboards}
|
||||
placeholder="Chose default dashboard"
|
||||
width={20}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user