Use a list view for DiffusionHistory

Summary: This moves Diffusion History to use an easier to parse list view for commits and their (diff, audit, build) status. I left TableView around, which is used on a repositories home, and we can maybe add a "graph view" history back as another controller. Not sure what the real use is for that kind of feature though. I don't have Harbormaster set up locally so I could use another install to give this a run. I also expect to maybe not live with this UI as final, I like the UX, but the icons for indicating status don't really feel great to me, just OK.

Test Plan:
pull various repositories, check various history displays.

{F4980356}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D18039
This commit is contained in:
Chad Little
2017-05-27 17:55:44 -07:00
parent 87c59c0867
commit c5bb69fd7d
11 changed files with 425 additions and 188 deletions

View File

@@ -26,11 +26,6 @@ final class DiffusionHistoryController extends DiffusionController {
'limit' => $pager->getPageSize() + 1,
);
if (!$request->getBool('copies')) {
$params['needDirectChanges'] = true;
$params['needChildChanges'] = true;
}
$history_results = $this->callConduitWithDiffusionRequest(
'diffusion.historyquery',
$params);
@@ -39,27 +34,12 @@ final class DiffusionHistoryController extends DiffusionController {
$history = $pager->sliceResults($history);
$show_graph = !strlen($drequest->getPath());
$history_table = id(new DiffusionHistoryTableView())
->setUser($request->getUser())
$history_list = id(new DiffusionHistoryListView())
->setViewer($viewer)
->setDiffusionRequest($drequest)
->setHistory($history);
$history_table->loadRevisions();
if ($show_graph) {
$history_table->setParents($history_results['parents']);
$history_table->setIsHead(!$pager->getOffset());
$history_table->setIsTail(!$pager->getHasMorePages());
}
$history_header = $this->buildHistoryHeader($drequest);
$history_panel = id(new PHUIObjectBoxView())
->setHeader($history_header)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setTable($history_table)
->setPager($pager);
$history_list->loadRevisions();
$header = $this->buildHeader($drequest);
$crumbs = $this->buildCrumbs(
@@ -70,44 +50,32 @@ final class DiffusionHistoryController extends DiffusionController {
));
$crumbs->setBorder(true);
$title = array(
pht('History'),
$repository->getDisplayName(),
);
$pager = id(new PHUIBoxView())
->addClass('mlb')
->appendChild($pager);
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter(array(
$history_panel,
$history_list,
$pager,
));
return $this->newPage()
->setTitle(
array(
pht('History'),
$repository->getDisplayName(),
))
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$view,
));
->appendChild($view);
}
private function buildHeader(DiffusionRequest $drequest) {
$viewer = $this->getViewer();
$tag = $this->renderCommitHashTag($drequest);
$header = id(new PHUIHeaderView())
->setUser($viewer)
->setPolicyObject($drequest->getRepository())
->addTag($tag)
->setHeader($this->renderPathLinks($drequest, $mode = 'history'))
->setHeaderIcon('fa-clock-o');
return $header;
}
private function buildHistoryHeader(DiffusionRequest $drequest) {
$viewer = $this->getViewer();
$browse_uri = $drequest->generateURI(
array(
'action' => 'browse',
@@ -117,36 +85,18 @@ final class DiffusionHistoryController extends DiffusionController {
->setTag('a')
->setText(pht('Browse'))
->setHref($browse_uri)
->setIcon('fa-files-o');
// TODO: Sometimes we do have a change view, we need to look at the most
// recent history entry to figure it out.
$request = $this->getRequest();
if ($request->getBool('copies')) {
$branch_name = pht('Hide Copies/Branches');
$branch_uri = $request->getRequestURI()
->alter('offset', null)
->alter('copies', null);
} else {
$branch_name = pht('Show Copies/Branches');
$branch_uri = $request->getRequestURI()
->alter('offset', null)
->alter('copies', true);
}
$branch_button = id(new PHUIButtonView())
->setTag('a')
->setText($branch_name)
->setIcon('fa-code-fork')
->setHref($branch_uri);
->setIcon('fa-code');
$header = id(new PHUIHeaderView())
->setHeader(pht('History'))
->addActionLink($browse_button)
->addActionLink($branch_button);
->setUser($viewer)
->setPolicyObject($drequest->getRepository())
->addTag($tag)
->setHeader($this->renderPathLinks($drequest, $mode = 'history'))
->setHeaderIcon('fa-clock-o')
->addActionLink($browse_button);
return $header;
}
}