mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 13:22:42 +01:00
Paginate Diffusion history views, respect 'pagesize' parameter.
This commit is contained in:
parent
f76c3bbc22
commit
3369147cab
4 changed files with 22 additions and 3 deletions
|
@ -20,12 +20,28 @@ class DiffusionHistoryController extends DiffusionController {
|
||||||
|
|
||||||
public function processRequest() {
|
public function processRequest() {
|
||||||
$drequest = $this->diffusionRequest;
|
$drequest = $this->diffusionRequest;
|
||||||
|
$request = $this->getRequest();
|
||||||
|
|
||||||
|
$page_size = $request->getInt('pagesize', 100);
|
||||||
|
$offset = $request->getInt('page', 0);
|
||||||
|
|
||||||
$history_query = DiffusionHistoryQuery::newFromDiffusionRequest(
|
$history_query = DiffusionHistoryQuery::newFromDiffusionRequest(
|
||||||
$drequest);
|
$drequest);
|
||||||
|
$history_query->setOffset($offset);
|
||||||
|
$history_query->setLimit($page_size + 1);
|
||||||
$history = $history_query->loadHistory();
|
$history = $history_query->loadHistory();
|
||||||
|
|
||||||
|
$pager = new AphrontPagerView();
|
||||||
|
$pager->setPageSize($page_size);
|
||||||
|
$pager->setOffset($offset);
|
||||||
|
if (count($history) == $page_size + 1) {
|
||||||
|
array_pop($history);
|
||||||
|
$pager->setHasMorePages(true);
|
||||||
|
} else {
|
||||||
|
$pager->setHasMorePages(false);
|
||||||
|
}
|
||||||
|
$pager->setURI($request->getRequestURI(), 'page');
|
||||||
|
|
||||||
$content = array();
|
$content = array();
|
||||||
|
|
||||||
$content[] = $this->buildCrumbs(
|
$content[] = $this->buildCrumbs(
|
||||||
|
@ -41,6 +57,7 @@ class DiffusionHistoryController extends DiffusionController {
|
||||||
|
|
||||||
$history_panel = new AphrontPanelView();
|
$history_panel = new AphrontPanelView();
|
||||||
$history_panel->appendChild($history_table);
|
$history_panel->appendChild($history_table);
|
||||||
|
$history_panel->appendChild($pager);
|
||||||
|
|
||||||
$content[] = $history_panel;
|
$content[] = $history_panel;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/controller/base');
|
phutil_require_module('phabricator', 'applications/diffusion/controller/base');
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/query/history/base');
|
phutil_require_module('phabricator', 'applications/diffusion/query/history/base');
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/view/historytable');
|
phutil_require_module('phabricator', 'applications/diffusion/view/historytable');
|
||||||
|
phutil_require_module('phabricator', 'view/control/pager');
|
||||||
phutil_require_module('phabricator', 'view/layout/panel');
|
phutil_require_module('phabricator', 'view/layout/panel');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,11 +43,12 @@ final class DiffusionSvnHistoryQuery extends DiffusionHistoryQuery {
|
||||||
'SELECT * FROM %T WHERE repositoryID = %d AND pathID = %d
|
'SELECT * FROM %T WHERE repositoryID = %d AND pathID = %d
|
||||||
AND commitSequence <= %d
|
AND commitSequence <= %d
|
||||||
ORDER BY commitSequence DESC
|
ORDER BY commitSequence DESC
|
||||||
LIMIT %d',
|
LIMIT %d, %d',
|
||||||
PhabricatorRepository::TABLE_PATHCHANGE,
|
PhabricatorRepository::TABLE_PATHCHANGE,
|
||||||
$repository->getID(),
|
$repository->getID(),
|
||||||
$path_id,
|
$path_id,
|
||||||
$commit ? $commit : 0x7FFFFFFF,
|
$commit ? $commit : 0x7FFFFFFF,
|
||||||
|
$this->getOffset(),
|
||||||
$this->getLimit());
|
$this->getLimit());
|
||||||
|
|
||||||
$commits = array();
|
$commits = array();
|
||||||
|
|
|
@ -34,7 +34,7 @@ class PhabricatorUser extends PhabricatorUserDAO {
|
||||||
|
|
||||||
protected $conduitCertificate;
|
protected $conduitCertificate;
|
||||||
|
|
||||||
protected $preferences = null;
|
private $preferences = null;
|
||||||
|
|
||||||
public function getProfileImagePHID() {
|
public function getProfileImagePHID() {
|
||||||
return nonempty(
|
return nonempty(
|
||||||
|
|
Loading…
Reference in a new issue