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

Modernize daemon application

Summary: Make it possible to get to stuff that used to be in tabs.

Test Plan: Clicked links and such.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D3264
This commit is contained in:
epriestley 2012-08-13 15:27:45 -07:00
parent e0e339f16c
commit a68c30ce83
12 changed files with 113 additions and 54 deletions

View file

@ -546,6 +546,7 @@ phutil_register_library_map(array(
'PhabricatorApplicationApplications' => 'applications/meta/application/PhabricatorApplicationApplications.php', 'PhabricatorApplicationApplications' => 'applications/meta/application/PhabricatorApplicationApplications.php',
'PhabricatorApplicationAudit' => 'applications/audit/application/PhabricatorApplicationAudit.php', 'PhabricatorApplicationAudit' => 'applications/audit/application/PhabricatorApplicationAudit.php',
'PhabricatorApplicationAuth' => 'applications/auth/application/PhabricatorApplicationAuth.php', 'PhabricatorApplicationAuth' => 'applications/auth/application/PhabricatorApplicationAuth.php',
'PhabricatorApplicationDaemons' => 'applications/daemon/application/PhabricatorApplicationDaemons.php',
'PhabricatorApplicationDifferential' => 'applications/differential/application/PhabricatorApplicationDifferential.php', 'PhabricatorApplicationDifferential' => 'applications/differential/application/PhabricatorApplicationDifferential.php',
'PhabricatorApplicationDiffusion' => 'applications/diffusion/application/PhabricatorApplicationDiffusion.php', 'PhabricatorApplicationDiffusion' => 'applications/diffusion/application/PhabricatorApplicationDiffusion.php',
'PhabricatorApplicationFact' => 'applications/fact/application/PhabricatorApplicationFact.php', 'PhabricatorApplicationFact' => 'applications/fact/application/PhabricatorApplicationFact.php',
@ -1667,6 +1668,7 @@ phutil_register_library_map(array(
'PhabricatorApplicationApplications' => 'PhabricatorApplication', 'PhabricatorApplicationApplications' => 'PhabricatorApplication',
'PhabricatorApplicationAudit' => 'PhabricatorApplication', 'PhabricatorApplicationAudit' => 'PhabricatorApplication',
'PhabricatorApplicationAuth' => 'PhabricatorApplication', 'PhabricatorApplicationAuth' => 'PhabricatorApplication',
'PhabricatorApplicationDaemons' => 'PhabricatorApplication',
'PhabricatorApplicationDifferential' => 'PhabricatorApplication', 'PhabricatorApplicationDifferential' => 'PhabricatorApplication',
'PhabricatorApplicationDiffusion' => 'PhabricatorApplication', 'PhabricatorApplicationDiffusion' => 'PhabricatorApplication',
'PhabricatorApplicationFact' => 'PhabricatorApplication', 'PhabricatorApplicationFact' => 'PhabricatorApplication',

View file

@ -151,20 +151,6 @@ class AphrontDefaultApplicationConfiguration
'index/(?P<phid>[^/]+)/' => 'PhabricatorSearchIndexController', 'index/(?P<phid>[^/]+)/' => 'PhabricatorSearchIndexController',
), ),
'/daemon/' => array(
'task/(?P<id>\d+)/' => 'PhabricatorWorkerTaskDetailController',
'task/(?P<id>\d+)/(?P<action>[^/]+)/'
=> 'PhabricatorWorkerTaskUpdateController',
'log/' => array(
'' => 'PhabricatorDaemonLogListController',
'combined/' => 'PhabricatorDaemonCombinedLogController',
'(?P<id>\d+)/' => 'PhabricatorDaemonLogViewController',
),
'timeline/' => 'PhabricatorDaemonTimelineConsoleController',
'timeline/(?P<id>\d+)/' => 'PhabricatorDaemonTimelineEventController',
'' => 'PhabricatorDaemonConsoleController',
),
'/herald/' => array( '/herald/' => array(
'' => 'HeraldHomeController', '' => 'HeraldHomeController',
'view/(?P<content_type>[^/]+)/(?:(?P<rule_type>[^/]+)/)?' 'view/(?P<content_type>[^/]+)/(?:(?P<rule_type>[^/]+)/)?'

View file

@ -0,0 +1,55 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
final class PhabricatorApplicationDaemons extends PhabricatorApplication {
public function getName() {
return 'Daemon Console';
}
public function getShortDescription() {
return 'Manage Daemons';
}
public function getBaseURI() {
return '/daemon/';
}
public function getTitleGlyph() {
return "\xE2\x98\xAF";
}
public function getRoutes() {
return array(
'/daemon/' => array(
'task/(?P<id>\d+)/' => 'PhabricatorWorkerTaskDetailController',
'task/(?P<id>\d+)/(?P<action>[^/]+)/'
=> 'PhabricatorWorkerTaskUpdateController',
'log/' => array(
'' => 'PhabricatorDaemonLogListController',
'combined/' => 'PhabricatorDaemonCombinedLogController',
'(?P<id>\d+)/' => 'PhabricatorDaemonLogViewController',
),
'timeline/' => 'PhabricatorDaemonTimelineConsoleController',
'timeline/(?P<id>\d+)/' => 'PhabricatorDaemonTimelineEventController',
'' => 'PhabricatorDaemonConsoleController',
),
);
}
}

View file

@ -45,8 +45,12 @@ final class PhabricatorDaemonCombinedLogController
$log_panel->appendChild($event_view); $log_panel->appendChild($event_view);
$log_panel->appendChild($pager); $log_panel->appendChild($pager);
return $this->buildStandardPageResponse( $nav = $this->buildSideNavView();
$log_panel, $nav->selectFilter('log/combined');
$nav->appendChild($log_panel);
return $this->buildApplicationPage(
$nav,
array( array(
'title' => 'Combined Daemon Log', 'title' => 'Combined Daemon Log',
)); ));

View file

@ -155,16 +155,20 @@ final class PhabricatorDaemonConsoleController
$cursor_panel->setHeader('Timeline Cursors'); $cursor_panel->setHeader('Timeline Cursors');
$cursor_panel->appendChild($cursor_table); $cursor_panel->appendChild($cursor_table);
return $this->buildStandardPageResponse( $nav = $this->buildSideNavView();
$nav->selectFilter('');
$nav->appendChild(
array( array(
$daemon_panel, $daemon_panel,
$cursor_panel, $cursor_panel,
$queued_panel, $queued_panel,
$leased_panel, $leased_panel,
), ));
return $this->buildApplicationPage(
$nav,
array( array(
'title' => 'Console', 'title' => 'Console',
'tab' => 'console',
)); ));
} }

View file

@ -1,7 +1,7 @@
<?php <?php
/* /*
* Copyright 2011 Facebook, Inc. * Copyright 2012 Facebook, Inc.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,29 +18,20 @@
abstract class PhabricatorDaemonController extends PhabricatorController { abstract class PhabricatorDaemonController extends PhabricatorController {
public function buildStandardPageResponse($view, array $data) { protected function buildSideNavView() {
$page = $this->buildStandardPageView(); $nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
$page->setApplicationName('Daemon Console'); $nav->addLabel('Daemons');
$page->setBaseURI('/daemon/'); $nav->addFilter('', 'Console', $this->getApplicationURI());
$page->setTitle(idx($data, 'title')); $nav->addFilter('log', 'All Daemons');
$page->setTabs( $nav->addFilter('log/combined', 'Combined Log');
array(
'console' => array(
'href' => '/daemon/',
'name' => 'Console',
),
'timeline' => array(
'href' => '/daemon/timeline/',
'name' => 'Timeline',
),
),
idx($data, 'tab'));
$page->setGlyph("\xE2\x98\xAF");
$page->appendChild($view);
$response = new AphrontWebpageResponse(); $nav->addSpacer();
return $response->setContent($page->render()); $nav->addLabel('Event Timeline');
$nav->addFilter('timeline', 'Timeline');
return $nav;
} }
} }

View file

@ -42,8 +42,12 @@ final class PhabricatorDaemonLogListController
$daemon_panel->appendChild($daemon_table); $daemon_panel->appendChild($daemon_table);
$daemon_panel->appendChild($pager); $daemon_panel->appendChild($pager);
return $this->buildStandardPageResponse( $nav = $this->buildSideNavView();
$daemon_panel, $nav->selectFilter('log');
$nav->appendChild($daemon_panel);
return $this->buildApplicationPage(
$nav,
array( array(
'title' => 'All Daemons', 'title' => 'All Daemons',
)); ));

View file

@ -84,8 +84,12 @@ final class PhabricatorDaemonLogViewController
$content[] = $log_panel; $content[] = $log_panel;
return $this->buildStandardPageResponse( $nav = $this->buildSideNavView();
$content, $nav->selectFilter('log');
$nav->appendChild($content);
return $this->buildApplicationPage(
$nav,
array( array(
'title' => 'Daemon Log', 'title' => 'Daemon Log',
)); ));

View file

@ -57,10 +57,12 @@ final class PhabricatorDaemonTimelineConsoleController
$event_panel->setHeader('Timeline Events'); $event_panel->setHeader('Timeline Events');
$event_panel->appendChild($event_table); $event_panel->appendChild($event_table);
return $this->buildStandardPageResponse( $nav = $this->buildSideNavView();
array( $nav->selectFilter('timeline');
$event_panel, $nav->appendChild($event_panel);
),
return $this->buildApplicationPage(
$nav,
array( array(
'title' => 'Timeline', 'title' => 'Timeline',
'tab' => 'timeline', 'tab' => 'timeline',

View file

@ -70,8 +70,12 @@ final class PhabricatorDaemonTimelineEventController
$panel->setWidth(AphrontPanelView::WIDTH_FORM); $panel->setWidth(AphrontPanelView::WIDTH_FORM);
$panel->appendChild($form); $panel->appendChild($form);
return $this->buildStandardPageResponse( $nav = $this->buildSideNavView();
$panel, $nav->selectFilter('timeline');
$nav->appendChild($panel);
return $this->buildApplicationPage(
$nav,
array( array(
'title' => 'Timeline Event', 'title' => 'Timeline Event',
)); ));

View file

@ -145,8 +145,12 @@ final class PhabricatorWorkerTaskDetailController
), ),
'Free Lease')); 'Free Lease'));
return $this->buildStandardPageResponse( $nav = $this->buildSideNavView();
$panel, $nav->selectFilter('');
$nav->appendChild($panel);
return $this->buildApplicationPage(
$nav,
array( array(
'title' => 'Task', 'title' => 'Task',
)); ));

View file

@ -73,7 +73,6 @@ final class PhabricatorWorkerTaskUpdateController
return new Aphront404Response(); return new Aphront404Response();
} }
$dialog->addCancelButton('/daemon/'); $dialog->addCancelButton('/daemon/');
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);