Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F94197
D7823.diff
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D7823.diff
View Options
diff --git a/src/applications/harbormaster/controller/HarbormasterBuildableListController.php b/src/applications/harbormaster/controller/HarbormasterBuildableListController.php
--- a/src/applications/harbormaster/controller/HarbormasterBuildableListController.php
+++ b/src/applications/harbormaster/controller/HarbormasterBuildableListController.php
@@ -37,6 +37,7 @@
$item = id(new PHUIObjectItemView())
->setHeader(pht('Buildable %d', $buildable->getID()));
+ $item->addAttribute($buildable->getContainerHandle()->getName());
$item->addAttribute($buildable->getBuildableHandle()->getFullName());
if ($id) {
diff --git a/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php b/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php
--- a/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php
+++ b/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php
@@ -6,21 +6,127 @@
public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery();
+ $revisions = $this->readPHIDsFromRequest(
+ $request,
+ 'revisions',
+ array(
+ DifferentialPHIDTypeRevision::TYPECONST,
+ ));
+
+ $repositories = $this->readPHIDsFromRequest(
+ $request,
+ 'repositories',
+ array(
+ PhabricatorRepositoryPHIDTypeRepository::TYPECONST,
+ ));
+
+ $container_phids = array_merge($revisions, $repositories);
+ $saved->setParameter('containerPHIDs', $container_phids);
+
+ $commits = $this->readPHIDsFromRequest(
+ $request,
+ 'commits',
+ array(
+ PhabricatorRepositoryPHIDTypeCommit::TYPECONST,
+ ));
+
+ $diffs = $this->readListFromRequest($request, 'diffs');
+ if ($diffs) {
+ $diffs = id(new DifferentialDiffQuery())
+ ->setViewer($this->requireViewer())
+ ->withIDs($diffs)
+ ->execute();
+ $diffs = mpull($diffs, 'getPHID', 'getPHID');
+ }
+
+ $buildable_phids = array_merge($commits, $diffs);
+ $saved->setParameter('buildablePHIDs', $buildable_phids);
+
+
return $saved;
}
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
$query = id(new HarbormasterBuildableQuery())
+ ->needContainerHandles(true)
->needBuildableHandles(true)
->needBuilds(true);
+ $container_phids = $saved->getParameter('containerPHIDs', array());
+ if ($container_phids) {
+ $query->withContainerPHIDs($container_phids);
+ }
+
+ $buildable_phids = $saved->getParameter('buildablePHIDs', array());
+
+ if ($buildable_phids) {
+ $query->withBuildablePHIDs($buildable_phids);
+ }
+
return $query;
}
public function buildSearchForm(
AphrontFormView $form,
PhabricatorSavedQuery $saved_query) {
+ $container_phids = $saved_query->getParameter('containerPHIDs', array());
+ $buildable_phids = $saved_query->getParameter('buildablePHIDs', array());
+
+ $all_phids = array_merge($container_phids, $buildable_phids);
+
+ $revision_names = array();
+ $diff_names = array();
+ $repository_names = array();
+ $commit_names = array();
+
+ if ($all_phids) {
+ $objects = id(new PhabricatorObjectQuery())
+ ->setViewer($this->requireViewer())
+ ->withPHIDs($all_phids)
+ ->execute();
+
+ foreach ($all_phids as $phid) {
+ $object = idx($objects, $phid);
+ if (!$object) {
+ continue;
+ }
+
+ if ($object instanceof DifferentialRevision) {
+ $revision_names[] = 'D'.$object->getID();
+ } else if ($object instanceof DifferentialDiff) {
+ $diff_names[] = $object->getID();
+ } else if ($object instanceof PhabricatorRepository) {
+ $repository_names[] = 'r'.$object->getCallsign();
+ } else if ($object instanceof PhabricatorRepositoryCommit) {
+ $repository = $object->getRepository();
+ $commit_names[] = $repository->formatCommitName(
+ $object->getCommitIdentifier());
+ }
+ }
+ }
+
+ $form
+ ->appendChild(
+ id(new AphrontFormTextControl())
+ ->setLabel(pht('Differential Revisions'))
+ ->setName('revisions')
+ ->setValue(implode(', ', $revision_names)))
+ ->appendChild(
+ id(new AphrontFormTextControl())
+ ->setLabel(pht('Differential Diffs'))
+ ->setName('diffs')
+ ->setValue(implode(', ', $diff_names)))
+ ->appendChild(
+ id(new AphrontFormTextControl())
+ ->setLabel(pht('Repositories'))
+ ->setName('repositories')
+ ->setValue(implode(', ', $repository_names)))
+ ->appendChild(
+ id(new AphrontFormTextControl())
+ ->setLabel(pht('Commits'))
+ ->setName('commits')
+ ->setValue(implode(', ', $commit_names)));
}
protected function getURI($path) {
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/qw/wd/3aumdktucpfilp3i
Default Alt Text
D7823.diff (4 KB)
Attached To
Mode
D7823: Allow buildables to be queried by container and underlying buildable
Attached
Detach File
Event Timeline
Log In to Comment