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

Modernize Herald

Summary: Updates Herald to use modern methods.

Test Plan: View List, View Test Console, Run a test, View Results, View Rules, New Rule, Edit Rule, Check mobile menus.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9690

Differential Revision: https://secure.phabricator.com/D14596
This commit is contained in:
Chad Little 2015-11-28 17:05:28 -08:00
parent ee102c7aca
commit 1bfddccf39
8 changed files with 53 additions and 63 deletions

View file

@ -18,24 +18,19 @@ abstract class HeraldController extends PhabricatorController {
return $crumbs;
}
public function buildSideNavView($for_app = false) {
$user = $this->getRequest()->getUser();
public function buildSideNavView() {
$viewer = $this->getViewer();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
if ($for_app) {
$nav->addFilter('new', pht('Create Rule'));
}
id(new HeraldRuleSearchEngine())
->setViewer($user)
->setViewer($viewer)
->addNavigationItems($nav->getMenu());
$nav
->addLabel(pht('Utilities'))
->addFilter('test', pht('Test Console'))
->addFilter('transcript', pht('Transcripts'));
$nav->addLabel(pht('Utilities'))
->addFilter('test', pht('Test Console'))
->addFilter('transcript', pht('Transcripts'));
$nav->selectFilter(null);

View file

@ -206,13 +206,14 @@ final class HeraldNewController extends HeraldController {
->buildApplicationCrumbs()
->addTextCrumb(pht('Create Rule'));
return $this->buildApplicationPage(
array(
$crumbs,
$form_box,
),
array(
'title' => pht('Create Herald Rule'),
$title = pht('Create Herald Rule');
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$form_box,
));
}

View file

@ -247,13 +247,14 @@ final class HeraldRuleController extends HeraldController {
->buildApplicationCrumbs()
->addTextCrumb($title);
return $this->buildApplicationPage(
array(
$crumbs,
$form_box,
),
array(
'title' => pht('Edit Rule'),
$title = pht('Edit Rule');
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$form_box,
));
}

View file

@ -49,14 +49,15 @@ final class HeraldRuleViewController extends HeraldController {
new HeraldTransactionQuery());
$timeline->setShouldTerminate(true);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
$timeline,
),
array(
'title' => $rule->getName(),
$title = $rule->getName();
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$object_box,
$timeline,
));
}

View file

@ -102,19 +102,19 @@ final class HeraldTestConsoleController extends HeraldController {
->setFormErrors($errors)
->setForm($form);
$nav = $this->buildSideNavView();
$nav->selectFilter('test');
$nav->appendChild($box);
$crumbs = id($this->buildApplicationCrumbs())
->addTextCrumb(pht('Test Console'));
$nav->setCrumbs($crumbs);
return $this->buildApplicationPage(
$nav,
array(
'title' => pht('Test Console'),
$title = pht('Test Console');
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$box,
));
}
}

View file

@ -81,13 +81,14 @@ final class HeraldTranscriptController extends HeraldController {
$this->getApplicationURI('/transcript/'))
->addTextCrumb($xscript->getID());
return $this->buildApplicationPage(
array(
$crumbs,
$content,
),
array(
'title' => pht('Transcript'),
$title = pht('Transcript');
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$content,
));
}

View file

@ -2,16 +2,12 @@
final class HeraldTranscriptListController extends HeraldController {
public function buildSideNavView($for_app = false) {
public function buildSideNavView() {
$user = $this->getRequest()->getUser();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
if ($for_app) {
$nav->addFilter('new', pht('Create Rule'));
}
id(new HeraldTranscriptSearchEngine())
->setViewer($user)
->addNavigationItems($nav->getMenu());
@ -31,14 +27,9 @@ final class HeraldTranscriptListController extends HeraldController {
}
public function handleRequest(AphrontRequest $request) {
$querykey = $request->getURIData('queryKey');
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($querykey)
->setSearchEngine(new HeraldTranscriptSearchEngine())
->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);
return id(new HeraldTranscriptSearchEngine())
->setController($this)
->buildResponse();
}
}

View file

@ -76,7 +76,7 @@ final class HeraldTranscriptSearchEngine
protected function getBuiltinQueryNames() {
return array(
'all' => pht('All'),
'all' => pht('All Transcripts'),
);
}