diff --git a/frontend/src/Editor/Editor.jsx b/frontend/src/Editor/Editor.jsx index 510c74427a..b9de7f30c9 100644 --- a/frontend/src/Editor/Editor.jsx +++ b/frontend/src/Editor/Editor.jsx @@ -309,6 +309,23 @@ class Editor extends React.Component { }); }; + saveAppName = (id, name, notify = false) => { + + if (!name.trim()) { + toast.warn("App name can't be empty or whitespace", { + hideProgressBar: true, + position: 'top-center', + }); + + this.setState({ + app: { ...this.state.app, name: this.state.oldName }, + }) + + return; + } + this.saveApp(id, {name}, notify); + } + renderDataSource = (dataSource) => { const sourceMeta = DataSourceTypes.find((source) => source.kind === dataSource.kind); return ( @@ -569,8 +586,9 @@ class Editor extends React.Component { this.setState({ oldName: e.target.value })} onChange={(e) => this.onNameChanged(e.target.value)} - onBlur={(e) => this.saveApp(this.state.app.id, { name: e.target.value })} + onBlur={(e) => this.saveAppName(this.state.app.id, e.target.value)} className="form-control-plaintext form-control-plaintext-sm" value={this.state.app.name} />