Add pagers to server clients and client authorizations in OAuth Server GUI
Summary: ...also make the pager usage in ChatLog use the nice formatWhereClause functionality Test Plan: set $page_size = 2 and paged around the data a bit Reviewers: epriestley Reviewed By: epriestley CC: aran Maniphest Tasks: T905 Differential Revision: https://secure.phabricator.com/D2106
This commit is contained in:
@@ -30,9 +30,17 @@ extends PhabricatorOAuthClientBaseController {
|
||||
$title = 'OAuth Clients';
|
||||
$request = $this->getRequest();
|
||||
$current_user = $request->getUser();
|
||||
$clients = id(new PhabricatorOAuthServerClient())
|
||||
->loadAllWhere('creatorPHID = %s',
|
||||
$current_user->getPHID());
|
||||
$offset = $request->getInt('offset', 0);
|
||||
$page_size = 100;
|
||||
$pager = new AphrontPagerView();
|
||||
$request_uri = $request->getRequestURI();
|
||||
$pager->setURI($request_uri, 'offset');
|
||||
$pager->setPageSize($page_size);
|
||||
$pager->setOffset($offset);
|
||||
|
||||
$query = new PhabricatorOAuthServerClientQuery();
|
||||
$query->withCreatorPHIDs(array($current_user->getPHID()));
|
||||
$clients = $query->executeWithPager($pager);
|
||||
|
||||
$rows = array();
|
||||
$rowc = array();
|
||||
@@ -76,8 +84,10 @@ extends PhabricatorOAuthClientBaseController {
|
||||
$panel = $this->buildClientList($rows, $rowc, $title);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
array($this->getNoticeView(),
|
||||
$panel),
|
||||
array(
|
||||
$this->getNoticeView(),
|
||||
$panel->appendChild($pager)
|
||||
),
|
||||
array('title' => $title)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/oauthserver/controller/client/base');
|
||||
phutil_require_module('phabricator', 'applications/oauthserver/storage/client');
|
||||
phutil_require_module('phabricator', 'applications/oauthserver/query/client');
|
||||
phutil_require_module('phabricator', 'view/control/pager');
|
||||
phutil_require_module('phabricator', 'view/control/table');
|
||||
phutil_require_module('phabricator', 'view/form/error');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('PhabricatorOAuthClientListController.php');
|
||||
|
||||
@@ -27,12 +27,20 @@ extends PhabricatorOAuthClientAuthorizationBaseController {
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$title = 'OAuth Client Authorizations';
|
||||
$request = $this->getRequest();
|
||||
$current_user = $request->getUser();
|
||||
$authorizations = id(new PhabricatorOAuthClientAuthorization())
|
||||
->loadAllWhere('userPHID = %s',
|
||||
$current_user->getPHID());
|
||||
$title = 'OAuth Client Authorizations';
|
||||
$request = $this->getRequest();
|
||||
$current_user = $request->getUser();
|
||||
$offset = $request->getInt('offset', 0);
|
||||
$page_size = 100;
|
||||
$pager = new AphrontPagerView();
|
||||
$request_uri = $request->getRequestURI();
|
||||
$pager->setURI($request_uri, 'offset');
|
||||
$pager->setPageSize($page_size);
|
||||
$pager->setOffset($offset);
|
||||
|
||||
$query = new PhabricatorOAuthClientAuthorizationQuery();
|
||||
$query->withUserPHIDs(array($current_user->getPHID()));
|
||||
$authorizations = $query->executeWithPager($pager);
|
||||
|
||||
$client_authorizations = mpull($authorizations, null, 'getClientPHID');
|
||||
$client_phids = array_keys($client_authorizations);
|
||||
@@ -101,8 +109,10 @@ extends PhabricatorOAuthClientAuthorizationBaseController {
|
||||
$panel = $this->buildClientAuthorizationList($rows, $rowc, $title);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
array($this->getNoticeView(),
|
||||
$panel),
|
||||
array(
|
||||
$this->getNoticeView(),
|
||||
$panel->appendChild($pager),
|
||||
),
|
||||
array('title' => $title)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,9 +7,10 @@
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/oauthserver/controller/clientauthorization/base');
|
||||
phutil_require_module('phabricator', 'applications/oauthserver/query/clientauthorization');
|
||||
phutil_require_module('phabricator', 'applications/oauthserver/storage/client');
|
||||
phutil_require_module('phabricator', 'applications/oauthserver/storage/clientauthorization');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
phutil_require_module('phabricator', 'view/control/pager');
|
||||
phutil_require_module('phabricator', 'view/control/table');
|
||||
phutil_require_module('phabricator', 'view/form/error');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
|
||||
Reference in New Issue
Block a user