This commit is contained in:
David Douglas 2017-08-18 13:44:19 +01:00
Родитель 1b752ad28f 608b746801
Коммит eb178658e1
3 изменённых файлов: 18 добавлений и 13 удалений

Просмотреть файл

@ -108,7 +108,7 @@ export default class Card extends React.PureComponent<ICardProps, ICardState> {
onClick={() => SettingsActions.openDialog(title, id)}
className="card-settings-btn"
>
settings
expand_more
</Button>
);

Просмотреть файл

@ -162,7 +162,7 @@ export default class Editor extends React.PureComponent<IEditorProps, IEditorSta
];
const actions = !value ? null : actionButtons;
const content = !value ? this.renderLoading() : this.renderEditor(value, theme);
const content = value !== null ? this.renderEditor(value, theme) : this.renderLoading();
return (
<Dialog

Просмотреть файл

@ -30,7 +30,7 @@ export default class SetupDashboard extends React.Component<ISetupDashboardProps
super(props);
this.onSave = this.onSave.bind(this);
this.onCancel = this.onCancel.bind(this);
this.onDelete = this.onDelete.bind(this);
this.onSaveGoToDashboard = this.onSaveGoToDashboard.bind(this);
this.redirectToHomepageIfStandalone = this.redirectToHomepageIfStandalone.bind(this);
@ -46,15 +46,15 @@ export default class SetupDashboard extends React.Component<ISetupDashboardProps
}
onParamChange(connectionKey: string, paramKey: string, value: any) {
let { connections } = this.state;
const { connections } = this.state;
connections[connectionKey] = connections[connectionKey] || {};
connections[connectionKey][paramKey] = value;
}
onSave() {
let { dashboard } = this.props;
let { connections } = this.state;
const { dashboard } = this.props;
const { connections } = this.state;
dashboard.config.connections = connections;
@ -66,18 +66,23 @@ export default class SetupDashboard extends React.Component<ISetupDashboardProps
setTimeout(this.redirectToHomepageIfStandalone, 2000);
}
onCancel() {
this.redirectToHomepageIfStandalone();
onDelete() {
const { dashboard } = this.props;
if (!dashboard) {
console.warn('Dashboard not found. Aborting delete.');
}
ConfigurationsActions.deleteDashboard(dashboard.id);
window.location.href = '/';
}
redirectToHomepageIfStandalone() {
let { dashboard } = this.props;
const { dashboard } = this.props;
window.location.replace(`/dashboard/${dashboard.url}`);
}
render() {
let { dashboard } = this.props;
let { connections } = this.state;
const { dashboard } = this.props;
const { connections } = this.state;
return (
<div style={{ width: '100%' }}>
@ -85,8 +90,8 @@ export default class SetupDashboard extends React.Component<ISetupDashboardProps
<div>
<Button flat primary label="Save" onClick={this.onSave}>save</Button>
<Button flat secondary label="Save and Go to Dashboard" onClick={this.onSaveGoToDashboard}>save</Button>
<Button flat secondary label="Cancel" onClick={this.onCancel}>cancel</Button>
<Button flat primary label="Save and Go to Dashboard" onClick={this.onSaveGoToDashboard}>save</Button>
<Button flat secondary label="Delete" onClick={this.onDelete}>delete</Button>
</div>
</div>