1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +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',
'PhabricatorApplicationAudit' => 'applications/audit/application/PhabricatorApplicationAudit.php',
'PhabricatorApplicationAuth' => 'applications/auth/application/PhabricatorApplicationAuth.php',
'PhabricatorApplicationDaemons' => 'applications/daemon/application/PhabricatorApplicationDaemons.php',
'PhabricatorApplicationDifferential' => 'applications/differential/application/PhabricatorApplicationDifferential.php',
'PhabricatorApplicationDiffusion' => 'applications/diffusion/application/PhabricatorApplicationDiffusion.php',
'PhabricatorApplicationFact' => 'applications/fact/application/PhabricatorApplicationFact.php',
@ -1667,6 +1668,7 @@ phutil_register_library_map(array(
'PhabricatorApplicationApplications' => 'PhabricatorApplication',
'PhabricatorApplicationAudit' => 'PhabricatorApplication',
'PhabricatorApplicationAuth' => 'PhabricatorApplication',
'PhabricatorApplicationDaemons' => 'PhabricatorApplication',
'PhabricatorApplicationDifferential' => 'PhabricatorApplication',
'PhabricatorApplicationDiffusion' => 'PhabricatorApplication',
'PhabricatorApplicationFact' => 'PhabricatorApplication',

View file

@ -151,20 +151,6 @@ class AphrontDefaultApplicationConfiguration
'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(
'' => 'HeraldHomeController',
'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($pager);
return $this->buildStandardPageResponse(
$log_panel,
$nav = $this->buildSideNavView();
$nav->selectFilter('log/combined');
$nav->appendChild($log_panel);
return $this->buildApplicationPage(
$nav,
array(
'title' => 'Combined Daemon Log',
));

View file

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

View file

@ -1,7 +1,7 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
* 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.
@ -18,29 +18,20 @@
abstract class PhabricatorDaemonController extends PhabricatorController {
public function buildStandardPageResponse($view, array $data) {
$page = $this->buildStandardPageView();
protected function buildSideNavView() {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
$page->setApplicationName('Daemon Console');
$page->setBaseURI('/daemon/');
$page->setTitle(idx($data, 'title'));
$page->setTabs(
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);
$nav->addLabel('Daemons');
$nav->addFilter('', 'Console', $this->getApplicationURI());
$nav->addFilter('log', 'All Daemons');
$nav->addFilter('log/combined', 'Combined Log');
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
$nav->addSpacer();
$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($pager);
return $this->buildStandardPageResponse(
$daemon_panel,
$nav = $this->buildSideNavView();
$nav->selectFilter('log');
$nav->appendChild($daemon_panel);
return $this->buildApplicationPage(
$nav,
array(
'title' => 'All Daemons',
));

View file

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

View file

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

View file

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

View file

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

View file

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