Skip to content

Commit

Permalink
fix(DeploymentViewer): fix deployment name change
Browse files Browse the repository at this point in the history
  • Loading branch information
landonreed committed May 31, 2017
1 parent 84b6233 commit 42fddc5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
14 changes: 6 additions & 8 deletions lib/manager/actions/deployments.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { browserHistory } from 'react-router'
import { secureFetch } from '../../common/actions'
import { receiveProject } from './projects'
import { startJobMonitor } from './status'
import fileDownload from '../../common/util/file-download'

// Deployment Actions

Expand Down Expand Up @@ -122,13 +123,10 @@ export function downloadDeployment (deployment) {
return function (dispatch, getState) {
// dispatch(downloadingDeployment())
const url = '/api/manager/secure/deployments/' + deployment.id + '/download'
window.location.assign(url)
// return dispatch(secureFetch(url))
// .then(response => response.json())
// .then(deployment => {
// console.log(deployment)
// // dispatch(receiveDeployment(deployment.project.id, deployment))
// })
// window.location.assign(url)
return dispatch(secureFetch(url))
.then(response => response.blob())
.then(blob => fileDownload(blob, 'test.zip', 'application/zip'))
}
}

Expand Down Expand Up @@ -211,7 +209,7 @@ export function createDeploymentFromFeedSource (feedSource) {

export function updateDeployment (deployment, changes) {
return function (dispatch, getState) {
dispatch(savingDeployment())
dispatch(savingDeployment(deployment))
const url = '/api/manager/secure/deployments/' + deployment.id
return dispatch(secureFetch(url, 'put', changes))
.then(response => response.json())
Expand Down
6 changes: 2 additions & 4 deletions lib/manager/components/DeploymentViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class DeploymentViewer extends Component {
addFeedVersion: PropTypes.func,
deleteFeedVersion: PropTypes.func,
deployment: PropTypes.object,
deploymentPropertyChanged: PropTypes.func,
updateDeployment: PropTypes.func,
deployToTargetClicked: PropTypes.func,
downloadDeployment: PropTypes.func,
feedSources: PropTypes.array,
Expand All @@ -26,16 +26,14 @@ export default class DeploymentViewer extends Component {
user: PropTypes.object
}

state = {}

_onAddFeedSource = (evt) => {
const feed = this.props.feedSources.find(fs => fs.id === evt)
this.props.addFeedVersion(this.props.deployment, {id: feed.latestVersionId})
}

_onChangeSearch = evt => this.props.searchTextChanged(evt.target.value)

_onChangeName = (value) => this.props.deploymentPropertyChanged(this.props.deployment, 'name', value)
_onChangeName = (name) => this.props.updateDeployment(this.props.deployment, {name})

_onClickDownload = () => this.props.downloadDeployment(this.props.deployment)

Expand Down
3 changes: 2 additions & 1 deletion lib/manager/containers/ActiveDeploymentViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const mapDispatchToProps = (dispatch, ownProps) => {
const index = feedVersions.findIndex(v => v.id === feedVersion.id)
feedVersions.splice(index, 1)
return dispatch(updateDeployment(deployment, {feedVersions}))
}
},
updateDeployment: (deployment, changes) => dispatch(updateDeployment(deployment, changes))
}
}

Expand Down
1 change: 0 additions & 1 deletion lib/manager/containers/ActiveProjectViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ const mapDispatchToProps = (dispatch, ownProps) => {
createDeploymentFromFeedSource: (feedSource) => dispatch(createDeploymentFromFeedSource(feedSource)),
onNewDeploymentClick: () => dispatch(createDeployment(projectId)),
newDeploymentNamed: (name) => dispatch(saveDeployment({ projectId, name })),
updateDeployment: (deployment, changes) => dispatch(updateDeployment(deployment, changes)),
searchTextChanged: (text) => dispatch(setVisibilitySearchText(text)),
visibilityFilterChanged: (filter) => dispatch(setVisibilityFilter(filter)),
uploadFeed: (feedSource, file) => dispatch(uploadFeed(feedSource, file)),
Expand Down

0 comments on commit 42fddc5

Please sign in to comment.