mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-11 07:11:04 +01:00
Replace weird, redundant list of branches in Diffusion "Manage" UI with a link to the main branch list
Summary: Fixes T13312. Currently, {nav Manage > Branches} has a list of branches on the same page. This has a few minor issues: - Pager is at the top (see T13312), which is weird. - "Default" icon is mystery meat. - Table is kind of pointless/redundant in general? Previously, this table had more information about technical status of each branch (autoclose/track/publish) but most of these details have been simplified/eliminated, and the main "Branches" view now has more information than it did before. Get rid of this and just link to the main view. Test Plan: Viewed "Branches" in UI, saw a link to the main view instead of a weird table. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13312 Differential Revision: https://secure.phabricator.com/D20584
This commit is contained in:
parent
dcf3ca8e04
commit
5d8ee504d6
1 changed files with 17 additions and 92 deletions
|
@ -62,6 +62,23 @@ final class DiffusionRepositoryBranchesManagementPanel
|
|||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(!$can_edit));
|
||||
|
||||
$drequest = DiffusionRequest::newFromDictionary(
|
||||
array(
|
||||
'user' => $viewer,
|
||||
'repository' => $repository,
|
||||
));
|
||||
|
||||
$view_uri = $drequest->generateURI(
|
||||
array(
|
||||
'action' => 'branches',
|
||||
));
|
||||
|
||||
$action_list->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setIcon('fa-code-fork')
|
||||
->setName(pht('View Branches'))
|
||||
->setHref($view_uri));
|
||||
|
||||
return $this->newCurtainView()
|
||||
->setActionList($action_list);
|
||||
}
|
||||
|
@ -111,98 +128,6 @@ final class DiffusionRepositoryBranchesManagementPanel
|
|||
|
||||
$content[] = $this->newBox(pht('Branches'), $view);
|
||||
|
||||
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);
|
||||
$can_close_branches = ($repository->isHg());
|
||||
|
||||
$publisher = $repository->newPublisher();
|
||||
|
||||
$rows = array();
|
||||
foreach ($branches as $branch) {
|
||||
$branch_name = $branch->getShortName();
|
||||
$permanent = $publisher->shouldPublishRef($branch);
|
||||
|
||||
$default = $repository->getDefaultBranch();
|
||||
$icon = null;
|
||||
if ($default == $branch->getShortName()) {
|
||||
$icon = id(new PHUIIconView())
|
||||
->setIcon('fa-code-fork');
|
||||
}
|
||||
|
||||
$fields = $branch->getRawFields();
|
||||
$closed = idx($fields, 'closed');
|
||||
if ($closed) {
|
||||
$status = pht('Closed');
|
||||
} else {
|
||||
$status = pht('Open');
|
||||
}
|
||||
|
||||
if ($publishing_disabled) {
|
||||
$permanent_status = pht('Publishing Disabled');
|
||||
} else {
|
||||
if ($permanent) {
|
||||
$permanent_status = pht('Permanent');
|
||||
} else {
|
||||
$permanent_status = pht('Not Permanent');
|
||||
}
|
||||
}
|
||||
|
||||
$rows[] = array(
|
||||
$icon,
|
||||
$branch_name,
|
||||
$status,
|
||||
$permanent_status,
|
||||
);
|
||||
}
|
||||
$branch_table = new AphrontTableView($rows);
|
||||
$branch_table->setHeaders(
|
||||
array(
|
||||
'',
|
||||
pht('Branch'),
|
||||
pht('Status'),
|
||||
pht('Permanent'),
|
||||
));
|
||||
$branch_table->setColumnClasses(
|
||||
array(
|
||||
'',
|
||||
'pri',
|
||||
'narrow',
|
||||
'wide',
|
||||
));
|
||||
$branch_table->setColumnVisibility(
|
||||
array(
|
||||
true,
|
||||
true,
|
||||
$can_close_branches,
|
||||
true,
|
||||
));
|
||||
|
||||
$box = $this->newBox(pht('Branch Status'), $branch_table);
|
||||
$box->setPager($pager);
|
||||
$content[] = $box;
|
||||
} else {
|
||||
$content[] = id(new PHUIInfoView())
|
||||
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
|
||||
->appendChild(
|
||||
pht(
|
||||
'Branch status is unavailable while the repository is still '.
|
||||
'importing.'));
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue