mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fixed type
This commit is contained in:
@@ -9,7 +9,7 @@ const setup = () => {
|
||||
timezone: 'UTC',
|
||||
theme: 'Default',
|
||||
},
|
||||
starredDashboards: [{ id: 1, name: 'Standard dashboard' }],
|
||||
starredDashboards: [{ id: 1, title: 'Standard dashboard', url: '', uri: '', uid: '', type: '', tags: [] }],
|
||||
setOrganizationTimezone: jest.fn(),
|
||||
setOrganizationTheme: jest.fn(),
|
||||
setOrganizationHomeDashboard: jest.fn(),
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import Tooltip from '../../core/components/Tooltip/Tooltip';
|
||||
import SimplePicker from '../../core/components/Picker/SimplePicker';
|
||||
import { DashboardAcl, OrganizationPreferences } from 'app/types';
|
||||
import { Dashboard, OrganizationPreferences } from 'app/types';
|
||||
import {
|
||||
setOrganizationHomeDashboard,
|
||||
setOrganizationTheme,
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
|
||||
export interface Props {
|
||||
preferences: OrganizationPreferences;
|
||||
starredDashboards: DashboardAcl[];
|
||||
starredDashboards: Dashboard[];
|
||||
setOrganizationHomeDashboard: typeof setOrganizationHomeDashboard;
|
||||
setOrganizationTheme: typeof setOrganizationTheme;
|
||||
setOrganizationTimezone: typeof setOrganizationTimezone;
|
||||
@@ -42,7 +42,7 @@ export class OrgPreferences extends PureComponent<Props> {
|
||||
setOrganizationTheme,
|
||||
} = this.props;
|
||||
|
||||
starredDashboards.unshift({ id: 0, title: 'Default' });
|
||||
starredDashboards.unshift({ id: 0, title: 'Default', tags: [], type: '', uid: '', uri: '', url: '' });
|
||||
|
||||
return (
|
||||
<form className="section gf-form-group" onSubmit={this.onSubmitForm}>
|
||||
@@ -73,7 +73,7 @@ export class OrgPreferences extends PureComponent<Props> {
|
||||
defaultValue={starredDashboards.find(dashboard => dashboard.id === preferences.homeDashboardId)}
|
||||
getOptionValue={i => i.id}
|
||||
getOptionLabel={i => i.title}
|
||||
onSelected={(dashboard: DashboardAcl) => setOrganizationHomeDashboard(dashboard.id)}
|
||||
onSelected={(dashboard: Dashboard) => setOrganizationHomeDashboard(dashboard.id)}
|
||||
options={starredDashboards}
|
||||
placeholder="Chose default dashboard"
|
||||
width={20}
|
||||
|
||||
@@ -62,7 +62,12 @@ exports[`Render should render component 1`] = `
|
||||
defaultValue={
|
||||
Object {
|
||||
"id": 1,
|
||||
"name": "Standard dashboard",
|
||||
"tags": Array [],
|
||||
"title": "Standard dashboard",
|
||||
"type": "",
|
||||
"uid": "",
|
||||
"uri": "",
|
||||
"url": "",
|
||||
}
|
||||
}
|
||||
getOptionLabel={[Function]}
|
||||
@@ -70,9 +75,23 @@ exports[`Render should render component 1`] = `
|
||||
onSelected={[Function]}
|
||||
options={
|
||||
Array [
|
||||
Object {
|
||||
"id": 0,
|
||||
"tags": Array [],
|
||||
"title": "Default",
|
||||
"type": "",
|
||||
"uid": "",
|
||||
"uri": "",
|
||||
"url": "",
|
||||
},
|
||||
Object {
|
||||
"id": 1,
|
||||
"name": "Standard dashboard",
|
||||
"tags": Array [],
|
||||
"title": "Standard dashboard",
|
||||
"type": "",
|
||||
"uid": "",
|
||||
"uri": "",
|
||||
"url": "",
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ThunkAction } from 'redux-thunk';
|
||||
import { DashboardAcl, Organization, OrganizationPreferences, StoreState } from 'app/types';
|
||||
import { Dashboard, Organization, OrganizationPreferences, StoreState } from 'app/types';
|
||||
import { getBackendSrv } from '../../../core/services/backend_srv';
|
||||
|
||||
type ThunkResult<R> = ThunkAction<R, StoreState, undefined, any>;
|
||||
@@ -26,7 +26,7 @@ interface LoadPreferencesAction {
|
||||
|
||||
interface LoadStarredDashboardsAction {
|
||||
type: ActionTypes.LoadStarredDashboards;
|
||||
payload: DashboardAcl[];
|
||||
payload: Dashboard[];
|
||||
}
|
||||
|
||||
interface SetOrganizationNameAction {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { DashboardAcl, Organization, OrganizationPreferences, OrganizationState } from 'app/types';
|
||||
import { Dashboard, Organization, OrganizationPreferences, OrganizationState } from 'app/types';
|
||||
import { Action, ActionTypes } from './actions';
|
||||
|
||||
const initialState: OrganizationState = {
|
||||
organization: {} as Organization,
|
||||
preferences: {} as OrganizationPreferences,
|
||||
starredDashboards: [] as DashboardAcl[],
|
||||
starredDashboards: [] as Dashboard[],
|
||||
};
|
||||
|
||||
const organizationReducer = (state = initialState, action: Action): OrganizationState => {
|
||||
|
||||
Reference in New Issue
Block a user