Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F87947
D7713.diff
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D7713.diff
View Options
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php
@@ -399,6 +399,18 @@
->setWorkflow(!$can_edit)
->setDisabled(!$can_edit));
+ if ($repository->isHosted()) {
+ $callsign = $repository->getCallsign();
+ $push_uri = $this->getApplicationURI(
+ 'pushlog/?repositories=r'.$callsign);
+
+ $view->addAction(
+ id(new PhabricatorActionView())
+ ->setName(pht('View Push Logs'))
+ ->setIcon('transcript')
+ ->setHref($push_uri));
+ }
+
return $view;
}
diff --git a/src/applications/repository/query/PhabricatorRepositoryPushLogQuery.php b/src/applications/repository/query/PhabricatorRepositoryPushLogQuery.php
--- a/src/applications/repository/query/PhabricatorRepositoryPushLogQuery.php
+++ b/src/applications/repository/query/PhabricatorRepositoryPushLogQuery.php
@@ -5,6 +5,7 @@
private $ids;
private $repositoryPHIDs;
+ private $pusherPHIDs;
public function withIDs(array $ids) {
$this->ids = $ids;
@@ -16,6 +17,11 @@
return $this;
}
+ public function withPusherPHIDs(array $pusher_phids) {
+ $this->pusherPHIDs = $pusher_phids;
+ return $this;
+ }
+
protected function loadPage() {
$table = new PhabricatorRepositoryPushLog();
$conn_r = $table->establishConnection('r');
@@ -73,6 +79,13 @@
$this->repositoryPHIDs);
}
+ if ($this->pusherPHIDs) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'pusherPHID in (%Ls)',
+ $this->pusherPHIDs);
+ }
+
$where[] = $this->buildPagingClause($conn_r);
return $this->formatWhereClause($where);
diff --git a/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php b/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php
--- a/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php
+++ b/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php
@@ -6,19 +6,76 @@
public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery();
+ $saved->setParameter(
+ 'repositoryPHIDs',
+ $this->readPHIDsFromRequest(
+ $request,
+ 'repositories',
+ array(
+ PhabricatorRepositoryPHIDTypeRepository::TYPECONST,
+ )));
+
+ $saved->setParameter(
+ 'pusherPHIDs',
+ $this->readUsersFromRequest(
+ $request,
+ 'pushers'));
+
return $saved;
}
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
$query = id(new PhabricatorRepositoryPushLogQuery());
+ $repository_phids = $saved->getParameter('repositoryPHIDs');
+ if ($repository_phids) {
+ $query->withRepositoryPHIDs($repository_phids);
+ }
+
+ $pusher_phids = $saved->getParameter('pusherPHIDs');
+ if ($pusher_phids) {
+ $query->withPusherPHIDs($pusher_phids);
+ }
+
return $query;
}
public function buildSearchForm(
AphrontFormView $form,
PhabricatorSavedQuery $saved_query) {
+ $repository_phids = $saved_query->getParameter('repositoryPHIDs', array());
+ $pusher_phids = $saved_query->getParameter('pusherPHIDs', array());
+
+ $all_phids = array_merge(
+ $repository_phids,
+ $pusher_phids);
+
+ if ($all_phids) {
+ $handles = id(new PhabricatorHandleQuery())
+ ->setViewer($this->requireViewer())
+ ->withPHIDs($all_phids)
+ ->execute();
+ } else {
+ $handles = array();
+ }
+
+ $repository_handles = array_select_keys($handles, $repository_phids);
+ $pusher_handles = array_select_keys($handles, $pusher_phids);
+
+ $form
+ ->appendChild(
+ id(new AphrontFormTokenizerControl())
+ ->setDatasource('/typeahead/common/repositories/')
+ ->setName('repositories')
+ ->setLabel(pht('Repositories'))
+ ->setValue($repository_handles))
+ ->appendChild(
+ id(new AphrontFormTokenizerControl())
+ ->setDatasource('/typeahead/common/accounts/')
+ ->setName('pushers')
+ ->setLabel(pht('Pushers'))
+ ->setValue($pusher_handles));
}
protected function getURI($path) {
diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
--- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
+++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
@@ -299,6 +299,56 @@
}
+ /**
+ * Read a list of generic PHIDs from a request in a flexible way. Like
+ * @{method:readUsersFromRequest}, this method supports either array or
+ * comma-delimited forms. Objects can be specified either by PHID or by
+ * object name.
+ *
+ * @param AphrontRequest Request to read PHIDs from.
+ * @param string Key to read in the request.
+ * @param list<const> Optional, list of permitted PHID types.
+ * @return list<phid> List of object PHIDs.
+ *
+ * @task read
+ */
+ protected function readPHIDsFromRequest(
+ AphrontRequest $request,
+ $key,
+ array $allow_types = array()) {
+
+ $list = $request->getArr($key, null);
+ if ($list === null) {
+ $list = $request->getStrList($key);
+ }
+
+ if (!$list) {
+ return array();
+ }
+
+ $objects = id(new PhabricatorObjectQuery())
+ ->setViewer($this->requireViewer())
+ ->withNames($list)
+ ->execute();
+ $list = mpull($objects, 'getPHID');
+
+ if (!$list) {
+ return array();
+ }
+
+ // If only certain PHID types are allowed, filter out all the others.
+ if ($allow_types) {
+ $allow_types = array_fuse($allow_types);
+ foreach ($list as $key => $phid) {
+ if (empty($allow_types[phid_get_type($phid)])) {
+ unset($list[$key]);
+ }
+ }
+ }
+
+ return $list;
+ }
+
protected function readBoolFromRequest(
AphrontRequest $request,
$key) {
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/on/ny/dvoxnlldkg2eou2i
Default Alt Text
D7713.diff (6 KB)
Attached To
Mode
D7713: Allow repository push logs to be filtered by pusher and repository
Attached
Detach File
Event Timeline
Log In to Comment