1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-14 02:42:40 +01:00

Modernize Dashboard UI and code

Summary: Pulls everything over to two column UI and new edit pages. Removed history view and consolidated some pages.

Test Plan: New Panel, Edit Panel. New Dashboard, Edit Dashboard, View Standalone pages.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D15588
This commit is contained in:
Chad Little 2016-04-02 16:02:13 -07:00
parent fd94e07aad
commit 8d8f983f6a
11 changed files with 179 additions and 205 deletions

View file

@ -7,7 +7,7 @@
*/ */
return array( return array(
'names' => array( 'names' => array(
'core.pkg.css' => '2d0339fc', 'core.pkg.css' => '5de0f7af',
'core.pkg.js' => 'e5484f37', 'core.pkg.js' => 'e5484f37',
'darkconsole.pkg.js' => 'e7393ebb', 'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '7ba78475', 'differential.pkg.css' => '7ba78475',
@ -54,7 +54,7 @@ return array(
'rsrc/css/application/contentsource/content-source-view.css' => '4b8b05d4', 'rsrc/css/application/contentsource/content-source-view.css' => '4b8b05d4',
'rsrc/css/application/countdown/timer.css' => '96696f21', 'rsrc/css/application/countdown/timer.css' => '96696f21',
'rsrc/css/application/daemon/bulk-job.css' => 'df9c1d4a', 'rsrc/css/application/daemon/bulk-job.css' => 'df9c1d4a',
'rsrc/css/application/dashboard/dashboard.css' => 'eb458607', 'rsrc/css/application/dashboard/dashboard.css' => 'bc6f2127',
'rsrc/css/application/diff/inline-comment-summary.css' => '51efda3a', 'rsrc/css/application/diff/inline-comment-summary.css' => '51efda3a',
'rsrc/css/application/differential/add-comment.css' => 'c47f8c40', 'rsrc/css/application/differential/add-comment.css' => 'c47f8c40',
'rsrc/css/application/differential/changeset-view.css' => '3e3b0b76', 'rsrc/css/application/differential/changeset-view.css' => '3e3b0b76',
@ -753,7 +753,7 @@ return array(
'phabricator-content-source-view-css' => '4b8b05d4', 'phabricator-content-source-view-css' => '4b8b05d4',
'phabricator-core-css' => 'd0801452', 'phabricator-core-css' => 'd0801452',
'phabricator-countdown-css' => '96696f21', 'phabricator-countdown-css' => '96696f21',
'phabricator-dashboard-css' => 'eb458607', 'phabricator-dashboard-css' => 'bc6f2127',
'phabricator-drag-and-drop-file-upload' => '81f182b5', 'phabricator-drag-and-drop-file-upload' => '81f182b5',
'phabricator-draggable-list' => '5a13c79f', 'phabricator-draggable-list' => '5a13c79f',
'phabricator-fatal-config-template-css' => '8e6c6fcd', 'phabricator-fatal-config-template-css' => '8e6c6fcd',

View file

@ -2183,7 +2183,6 @@ phutil_register_library_map(array(
'PhabricatorDashboardDashboardHasPanelEdgeType' => 'applications/dashboard/edge/PhabricatorDashboardDashboardHasPanelEdgeType.php', 'PhabricatorDashboardDashboardHasPanelEdgeType' => 'applications/dashboard/edge/PhabricatorDashboardDashboardHasPanelEdgeType.php',
'PhabricatorDashboardDashboardPHIDType' => 'applications/dashboard/phid/PhabricatorDashboardDashboardPHIDType.php', 'PhabricatorDashboardDashboardPHIDType' => 'applications/dashboard/phid/PhabricatorDashboardDashboardPHIDType.php',
'PhabricatorDashboardEditController' => 'applications/dashboard/controller/PhabricatorDashboardEditController.php', 'PhabricatorDashboardEditController' => 'applications/dashboard/controller/PhabricatorDashboardEditController.php',
'PhabricatorDashboardHistoryController' => 'applications/dashboard/controller/PhabricatorDashboardHistoryController.php',
'PhabricatorDashboardInstall' => 'applications/dashboard/storage/PhabricatorDashboardInstall.php', 'PhabricatorDashboardInstall' => 'applications/dashboard/storage/PhabricatorDashboardInstall.php',
'PhabricatorDashboardInstallController' => 'applications/dashboard/controller/PhabricatorDashboardInstallController.php', 'PhabricatorDashboardInstallController' => 'applications/dashboard/controller/PhabricatorDashboardInstallController.php',
'PhabricatorDashboardLayoutConfig' => 'applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php', 'PhabricatorDashboardLayoutConfig' => 'applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php',
@ -6604,7 +6603,6 @@ phutil_register_library_map(array(
'PhabricatorDashboardDashboardHasPanelEdgeType' => 'PhabricatorEdgeType', 'PhabricatorDashboardDashboardHasPanelEdgeType' => 'PhabricatorEdgeType',
'PhabricatorDashboardDashboardPHIDType' => 'PhabricatorPHIDType', 'PhabricatorDashboardDashboardPHIDType' => 'PhabricatorPHIDType',
'PhabricatorDashboardEditController' => 'PhabricatorDashboardController', 'PhabricatorDashboardEditController' => 'PhabricatorDashboardController',
'PhabricatorDashboardHistoryController' => 'PhabricatorDashboardController',
'PhabricatorDashboardInstall' => 'PhabricatorDashboardDAO', 'PhabricatorDashboardInstall' => 'PhabricatorDashboardDAO',
'PhabricatorDashboardInstallController' => 'PhabricatorDashboardController', 'PhabricatorDashboardInstallController' => 'PhabricatorDashboardController',
'PhabricatorDashboardLayoutConfig' => 'Phobject', 'PhabricatorDashboardLayoutConfig' => 'Phobject',

View file

@ -27,7 +27,6 @@ final class PhabricatorDashboardApplication extends PhabricatorApplication {
'view/(?P<id>\d+)/' => 'PhabricatorDashboardViewController', 'view/(?P<id>\d+)/' => 'PhabricatorDashboardViewController',
'archive/(?P<id>\d+)/' => 'PhabricatorDashboardArchiveController', 'archive/(?P<id>\d+)/' => 'PhabricatorDashboardArchiveController',
'manage/(?P<id>\d+)/' => 'PhabricatorDashboardManageController', 'manage/(?P<id>\d+)/' => 'PhabricatorDashboardManageController',
'history/(?P<id>\d+)/' => 'PhabricatorDashboardHistoryController',
'create/' => 'PhabricatorDashboardEditController', 'create/' => 'PhabricatorDashboardEditController',
'copy/(?:(?P<id>\d+)/)?' => 'PhabricatorDashboardCopyController', 'copy/(?:(?P<id>\d+)/)?' => 'PhabricatorDashboardCopyController',
'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorDashboardEditController', 'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorDashboardEditController',

View file

@ -49,7 +49,7 @@ final class PhabricatorDashboardEditController
if ($is_new) { if ($is_new) {
$title = pht('Create Dashboard'); $title = pht('Create Dashboard');
$header = pht('Create Dashboard'); $header_icon = 'fa-plus-square';
$button = pht('Create Dashboard'); $button = pht('Create Dashboard');
$cancel_uri = $this->getApplicationURI(); $cancel_uri = $this->getApplicationURI();
@ -58,11 +58,11 @@ final class PhabricatorDashboardEditController
$id = $dashboard->getID(); $id = $dashboard->getID();
$cancel_uri = $this->getApplicationURI('manage/'.$id.'/'); $cancel_uri = $this->getApplicationURI('manage/'.$id.'/');
$title = pht('Edit Dashboard %d', $dashboard->getID()); $title = pht('Edit Dashboard: %s', $dashboard->getName());
$header = pht('Edit Dashboard "%s"', $dashboard->getName()); $header_icon = 'fa-pencil';
$button = pht('Save Changes'); $button = pht('Save Changes');
$crumbs->addTextCrumb(pht('Dashboard %d', $id), $cancel_uri); $crumbs->addTextCrumb($dashboard->getName(), $cancel_uri);
$crumbs->addTextCrumb(pht('Edit')); $crumbs->addTextCrumb(pht('Edit'));
} }
@ -140,6 +140,12 @@ final class PhabricatorDashboardEditController
->setName('name') ->setName('name')
->setValue($v_name) ->setValue($v_name)
->setError($e_name)) ->setError($e_name))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Layout Mode'))
->setName('layout_mode')
->setValue($v_layout_mode)
->setOptions($layout_mode_options))
->appendChild( ->appendChild(
id(new AphrontFormPolicyControl()) id(new AphrontFormPolicyControl())
->setName('viewPolicy') ->setName('viewPolicy')
@ -151,13 +157,7 @@ final class PhabricatorDashboardEditController
->setName('editPolicy') ->setName('editPolicy')
->setPolicyObject($dashboard) ->setPolicyObject($dashboard)
->setCapability(PhabricatorPolicyCapability::CAN_EDIT) ->setCapability(PhabricatorPolicyCapability::CAN_EDIT)
->setPolicies($policies)) ->setPolicies($policies));
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Layout Mode'))
->setName('layout_mode')
->setValue($v_layout_mode)
->setOptions($layout_mode_options));
$form->appendControl( $form->appendControl(
id(new AphrontFormTokenizerControl()) id(new AphrontFormTokenizerControl())
@ -172,18 +172,25 @@ final class PhabricatorDashboardEditController
->addCancelButton($cancel_uri)); ->addCancelButton($cancel_uri));
$box = id(new PHUIObjectBoxView()) $box = id(new PHUIObjectBoxView())
->setHeaderText($header) ->setHeaderText(pht('Dashboard'))
->setForm($form) ->setForm($form)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setValidationException($validation_exception); ->setValidationException($validation_exception);
return $this->buildApplicationPage( $crumbs->setBorder(true);
array(
$crumbs, $header = id(new PHUIHeaderView())
$box, ->setHeader($title)
), ->setHeaderIcon($header_icon);
array(
'title' => $title, $view = id(new PHUITwoColumnView())
)); ->setHeader($header)
->setFooter($box);
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
} }
private function processTemplateRequest(AphrontRequest $request) { private function processTemplateRequest(AphrontRequest $request) {

View file

@ -1,48 +0,0 @@
<?php
final class PhabricatorDashboardHistoryController
extends PhabricatorDashboardController {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$dashboard_view_uri = $this->getApplicationURI('view/'.$id.'/');
$dashboard_manage_uri = $this->getApplicationURI('manage/'.$id.'/');
$dashboard = id(new PhabricatorDashboardQuery())
->setViewer($viewer)
->withIDs(array($id))
->executeOne();
if (!$dashboard) {
return new Aphront404Response();
}
$title = $dashboard->getName();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->setBorder(true);
$crumbs->addTextCrumb(
pht('Dashboard %d', $dashboard->getID()),
$dashboard_view_uri);
$crumbs->addTextCrumb(
pht('Manage'),
$dashboard_manage_uri);
$crumbs->addTextCrumb(pht('History'));
$timeline = $this->buildTransactionTimeline(
$dashboard,
new PhabricatorDashboardTransactionQuery());
$timeline->setShouldTerminate(true);
return $this->buildApplicationPage(
array(
$crumbs,
$timeline,
),
array(
'title' => $title,
));
}
}

View file

@ -34,25 +34,25 @@ final class PhabricatorDashboardManageController
pht('Dashboard %d', $dashboard->getID()), pht('Dashboard %d', $dashboard->getID()),
$dashboard_uri); $dashboard_uri);
$crumbs->addTextCrumb(pht('Manage')); $crumbs->addTextCrumb(pht('Manage'));
$crumbs->setBorder(true);
$header = $this->buildHeaderView($dashboard); $header = $this->buildHeaderView($dashboard);
$actions = $this->buildActionView($dashboard); $curtain = $this->buildCurtainview($dashboard);
$properties = $this->buildPropertyView($dashboard); $properties = $this->buildPropertyView($dashboard);
$properties->setActionList($actions); $timeline = $this->buildTransactionTimeline(
$box = id(new PHUIObjectBoxView()) $dashboard,
->setHeader($header) new PhabricatorDashboardTransactionQuery());
->addPropertyList($properties);
$info_view = null;
if (!$can_edit) { if (!$can_edit) {
$no_edit = pht( $no_edit = pht(
'You do not have permission to edit this dashboard. If you want to '. 'You do not have permission to edit this dashboard. If you want to '.
'make changes, make a copy first.'); 'make changes, make a copy first.');
$box->setInfoView( $info_view = id(new PHUIInfoView())
id(new PHUIInfoView()) ->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->setSeverity(PHUIInfoView::SEVERITY_NOTICE) ->setErrors(array($no_edit));
->setErrors(array($no_edit)));
} }
$rendered_dashboard = id(new PhabricatorDashboardRenderingEngine()) $rendered_dashboard = id(new PhabricatorDashboardRenderingEngine())
@ -61,19 +61,30 @@ final class PhabricatorDashboardManageController
->setArrangeMode($can_edit) ->setArrangeMode($can_edit)
->renderDashboard(); ->renderDashboard();
return $this->buildApplicationPage( $dashboard_box = id(new PHUIBoxView())
array( ->addClass('dashboard-preview-box')
$crumbs, ->appendChild($rendered_dashboard);
$box,
$rendered_dashboard, $view = id(new PHUITwoColumnView())
), ->setHeader($header)
array( ->setCurtain($curtain)
'title' => $title, ->setMainColumn(array(
)); $info_view,
$properties,
$timeline,
))
->setFooter($dashboard_box);
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
} }
private function buildHeaderView(PhabricatorDashboard $dashboard) { private function buildHeaderView(PhabricatorDashboard $dashboard) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getViewer();
$id = $dashboard->getID();
if ($dashboard->isArchived()) { if ($dashboard->isArchived()) {
$status_icon = 'fa-ban'; $status_icon = 'fa-ban';
@ -87,33 +98,33 @@ final class PhabricatorDashboardManageController
PhabricatorDashboard::getStatusNameMap(), PhabricatorDashboard::getStatusNameMap(),
$dashboard->getStatus()); $dashboard->getStatus());
$button = id(new PHUIButtonView())
->setTag('a')
->setText(pht('View Dashboard'))
->setIcon('fa-columns')
->setHref($this->getApplicationURI("view/{$id}/"));
return id(new PHUIHeaderView()) return id(new PHUIHeaderView())
->setUser($viewer) ->setUser($viewer)
->setHeader($dashboard->getName()) ->setHeader($dashboard->getName())
->setPolicyObject($dashboard) ->setPolicyObject($dashboard)
->setStatus($status_icon, $status_color, $status_name); ->setStatus($status_icon, $status_color, $status_name)
->setHeaderIcon('fa-dashboard')
->addActionLink($button);
} }
private function buildActionView(PhabricatorDashboard $dashboard) { private function buildCurtainView(PhabricatorDashboard $dashboard) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getViewer();
$id = $dashboard->getID(); $id = $dashboard->getID();
$actions = id(new PhabricatorActionListView()) $curtain = $this->newCurtainView($dashboard);
->setObject($dashboard)
->setUser($viewer);
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
$dashboard, $dashboard,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('View Dashboard'))
->setIcon('fa-columns')
->setHref($this->getApplicationURI("view/{$id}/")));
$actions->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Dashboard')) ->setName(pht('Edit Dashboard'))
->setIcon('fa-pencil') ->setIcon('fa-pencil')
@ -121,7 +132,7 @@ final class PhabricatorDashboardManageController
->setDisabled(!$can_edit)); ->setDisabled(!$can_edit));
if ($dashboard->isArchived()) { if ($dashboard->isArchived()) {
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Activate Dashboard')) ->setName(pht('Activate Dashboard'))
->setIcon('fa-check') ->setIcon('fa-check')
@ -129,7 +140,7 @@ final class PhabricatorDashboardManageController
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow($can_edit)); ->setWorkflow($can_edit));
} else { } else {
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Archive Dashboard')) ->setName(pht('Archive Dashboard'))
->setIcon('fa-ban') ->setIcon('fa-ban')
@ -138,7 +149,7 @@ final class PhabricatorDashboardManageController
->setWorkflow($can_edit)); ->setWorkflow($can_edit));
} }
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Copy Dashboard')) ->setName(pht('Copy Dashboard'))
->setIcon('fa-files-o') ->setIcon('fa-files-o')
@ -158,28 +169,21 @@ final class PhabricatorDashboardManageController
$title_install = pht('Install Dashboard'); $title_install = pht('Install Dashboard');
$href_install = "install/{$id}/"; $href_install = "install/{$id}/";
} }
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName($title_install) ->setName($title_install)
->setIcon('fa-wrench') ->setIcon('fa-wrench')
->setHref($this->getApplicationURI($href_install)) ->setHref($this->getApplicationURI($href_install))
->setWorkflow(true)); ->setWorkflow(true));
$actions->addAction( return $curtain;
id(new PhabricatorActionView())
->setName(pht('View History'))
->setIcon('fa-history')
->setHref($this->getApplicationURI("history/{$id}/")));
return $actions;
} }
private function buildPropertyView(PhabricatorDashboard $dashboard) { private function buildPropertyView(PhabricatorDashboard $dashboard) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getViewer();
$properties = id(new PHUIPropertyListView()) $properties = id(new PHUIPropertyListView())
->setUser($viewer) ->setUser($viewer);
->setObject($dashboard);
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
$viewer, $viewer,
@ -193,9 +197,10 @@ final class PhabricatorDashboardManageController
pht('Panels'), pht('Panels'),
$viewer->renderHandleList($dashboard->getPanelPHIDs())); $viewer->renderHandleList($dashboard->getPanelPHIDs()));
$properties->invokeWillRenderEvent(); return id(new PHUIObjectBoxView())
->setHeaderText(pht('DETAILS'))
return $properties; ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->addPropertyList($properties);
} }
} }

View file

@ -90,18 +90,18 @@ final class PhabricatorDashboardPanelEditController
} }
if ($is_create) { if ($is_create) {
$title = pht('New Panel'); $title = pht('Create New Panel');
$header = pht('Create New Panel');
$button = pht('Create Panel'); $button = pht('Create Panel');
$header_icon = 'fa-plus-square';
if ($dashboard) { if ($dashboard) {
$cancel_uri = $manage_uri; $cancel_uri = $manage_uri;
} else { } else {
$cancel_uri = $this->getApplicationURI('panel/'); $cancel_uri = $this->getApplicationURI('panel/');
} }
} else { } else {
$title = pht('Edit %s', $panel->getMonogram()); $title = pht('Edit Panel: %s', $panel->getName());
$header = pht('Edit %s %s', $panel->getMonogram(), $panel->getName());
$button = pht('Save Panel'); $button = pht('Save Panel');
$header_icon = 'fa-pencil';
if ($dashboard) { if ($dashboard) {
$cancel_uri = $manage_uri; $cancel_uri = $manage_uri;
} else { } else {
@ -260,10 +260,11 @@ final class PhabricatorDashboardPanelEditController
'/'.$panel->getMonogram()); '/'.$panel->getMonogram());
$crumbs->addTextCrumb(pht('Edit')); $crumbs->addTextCrumb(pht('Edit'));
} }
$crumbs->setBorder(true);
if ($request->isAjax()) { if ($request->isAjax()) {
return $this->newDialog() return $this->newDialog()
->setTitle($header) ->setTitle($title)
->setSubmitURI($submit_uri) ->setSubmitURI($submit_uri)
->setWidth(AphrontDialogView::WIDTH_FORM) ->setWidth(AphrontDialogView::WIDTH_FORM)
->setValidationException($validation_exception) ->setValidationException($validation_exception)
@ -279,18 +280,23 @@ final class PhabricatorDashboardPanelEditController
} }
$box = id(new PHUIObjectBoxView()) $box = id(new PHUIObjectBoxView())
->setHeaderText($header) ->setHeaderText(pht('Panel'))
->setValidationException($validation_exception) ->setValidationException($validation_exception)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setForm($form); ->setForm($form);
return $this->buildApplicationPage( $header = id(new PHUIHeaderView())
array( ->setHeader($title)
$crumbs, ->setHeaderIcon($header_icon);
$box,
), $view = id(new PHUITwoColumnView())
array( ->setHeader($header)
'title' => $title, ->setFooter($box);
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
} }
private function processPanelTypeRequest(AphrontRequest $request) { private function processPanelTypeRequest(AphrontRequest $request) {
@ -349,26 +355,33 @@ final class PhabricatorDashboardPanelEditController
} }
$title = pht('Create Dashboard Panel'); $title = pht('Create Dashboard Panel');
$header_icon = 'fa-plus-square';
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb( $crumbs->addTextCrumb(
pht('Panels'), pht('Panels'),
$this->getApplicationURI('panel/')); $this->getApplicationURI('panel/'));
$crumbs->addTextCrumb(pht('New Panel')); $crumbs->addTextCrumb(pht('New Panel'));
$crumbs->setBorder(true);
$box = id(new PHUIObjectBoxView()) $box = id(new PHUIObjectBoxView())
->setHeaderText($title) ->setHeaderText(pht('Panel'))
->setFormErrors($errors) ->setFormErrors($errors)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setForm($form); ->setForm($form);
return $this->buildApplicationPage( $header = id(new PHUIHeaderView())
array( ->setHeader($title)
$crumbs, ->setHeaderIcon($header_icon);
$box,
), $view = id(new PHUITwoColumnView())
array( ->setHeader($header)
'title' => $title, ->setFooter($box);
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
} }
private function processPanelCloneRequest( private function processPanelCloneRequest(

View file

@ -50,20 +50,18 @@ final class PhabricatorDashboardPanelRenderController
$crumbs = $this->buildApplicationCrumbs() $crumbs = $this->buildApplicationCrumbs()
->addTextCrumb(pht('Panels'), $this->getApplicationURI('panel/')) ->addTextCrumb(pht('Panels'), $this->getApplicationURI('panel/'))
->addTextCrumb($panel->getMonogram(), '/'.$panel->getMonogram()) ->addTextCrumb($panel->getMonogram(), '/'.$panel->getMonogram())
->addTextCrumb(pht('Standalone View')); ->addTextCrumb(pht('Standalone View'))
->setBorder(true);
$view = id(new PHUIBoxView()) $view = id(new PHUIBoxView())
->addClass('dashboard-view') ->addClass('dashboard-view')
->appendChild($rendered_panel); ->appendChild($rendered_panel);
return $this->buildApplicationPage( return $this->newPage()
array( ->setTitle(array(pht('Panel'), $panel->getName()))
$crumbs, ->setCrumbs($crumbs)
$view, ->appendChild($view);
),
array(
'title' => array(pht('Panel'), $panel->getName()),
));
} }
} }

View file

@ -25,19 +25,15 @@ final class PhabricatorDashboardPanelViewController
pht('Panels'), pht('Panels'),
$this->getApplicationURI('panel/')); $this->getApplicationURI('panel/'));
$crumbs->addTextCrumb($panel->getMonogram()); $crumbs->addTextCrumb($panel->getMonogram());
$crumbs->setBorder(true);
$header = $this->buildHeaderView($panel); $header = $this->buildHeaderView($panel);
$actions = $this->buildActionView($panel); $curtain = $this->buildCurtainView($panel);
$properties = $this->buildPropertyView($panel); $properties = $this->buildPropertyView($panel);
$timeline = $this->buildTransactionTimeline( $timeline = $this->buildTransactionTimeline(
$panel, $panel,
new PhabricatorDashboardPanelTransactionQuery()); new PhabricatorDashboardPanelTransactionQuery());
$timeline->setShouldTerminate(true);
$properties->setActionList($actions);
$box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($properties);
$rendered_panel = id(new PhabricatorDashboardPanelRenderingEngine()) $rendered_panel = id(new PhabricatorDashboardPanelRenderingEngine())
->setViewer($viewer) ->setViewer($viewer)
@ -45,31 +41,41 @@ final class PhabricatorDashboardPanelViewController
->setParentPanelPHIDs(array()) ->setParentPanelPHIDs(array())
->renderPanel(); ->renderPanel();
$view = id(new PHUIBoxView()) $preview = id(new PHUIBoxView())
->addMargin(PHUI::MARGIN_LARGE_LEFT) ->addClass('dashboard-preview-box')
->addMargin(PHUI::MARGIN_LARGE_RIGHT)
->addMargin(PHUI::MARGIN_LARGE_TOP)
->appendChild($rendered_panel); ->appendChild($rendered_panel);
return $this->buildApplicationPage( $view = id(new PHUITwoColumnView())
array( ->setHeader($header)
$crumbs, ->setCurtain($curtain)
$box, ->setMainColumn(array(
$view, $properties,
$timeline, $timeline,
), ))
array( ->setFooter($rendered_panel);
'title' => $title,
)); return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
} }
private function buildHeaderView(PhabricatorDashboardPanel $panel) { private function buildHeaderView(PhabricatorDashboardPanel $panel) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getViewer();
$id = $panel->getID();
$button = id(new PHUIButtonView())
->setTag('a')
->setText(pht('View Panel'))
->setIcon('fa-columns')
->setHref($this->getApplicationURI("panel/render/{$id}/"));
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView())
->setUser($viewer) ->setUser($viewer)
->setHeader($panel->getName()) ->setHeader($panel->getName())
->setPolicyObject($panel); ->setPolicyObject($panel)
->setHeaderIcon('fa-columns')
->addActionLink($button);
if (!$panel->getIsArchived()) { if (!$panel->getIsArchived()) {
$header->setStatus('fa-check', 'bluegrey', pht('Active')); $header->setStatus('fa-check', 'bluegrey', pht('Active'));
@ -79,20 +85,18 @@ final class PhabricatorDashboardPanelViewController
return $header; return $header;
} }
private function buildActionView(PhabricatorDashboardPanel $panel) { private function buildCurtainView(PhabricatorDashboardPanel $panel) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getViewer();
$id = $panel->getID(); $id = $panel->getID();
$actions = id(new PhabricatorActionListView()) $curtain = $this->newCurtainView($panel);
->setObject($panel)
->setUser($viewer);
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
$panel, $panel,
PhabricatorPolicyCapability::CAN_EDIT); PhabricatorPolicyCapability::CAN_EDIT);
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Edit Panel')) ->setName(pht('Edit Panel'))
->setIcon('fa-pencil') ->setIcon('fa-pencil')
@ -108,7 +112,7 @@ final class PhabricatorDashboardPanelViewController
$archive_icon = 'fa-check'; $archive_icon = 'fa-check';
} }
$actions->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName($archive_text) ->setName($archive_text)
->setIcon($archive_icon) ->setIcon($archive_icon)
@ -116,21 +120,14 @@ final class PhabricatorDashboardPanelViewController
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(true)); ->setWorkflow(true));
$actions->addAction( return $curtain;
id(new PhabricatorActionView())
->setName(pht('View Standalone'))
->setIcon('fa-eye')
->setHref($this->getApplicationURI("panel/render/{$id}/")));
return $actions;
} }
private function buildPropertyView(PhabricatorDashboardPanel $panel) { private function buildPropertyView(PhabricatorDashboardPanel $panel) {
$viewer = $this->getRequest()->getUser(); $viewer = $this->getViewer();
$properties = id(new PHUIPropertyListView()) $properties = id(new PHUIPropertyListView())
->setUser($viewer) ->setUser($viewer);
->setObject($panel);
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
$viewer, $viewer,
@ -167,7 +164,10 @@ final class PhabricatorDashboardPanelViewController
? $viewer->renderHandleList($dashboard_phids) ? $viewer->renderHandleList($dashboard_phids)
: phutil_tag('em', array(), $does_not_appear)); : phutil_tag('em', array(), $does_not_appear));
return $properties; return id(new PHUIObjectBoxView())
->setHeaderText(pht('DETAILS'))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->addPropertyList($properties);
} }
} }

View file

@ -36,14 +36,10 @@ final class PhabricatorDashboardViewController
$rendered_dashboard = $this->buildEmptyView(); $rendered_dashboard = $this->buildEmptyView();
} }
return $this->buildApplicationPage( return $this->newPage()
array( ->setTitle($title)
$crumbs, ->setCrumbs($crumbs)
$rendered_dashboard, ->appendChild($rendered_dashboard);
),
array(
'title' => $title,
));
} }
protected function buildApplicationCrumbs() { protected function buildApplicationCrumbs() {

View file

@ -55,8 +55,8 @@
.aphront-multi-column-column.dashboard-column-empty .aphront-multi-column-column.dashboard-column-empty
.dashboard-panel-placeholder { .dashboard-panel-placeholder {
display: block; display: block;
padding: 24px; padding: 20px;
margin: 16px 16px 0px 16px; margin: 0 0 12px 0;
text-decoration: none; text-decoration: none;
border: 1px {$greyborder} dashed; border: 1px {$greyborder} dashed;
color: {$greytext}; color: {$greytext};
@ -73,3 +73,9 @@
.aphront-multi-column-column .phui-info-view { .aphront-multi-column-column .phui-info-view {
margin: 0; margin: 0;
} }
.dashboard-preview-box {
border: 1px solid {$lightblueborder};
border-radius: 3px;
background-color: rgba(255,255,255,.33);
}