mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 01:18:23 +00:00
Fixes app being able to be named empty or whitespace string in editor (#1197)
This commit is contained in:
parent
59e33a370c
commit
2106f4c5f5
1 changed files with 19 additions and 1 deletions
|
|
@ -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 {
|
|||
<input
|
||||
type="text"
|
||||
style={{ width: '200px', left: '80px', position: 'absolute' }}
|
||||
onFocus={(e) => 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}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue