Skip to content

Commit 90ef04b

Browse files
prepare for future deploy-from-existing-graph feature
1 parent d457b45 commit 90ef04b

File tree

6 files changed

+24
-7
lines changed

6 files changed

+24
-7
lines changed

i18n/english.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ components:
127127
close: Close
128128
danger: Danger!
129129
deploy: Deploy
130+
deployExisting: Deploy Previously Built Graph
130131
invalidBounds: Bounds are invalid!
131132
to: to
132133
warning: Warning!

i18n/german.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ components:
128128
close: Schließen
129129
danger: Gefahr!
130130
deploy: Deployen
131+
deployExisting: Zuelezt Deployte Graph Deployen
131132
invalidBounds: Grenzen sind ungültig!
132133
success: Erfolg!
133134
to: zu

i18n/polish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ components:
131131
close: Zamknij
132132
danger: Uwaga!
133133
deploy: Wdrożenie
134+
deployExisting: Zuelezt Deployte Graph Deployen
134135
invalidBounds: Granice są nieprawidłowe!
135136
success: Sukces!
136137
to: do

lib/manager/actions/deployments.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,15 @@ export function fetchFeedSourceDeployments (feedSource: Feed) {
7979
}
8080
}
8181

82-
export function deployToTarget (deployment: Deployment, target: string) {
83-
return function (dispatch: dispatchFn, getState: getStateFn) {
82+
export function deployToTarget (deployment: Deployment, target: string, deployType?: string) {
83+
return async function (dispatch: dispatchFn, getState: getStateFn) {
8484
const {id} = deployment
8585
// Ensure that target server has valid name (used as identifier currently)
8686
if (!target) return window.alert('OTP Server must have valid name.')
87+
if (deployType) {
88+
await dispatch(updateDeployment(deployment, {deployType}))
89+
}
90+
8791
return dispatch(secureFetch(`${DEPLOYMENT_URL}/${id}/deploy/${target}`, 'post'))
8892
.then(response => {
8993
// FIXME: Use standard handleJobResponse for deployment job

lib/manager/components/deployment/DeploymentConfirmModal.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ export default class DeploymentConfirmModal extends Component<Props, State> {
3333
messages = getComponentMessages('DeploymentConfirmModal')
3434
state = {}
3535

36-
_onClickDeploy = () => {
37-
const {deployment, deployToTarget, target} = this.props
38-
deployToTarget(deployment, target)
36+
_onClickDeploy = (deployType: string) => {
37+
const {deployment, deployToTarget, oldDeployment, target} = this.props
38+
deployToTarget(deployType === 'USE_PREBUILT_GRAPH' ? oldDeployment : deployment, target, deployType)
3939
this.setState({isDeployed: true})
4040
}
4141

4242
_onClose = () => this.props.onClose()
4343

44+
// eslint-disable-next-line complexity
4445
render () {
4546
const {Body, Footer, Header, Title} = Modal
4647
const {deployment, oldDeployment, project, target} = this.props
@@ -145,11 +146,20 @@ export default class DeploymentConfirmModal extends Component<Props, State> {
145146
}
146147
</Body>
147148
<Footer>
149+
{/* TODO: Create a new deployment type on the server */}
150+
{/* <Button
151+
bsStyle='secondary'
152+
data-test-id='confirm-deploy-server-button'
153+
disabled={deploymentIsDisabled || !oldDeployment}
154+
onClick={() => this._onClickDeploy('USE_PREBUILT_GRAPH')}
155+
>
156+
{this.messages('deployExisting')}
157+
</Button> */}
148158
<Button
149159
bsStyle='primary'
150160
data-test-id='confirm-deploy-server-button'
151161
disabled={deploymentIsDisabled}
152-
onClick={this._onClickDeploy}
162+
onClick={() => this._onClickDeploy('REPLACE')}
153163
>
154164
{this.messages('deploy')}
155165
</Button>

lib/manager/components/deployment/DeploymentViewer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ export default class DeploymentViewer extends Component<Props, State> {
383383
: []
384384
const serverDeployedTo = getServerDeployedTo(deployment, project)
385385
const oldDeployment = (target && project.deployments)
386-
? project.deployments.find(d => d.deployedTo === target && deployment.routerId === d.routerId)
386+
? project.deployments.find(d => d.deployedTo === target)
387387
: null
388388
const appName = getConfigProperty('application.title')
389389
const title = `${appName ? appName + ' - ' : ''}${deployment.name}`

0 commit comments

Comments
 (0)