mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 17:08:34 +00:00
Feature: Disable launch button if not deployed (#350)
This commit is contained in:
parent
18a1757ab9
commit
3980448fb2
2 changed files with 19 additions and 3 deletions
|
|
@ -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} />}
|
||||
</div>
|
||||
<div className="nav-item dropdown d-none d-md-flex me-3">
|
||||
<a href={appLink} target="_blank" className="btn btn-sm" rel="noreferrer">
|
||||
<a href={appLink} target="_blank" className={`btn btn-sm ${app?.current_version_id ? '': 'disabled'}`} rel="noreferrer">
|
||||
Launch
|
||||
</a>
|
||||
</div>
|
||||
<div className="nav-item dropdown me-2">
|
||||
{this.state.app && (
|
||||
<SaveAndPreview appId={app.id} appName={app.name} appDefinition={appDefinition} app={app} />
|
||||
<SaveAndPreview
|
||||
appId={app.id}
|
||||
appName={app.name}
|
||||
appDefinition={appDefinition}
|
||||
app={app}
|
||||
onVersionDeploy={this.onVersionDeploy}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue