1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 13:22:42 +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,22 +18,17 @@ 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'))
$nav->addLabel(pht('Utilities'))
->addFilter('test', pht('Test Console'))
->addFilter('transcript', pht('Transcripts'));

View file

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

View file

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

View file

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

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,
$title = pht('Test Console');
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
'title' => pht('Test Console'),
$box,
));
}
}

View file

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

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'),
);
}