mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
Should not allow creation of version without name (#1261)
This commit is contained in:
parent
1efd73d8e2
commit
1cc16506b8
1 changed files with 20 additions and 10 deletions
|
|
@ -15,6 +15,7 @@ class SaveAndPreview extends React.Component {
|
|||
appId: props.appId,
|
||||
isLoading: true,
|
||||
showVersionForm: false,
|
||||
newVersionName: '',
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -38,25 +39,34 @@ class SaveAndPreview extends React.Component {
|
|||
hideModal = () => {
|
||||
this.setState({
|
||||
showModal: false,
|
||||
showVersionForm: false,
|
||||
});
|
||||
};
|
||||
|
||||
createVersion = () => {
|
||||
const newVersionName = this.state.newVersionName;
|
||||
const appId = this.props.appId;
|
||||
this.setState({ creatingVersion: true });
|
||||
|
||||
appVersionService.create(appId, newVersionName).then(() => {
|
||||
this.setState({ showVersionForm: false, creatingVersion: false });
|
||||
toast.success('Version Created', {
|
||||
|
||||
if (newVersionName.trim() !== ''){
|
||||
this.setState({ creatingVersion: true });
|
||||
appVersionService.create(appId, newVersionName).then(() => {
|
||||
this.setState({ showVersionForm: false, creatingVersion: false });
|
||||
toast.success('Version Created', {
|
||||
hideProgressBar: true,
|
||||
position: 'top-center',
|
||||
containerId: this.state.appId,
|
||||
});
|
||||
this.fetchVersions();
|
||||
// eslint-disable-next-line no-undef
|
||||
this.props.setAppDefinitionFromVersion(version);
|
||||
});
|
||||
} else {
|
||||
toast.error(
|
||||
'The name of version should not be empty', {
|
||||
hideProgressBar: true,
|
||||
position: 'top-center',
|
||||
containerId: this.state.appId,
|
||||
});
|
||||
this.fetchVersions();
|
||||
// eslint-disable-next-line no-undef
|
||||
this.props.setAppDefinitionFromVersion(version);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
saveVersion = (versionId) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue