Skip to content

Commit

Permalink
prepare for future deploy-from-existing-graph feature
Browse files Browse the repository at this point in the history
  • Loading branch information
miles-grant-ibigroup committed Jan 24, 2024
1 parent d457b45 commit 90ef04b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
1 change: 1 addition & 0 deletions i18n/english.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ components:
close: Close
danger: Danger!
deploy: Deploy
deployExisting: Deploy Previously Built Graph
invalidBounds: Bounds are invalid!
to: to
warning: Warning!
Expand Down
1 change: 1 addition & 0 deletions i18n/german.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ components:
close: Schließen
danger: Gefahr!
deploy: Deployen
deployExisting: Zuelezt Deployte Graph Deployen
invalidBounds: Grenzen sind ungültig!
success: Erfolg!
to: zu
Expand Down
1 change: 1 addition & 0 deletions i18n/polish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ components:
close: Zamknij
danger: Uwaga!
deploy: Wdrożenie
deployExisting: Zuelezt Deployte Graph Deployen
invalidBounds: Granice są nieprawidłowe!
success: Sukces!
to: do
Expand Down
8 changes: 6 additions & 2 deletions lib/manager/actions/deployments.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,15 @@ export function fetchFeedSourceDeployments (feedSource: Feed) {
}
}

export function deployToTarget (deployment: Deployment, target: string) {
return function (dispatch: dispatchFn, getState: getStateFn) {
export function deployToTarget (deployment: Deployment, target: string, deployType?: string) {
return async function (dispatch: dispatchFn, getState: getStateFn) {
const {id} = deployment
// Ensure that target server has valid name (used as identifier currently)
if (!target) return window.alert('OTP Server must have valid name.')
if (deployType) {
await dispatch(updateDeployment(deployment, {deployType}))
}

return dispatch(secureFetch(`${DEPLOYMENT_URL}/${id}/deploy/${target}`, 'post'))
.then(response => {
// FIXME: Use standard handleJobResponse for deployment job
Expand Down
18 changes: 14 additions & 4 deletions lib/manager/components/deployment/DeploymentConfirmModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ export default class DeploymentConfirmModal extends Component<Props, State> {
messages = getComponentMessages('DeploymentConfirmModal')
state = {}

_onClickDeploy = () => {
const {deployment, deployToTarget, target} = this.props
deployToTarget(deployment, target)
_onClickDeploy = (deployType: string) => {
const {deployment, deployToTarget, oldDeployment, target} = this.props
deployToTarget(deployType === 'USE_PREBUILT_GRAPH' ? oldDeployment : deployment, target, deployType)
this.setState({isDeployed: true})
}

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

// eslint-disable-next-line complexity
render () {
const {Body, Footer, Header, Title} = Modal
const {deployment, oldDeployment, project, target} = this.props
Expand Down Expand Up @@ -145,11 +146,20 @@ export default class DeploymentConfirmModal extends Component<Props, State> {
}
</Body>
<Footer>
{/* TODO: Create a new deployment type on the server */}
{/* <Button
bsStyle='secondary'
data-test-id='confirm-deploy-server-button'
disabled={deploymentIsDisabled || !oldDeployment}
onClick={() => this._onClickDeploy('USE_PREBUILT_GRAPH')}
>
{this.messages('deployExisting')}
</Button> */}
<Button
bsStyle='primary'
data-test-id='confirm-deploy-server-button'
disabled={deploymentIsDisabled}
onClick={this._onClickDeploy}
onClick={() => this._onClickDeploy('REPLACE')}
>
{this.messages('deploy')}
</Button>
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/components/deployment/DeploymentViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export default class DeploymentViewer extends Component<Props, State> {
: []
const serverDeployedTo = getServerDeployedTo(deployment, project)
const oldDeployment = (target && project.deployments)
? project.deployments.find(d => d.deployedTo === target && deployment.routerId === d.routerId)
? project.deployments.find(d => d.deployedTo === target)
: null
const appName = getConfigProperty('application.title')
const title = `${appName ? appName + ' - ' : ''}${deployment.name}`
Expand Down

0 comments on commit 90ef04b

Please sign in to comment.