mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +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:
parent
7f90ef2d82
commit
a7124f8f7a
2 changed files with 64 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue