Skip to content

Commit

Permalink
fix(deployment): only render deployment button if deployment is deplo…
Browse files Browse the repository at this point in the history
…yed to server
  • Loading branch information
landonreed committed Jul 2, 2018
1 parent 1e623db commit 31af45d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/manager/components/DeploymentPreviewButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ export default class DeploymentPreviewButton extends Component {
}
render () {
const { deployment } = this.props
const { id, projectBounds } = deployment
// TODO: add Try it button
const server = deployment.project.otpServers.find(server => server.name === deployment.deployedTo)
const { id, deployedTo, project, projectBounds } = deployment
if (!deployedTo) {
// Deployment has not been deployed to a server, do not render button.
return null
}
if (!deployment.project.otpServers) {
console.warn(`No otp servers defined for project`)
return null
}
const server = project.otpServers.find(server => server.name === deployedTo)
let href = server && server.publicUrl
if (!href || href.length === 0) {
console.warn(`No public URL set for deployment id=${id}`)
Expand Down

0 comments on commit 31af45d

Please sign in to comment.