1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

Add status table to Diffusion Branch manage page

Summary: Fixes T12832. Adds a basic table (not paginated?) to view tracking and autoclose status.

Test Plan:
Review a large repository (Krita) with setting various states of tracking and autoclose.

{F5092117}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12832

Differential Revision: https://secure.phabricator.com/D18386
This commit is contained in:
Chad Little 2017-08-10 13:22:46 -07:00
parent 7f90ef2d82
commit a7124f8f7a
2 changed files with 64 additions and 1 deletions

View file

@ -67,6 +67,7 @@ final class DiffusionRepositoryBranchesManagementPanel
public function buildManagementPanelContent() {
$repository = $this->getRepository();
$viewer = $this->getViewer();
$content = array();
$view = id(new PHUIPropertyListView())
->setViewer($viewer);
@ -90,8 +91,66 @@ final class DiffusionRepositoryBranchesManagementPanel
}
$view->addProperty(pht('Autoclose Only'), $autoclose_only);
$content[] = $this->newBox(pht('Branches'), $view);
return $this->newBox(pht('Branches'), $view);
// Branch Autoclose Table
if (!$repository->isImporting()) {
$request = $this->getRequest();
$pager = id(new PHUIPagerView())
->readFromRequest($request);
$params = array(
'offset' => $pager->getOffset(),
'limit' => $pager->getPageSize() + 1,
'repository' => $repository->getID(),
);
$branches = id(new ConduitCall('diffusion.branchquery', $params))
->setUser($viewer)
->execute();
$branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches);
$branches = $pager->sliceResults($branches);
$rows = array();
foreach ($branches as $branch) {
$branch_name = $branch->getShortName();
$tracking = $repository->shouldTrackBranch($branch_name);
$autoclosing = $repository->shouldAutocloseBranch($branch_name);
$rows[] = array(
$branch_name,
$tracking ? pht('Tracking') : pht('Off'),
$autoclosing ? pht('Autoclose On') : pht('Off'),
);
}
$branch_table = new AphrontTableView($rows);
$branch_table->setHeaders(
array(
pht('Branch'),
pht('Track'),
pht('Autoclose'),
));
$branch_table->setColumnClasses(
array(
'pri',
'narrow',
'wide',
));
$box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Branch Status'))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setTable($branch_table)
->setPager($pager);
$content[] = $box;
} else {
$content[] = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->appendChild(pht('Branch status in unavailable while the repository '.
'is still importing.'));
}
return $content;
}
}

View file

@ -25,6 +25,10 @@ abstract class DiffusionRepositoryManagementPanel
return $this->repository;
}
final public function getRequest() {
return $this->controller->getRequest();
}
final public function setController(PhabricatorController $controller) {
$this->controller = $controller;
return $this;