Mew app creation - v1 should be default name and pressing enter should create version (#1968)

* updating default value to app version

* typo

* bugix toast triggering more than once
This commit is contained in:
Kiran Ashok 2022-01-27 20:41:29 +05:30 committed by GitHub
parent fda3028c5a
commit 47fbf3fb92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,7 +110,7 @@ class Editor extends React.Component {
socket: null,
showInitVersionCreateModal: false,
isCreatingInitVersion: false,
initVersionName: null,
initVersionName: 'v1',
isSavingEditingVersion: false,
showSaveDetail: false,
hasAppDefinitionChanged: false,
@ -800,7 +800,12 @@ class Editor extends React.Component {
</span>
);
};
handleKeyPress = (event) => {
if (event.key === 'Enter') {
// eslint-disable-next-line no-undef
this.createInitVersion();
}
};
createInitVersion = () => {
const newVersionName = this.state.initVersionName;
const appId = this.state.appId;
@ -844,6 +849,7 @@ class Editor extends React.Component {
enforceFocus={false}
animation={false}
centered={true}
// eslint-disable-next-line no-undef
>
<Modal.Header>
<Modal.Title>Create Version</Modal.Title>
@ -855,7 +861,9 @@ class Editor extends React.Component {
type="text"
className="form-control"
placeholder="version name"
defaultValue={this.state.initVersionName}
onChange={(e) => this.setState({ initVersionName: e.target.value })}
onKeyPress={(e) => this.handleKeyPress(e)}
/>
</div>
</div>