Differential D11870 Diff 34163 src/applications/harbormaster/controller/HarbormasterBuildActionController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/controller/HarbormasterBuildActionController.php
Show All 29 Lines | public function processRequest() { | ||||
if (!$build) { | if (!$build) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
switch ($command) { | switch ($command) { | ||||
case HarbormasterBuildCommand::COMMAND_RESTART: | case HarbormasterBuildCommand::COMMAND_RESTART: | ||||
$can_issue = $build->canRestartBuild(); | $can_issue = $build->canRestartBuild(); | ||||
break; | break; | ||||
case HarbormasterBuildCommand::COMMAND_STOP: | case HarbormasterBuildCommand::COMMAND_PAUSE: | ||||
$can_issue = $build->canStopBuild(); | $can_issue = $build->canPauseBuild(); | ||||
break; | break; | ||||
case HarbormasterBuildCommand::COMMAND_RESUME: | case HarbormasterBuildCommand::COMMAND_RESUME: | ||||
$can_issue = $build->canResumeBuild(); | $can_issue = $build->canResumeBuild(); | ||||
break; | break; | ||||
case HarbormasterBuildCommand::COMMAND_ABORT: | |||||
$can_issue = $build->canAbortBuild(); | |||||
break; | |||||
default: | default: | ||||
return new Aphront400Response(); | return new Aphront400Response(); | ||||
} | } | ||||
switch ($this->via) { | switch ($this->via) { | ||||
case 'buildable': | case 'buildable': | ||||
$return_uri = '/'.$build->getBuildable()->getMonogram(); | $return_uri = '/'.$build->getBuildable()->getMonogram(); | ||||
break; | break; | ||||
Show All 33 Lines | switch ($command) { | ||||
$body = pht( | $body = pht( | ||||
'This build is already restarting. You can not reissue a '. | 'This build is already restarting. You can not reissue a '. | ||||
'restart command to a restarting build.'); | 'restart command to a restarting build.'); | ||||
} else { | } else { | ||||
$body = pht('You can not restart this build.'); | $body = pht('You can not restart this build.'); | ||||
} | } | ||||
} | } | ||||
break; | break; | ||||
case HarbormasterBuildCommand::COMMAND_STOP: | case HarbormasterBuildCommand::COMMAND_ABORT: | ||||
if ($can_issue) { | |||||
$title = pht('Really abort build?'); | |||||
$body = pht( | |||||
'Progress on this build will be discarded. Really '. | |||||
epriestley: Prefer single space after period. | |||||
'abort build?'); | |||||
$submit = pht('Abort Build'); | |||||
} else { | |||||
$title = pht('Unable to Abort Build'); | |||||
$body = pht('You can not abort this build.'); | |||||
} | |||||
break; | |||||
case HarbormasterBuildCommand::COMMAND_PAUSE: | |||||
if ($can_issue) { | if ($can_issue) { | ||||
$title = pht('Really pause build?'); | $title = pht('Really pause build?'); | ||||
$body = pht( | $body = pht( | ||||
'If you pause this build, work will halt once the current steps '. | 'If you pause this build, work will halt once the current steps '. | ||||
'complete. You can resume the build later.'); | 'complete. You can resume the build later.'); | ||||
$submit = pht('Pause Build'); | $submit = pht('Pause Build'); | ||||
} else { | } else { | ||||
$title = pht('Unable to Pause Build'); | $title = pht('Unable to Pause Build'); | ||||
if ($build->isComplete()) { | if ($build->isComplete()) { | ||||
$body = pht( | $body = pht( | ||||
'This build is already complete. You can not pause a completed '. | 'This build is already complete. You can not pause a completed '. | ||||
'build.'); | 'build.'); | ||||
} else if ($build->isStopped()) { | } else if ($build->isPaused()) { | ||||
$body = pht( | $body = pht( | ||||
'This build is already paused. You can not pause a build which '. | 'This build is already paused. You can not pause a build which '. | ||||
'has already been paused.'); | 'has already been paused.'); | ||||
} else if ($build->isStopping()) { | } else if ($build->isPausing()) { | ||||
$body = pht( | $body = pht( | ||||
'This build is already pausing. You can not reissue a pause '. | 'This build is already pausing. You can not reissue a pause '. | ||||
'command to a pausing build.'); | 'command to a pausing build.'); | ||||
} else { | } else { | ||||
$body = pht( | $body = pht( | ||||
'This build can not be paused.'); | 'This build can not be paused.'); | ||||
} | } | ||||
} | } | ||||
break; | break; | ||||
case HarbormasterBuildCommand::COMMAND_RESUME: | case HarbormasterBuildCommand::COMMAND_RESUME: | ||||
if ($can_issue) { | if ($can_issue) { | ||||
$title = pht('Really resume build?'); | $title = pht('Really resume build?'); | ||||
$body = pht( | $body = pht( | ||||
'Work will continue on the build. Really resume?'); | 'Work will continue on the build. Really resume?'); | ||||
$submit = pht('Resume Build'); | $submit = pht('Resume Build'); | ||||
} else { | } else { | ||||
$title = pht('Unable to Resume Build'); | $title = pht('Unable to Resume Build'); | ||||
if ($build->isResuming()) { | if ($build->isResuming()) { | ||||
$body = pht( | $body = pht( | ||||
'This build is already resuming. You can not reissue a resume '. | 'This build is already resuming. You can not reissue a resume '. | ||||
'command to a resuming build.'); | 'command to a resuming build.'); | ||||
} else if (!$build->isStopped()) { | } else if (!$build->isPaused()) { | ||||
$body = pht( | $body = pht( | ||||
'This build is not stopped. You can only resume a stopped '. | 'This build is not paused. You can only resume a paused '. | ||||
'build.'); | 'build.'); | ||||
} | } | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
$dialog = id(new AphrontDialogView()) | $dialog = id(new AphrontDialogView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
Show All 12 Lines |
Prefer single space after period.