diff --git a/src/applications/dashboard/controller/PhabricatorDashboardPanelRenderController.php b/src/applications/dashboard/controller/PhabricatorDashboardPanelRenderController.php index 0a0e7e30c0..8f25a0f9bb 100644 --- a/src/applications/dashboard/controller/PhabricatorDashboardPanelRenderController.php +++ b/src/applications/dashboard/controller/PhabricatorDashboardPanelRenderController.php @@ -1,67 +1,68 @@ getViewer(); $id = $request->getURIData('id'); $panel = id(new PhabricatorDashboardPanelQuery()) ->setViewer($viewer) ->withIDs(array($id)) ->executeOne(); if (!$panel) { return new Aphront404Response(); } if ($request->isAjax()) { $parent_phids = $request->getStrList('parentPanelPHIDs', null); if ($parent_phids === null) { throw new Exception( pht( 'Required parameter `parentPanelPHIDs` is not present in '. 'request.')); } } else { $parent_phids = array(); } $rendered_panel = id(new PhabricatorDashboardPanelRenderingEngine()) ->setViewer($viewer) ->setPanel($panel) + ->setPanelPHID($panel->getPHID()) ->setParentPanelPHIDs($parent_phids) ->setHeaderMode($request->getStr('headerMode')) ->setDashboardID($request->getInt('dashboardID')) ->renderPanel(); if ($request->isAjax()) { return id(new AphrontAjaxResponse()) ->setContent( array( 'panelMarkup' => hsprintf('%s', $rendered_panel), )); } $crumbs = $this->buildApplicationCrumbs() ->addTextCrumb(pht('Panels'), $this->getApplicationURI('panel/')) ->addTextCrumb($panel->getMonogram(), '/'.$panel->getMonogram()) ->addTextCrumb(pht('Standalone View')) ->setBorder(true); $view = id(new PHUIBoxView()) ->addClass('dashboard-view') ->appendChild($rendered_panel); return $this->newPage() ->setTitle(array(pht('Panel'), $panel->getName())) ->setCrumbs($crumbs) ->appendChild($view); } } diff --git a/src/applications/dashboard/controller/PhabricatorDashboardPanelViewController.php b/src/applications/dashboard/controller/PhabricatorDashboardPanelViewController.php index 9fd9e1840d..4b5f1b45be 100644 --- a/src/applications/dashboard/controller/PhabricatorDashboardPanelViewController.php +++ b/src/applications/dashboard/controller/PhabricatorDashboardPanelViewController.php @@ -1,173 +1,174 @@ getViewer(); $id = $request->getURIData('id'); $panel = id(new PhabricatorDashboardPanelQuery()) ->setViewer($viewer) ->withIDs(array($id)) ->executeOne(); if (!$panel) { return new Aphront404Response(); } $title = $panel->getMonogram().' '.$panel->getName(); $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb( pht('Panels'), $this->getApplicationURI('panel/')); $crumbs->addTextCrumb($panel->getMonogram()); $crumbs->setBorder(true); $header = $this->buildHeaderView($panel); $curtain = $this->buildCurtainView($panel); $properties = $this->buildPropertyView($panel); $timeline = $this->buildTransactionTimeline( $panel, new PhabricatorDashboardPanelTransactionQuery()); $rendered_panel = id(new PhabricatorDashboardPanelRenderingEngine()) ->setViewer($viewer) ->setPanel($panel) + ->setPanelPHID($panel->getPHID()) ->setParentPanelPHIDs(array()) ->renderPanel(); $preview = id(new PHUIBoxView()) ->addClass('dashboard-preview-box') ->appendChild($rendered_panel); $view = id(new PHUITwoColumnView()) ->setHeader($header) ->setCurtain($curtain) ->setMainColumn(array( $properties, $timeline, )) ->setFooter($rendered_panel); return $this->newPage() ->setTitle($title) ->setCrumbs($crumbs) ->appendChild($view); } private function buildHeaderView(PhabricatorDashboardPanel $panel) { $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()) ->setUser($viewer) ->setHeader($panel->getName()) ->setPolicyObject($panel) ->setHeaderIcon('fa-columns') ->addActionLink($button); if (!$panel->getIsArchived()) { $header->setStatus('fa-check', 'bluegrey', pht('Active')); } else { $header->setStatus('fa-ban', 'red', pht('Archived')); } return $header; } private function buildCurtainView(PhabricatorDashboardPanel $panel) { $viewer = $this->getViewer(); $id = $panel->getID(); $curtain = $this->newCurtainView($panel); $can_edit = PhabricatorPolicyFilter::hasCapability( $viewer, $panel, PhabricatorPolicyCapability::CAN_EDIT); $curtain->addAction( id(new PhabricatorActionView()) ->setName(pht('Edit Panel')) ->setIcon('fa-pencil') ->setHref($this->getApplicationURI("panel/edit/{$id}/")) ->setDisabled(!$can_edit) ->setWorkflow(!$can_edit)); if (!$panel->getIsArchived()) { $archive_text = pht('Archive Panel'); $archive_icon = 'fa-ban'; } else { $archive_text = pht('Activate Panel'); $archive_icon = 'fa-check'; } $curtain->addAction( id(new PhabricatorActionView()) ->setName($archive_text) ->setIcon($archive_icon) ->setHref($this->getApplicationURI("panel/archive/{$id}/")) ->setDisabled(!$can_edit) ->setWorkflow(true)); return $curtain; } private function buildPropertyView(PhabricatorDashboardPanel $panel) { $viewer = $this->getViewer(); $properties = id(new PHUIPropertyListView()) ->setUser($viewer); $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( $viewer, $panel); $panel_type = $panel->getImplementation(); if ($panel_type) { $type_name = $panel_type->getPanelTypeName(); } else { $type_name = phutil_tag( 'em', array(), nonempty($panel->getPanelType(), pht('null'))); } $properties->addProperty( pht('Panel Type'), $type_name); $properties->addProperty( pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]); $dashboard_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( $panel->getPHID(), PhabricatorDashboardPanelHasDashboardEdgeType::EDGECONST); $does_not_appear = pht( 'This panel does not appear on any dashboards.'); $properties->addProperty( pht('Appears On'), $dashboard_phids ? $viewer->renderHandleList($dashboard_phids) : phutil_tag('em', array(), $does_not_appear)); return id(new PHUIObjectBoxView()) ->setHeaderText(pht('Details')) ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) ->addPropertyList($properties); } } diff --git a/src/applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php b/src/applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php index 2fa8e83a10..c30b06c596 100644 --- a/src/applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php +++ b/src/applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php @@ -1,76 +1,89 @@ getViewer(); $id = $request->getURIData('id'); $dashboard = id(new PhabricatorDashboardQuery()) ->setViewer($viewer) ->withIDs(array($id)) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT, )) ->executeOne(); if (!$dashboard) { return new Aphront404Response(); } + // NOTE: If you can edit a dashboard, you can remove panels from it even + // if you don't have permission to see them or they aren't valid. We only + // require that the panel be present on the dashboard. + $v_panel = $request->getStr('panelPHID'); - $panel = id(new PhabricatorDashboardPanelQuery()) - ->setViewer($viewer) - ->withPHIDs(array($v_panel)) - ->executeOne(); - if (!$panel) { + + $panel_on_dashboard = false; + $layout = $dashboard->getLayoutConfigObject(); + $columns = $layout->getPanelLocations(); + foreach ($columns as $column) { + foreach ($column as $column_panel_phid) { + if ($column_panel_phid == $v_panel) { + $panel_on_dashboard = true; + break; + } + } + } + + if (!$panel_on_dashboard) { return new Aphront404Response(); } $redirect_uri = $this->getApplicationURI( 'manage/'.$dashboard->getID().'/'); $layout_config = $dashboard->getLayoutConfigObject(); if ($request->isFormPost()) { $xactions = array(); $xactions[] = id(new PhabricatorDashboardTransaction()) ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) ->setMetadataValue( 'edge:type', PhabricatorDashboardDashboardHasPanelEdgeType::EDGECONST) ->setNewValue( array( '-' => array( - $panel->getPHID() => $panel->getPHID(), + $v_panel => $v_panel, ), )); - $layout_config->removePanel($panel->getPHID()); + $layout_config->removePanel($v_panel); $dashboard->setLayoutConfigFromObject($layout_config); $editor = id(new PhabricatorDashboardTransactionEditor()) ->setActor($viewer) ->setContentSourceFromRequest($request) ->setContinueOnMissingFields(true) ->setContinueOnNoEffect(true) ->applyTransactions($dashboard, $xactions); return id(new AphrontRedirectResponse())->setURI($redirect_uri); } $form = id(new AphrontFormView()) ->setUser($viewer) ->addHiddenInput('confirm', true) ->addHiddenInput('panelPHID', $v_panel) ->appendChild(pht('Are you sure you want to remove this panel?')); return $this->newDialog() - ->setTitle(pht('Remove Panel %s', $panel->getMonogram())) + ->setTitle(pht('Remove Panel')) ->appendChild($form->buildLayoutView()) ->addCancelButton($redirect_uri) ->addSubmitButton(pht('Remove Panel')); } } diff --git a/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php b/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php index 286d749a18..fbd5aaa2bb 100644 --- a/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php +++ b/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php @@ -1,325 +1,343 @@ dashboardID = $id; return $this; } public function getDashboardID() { return $this->dashboardID; } public function setHeaderMode($header_mode) { $this->headerMode = $header_mode; return $this; } public function getHeaderMode() { return $this->headerMode; } /** * Allow the engine to render the panel via Ajax. */ public function setEnableAsyncRendering($enable) { $this->enableAsyncRendering = $enable; return $this; } public function setParentPanelPHIDs(array $parents) { $this->parentPanelPHIDs = $parents; return $this; } public function getParentPanelPHIDs() { return $this->parentPanelPHIDs; } public function setViewer(PhabricatorUser $viewer) { $this->viewer = $viewer; return $this; } public function getViewer() { return $this->viewer; } public function setPanel(PhabricatorDashboardPanel $panel) { $this->panel = $panel; return $this; } public function getPanel() { return $this->panel; } + public function setPanelPHID($panel_phid) { + $this->panelPHID = $panel_phid; + return $this; + } + + public function getPanelPHID() { + return $this->panelPHID; + } + public function renderPanel() { $panel = $this->getPanel(); $viewer = $this->getViewer(); if (!$panel) { return $this->renderErrorPanel( pht('Missing or Restricted Panel'), pht( 'This panel does not exist, or you do not have permission '. 'to see it.')); } $panel_type = $panel->getImplementation(); if (!$panel_type) { return $this->renderErrorPanel( $panel->getName(), pht( 'This panel has type "%s", but that panel type is not known to '. 'Phabricator.', $panel->getPanelType())); } try { $this->detectRenderingCycle($panel); if ($this->enableAsyncRendering) { if ($panel_type->shouldRenderAsync()) { return $this->renderAsyncPanel(); } } return $this->renderNormalPanel($viewer, $panel, $this); } catch (Exception $ex) { return $this->renderErrorPanel( $panel->getName(), pht( '%s: %s', phutil_tag('strong', array(), get_class($ex)), $ex->getMessage())); } } private function renderNormalPanel() { $panel = $this->getPanel(); $panel_type = $panel->getImplementation(); $content = $panel_type->renderPanelContent( $this->getViewer(), $panel, $this); $header = $this->renderPanelHeader(); return $this->renderPanelDiv( $content, $header); } private function renderAsyncPanel() { $panel = $this->getPanel(); $panel_id = celerity_generate_unique_node_id(); $dashboard_id = $this->getDashboardID(); Javelin::initBehavior( 'dashboard-async-panel', array( 'panelID' => $panel_id, 'parentPanelPHIDs' => $this->getParentPanelPHIDs(), 'headerMode' => $this->getHeaderMode(), 'dashboardID' => $dashboard_id, 'uri' => '/dashboard/panel/render/'.$panel->getID().'/', )); $header = $this->renderPanelHeader(); $content = id(new PHUIPropertyListView()) ->addTextContent(pht('Loading...')); return $this->renderPanelDiv( $content, $header, $panel_id); } private function renderErrorPanel($title, $body) { switch ($this->getHeaderMode()) { case self::HEADER_MODE_NONE: $header = null; break; case self::HEADER_MODE_EDIT: $header = id(new PHUIHeaderView()) ->setHeader($title); $header = $this->addPanelHeaderActions($header); break; case self::HEADER_MODE_NORMAL: default: $header = id(new PHUIHeaderView()) ->setHeader($title); break; } $icon = id(new PHUIIconView()) ->setIcon('fa-warning red msr'); $content = id(new PHUIBoxView()) ->addClass('dashboard-box') ->addMargin(PHUI::MARGIN_MEDIUM) ->appendChild($icon) ->appendChild($body); return $this->renderPanelDiv( $content, $header); } private function renderPanelDiv( $content, $header = null, $id = null) { require_celerity_resource('phabricator-dashboard-css'); $panel = $this->getPanel(); if (!$id) { $id = celerity_generate_unique_node_id(); } $box = new PHUIObjectBoxView(); $interface = 'PhabricatorApplicationSearchResultView'; if ($content instanceof $interface) { if ($content->getObjectList()) { $box->setObjectList($content->getObjectList()); } if ($content->getTable()) { $box->setTable($content->getTable()); } if ($content->getContent()) { $box->appendChild($content->getContent()); } } else { $box->appendChild($content); } $box ->setHeader($header) ->setID($id) ->addSigil('dashboard-panel'); if ($panel) { $box->setMetadata( array( 'objectPHID' => $panel->getPHID(), )); } return phutil_tag_div('dashboard-pane', $box); } private function renderPanelHeader() { $panel = $this->getPanel(); switch ($this->getHeaderMode()) { case self::HEADER_MODE_NONE: $header = null; break; case self::HEADER_MODE_EDIT: $header = id(new PHUIHeaderView()) ->setHeader($panel->getName()); $header = $this->addPanelHeaderActions($header); break; case self::HEADER_MODE_NORMAL: default: $header = id(new PHUIHeaderView()) ->setHeader($panel->getName()); $panel_type = $panel->getImplementation(); $header = $panel_type->adjustPanelHeader( $this->getViewer(), $panel, $this, $header); break; } return $header; } private function addPanelHeaderActions( PHUIHeaderView $header) { $panel = $this->getPanel(); - if (!$panel) { - return $header; - } - $dashboard_id = $this->getDashboardID(); - $edit_uri = id(new PhutilURI( - '/dashboard/panel/edit/'.$panel->getID().'/')); - if ($dashboard_id) { - $edit_uri->setQueryParam('dashboardID', $dashboard_id); + + if ($panel) { + $panel_id = $panel->getID(); + + $edit_uri = "/dashboard/panel/edit/{$panel_id}/"; + $edit_uri = new PhutilURI($edit_uri); + if ($dashboard_id) { + $edit_uri->setQueryParam('dashboardID', $dashboard_id); + } + + $action_edit = id(new PHUIIconView()) + ->setIcon('fa-pencil') + ->setWorkflow(true) + ->setHref((string)$edit_uri); + + $header->addActionItem($action_edit); } - $action_edit = id(new PHUIIconView()) - ->setIcon('fa-pencil') - ->setWorkflow(true) - ->setHref((string)$edit_uri); - $header->addActionItem($action_edit); if ($dashboard_id) { - $uri = id(new PhutilURI( - '/dashboard/removepanel/'.$dashboard_id.'/')) - ->setQueryParam('panelPHID', $panel->getPHID()); + $panel_phid = $this->getPanelPHID(); + + $remove_uri = "/dashboard/removepanel/{$dashboard_id}/"; + $remove_uri = id(new PhutilURI($remove_uri)) + ->setQueryParam('panelPHID', $panel_phid); + $action_remove = id(new PHUIIconView()) ->setIcon('fa-trash-o') - ->setHref((string)$uri) + ->setHref((string)$remove_uri) ->setWorkflow(true); + $header->addActionItem($action_remove); } + return $header; } /** * Detect graph cycles in panels, and deeply nested panels. * * This method throws if the current rendering stack is too deep or contains * a cycle. This can happen if you embed layout panels inside each other, * build a big stack of panels, or embed a panel in remarkup inside another * panel. Generally, all of this stuff is ridiculous and we just want to * shut it down. * * @param PhabricatorDashboardPanel Panel being rendered. * @return void */ private function detectRenderingCycle(PhabricatorDashboardPanel $panel) { if ($this->parentPanelPHIDs === null) { throw new PhutilInvalidStateException('setParentPanelPHIDs'); } $max_depth = 4; if (count($this->parentPanelPHIDs) >= $max_depth) { throw new Exception( pht( 'To render more than %s levels of panels nested inside other '. 'panels, purchase a subscription to Phabricator Gold.', new PhutilNumber($max_depth))); } if (in_array($panel->getPHID(), $this->parentPanelPHIDs)) { throw new Exception( pht( 'You awake in a twisting maze of mirrors, all alike. '. 'You are likely to be eaten by a graph cycle. '. 'Should you escape alive, you resolve to be more careful about '. 'putting dashboard panels inside themselves.')); } } } diff --git a/src/applications/dashboard/engine/PhabricatorDashboardRenderingEngine.php b/src/applications/dashboard/engine/PhabricatorDashboardRenderingEngine.php index f9af84973e..d1e1d3111c 100644 --- a/src/applications/dashboard/engine/PhabricatorDashboardRenderingEngine.php +++ b/src/applications/dashboard/engine/PhabricatorDashboardRenderingEngine.php @@ -1,148 +1,149 @@ viewer = $viewer; return $this; } public function setDashboard(PhabricatorDashboard $dashboard) { $this->dashboard = $dashboard; return $this; } public function setArrangeMode($mode) { $this->arrangeMode = $mode; return $this; } public function renderDashboard() { require_celerity_resource('phabricator-dashboard-css'); $dashboard = $this->dashboard; $viewer = $this->viewer; $layout_config = $dashboard->getLayoutConfigObject(); $panel_grid_locations = $layout_config->getPanelLocations(); $panels = mpull($dashboard->getPanels(), null, 'getPHID'); $dashboard_id = celerity_generate_unique_node_id(); $result = id(new AphrontMultiColumnView()) ->setID($dashboard_id) ->setFluidLayout(true) ->setGutter(AphrontMultiColumnView::GUTTER_LARGE); if ($this->arrangeMode) { $h_mode = PhabricatorDashboardPanelRenderingEngine::HEADER_MODE_EDIT; } else { $h_mode = PhabricatorDashboardPanelRenderingEngine::HEADER_MODE_NORMAL; } foreach ($panel_grid_locations as $column => $panel_column_locations) { $panel_phids = $panel_column_locations; // TODO: This list may contain duplicates when the dashboard itself // does not? Perhaps this is related to T10612. For now, just unique // the list before moving on. $panel_phids = array_unique($panel_phids); $column_result = array(); foreach ($panel_phids as $panel_phid) { $panel_engine = id(new PhabricatorDashboardPanelRenderingEngine()) ->setViewer($viewer) ->setDashboardID($dashboard->getID()) ->setEnableAsyncRendering(true) + ->setPanelPHID($panel_phid) ->setParentPanelPHIDs(array()) ->setHeaderMode($h_mode); $panel = idx($panels, $panel_phid); if ($panel) { $panel_engine->setPanel($panel); } $column_result[] = $panel_engine->renderPanel(); } $column_class = $layout_config->getColumnClass( $column, $this->arrangeMode); if ($this->arrangeMode) { $column_result[] = $this->renderAddPanelPlaceHolder($column); $column_result[] = $this->renderAddPanelUI($column); } $result->addColumn( $column_result, $column_class, $sigil = 'dashboard-column', $metadata = array('columnID' => $column)); } if ($this->arrangeMode) { Javelin::initBehavior( 'dashboard-move-panels', array( 'dashboardID' => $dashboard_id, 'moveURI' => '/dashboard/movepanel/'.$dashboard->getID().'/', )); } $view = id(new PHUIBoxView()) ->addClass('dashboard-view') ->appendChild($result); return $view; } private function renderAddPanelPlaceHolder($column) { $dashboard = $this->dashboard; $panels = $dashboard->getPanels(); return javelin_tag( 'span', array( 'sigil' => 'workflow', 'class' => 'drag-ghost dashboard-panel-placeholder', ), pht('This column does not have any panels yet.')); } private function renderAddPanelUI($column) { $dashboard_id = $this->dashboard->getID(); $create_uri = id(new PhutilURI('/dashboard/panel/create/')) ->setQueryParam('dashboardID', $dashboard_id) ->setQueryParam('column', $column); $add_uri = id(new PhutilURI('/dashboard/addpanel/'.$dashboard_id.'/')) ->setQueryParam('column', $column); $create_button = id(new PHUIButtonView()) ->setTag('a') ->setHref($create_uri) ->setWorkflow(true) ->setColor(PHUIButtonView::GREY) ->setText(pht('Create Panel')) ->addClass(PHUI::MARGIN_MEDIUM); $add_button = id(new PHUIButtonView()) ->setTag('a') ->setHref($add_uri) ->setWorkflow(true) ->setColor(PHUIButtonView::GREY) ->setText(pht('Add Existing Panel')) ->addClass(PHUI::MARGIN_MEDIUM); return phutil_tag( 'div', array( 'style' => 'text-align: center;', ), array( $create_button, $add_button, )); } } diff --git a/src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php b/src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php index 4a0dae02f1..3cb758a11a 100644 --- a/src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php +++ b/src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php @@ -1,125 +1,126 @@ array( 'name' => pht('Tabs'), 'type' => 'dashboard.tabs', ), ); } public function shouldRenderAsync() { // The actual tab panel itself is cheap to render. return false; } public function renderPanelContent( PhabricatorUser $viewer, PhabricatorDashboardPanel $panel, PhabricatorDashboardPanelRenderingEngine $engine) { $config = $panel->getProperty('config'); if (!is_array($config)) { // NOTE: The older version of this panel stored raw JSON. $config = phutil_json_decode($config); } $list = id(new PHUIListView()) ->setType(PHUIListView::NAVBAR_LIST); $selected = 0; $node_ids = array(); foreach ($config as $idx => $tab_spec) { $node_ids[$idx] = celerity_generate_unique_node_id(); } foreach ($config as $idx => $tab_spec) { $list->addMenuItem( id(new PHUIListItemView()) ->setHref('#') ->setSelected($idx == $selected) ->addSigil('dashboard-tab-panel-tab') ->setMetadata(array('idx' => $idx)) ->setName(idx($tab_spec, 'name', pht('Nameless Tab')))); } $ids = ipull($config, 'panelID'); if ($ids) { $panels = id(new PhabricatorDashboardPanelQuery()) ->setViewer($viewer) ->withIDs($ids) ->execute(); } else { $panels = array(); } $parent_phids = $engine->getParentPanelPHIDs(); $parent_phids[] = $panel->getPHID(); // TODO: Currently, we'll load all the panels on page load. It would be // vaguely nice to load hidden panels only when the user selects them. // TODO: Maybe we should persist which panel the user selected, so it // remains selected across page loads. $content = array(); $no_headers = PhabricatorDashboardPanelRenderingEngine::HEADER_MODE_NONE; foreach ($config as $idx => $tab_spec) { $panel_id = idx($tab_spec, 'panelID'); $panel = idx($panels, $panel_id); if ($panel) { $panel_content = id(new PhabricatorDashboardPanelRenderingEngine()) ->setViewer($viewer) ->setEnableAsyncRendering(true) ->setParentPanelPHIDs($parent_phids) ->setPanel($panel) + ->setPanelPHID($panel->getPHID()) ->setHeaderMode($no_headers) ->renderPanel(); } else { $panel_content = pht('(Invalid Panel)'); } $content[] = phutil_tag( 'div', array( 'id' => $node_ids[$idx], 'style' => ($idx == $selected) ? null : 'display: none', ), $panel_content); } Javelin::initBehavior('dashboard-tab-panel'); return javelin_tag( 'div', array( 'sigil' => 'dashboard-tab-panel-container', 'meta' => array( 'panels' => $node_ids, ), ), array( $list, $content, )); } } diff --git a/src/applications/dashboard/remarkup/PhabricatorDashboardRemarkupRule.php b/src/applications/dashboard/remarkup/PhabricatorDashboardRemarkupRule.php index 6b0a48dc01..d96852b10e 100644 --- a/src/applications/dashboard/remarkup/PhabricatorDashboardRemarkupRule.php +++ b/src/applications/dashboard/remarkup/PhabricatorDashboardRemarkupRule.php @@ -1,39 +1,40 @@ getEngine()->getConfig('viewer'); return id(new PhabricatorDashboardPanelQuery()) ->setViewer($viewer) ->withIDs($ids) ->execute(); } protected function renderObjectEmbed( $object, PhabricatorObjectHandle $handle, $options) { $engine = $this->getEngine(); $viewer = $engine->getConfig('viewer'); $parent_key = self::KEY_PARENT_PANEL_PHIDS; $parent_phids = $engine->getConfig($parent_key, array()); return id(new PhabricatorDashboardPanelRenderingEngine()) ->setViewer($viewer) ->setPanel($object) + ->setPanelPHID($object->getPHID()) ->setParentPanelPHIDs($parent_phids) ->renderPanel(); } }