mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 05:12:41 +01:00
Herald - Kill Tabs
Summary: makes a nice side filter for most UI elements. only place this getds a little funky is on the test console; a second, inner filter list appears for the "affected" filters. Test Plan: viewed each side filter and verified ui. for each filter, interacted with the ui and made sure things looked right and there were no errors Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley Maniphest Tasks: T631 Differential Revision: https://secure.phabricator.com/D1289
This commit is contained in:
parent
efb0fa739f
commit
46baa3b7ae
11 changed files with 100 additions and 48 deletions
|
@ -20,6 +20,15 @@ class HeraldAllRulesController extends HeraldController {
|
|||
|
||||
private $view;
|
||||
private $viewPHID;
|
||||
private $filter;
|
||||
|
||||
public function getFilter() {
|
||||
return $this->filter;
|
||||
}
|
||||
public function setFilter($filter) {
|
||||
$this->filter = 'all/view/'.$filter;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function shouldRequireAdmin() {
|
||||
return true;
|
||||
|
@ -27,6 +36,7 @@ class HeraldAllRulesController extends HeraldController {
|
|||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->view = idx($data, 'view');
|
||||
$this->setFilter($this->view);
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
|
@ -108,7 +118,10 @@ class HeraldAllRulesController extends HeraldController {
|
|||
}
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
$sidenav,
|
||||
array(
|
||||
$filter_view,
|
||||
$panel
|
||||
),
|
||||
array(
|
||||
'title' => 'Herald',
|
||||
'tab' => 'all',
|
||||
|
|
|
@ -25,43 +25,57 @@ abstract class HeraldController extends PhabricatorController {
|
|||
$page->setBaseURI('/herald/');
|
||||
$page->setTitle(idx($data, 'title'));
|
||||
$page->setGlyph("\xE2\x98\xBF");
|
||||
$page->appendChild($view);
|
||||
|
||||
$doclink = PhabricatorEnv::getDoclink('article/Herald_User_Guide.html');
|
||||
|
||||
$nav = new AphrontSideNavFilterView();
|
||||
$nav
|
||||
->setBaseURI(new PhutilURI('/herald/'))
|
||||
->addLabel('Rules')
|
||||
->addFilter('new', 'Create Rule');
|
||||
$rules_map = HeraldContentTypeConfig::getContentTypeMap();
|
||||
$first_filter = null;
|
||||
foreach ($rules_map as $key => $value) {
|
||||
$nav->addFilter('view/'.$key, $value);
|
||||
if (!$first_filter) {
|
||||
$first_filter = 'view/'.$key;
|
||||
}
|
||||
}
|
||||
|
||||
$nav
|
||||
->addSpacer()
|
||||
->addLabel('Utilities')
|
||||
->addFilter('test', 'Test Console')
|
||||
->addFilter('transcript', 'Transcripts');
|
||||
|
||||
$user = $this->getRequest()->getUser();
|
||||
if ($user->getIsAdmin()) {
|
||||
$nav
|
||||
->addSpacer()
|
||||
->addLabel('Admin');
|
||||
$view_PHID = nonempty($this->getRequest()->getStr('phid'), null);
|
||||
foreach ($rules_map as $key => $value) {
|
||||
$nav
|
||||
->addFilter('all/view/'.$key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
$nav->selectFilter($this->getFilter(), $first_filter);
|
||||
$nav->appendChild($view);
|
||||
$page->appendChild($nav);
|
||||
|
||||
$tabs = array(
|
||||
'rules' => array(
|
||||
'href' => '/herald/',
|
||||
'name' => 'Rules',
|
||||
),
|
||||
'test' => array(
|
||||
'href' => '/herald/test/',
|
||||
'name' => 'Test Console',
|
||||
),
|
||||
'transcripts' => array(
|
||||
'href' => '/herald/transcript/',
|
||||
'name' => 'Transcripts',
|
||||
),
|
||||
'help' => array(
|
||||
'href' => $doclink,
|
||||
'name' => 'Help',
|
||||
),
|
||||
);
|
||||
|
||||
$user = $this->getRequest()->getUser();
|
||||
if ($user->getIsAdmin()) {
|
||||
$tabs['all'] = array(
|
||||
'href' => '/herald/all',
|
||||
'name' => 'All Rules',
|
||||
);
|
||||
}
|
||||
|
||||
$page->setTabs(
|
||||
$tabs,
|
||||
idx($data, 'tab'));
|
||||
$page->setTabs($tabs. null);
|
||||
|
||||
$response = new AphrontWebpageResponse();
|
||||
return $response->setContent($page->render());
|
||||
|
||||
}
|
||||
|
||||
abstract function getFilter();
|
||||
}
|
||||
|
|
|
@ -8,8 +8,11 @@
|
|||
|
||||
phutil_require_module('phabricator', 'aphront/response/webpage');
|
||||
phutil_require_module('phabricator', 'applications/base/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/herald/config/contenttype');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
phutil_require_module('phabricator', 'view/layout/sidenavfilter');
|
||||
|
||||
phutil_require_module('phutil', 'parser/uri');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,12 @@ class HeraldDeleteController extends HeraldController {
|
|||
|
||||
private $id;
|
||||
|
||||
public function getFilter() {
|
||||
// note this controller is only used from a dialog-context at the moment
|
||||
// and there is actually no "delete" filter
|
||||
return 'delete';
|
||||
}
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = $data['id'];
|
||||
}
|
||||
|
|
|
@ -19,9 +19,19 @@
|
|||
class HeraldHomeController extends HeraldController {
|
||||
|
||||
private $view;
|
||||
private $filter;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->view = idx($data, 'view');
|
||||
$this->setFilter($this->view);
|
||||
}
|
||||
|
||||
public function getFilter() {
|
||||
return $this->filter;
|
||||
}
|
||||
public function setFilter($filter) {
|
||||
$this->filter = 'view/'.$filter;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
|
@ -52,28 +62,11 @@ class HeraldHomeController extends HeraldController {
|
|||
->setView($this->view);
|
||||
$panel = $list_view->render();
|
||||
|
||||
$sidenav = new AphrontSideNavView();
|
||||
$sidenav->appendChild($panel);
|
||||
|
||||
foreach ($map as $key => $value) {
|
||||
$sidenav->addNavItem(
|
||||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '/herald/view/'.$key.'/',
|
||||
'class' => ($key == $this->view)
|
||||
? 'aphront-side-nav-selected'
|
||||
: null,
|
||||
),
|
||||
phutil_escape_html($value)));
|
||||
}
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
$sidenav,
|
||||
$panel,
|
||||
array(
|
||||
'title' => 'Herald',
|
||||
'tab' => 'rules',
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,9 +11,7 @@ phutil_require_module('phabricator', 'applications/herald/controller/base');
|
|||
phutil_require_module('phabricator', 'applications/herald/storage/rule');
|
||||
phutil_require_module('phabricator', 'applications/herald/view/rulelist');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'view/layout/sidenav');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,10 @@ class HeraldNewController extends HeraldController {
|
|||
|
||||
private $type;
|
||||
|
||||
public function getFilter() {
|
||||
return 'new';
|
||||
}
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->type = idx($data, 'type');
|
||||
}
|
||||
|
@ -51,7 +55,7 @@ class HeraldNewController extends HeraldController {
|
|||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setHeader('Create New Herald Rule');
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_FULL);
|
||||
$panel->appendChild($form);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
|
|
|
@ -19,6 +19,14 @@
|
|||
class HeraldRuleController extends HeraldController {
|
||||
|
||||
private $id;
|
||||
private $filter;
|
||||
|
||||
public function getFilter() {
|
||||
return $this->filter;
|
||||
}
|
||||
public function setFilter($filter) {
|
||||
$this->filter = 'view/'.$filter;
|
||||
}
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = (int)idx($data, 'id');
|
||||
|
@ -50,6 +58,7 @@ class HeraldRuleController extends HeraldController {
|
|||
}
|
||||
$rule->setContentType($type);
|
||||
}
|
||||
$this->setFilter($rule->getContentType());
|
||||
|
||||
$local_version = id(new HeraldRule())->getConfigVersion();
|
||||
if ($rule->getConfigVersion() > $local_version) {
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
|
||||
class HeraldTestConsoleController extends HeraldController {
|
||||
|
||||
public function getFilter() {
|
||||
return 'test';
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
@ -128,7 +132,7 @@ class HeraldTestConsoleController extends HeraldController {
|
|||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setHeader('Test Herald Rules');
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_FULL);
|
||||
$panel->appendChild($form);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
|
|
|
@ -26,6 +26,10 @@ class HeraldTranscriptController extends HeraldController {
|
|||
private $filter;
|
||||
private $handles;
|
||||
|
||||
public function getFilter() {
|
||||
return 'transcript';
|
||||
}
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = $data['id'];
|
||||
$map = $this->getFilterMap();
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
|
||||
class HeraldTranscriptListController extends HeraldController {
|
||||
|
||||
public function getFilter() {
|
||||
return 'transcript';
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
|
Loading…
Reference in a new issue