1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 16:58:48 +02:00

Hide Archived Panels from Dashboards

Summary:
In edit mode, Archived Panels are shown differently,
with content text in grey and with the usual red tag.

In view mode, Archived Panels are just not rendered.

This makes it easier to design Dashboards with individual
components that can be de-activated and re-activated on the fly.

Closes T15366.

{F325637}

Test Plan:
Have a Dashboard somewhere (e.g in your homepage).

Visit a Panel (W-ID) and Archive it.

See that now the Panel is not shown anymore on the Dashboard.

Edit the Dashboard and you see the Panel again as "Archived".

Anything around is just normal.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15366

Differential Revision: https://we.phorge.it/D25368
This commit is contained in:
Valerio Bozzolan 2023-08-01 09:39:18 +02:00
parent df3ac50cb7
commit 840a7fab2b
5 changed files with 36 additions and 4 deletions

View file

@ -9,7 +9,7 @@ return array(
'names' => array( 'names' => array(
'conpherence.pkg.css' => '76ed87e3', 'conpherence.pkg.css' => '76ed87e3',
'conpherence.pkg.js' => '020aebcf', 'conpherence.pkg.js' => '020aebcf',
'core.pkg.css' => '67a5ecf3', 'core.pkg.css' => '1a5169fe',
'core.pkg.js' => '2eeda9e0', 'core.pkg.js' => '2eeda9e0',
'dark-console.pkg.js' => '187792c2', 'dark-console.pkg.js' => '187792c2',
'differential.pkg.css' => '525f9a1d', 'differential.pkg.css' => '525f9a1d',
@ -167,7 +167,7 @@ return array(
'rsrc/css/phui/phui-invisible-character-view.css' => 'c694c4a4', 'rsrc/css/phui/phui-invisible-character-view.css' => 'c694c4a4',
'rsrc/css/phui/phui-left-right.css' => '68513c34', 'rsrc/css/phui/phui-left-right.css' => '68513c34',
'rsrc/css/phui/phui-lightbox.css' => '4ebf22da', 'rsrc/css/phui/phui-lightbox.css' => '4ebf22da',
'rsrc/css/phui/phui-list.css' => '0c04affd', 'rsrc/css/phui/phui-list.css' => 'ccf73664',
'rsrc/css/phui/phui-object-box.css' => 'fdffed5c', 'rsrc/css/phui/phui-object-box.css' => 'fdffed5c',
'rsrc/css/phui/phui-pager.css' => 'd022c7ad', 'rsrc/css/phui/phui-pager.css' => 'd022c7ad',
'rsrc/css/phui/phui-pinboard-view.css' => '1f08f5d8', 'rsrc/css/phui/phui-pinboard-view.css' => '1f08f5d8',
@ -864,7 +864,7 @@ return array(
'phui-invisible-character-view-css' => 'c694c4a4', 'phui-invisible-character-view-css' => 'c694c4a4',
'phui-left-right-css' => '68513c34', 'phui-left-right-css' => '68513c34',
'phui-lightbox-css' => '4ebf22da', 'phui-lightbox-css' => '4ebf22da',
'phui-list-view-css' => '0c04affd', 'phui-list-view-css' => 'ccf73664',
'phui-object-box-css' => 'fdffed5c', 'phui-object-box-css' => 'fdffed5c',
'phui-oi-big-ui-css' => 'fa74cc35', 'phui-oi-big-ui-css' => 'fa74cc35',
'phui-oi-color-css' => 'b517bfa0', 'phui-oi-color-css' => 'b517bfa0',

View file

@ -273,6 +273,11 @@ final class PhabricatorDashboardPanelRenderingEngine extends Phobject {
->addClass('dashboard-box') ->addClass('dashboard-box')
->addSigil('dashboard-panel'); ->addSigil('dashboard-panel');
// Allow to style Archived Panels differently.
if ($panel && $panel->getIsArchived()) {
$box->addClass('dashboard-panel-disabled');
}
if ($this->getMovable()) { if ($this->getMovable()) {
$box->addSigil('panel-movable'); $box->addSigil('panel-movable');
} }
@ -302,6 +307,16 @@ final class PhabricatorDashboardPanelRenderingEngine extends Phobject {
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView())
->setHeader($header_text); ->setHeader($header_text);
$header = $this->addPanelHeaderActions($header); $header = $this->addPanelHeaderActions($header);
// If the Panel is Archived, show in edit mode as such.
if ($panel && $panel->getIsArchived()) {
$header->setSubheader(
id(new PHUITagView())
->setType(PHUITagView::TYPE_SHADE)
->setColor(PHUITagView::COLOR_RED)
->setIcon('fa-ban')
->setName(pht('Archived')));
}
break; break;
case self::HEADER_MODE_NORMAL: case self::HEADER_MODE_NORMAL:
default: default:

View file

@ -71,6 +71,13 @@ final class PhabricatorDashboardRenderingEngine extends Phobject {
foreach ($column->getPanelRefs() as $panel_ref) { foreach ($column->getPanelRefs() as $panel_ref) {
$panel_phid = $panel_ref->getPanelPHID(); $panel_phid = $panel_ref->getPanelPHID();
$panel = idx($panels, $panel_phid);
// Do not render Archived panels in view mode.
if ($panel && $panel->getIsArchived() && !$is_editable) {
continue;
}
$panel_engine = id(new PhabricatorDashboardPanelRenderingEngine()) $panel_engine = id(new PhabricatorDashboardPanelRenderingEngine())
->setViewer($viewer) ->setViewer($viewer)
->setEnableAsyncRendering(true) ->setEnableAsyncRendering(true)
@ -83,7 +90,6 @@ final class PhabricatorDashboardRenderingEngine extends Phobject {
->setMovable(true) ->setMovable(true)
->setPanelHandle($handles[$panel_phid]); ->setPanelHandle($handles[$panel_phid]);
$panel = idx($panels, $panel_phid);
if ($panel) { if ($panel) {
$panel_engine->setPanel($panel); $panel_engine->setPanel($panel);
} }

View file

@ -19,6 +19,13 @@ final class PhabricatorDashboardPanelQuery
return $this; return $this;
} }
/**
* Whether to get only the Archived (`true`), only the not
* Archived (`false`) or all (`null`). Default to `null` (no filter).
*
* @param null|bool $archived
* @return self
*/
public function withArchived($archived) { public function withArchived($archived) {
$this->archived = $archived; $this->archived = $archived;
return $this; return $this;

View file

@ -287,6 +287,10 @@
border-bottom: 1px solid {$thinblueborder}; border-bottom: 1px solid {$thinblueborder};
} }
.dashboard-panel-disabled {
color: {$lightgreytext};
}
/* - Info Stack ------------------------------------------------------------ */ /* - Info Stack ------------------------------------------------------------ */
.phui-info-view + .phui-list-view { .phui-info-view + .phui-list-view {