1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

When a dashboard has inconsistent panel policies: keep doing nothing

Summary:
Depends on D20376. Ref T8033. It's possible to put a bunch of secret panels on a public dashboard, and not obvious that the dashboard won't be very useful.

This was more of an issue long ago (when the dashboard broke or all the panels completely vanished or something?). Nowadays, the panels render "You don't have permission to view this" so it's likely easy to explain/fix. Still, we can warn about this.

But, for now, don't, since a lot of this works better now and it's not really clear that this is particularly valuable. We can revisit this after all the connected changes have more of a chance to settle.

Test Plan:
(Earlier behavior, not how things look in the final version.)

{F6335008}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T8033

Differential Revision: https://secure.phabricator.com/D20377
This commit is contained in:
epriestley 2019-04-03 09:20:20 -07:00
parent 2bd1bb52e4
commit 8d24e3a21a
2 changed files with 27 additions and 6 deletions

View file

@ -275,8 +275,11 @@ final class PhabricatorDashboardPanelRenderingEngine extends Phobject {
$header = null; $header = null;
break; break;
case self::HEADER_MODE_EDIT: case self::HEADER_MODE_EDIT:
// In edit mode, include the panel monogram to make managing boards
// a little easier.
$header_text = pht('%s %s', $panel->getMonogram(), $panel->getName());
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView())
->setHeader($panel->getName()); ->setHeader($header_text);
$header = $this->addPanelHeaderActions($header); $header = $this->addPanelHeaderActions($header);
break; break;
case self::HEADER_MODE_NORMAL: case self::HEADER_MODE_NORMAL:
@ -316,6 +319,11 @@ final class PhabricatorDashboardPanelRenderingEngine extends Phobject {
->setIcon('fa-pencil') ->setIcon('fa-pencil')
->setName(pht('Edit Panel')) ->setName(pht('Edit Panel'))
->setHref((string)$edit_uri); ->setHref((string)$edit_uri);
$actions[] = id(new PhabricatorActionView())
->setIcon('fa-window-maximize')
->setName(pht('View Panel Details'))
->setHref($panel->getURI());
} }
if ($dashboard_id) { if ($dashboard_id) {

View file

@ -11,11 +11,19 @@ final class PhabricatorDashboardRenderingEngine extends Phobject {
return $this; return $this;
} }
public function getViewer() {
return $this->viewer;
}
public function setDashboard(PhabricatorDashboard $dashboard) { public function setDashboard(PhabricatorDashboard $dashboard) {
$this->dashboard = $dashboard; $this->dashboard = $dashboard;
return $this; return $this;
} }
public function getDashboard() {
return $this->dashboard;
}
public function setArrangeMode($mode) { public function setArrangeMode($mode) {
$this->arrangeMode = $mode; $this->arrangeMode = $mode;
return $this; return $this;
@ -26,6 +34,8 @@ final class PhabricatorDashboardRenderingEngine extends Phobject {
$dashboard = $this->dashboard; $dashboard = $this->dashboard;
$viewer = $this->viewer; $viewer = $this->viewer;
$is_editable = $this->arrangeMode;
$layout_config = $dashboard->getLayoutConfigObject(); $layout_config = $dashboard->getLayoutConfigObject();
$panel_grid_locations = $layout_config->getPanelLocations(); $panel_grid_locations = $layout_config->getPanelLocations();
$panels = mpull($dashboard->getPanels(), null, 'getPHID'); $panels = mpull($dashboard->getPanels(), null, 'getPHID');
@ -35,7 +45,7 @@ final class PhabricatorDashboardRenderingEngine extends Phobject {
->setFluidLayout(true) ->setFluidLayout(true)
->setGutter(AphrontMultiColumnView::GUTTER_LARGE); ->setGutter(AphrontMultiColumnView::GUTTER_LARGE);
if ($this->arrangeMode) { if ($is_editable) {
$h_mode = PhabricatorDashboardPanelRenderingEngine::HEADER_MODE_EDIT; $h_mode = PhabricatorDashboardPanelRenderingEngine::HEADER_MODE_EDIT;
} else { } else {
$h_mode = PhabricatorDashboardPanelRenderingEngine::HEADER_MODE_NORMAL; $h_mode = PhabricatorDashboardPanelRenderingEngine::HEADER_MODE_NORMAL;
@ -77,8 +87,8 @@ final class PhabricatorDashboardRenderingEngine extends Phobject {
} }
$column_class = $layout_config->getColumnClass( $column_class = $layout_config->getColumnClass(
$column, $column,
$this->arrangeMode); $is_editable);
if ($this->arrangeMode) { if ($is_editable) {
$column_result[] = $this->renderAddPanelPlaceHolder($column); $column_result[] = $this->renderAddPanelPlaceHolder($column);
$column_result[] = $this->renderAddPanelUI($column); $column_result[] = $this->renderAddPanelUI($column);
} }
@ -89,7 +99,7 @@ final class PhabricatorDashboardRenderingEngine extends Phobject {
$metadata = array('columnID' => $column)); $metadata = array('columnID' => $column));
} }
if ($this->arrangeMode) { if ($is_editable) {
Javelin::initBehavior( Javelin::initBehavior(
'dashboard-move-panels', 'dashboard-move-panels',
array( array(
@ -100,7 +110,10 @@ final class PhabricatorDashboardRenderingEngine extends Phobject {
$view = id(new PHUIBoxView()) $view = id(new PHUIBoxView())
->addClass('dashboard-view') ->addClass('dashboard-view')
->appendChild($result); ->appendChild(
array(
$result,
));
return $view; return $view;
} }