Page MenuHomePhabricator

D13844.id33431.diff
No OneTemporary

D13844.id33431.diff

diff --git a/src/applications/harbormaster/controller/HarbormasterPlanRunController.php b/src/applications/harbormaster/controller/HarbormasterPlanRunController.php
--- a/src/applications/harbormaster/controller/HarbormasterPlanRunController.php
+++ b/src/applications/harbormaster/controller/HarbormasterPlanRunController.php
@@ -22,6 +22,15 @@
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 @@
}
$title = pht('Run Build Plan Manually');
- $cancel_uri = $this->getApplicationURI("plan/{$plan_id}/");
$save_button = pht('Run Plan Manually');
$form = id(new PHUIFormLayoutView())
diff --git a/src/applications/harbormaster/controller/HarbormasterPlanViewController.php b/src/applications/harbormaster/controller/HarbormasterPlanViewController.php
--- a/src/applications/harbormaster/controller/HarbormasterPlanViewController.php
+++ b/src/applications/harbormaster/controller/HarbormasterPlanViewController.php
@@ -289,12 +289,14 @@
->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;
diff --git a/src/applications/harbormaster/management/HarbormasterManagementBuildWorkflow.php b/src/applications/harbormaster/management/HarbormasterManagementBuildWorkflow.php
--- a/src/applications/harbormaster/management/HarbormasterManagementBuildWorkflow.php
+++ b/src/applications/harbormaster/management/HarbormasterManagementBuildWorkflow.php
@@ -64,6 +64,11 @@
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)
diff --git a/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php b/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php
--- a/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php
+++ b/src/applications/harbormaster/storage/configuration/HarbormasterBuildPlan.php
@@ -85,6 +85,15 @@
}
+ public function canRunManually() {
+ if ($this->isAutoplan()) {
+ return false;
+ }
+
+ return true;
+ }
+
+
public function getName() {
$autoplan = $this->getAutoplan();
if ($autoplan) {

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 3:50 AM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6732201
Default Alt Text
D13844.id33431.diff (2 KB)

Event Timeline