From 3980448fb2204ba70c8dd144a6ce070085de918b Mon Sep 17 00:00:00 2001 From: Navaneeth Pk Date: Tue, 29 Jun 2021 00:39:52 +0530 Subject: [PATCH] Feature: Disable launch button if not deployed (#350) --- frontend/src/Editor/Editor.jsx | 17 +++++++++++++++-- frontend/src/Editor/SaveAndPreview.jsx | 5 ++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/frontend/src/Editor/Editor.jsx b/frontend/src/Editor/Editor.jsx index 1f37e37100..040ea7cf08 100644 --- a/frontend/src/Editor/Editor.jsx +++ b/frontend/src/Editor/Editor.jsx @@ -422,6 +422,13 @@ class Editor extends React.Component { this.setState({ showQuerySearchField: !this.state.showQuerySearchField }); } + onVersionDeploy = (versionId) => { + this.setState({ app: { + ...this.state.app, + current_version_id: versionId + }}) + } + render() { const { currentSidebarTab, @@ -561,13 +568,19 @@ class Editor extends React.Component { handleSlugChange={this.handleSlugChange} />}
- + Launch
{this.state.app && ( - + )}
diff --git a/frontend/src/Editor/SaveAndPreview.jsx b/frontend/src/Editor/SaveAndPreview.jsx index 40648d0029..d679c4853c 100644 --- a/frontend/src/Editor/SaveAndPreview.jsx +++ b/frontend/src/Editor/SaveAndPreview.jsx @@ -14,7 +14,7 @@ class SaveAndPreview extends React.Component { showModal: false, appId: props.appId, isLoading: true, - showVersionForm: false + showVersionForm: false, }; } @@ -65,7 +65,10 @@ class SaveAndPreview extends React.Component { appService.saveApp(this.props.appId, { name: this.props.appName, current_version_id: versionId }).then(() => { this.setState({ isDeploying: false }); toast.success('Version Deployed', { hideProgressBar: true, position: 'top-center' }); + + this.props.onVersionDeploy(versionId); }); + }; render() {