From 1bfddccf3925ca8df20662293596e47045a01dba Mon Sep 17 00:00:00 2001 From: Chad Little Date: Sat, 28 Nov 2015 17:05:28 -0800 Subject: [PATCH] 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 --- .../herald/controller/HeraldController.php | 17 ++++++----------- .../herald/controller/HeraldNewController.php | 15 ++++++++------- .../herald/controller/HeraldRuleController.php | 15 ++++++++------- .../controller/HeraldRuleViewController.php | 17 +++++++++-------- .../controller/HeraldTestConsoleController.php | 18 +++++++++--------- .../controller/HeraldTranscriptController.php | 15 ++++++++------- .../HeraldTranscriptListController.php | 17 ++++------------- .../query/HeraldTranscriptSearchEngine.php | 2 +- 8 files changed, 53 insertions(+), 63 deletions(-) diff --git a/src/applications/herald/controller/HeraldController.php b/src/applications/herald/controller/HeraldController.php index b3ba2f17c3..2151c62aa9 100644 --- a/src/applications/herald/controller/HeraldController.php +++ b/src/applications/herald/controller/HeraldController.php @@ -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); diff --git a/src/applications/herald/controller/HeraldNewController.php b/src/applications/herald/controller/HeraldNewController.php index 53e1faf7d6..c25b4c839b 100644 --- a/src/applications/herald/controller/HeraldNewController.php +++ b/src/applications/herald/controller/HeraldNewController.php @@ -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, )); } diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php index 510113b0de..d8e5e42df3 100644 --- a/src/applications/herald/controller/HeraldRuleController.php +++ b/src/applications/herald/controller/HeraldRuleController.php @@ -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, )); } diff --git a/src/applications/herald/controller/HeraldRuleViewController.php b/src/applications/herald/controller/HeraldRuleViewController.php index 2063ebcc2f..c8e0442dc5 100644 --- a/src/applications/herald/controller/HeraldRuleViewController.php +++ b/src/applications/herald/controller/HeraldRuleViewController.php @@ -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, )); } diff --git a/src/applications/herald/controller/HeraldTestConsoleController.php b/src/applications/herald/controller/HeraldTestConsoleController.php index 64b7c5867b..1e12825291 100644 --- a/src/applications/herald/controller/HeraldTestConsoleController.php +++ b/src/applications/herald/controller/HeraldTestConsoleController.php @@ -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, )); + } } diff --git a/src/applications/herald/controller/HeraldTranscriptController.php b/src/applications/herald/controller/HeraldTranscriptController.php index 3e4b0b074c..afb7b36558 100644 --- a/src/applications/herald/controller/HeraldTranscriptController.php +++ b/src/applications/herald/controller/HeraldTranscriptController.php @@ -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, )); } diff --git a/src/applications/herald/controller/HeraldTranscriptListController.php b/src/applications/herald/controller/HeraldTranscriptListController.php index 81865eee4a..c1f2b3ea5d 100644 --- a/src/applications/herald/controller/HeraldTranscriptListController.php +++ b/src/applications/herald/controller/HeraldTranscriptListController.php @@ -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(); } } diff --git a/src/applications/herald/query/HeraldTranscriptSearchEngine.php b/src/applications/herald/query/HeraldTranscriptSearchEngine.php index c3e4b8d8e3..cc0d620394 100644 --- a/src/applications/herald/query/HeraldTranscriptSearchEngine.php +++ b/src/applications/herald/query/HeraldTranscriptSearchEngine.php @@ -76,7 +76,7 @@ final class HeraldTranscriptSearchEngine protected function getBuiltinQueryNames() { return array( - 'all' => pht('All'), + 'all' => pht('All Transcripts'), ); }