Differential D20373 Diff 48598 src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php
Show First 20 Lines • Show All 271 Lines • ▼ Show 20 Lines | switch ($this->getHeaderMode()) { | ||||
$header); | $header); | ||||
break; | break; | ||||
} | } | ||||
return $header; | return $header; | ||||
} | } | ||||
private function addPanelHeaderActions( | private function addPanelHeaderActions( | ||||
PHUIHeaderView $header) { | PHUIHeaderView $header) { | ||||
$panel = $this->getPanel(); | |||||
$viewer = $this->getViewer(); | |||||
$panel = $this->getPanel(); | |||||
$dashboard_id = $this->getDashboardID(); | $dashboard_id = $this->getDashboardID(); | ||||
$actions = array(); | |||||
if ($panel) { | if ($panel) { | ||||
$panel_id = $panel->getID(); | $panel_id = $panel->getID(); | ||||
$edit_uri = "/dashboard/panel/edit/{$panel_id}/"; | $edit_uri = "/dashboard/panel/edit/{$panel_id}/"; | ||||
$edit_uri = new PhutilURI($edit_uri); | $edit_uri = new PhutilURI($edit_uri); | ||||
if ($dashboard_id) { | if ($dashboard_id) { | ||||
$edit_uri->replaceQueryParam('dashboardID', $dashboard_id); | $edit_uri->replaceQueryParam('dashboardID', $dashboard_id); | ||||
} | } | ||||
$action_edit = id(new PHUIIconView()) | $actions[] = id(new PhabricatorActionView()) | ||||
->setIcon('fa-pencil') | ->setIcon('fa-pencil') | ||||
->setWorkflow(true) | ->setName(pht('Edit Panel')) | ||||
->setHref((string)$edit_uri); | ->setHref((string)$edit_uri); | ||||
$header->addActionItem($action_edit); | |||||
} | } | ||||
if ($dashboard_id) { | if ($dashboard_id) { | ||||
$panel_phid = $this->getPanelPHID(); | $panel_phid = $this->getPanelPHID(); | ||||
$remove_uri = "/dashboard/removepanel/{$dashboard_id}/"; | $remove_uri = "/dashboard/removepanel/{$dashboard_id}/"; | ||||
$remove_uri = id(new PhutilURI($remove_uri)) | $remove_uri = id(new PhutilURI($remove_uri)) | ||||
->replaceQueryParam('panelPHID', $panel_phid); | ->replaceQueryParam('panelPHID', $panel_phid); | ||||
$action_remove = id(new PHUIIconView()) | $actions[] = id(new PhabricatorActionView()) | ||||
->setIcon('fa-trash-o') | ->setIcon('fa-times') | ||||
->setHref((string)$remove_uri) | ->setHref((string)$remove_uri) | ||||
->setName(pht('Remove Panel')) | |||||
->setWorkflow(true); | ->setWorkflow(true); | ||||
} | |||||
$dropdown_menu = id(new PhabricatorActionListView()) | |||||
->setViewer($viewer); | |||||
$header->addActionItem($action_remove); | foreach ($actions as $action) { | ||||
$dropdown_menu->addAction($action); | |||||
} | } | ||||
$action_menu = id(new PHUIButtonView()) | |||||
->setTag('a') | |||||
->setIcon('fa-cog') | |||||
->setText(pht('Manage Panel')) | |||||
->setDropdownMenu($dropdown_menu); | |||||
$header->addActionLink($action_menu); | |||||
return $header; | return $header; | ||||
} | } | ||||
/** | /** | ||||
* Detect graph cycles in panels, and deeply nested panels. | * Detect graph cycles in panels, and deeply nested panels. | ||||
* | * | ||||
* This method throws if the current rendering stack is too deep or contains | * This method throws if the current rendering stack is too deep or contains | ||||
Show All 34 Lines |