1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-20 05:42:40 +01:00

Don't let autoplans be run manually

Summary: Ref T8096. Like stop/start, autoplans are pushed into the system from outside (normally by `arc`) so it doesn't make any sense to run them manually.

Test Plan:
  - Tried to run an autoplan from web UI, got an error.
  - Ran a normal plan from web UI.
  - Tried to run an autoplan from CLI, got an error.
  - Ran a noraml plan from CLI.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T8096

Differential Revision: https://secure.phabricator.com/D13844
This commit is contained in:
epriestley 2015-08-10 14:14:52 -07:00
parent 2752419160
commit a1499ceb8f
4 changed files with 26 additions and 2 deletions

View file

@ -22,6 +22,15 @@ final class HarbormasterPlanRunController extends HarbormasterController {
return new Aphront404Response();
}
$cancel_uri = $this->getApplicationURI("plan/{$plan_id}/");
if (!$plan->canRunManually()) {
return $this->newDialog()
->setTitle(pht('Can Not Run Plan'))
->appendParagraph(pht('This plan can not be run manually.'))
->addCancelButton($cancel_uri);
}
$e_name = true;
$v_name = null;
@ -65,7 +74,6 @@ final class HarbormasterPlanRunController extends HarbormasterController {
}
$title = pht('Run Build Plan Manually');
$cancel_uri = $this->getApplicationURI("plan/{$plan_id}/");
$save_button = pht('Run Plan Manually');
$form = id(new PHUIFormLayoutView())

View file

@ -289,12 +289,14 @@ final class HarbormasterPlanViewController extends HarbormasterPlanController {
->setIcon('fa-ban'));
}
$can_run = ($has_manage && $plan->canRunManually());
$list->addAction(
id(new PhabricatorActionView())
->setName(pht('Run Plan Manually'))
->setHref($this->getApplicationURI("plan/run/{$id}/"))
->setWorkflow(true)
->setDisabled(!$has_manage)
->setDisabled(!$can_run)
->setIcon('fa-play-circle'));
return $list;

View file

@ -64,6 +64,11 @@ final class HarbormasterManagementBuildWorkflow
pht('Build plan "%s" does not exist.', $plan_id));
}
if (!$plan->canRunManually()) {
throw new PhutilArgumentUsageException(
pht('This build plan can not be run manually.'));
}
$console = PhutilConsole::getConsole();
$buildable = HarbormasterBuildable::initializeNewBuildable($viewer)

View file

@ -85,6 +85,15 @@ final class HarbormasterBuildPlan extends HarbormasterDAO
}
public function canRunManually() {
if ($this->isAutoplan()) {
return false;
}
return true;
}
public function getName() {
$autoplan = $this->getAutoplan();
if ($autoplan) {