Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14022553
D13844.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13844.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 7, 6:19 PM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6732201
Default Alt Text
D13844.diff (2 KB)
Attached To
Mode
D13844: Don't let autoplans be run manually
Attached
Detach File
Event Timeline
Log In to Comment