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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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