@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

Allow Drydock blueprints to be tagged and searched, and give types some little icons

Summary:
Ref T10457.

- Let blueprints be tagged so you can search and annotate them a little more easily.
- Give each blueprint type an optional icon to make things a little easier to parse visually.

Test Plan:
- Tagged blueprints.
- Searched by tags.
- Looked at nice little icons.

{F1139712}

Reviewers: chad

Reviewed By: chad

Subscribers: yelirekim

Maniphest Tasks: T10457

Differential Revision: https://secure.phabricator.com/D15392

+93 -7
+16
resources/sql/autopatches/20160303.drydock.3.edge.sql
··· 1 + CREATE TABLE {$NAMESPACE}_drydock.edge ( 2 + src VARBINARY(64) NOT NULL, 3 + type INT UNSIGNED NOT NULL, 4 + dst VARBINARY(64) NOT NULL, 5 + dateCreated INT UNSIGNED NOT NULL, 6 + seq INT UNSIGNED NOT NULL, 7 + dataID INT UNSIGNED, 8 + PRIMARY KEY (src, type, dst), 9 + KEY `src` (src, type, dateCreated, seq), 10 + UNIQUE KEY `key_dst` (dst, type, src) 11 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; 12 + 13 + CREATE TABLE {$NAMESPACE}_drydock.edgedata ( 14 + id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, 15 + data LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT} 16 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+3
src/__phutil_library_map__.php
··· 966 966 'DrydockResourceViewController' => 'applications/drydock/controller/DrydockResourceViewController.php', 967 967 'DrydockSFTPFilesystemInterface' => 'applications/drydock/interface/filesystem/DrydockSFTPFilesystemInterface.php', 968 968 'DrydockSSHCommandInterface' => 'applications/drydock/interface/command/DrydockSSHCommandInterface.php', 969 + 'DrydockSchemaSpec' => 'applications/drydock/storage/DrydockSchemaSpec.php', 969 970 'DrydockSlotLock' => 'applications/drydock/storage/DrydockSlotLock.php', 970 971 'DrydockSlotLockException' => 'applications/drydock/exception/DrydockSlotLockException.php', 971 972 'DrydockSlotLockFailureLogType' => 'applications/drydock/logtype/DrydockSlotLockFailureLogType.php', ··· 4975 4976 'PhabricatorPolicyInterface', 4976 4977 'PhabricatorCustomFieldInterface', 4977 4978 'PhabricatorNgramsInterface', 4979 + 'PhabricatorProjectInterface', 4978 4980 ), 4979 4981 'DrydockBlueprintController' => 'DrydockController', 4980 4982 'DrydockBlueprintCoreCustomField' => array( ··· 5094 5096 'DrydockResourceViewController' => 'DrydockResourceController', 5095 5097 'DrydockSFTPFilesystemInterface' => 'DrydockFilesystemInterface', 5096 5098 'DrydockSSHCommandInterface' => 'DrydockCommandInterface', 5099 + 'DrydockSchemaSpec' => 'PhabricatorConfigSchemaSpec', 5097 5100 'DrydockSlotLock' => 'DrydockDAO', 5098 5101 'DrydockSlotLockException' => 'Exception', 5099 5102 'DrydockSlotLockFailureLogType' => 'DrydockLogType',
+4
src/applications/drydock/blueprint/DrydockAlmanacServiceHostBlueprintImplementation.php
··· 15 15 return pht('Almanac Hosts'); 16 16 } 17 17 18 + public function getBlueprintIcon() { 19 + return 'fa-server'; 20 + } 21 + 18 22 public function getDescription() { 19 23 return pht( 20 24 'Allows Drydock to lease existing hosts defined in an Almanac service '.
+4
src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
··· 15 15 abstract public function getBlueprintName(); 16 16 abstract public function getDescription(); 17 17 18 + public function getBlueprintIcon() { 19 + return 'fa-map-o'; 20 + } 21 + 18 22 public function getFieldSpecifications() { 19 23 $fields = array(); 20 24
+4
src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
··· 13 13 return pht('Working Copy'); 14 14 } 15 15 16 + public function getBlueprintIcon() { 17 + return 'fa-folder-open'; 18 + } 19 + 16 20 public function getDescription() { 17 21 return pht('Allows Drydock to check out working copies of repositories.'); 18 22 }
+7 -1
src/applications/drydock/controller/DrydockBlueprintEditController.php
··· 52 52 foreach ($implementations as $implementation_name => $implementation) { 53 53 $disabled = !$implementation->isEnabled(); 54 54 55 + $impl_icon = $implementation->getBlueprintIcon(); 56 + $impl_name = $implementation->getBlueprintName(); 57 + 58 + $impl_icon = id(new PHUIIconView()) 59 + ->setIcon($impl_icon, 'lightgreytext'); 60 + 55 61 $control->addButton( 56 62 $implementation_name, 57 - $implementation->getBlueprintName(), 63 + array($impl_icon, ' ', $impl_name), 58 64 array( 59 65 pht('Provides: %s', $implementation->getType()), 60 66 phutil_tag('br'),
+5 -1
src/applications/drydock/controller/DrydockBlueprintViewController.php
··· 127 127 private function buildPropertyListView( 128 128 DrydockBlueprint $blueprint, 129 129 PhabricatorActionListView $actions) { 130 + $viewer = $this->getViewer(); 130 131 131 - $view = new PHUIPropertyListView(); 132 + $view = id(new PHUIPropertyListView()) 133 + ->setUser($viewer) 134 + ->setObject($blueprint); 135 + 132 136 $view->setActionList($actions); 133 137 134 138 $view->addProperty(
+34 -3
src/applications/drydock/query/DrydockBlueprintSearchEngine.php
··· 77 77 assert_instances_of($blueprints, 'DrydockBlueprint'); 78 78 79 79 $viewer = $this->requireViewer(); 80 + 81 + if ($blueprints) { 82 + $edge_query = id(new PhabricatorEdgeQuery()) 83 + ->withSourcePHIDs(mpull($blueprints, 'getPHID')) 84 + ->withEdgeTypes( 85 + array( 86 + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, 87 + )); 88 + 89 + $edge_query->execute(); 90 + } 91 + 80 92 $view = new PHUIObjectItemListView(); 81 93 82 94 foreach ($blueprints as $blueprint) { 95 + $impl = $blueprint->getImplementation(); 96 + 83 97 $item = id(new PHUIObjectItemView()) 84 98 ->setHeader($blueprint->getBlueprintName()) 85 - ->setHref($this->getApplicationURI('/blueprint/'.$blueprint->getID())) 99 + ->setHref($blueprint->getURI()) 86 100 ->setObjectName(pht('Blueprint %d', $blueprint->getID())); 87 101 88 - if (!$blueprint->getImplementation()->isEnabled()) { 102 + if (!$impl->isEnabled()) { 89 103 $item->setDisabled(true); 90 104 $item->addIcon('fa-chain-broken grey', pht('Implementation')); 91 105 } ··· 95 109 $item->addIcon('fa-ban grey', pht('Disabled')); 96 110 } 97 111 98 - $item->addAttribute($blueprint->getImplementation()->getBlueprintName()); 112 + $impl_icon = $impl->getBlueprintIcon(); 113 + $impl_name = $impl->getBlueprintName(); 114 + 115 + $impl_icon = id(new PHUIIconView()) 116 + ->setIcon($impl_icon, 'lightgreytext'); 117 + 118 + $item->addAttribute(array($impl_icon, ' ', $impl_name)); 119 + 120 + $phid = $blueprint->getPHID(); 121 + $project_phids = $edge_query->getDestinationPHIDs(array($phid)); 122 + if ($project_phids) { 123 + $project_handles = $viewer->loadHandles($project_phids); 124 + $item->addAttribute( 125 + id(new PHUIHandleTagListView()) 126 + ->setLimit(4) 127 + ->setSlim(true) 128 + ->setHandles($project_handles)); 129 + } 99 130 100 131 $view->addItem($item); 101 132 }
+7 -1
src/applications/drydock/storage/DrydockBlueprint.php
··· 9 9 PhabricatorApplicationTransactionInterface, 10 10 PhabricatorPolicyInterface, 11 11 PhabricatorCustomFieldInterface, 12 - PhabricatorNgramsInterface { 12 + PhabricatorNgramsInterface, 13 + PhabricatorProjectInterface { 13 14 14 15 protected $className; 15 16 protected $blueprintName; ··· 117 118 $log->setBlueprintPHID($this->getPHID()); 118 119 119 120 return $log->save(); 121 + } 122 + 123 + public function getURI() { 124 + $id = $this->getID(); 125 + return "/drydock/blueprint/{$id}/"; 120 126 } 121 127 122 128
+9
src/applications/drydock/storage/DrydockSchemaSpec.php
··· 1 + <?php 2 + 3 + final class DrydockSchemaSpec extends PhabricatorConfigSchemaSpec { 4 + 5 + public function buildSchemata() { 6 + $this->buildEdgeSchemata(new DrydockBlueprint()); 7 + } 8 + 9 + }
-1
src/applications/harbormaster/query/HarbormasterBuildPlanSearchEngine.php
··· 84 84 85 85 $viewer = $this->requireViewer(); 86 86 87 - 88 87 if ($plans) { 89 88 $edge_query = id(new PhabricatorEdgeQuery()) 90 89 ->withSourcePHIDs(mpull($plans, 'getPHID'))