mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-03 03:11:01 +01:00
Allow Drydock blueprints to be disabled
Summary: Ref T9252. If you have a blueprint and you do not like that blueprint very much, you can disable it. Test Plan: Disabled / enabled some blueprints. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9252 Differential Revision: https://secure.phabricator.com/D14156
This commit is contained in:
parent
1491269b72
commit
b441e8b81e
12 changed files with 183 additions and 27 deletions
2
resources/sql/autopatches/20150924.drydock.disable.1.sql
Normal file
2
resources/sql/autopatches/20150924.drydock.disable.1.sql
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE {$NAMESPACE}_drydock.drydock_blueprint
|
||||||
|
ADD isDisabled BOOL NOT NULL;
|
|
@ -805,6 +805,7 @@ phutil_register_library_map(array(
|
||||||
'DrydockBlueprintCreateController' => 'applications/drydock/controller/DrydockBlueprintCreateController.php',
|
'DrydockBlueprintCreateController' => 'applications/drydock/controller/DrydockBlueprintCreateController.php',
|
||||||
'DrydockBlueprintCustomField' => 'applications/drydock/customfield/DrydockBlueprintCustomField.php',
|
'DrydockBlueprintCustomField' => 'applications/drydock/customfield/DrydockBlueprintCustomField.php',
|
||||||
'DrydockBlueprintDatasource' => 'applications/drydock/typeahead/DrydockBlueprintDatasource.php',
|
'DrydockBlueprintDatasource' => 'applications/drydock/typeahead/DrydockBlueprintDatasource.php',
|
||||||
|
'DrydockBlueprintDisableController' => 'applications/drydock/controller/DrydockBlueprintDisableController.php',
|
||||||
'DrydockBlueprintEditController' => 'applications/drydock/controller/DrydockBlueprintEditController.php',
|
'DrydockBlueprintEditController' => 'applications/drydock/controller/DrydockBlueprintEditController.php',
|
||||||
'DrydockBlueprintEditor' => 'applications/drydock/editor/DrydockBlueprintEditor.php',
|
'DrydockBlueprintEditor' => 'applications/drydock/editor/DrydockBlueprintEditor.php',
|
||||||
'DrydockBlueprintImplementation' => 'applications/drydock/blueprint/DrydockBlueprintImplementation.php',
|
'DrydockBlueprintImplementation' => 'applications/drydock/blueprint/DrydockBlueprintImplementation.php',
|
||||||
|
@ -4530,6 +4531,7 @@ phutil_register_library_map(array(
|
||||||
'DrydockBlueprintCreateController' => 'DrydockBlueprintController',
|
'DrydockBlueprintCreateController' => 'DrydockBlueprintController',
|
||||||
'DrydockBlueprintCustomField' => 'PhabricatorCustomField',
|
'DrydockBlueprintCustomField' => 'PhabricatorCustomField',
|
||||||
'DrydockBlueprintDatasource' => 'PhabricatorTypeaheadDatasource',
|
'DrydockBlueprintDatasource' => 'PhabricatorTypeaheadDatasource',
|
||||||
|
'DrydockBlueprintDisableController' => 'DrydockBlueprintController',
|
||||||
'DrydockBlueprintEditController' => 'DrydockBlueprintController',
|
'DrydockBlueprintEditController' => 'DrydockBlueprintController',
|
||||||
'DrydockBlueprintEditor' => 'PhabricatorApplicationTransactionEditor',
|
'DrydockBlueprintEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||||
'DrydockBlueprintImplementation' => 'Phobject',
|
'DrydockBlueprintImplementation' => 'Phobject',
|
||||||
|
|
|
@ -49,7 +49,11 @@ final class PhabricatorDrydockApplication extends PhabricatorApplication {
|
||||||
'' => 'DrydockConsoleController',
|
'' => 'DrydockConsoleController',
|
||||||
'blueprint/' => array(
|
'blueprint/' => array(
|
||||||
'(?:query/(?P<queryKey>[^/]+)/)?' => 'DrydockBlueprintListController',
|
'(?:query/(?P<queryKey>[^/]+)/)?' => 'DrydockBlueprintListController',
|
||||||
'(?P<id>[1-9]\d*)/' => 'DrydockBlueprintViewController',
|
'(?P<id>[1-9]\d*)/' => array(
|
||||||
|
'' => 'DrydockBlueprintViewController',
|
||||||
|
'(?P<action>disable|enable)/' =>
|
||||||
|
'DrydockBlueprintDisableController',
|
||||||
|
),
|
||||||
'create/' => 'DrydockBlueprintCreateController',
|
'create/' => 'DrydockBlueprintCreateController',
|
||||||
'edit/(?:(?P<id>[1-9]\d*)/)?' => 'DrydockBlueprintEditController',
|
'edit/(?:(?P<id>[1-9]\d*)/)?' => 'DrydockBlueprintEditController',
|
||||||
),
|
),
|
||||||
|
@ -62,8 +66,10 @@ final class PhabricatorDrydockApplication extends PhabricatorApplication {
|
||||||
),
|
),
|
||||||
'lease/' => array(
|
'lease/' => array(
|
||||||
'(?:query/(?P<queryKey>[^/]+)/)?' => 'DrydockLeaseListController',
|
'(?:query/(?P<queryKey>[^/]+)/)?' => 'DrydockLeaseListController',
|
||||||
'(?P<id>[1-9]\d*)/' => 'DrydockLeaseViewController',
|
'(?P<id>[1-9]\d*)/' => array(
|
||||||
'(?P<id>[1-9]\d*)/release/' => 'DrydockLeaseReleaseController',
|
'' => 'DrydockLeaseViewController',
|
||||||
|
'release/' => 'DrydockLeaseReleaseController',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'log/' => array(
|
'log/' => array(
|
||||||
'(?:query/(?P<queryKey>[^/]+)/)?' => 'DrydockLogListController',
|
'(?:query/(?P<queryKey>[^/]+)/)?' => 'DrydockLogListController',
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DrydockBlueprintDisableController
|
||||||
|
extends DrydockBlueprintController {
|
||||||
|
|
||||||
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
|
$id = $request->getURIData('id');
|
||||||
|
|
||||||
|
$blueprint = id(new DrydockBlueprintQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withIDs(array($id))
|
||||||
|
->requireCapabilities(
|
||||||
|
array(
|
||||||
|
PhabricatorPolicyCapability::CAN_VIEW,
|
||||||
|
PhabricatorPolicyCapability::CAN_EDIT,
|
||||||
|
))
|
||||||
|
->executeOne();
|
||||||
|
if (!$blueprint) {
|
||||||
|
return new Aphront404Response();
|
||||||
|
}
|
||||||
|
|
||||||
|
$is_disable = ($request->getURIData('action') == 'disable');
|
||||||
|
$id = $blueprint->getID();
|
||||||
|
$cancel_uri = $this->getApplicationURI("blueprint/{$id}/");
|
||||||
|
|
||||||
|
if ($request->isFormPost()) {
|
||||||
|
$xactions = array();
|
||||||
|
|
||||||
|
$xactions[] = id(new DrydockBlueprintTransaction())
|
||||||
|
->setTransactionType(DrydockBlueprintTransaction::TYPE_DISABLED)
|
||||||
|
->setNewValue($is_disable ? 1 : 0);
|
||||||
|
|
||||||
|
$editor = id(new DrydockBlueprintEditor())
|
||||||
|
->setActor($viewer)
|
||||||
|
->setContentSourceFromRequest($request)
|
||||||
|
->setContinueOnNoEffect(true)
|
||||||
|
->setContinueOnMissingFields(true)
|
||||||
|
->applyTransactions($blueprint, $xactions);
|
||||||
|
|
||||||
|
return id(new AphrontRedirectResponse())->setURI($cancel_uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_disable) {
|
||||||
|
$title = pht('Disable Blueprint');
|
||||||
|
$body = pht(
|
||||||
|
'If you disable this blueprint, Drydock will no longer use it to '.
|
||||||
|
'allocate new resources. Existing resources will not be affected.');
|
||||||
|
$button = pht('Disable Blueprint');
|
||||||
|
} else {
|
||||||
|
$title = pht('Enable Blueprint');
|
||||||
|
$body = pht(
|
||||||
|
'If you enable this blueprint, Drydock will start using it to '.
|
||||||
|
'allocate new resources.');
|
||||||
|
$button = pht('Enable Blueprint');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->newDialog()
|
||||||
|
->setTitle($title)
|
||||||
|
->appendParagraph($body)
|
||||||
|
->addCancelButton($cancel_uri)
|
||||||
|
->addSubmitButton($button);
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,8 +33,10 @@ final class DrydockBlueprintEditController extends DrydockBlueprintController {
|
||||||
return new Aphront400Response();
|
return new Aphront400Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
$blueprint = DrydockBlueprint::initializeNewBlueprint($viewer);
|
$blueprint = DrydockBlueprint::initializeNewBlueprint($viewer)
|
||||||
$blueprint->setClassName($class);
|
->setClassName($class)
|
||||||
|
->attachImplementation($impl);
|
||||||
|
|
||||||
$cancel_uri = $this->getApplicationURI('blueprint/');
|
$cancel_uri = $this->getApplicationURI('blueprint/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,12 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setPolicyObject($blueprint);
|
->setPolicyObject($blueprint);
|
||||||
|
|
||||||
|
if ($blueprint->getIsDisabled()) {
|
||||||
|
$header->setStatus('fa-ban', 'red', pht('Disabled'));
|
||||||
|
} else {
|
||||||
|
$header->setStatus('fa-check', 'bluegrey', pht('Active'));
|
||||||
|
}
|
||||||
|
|
||||||
$actions = $this->buildActionListView($blueprint);
|
$actions = $this->buildActionListView($blueprint);
|
||||||
$properties = $this->buildPropertyListView($blueprint, $actions);
|
$properties = $this->buildPropertyListView($blueprint, $actions);
|
||||||
|
|
||||||
|
@ -84,15 +90,15 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildActionListView(DrydockBlueprint $blueprint) {
|
private function buildActionListView(DrydockBlueprint $blueprint) {
|
||||||
$viewer = $this->getRequest()->getUser();
|
$viewer = $this->getViewer();
|
||||||
|
$id = $blueprint->getID();
|
||||||
|
|
||||||
$view = id(new PhabricatorActionListView())
|
$view = id(new PhabricatorActionListView())
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setObjectURI($this->getRequest()->getRequestURI())
|
->setObjectURI($this->getRequest()->getRequestURI())
|
||||||
->setObject($blueprint);
|
->setObject($blueprint);
|
||||||
|
|
||||||
$uri = '/blueprint/edit/'.$blueprint->getID().'/';
|
$edit_uri = $this->getApplicationURI("blueprint/edit/{$id}/");
|
||||||
$uri = $this->getApplicationURI($uri);
|
|
||||||
|
|
||||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||||
$viewer,
|
$viewer,
|
||||||
|
@ -101,12 +107,30 @@ final class DrydockBlueprintViewController extends DrydockBlueprintController {
|
||||||
|
|
||||||
$view->addAction(
|
$view->addAction(
|
||||||
id(new PhabricatorActionView())
|
id(new PhabricatorActionView())
|
||||||
->setHref($uri)
|
->setHref($edit_uri)
|
||||||
->setName(pht('Edit Blueprint'))
|
->setName(pht('Edit Blueprint'))
|
||||||
->setIcon('fa-pencil')
|
->setIcon('fa-pencil')
|
||||||
->setWorkflow(!$can_edit)
|
->setWorkflow(!$can_edit)
|
||||||
->setDisabled(!$can_edit));
|
->setDisabled(!$can_edit));
|
||||||
|
|
||||||
|
if (!$blueprint->getIsDisabled()) {
|
||||||
|
$disable_name = pht('Disable Blueprint');
|
||||||
|
$disable_icon = 'fa-ban';
|
||||||
|
$disable_uri = $this->getApplicationURI("blueprint/{$id}/disable/");
|
||||||
|
} else {
|
||||||
|
$disable_name = pht('Enable Blueprint');
|
||||||
|
$disable_icon = 'fa-check';
|
||||||
|
$disable_uri = $this->getApplicationURI("blueprint/{$id}/enable/");
|
||||||
|
}
|
||||||
|
|
||||||
|
$view->addAction(
|
||||||
|
id(new PhabricatorActionView())
|
||||||
|
->setHref($disable_uri)
|
||||||
|
->setName($disable_name)
|
||||||
|
->setIcon($disable_icon)
|
||||||
|
->setWorkflow(true)
|
||||||
|
->setDisabled(!$can_edit));
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,9 @@ final class DrydockBlueprintEditor
|
||||||
|
|
||||||
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
||||||
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
|
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
|
||||||
|
|
||||||
$types[] = DrydockBlueprintTransaction::TYPE_NAME;
|
$types[] = DrydockBlueprintTransaction::TYPE_NAME;
|
||||||
|
$types[] = DrydockBlueprintTransaction::TYPE_DISABLED;
|
||||||
|
|
||||||
return $types;
|
return $types;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +30,11 @@ final class DrydockBlueprintEditor
|
||||||
switch ($xaction->getTransactionType()) {
|
switch ($xaction->getTransactionType()) {
|
||||||
case DrydockBlueprintTransaction::TYPE_NAME:
|
case DrydockBlueprintTransaction::TYPE_NAME:
|
||||||
return $object->getBlueprintName();
|
return $object->getBlueprintName();
|
||||||
|
case DrydockBlueprintTransaction::TYPE_DISABLED:
|
||||||
|
return (int)$object->getIsDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return parent::getCustomTransactionOldValue($object, $xaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCustomTransactionNewValue(
|
protected function getCustomTransactionNewValue(
|
||||||
|
@ -38,7 +44,11 @@ final class DrydockBlueprintEditor
|
||||||
switch ($xaction->getTransactionType()) {
|
switch ($xaction->getTransactionType()) {
|
||||||
case DrydockBlueprintTransaction::TYPE_NAME:
|
case DrydockBlueprintTransaction::TYPE_NAME:
|
||||||
return $xaction->getNewValue();
|
return $xaction->getNewValue();
|
||||||
|
case DrydockBlueprintTransaction::TYPE_DISABLED:
|
||||||
|
return (int)$xaction->getNewValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return parent::getCustomTransactionNewValue($object, $xaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function applyCustomInternalTransaction(
|
protected function applyCustomInternalTransaction(
|
||||||
|
@ -48,26 +58,26 @@ final class DrydockBlueprintEditor
|
||||||
switch ($xaction->getTransactionType()) {
|
switch ($xaction->getTransactionType()) {
|
||||||
case DrydockBlueprintTransaction::TYPE_NAME:
|
case DrydockBlueprintTransaction::TYPE_NAME:
|
||||||
$object->setBlueprintName($xaction->getNewValue());
|
$object->setBlueprintName($xaction->getNewValue());
|
||||||
break;
|
return;
|
||||||
|
case DrydockBlueprintTransaction::TYPE_DISABLED:
|
||||||
|
$object->setIsDisabled((int)$xaction->getNewValue());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return parent::applyCustomInternalTransaction($object, $xaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function applyCustomExternalTransaction(
|
protected function applyCustomExternalTransaction(
|
||||||
PhabricatorLiskDAO $object,
|
PhabricatorLiskDAO $object,
|
||||||
PhabricatorApplicationTransaction $xaction) {
|
PhabricatorApplicationTransaction $xaction) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function extractFilePHIDsFromCustomTransaction(
|
switch ($xaction->getTransactionType()) {
|
||||||
PhabricatorLiskDAO $object,
|
case DrydockBlueprintTransaction::TYPE_NAME:
|
||||||
PhabricatorApplicationTransaction $xaction) {
|
case DrydockBlueprintTransaction::TYPE_DISABLED:
|
||||||
return array();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function shouldSendMail(
|
return parent::applyCustomExternalTransaction($object, $xaction);
|
||||||
PhabricatorLiskDAO $object,
|
|
||||||
array $xactions) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ final class DrydockBlueprintQuery extends DrydockQuery {
|
||||||
private $phids;
|
private $phids;
|
||||||
private $blueprintClasses;
|
private $blueprintClasses;
|
||||||
private $datasourceQuery;
|
private $datasourceQuery;
|
||||||
|
private $disabled;
|
||||||
|
|
||||||
public function withIDs(array $ids) {
|
public function withIDs(array $ids) {
|
||||||
$this->ids = $ids;
|
$this->ids = $ids;
|
||||||
|
@ -27,6 +28,11 @@ final class DrydockBlueprintQuery extends DrydockQuery {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function withDisabled($disabled) {
|
||||||
|
$this->disabled = $disabled;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function newResultObject() {
|
public function newResultObject() {
|
||||||
return new DrydockBlueprint();
|
return new DrydockBlueprint();
|
||||||
}
|
}
|
||||||
|
@ -82,6 +88,13 @@ final class DrydockBlueprintQuery extends DrydockQuery {
|
||||||
$this->blueprintClasses);
|
$this->blueprintClasses);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->disabled !== null) {
|
||||||
|
$where[] = qsprintf(
|
||||||
|
$conn,
|
||||||
|
'isDisabled = %d',
|
||||||
|
(int)$this->disabled);
|
||||||
|
}
|
||||||
|
|
||||||
return $where;
|
return $where;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,23 @@ final class DrydockBlueprintSearchEngine
|
||||||
protected function buildQueryFromParameters(array $map) {
|
protected function buildQueryFromParameters(array $map) {
|
||||||
$query = $this->newQuery();
|
$query = $this->newQuery();
|
||||||
|
|
||||||
|
if ($map['isDisabled'] !== null) {
|
||||||
|
$query->withDisabled($map['isDisabled']);
|
||||||
|
}
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildCustomSearchFields() {
|
protected function buildCustomSearchFields() {
|
||||||
return array();
|
return array(
|
||||||
|
id(new PhabricatorSearchThreeStateField())
|
||||||
|
->setLabel(pht('Disabled'))
|
||||||
|
->setKey('isDisabled')
|
||||||
|
->setOptions(
|
||||||
|
pht('(Show All)'),
|
||||||
|
pht('Show Only Disabled Blueprints'),
|
||||||
|
pht('Hide Disabled Blueprints')),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getURI($path) {
|
protected function getURI($path) {
|
||||||
|
@ -31,6 +43,7 @@ final class DrydockBlueprintSearchEngine
|
||||||
|
|
||||||
protected function getBuiltinQueryNames() {
|
protected function getBuiltinQueryNames() {
|
||||||
return array(
|
return array(
|
||||||
|
'active' => pht('Active Blueprints'),
|
||||||
'all' => pht('All Blueprints'),
|
'all' => pht('All Blueprints'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +53,8 @@ final class DrydockBlueprintSearchEngine
|
||||||
$query->setQueryKey($query_key);
|
$query->setQueryKey($query_key);
|
||||||
|
|
||||||
switch ($query_key) {
|
switch ($query_key) {
|
||||||
|
case 'active':
|
||||||
|
return $query->setParameter('isDisabled', false);
|
||||||
case 'all':
|
case 'all':
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
@ -64,6 +79,12 @@ final class DrydockBlueprintSearchEngine
|
||||||
|
|
||||||
if (!$blueprint->getImplementation()->isEnabled()) {
|
if (!$blueprint->getImplementation()->isEnabled()) {
|
||||||
$item->setDisabled(true);
|
$item->setDisabled(true);
|
||||||
|
$item->addIcon('fa-chain-broken grey', pht('Implementation'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($blueprint->getIsDisabled()) {
|
||||||
|
$item->setDisabled(true);
|
||||||
|
$item->addIcon('fa-ban grey', pht('Disabled'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->addAttribute($blueprint->getImplementation()->getBlueprintName());
|
$item->addAttribute($blueprint->getImplementation()->getBlueprintName());
|
||||||
|
|
|
@ -15,6 +15,7 @@ final class DrydockBlueprint extends DrydockDAO
|
||||||
protected $viewPolicy;
|
protected $viewPolicy;
|
||||||
protected $editPolicy;
|
protected $editPolicy;
|
||||||
protected $details = array();
|
protected $details = array();
|
||||||
|
protected $isDisabled;
|
||||||
|
|
||||||
private $implementation = self::ATTACHABLE;
|
private $implementation = self::ATTACHABLE;
|
||||||
private $customFields = self::ATTACHABLE;
|
private $customFields = self::ATTACHABLE;
|
||||||
|
@ -34,7 +35,8 @@ final class DrydockBlueprint extends DrydockDAO
|
||||||
return id(new DrydockBlueprint())
|
return id(new DrydockBlueprint())
|
||||||
->setViewPolicy($view_policy)
|
->setViewPolicy($view_policy)
|
||||||
->setEditPolicy($edit_policy)
|
->setEditPolicy($edit_policy)
|
||||||
->setBlueprintName('');
|
->setBlueprintName('')
|
||||||
|
->setIsDisabled(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getConfiguration() {
|
protected function getConfiguration() {
|
||||||
|
@ -46,6 +48,7 @@ final class DrydockBlueprint extends DrydockDAO
|
||||||
self::CONFIG_COLUMN_SCHEMA => array(
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
'className' => 'text255',
|
'className' => 'text255',
|
||||||
'blueprintName' => 'sort255',
|
'blueprintName' => 'sort255',
|
||||||
|
'isDisabled' => 'bool',
|
||||||
),
|
),
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
final class DrydockBlueprintTransaction
|
final class DrydockBlueprintTransaction
|
||||||
extends PhabricatorApplicationTransaction {
|
extends PhabricatorApplicationTransaction {
|
||||||
|
|
||||||
const TYPE_NAME = 'drydock:blueprint:name';
|
const TYPE_NAME = 'drydock:blueprint:name';
|
||||||
|
const TYPE_DISABLED = 'drydock:blueprint:disabled';
|
||||||
|
|
||||||
public function getApplicationName() {
|
public function getApplicationName() {
|
||||||
return 'drydock';
|
return 'drydock';
|
||||||
|
@ -31,6 +32,16 @@ final class DrydockBlueprintTransaction
|
||||||
$old,
|
$old,
|
||||||
$new);
|
$new);
|
||||||
}
|
}
|
||||||
|
case self::TYPE_DISABLED:
|
||||||
|
if ($new) {
|
||||||
|
return pht(
|
||||||
|
'%s disabled this blueprint.',
|
||||||
|
$author_handle);
|
||||||
|
} else {
|
||||||
|
return pht(
|
||||||
|
'%s enabled this blueprint.',
|
||||||
|
$author_handle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::getTitle();
|
return parent::getTitle();
|
||||||
|
|
|
@ -184,12 +184,10 @@ final class DrydockAllocatorWorker extends DrydockWorker {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: When blueprints can be disabled, this query should ignore disabled
|
|
||||||
// blueprints.
|
|
||||||
|
|
||||||
$blueprints = id(new DrydockBlueprintQuery())
|
$blueprints = id(new DrydockBlueprintQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withBlueprintClasses(array_keys($impls))
|
->withBlueprintClasses(array_keys($impls))
|
||||||
|
->withDisabled(false)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$keep = array();
|
$keep = array();
|
||||||
|
|
Loading…
Reference in a new issue