mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Move Dashboard and Panel edit history out of the way
Summary: Fixes T5170, Create new page for dashboard history Test Plan: Open dashboard, manage dashboard, click on "View History". Dashboard history should appear. Panel history should appear on panel view page under panel. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Maniphest Tasks: T5170 Differential Revision: https://secure.phabricator.com/D9280
This commit is contained in:
parent
eace05e4a5
commit
7de4e80907
5 changed files with 80 additions and 23 deletions
|
@ -1467,6 +1467,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorDashboardController' => 'applications/dashboard/controller/PhabricatorDashboardController.php',
|
||||
'PhabricatorDashboardDAO' => 'applications/dashboard/storage/PhabricatorDashboardDAO.php',
|
||||
'PhabricatorDashboardEditController' => 'applications/dashboard/controller/PhabricatorDashboardEditController.php',
|
||||
'PhabricatorDashboardHistoryController' => 'applications/dashboard/controller/PhabricatorDashboardHistoryController.php',
|
||||
'PhabricatorDashboardInstall' => 'applications/dashboard/storage/PhabricatorDashboardInstall.php',
|
||||
'PhabricatorDashboardInstallController' => 'applications/dashboard/controller/PhabricatorDashboardInstallController.php',
|
||||
'PhabricatorDashboardLayoutConfig' => 'applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php',
|
||||
|
@ -4266,6 +4267,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorDashboardController' => 'PhabricatorController',
|
||||
'PhabricatorDashboardDAO' => 'PhabricatorLiskDAO',
|
||||
'PhabricatorDashboardEditController' => 'PhabricatorDashboardController',
|
||||
'PhabricatorDashboardHistoryController' => 'PhabricatorDashboardController',
|
||||
'PhabricatorDashboardInstall' => 'PhabricatorDashboardDAO',
|
||||
'PhabricatorDashboardInstallController' => 'PhabricatorDashboardController',
|
||||
'PhabricatorDashboardListController' => 'PhabricatorDashboardController',
|
||||
|
|
|
@ -22,6 +22,7 @@ final class PhabricatorApplicationDashboard extends PhabricatorApplication {
|
|||
=> 'PhabricatorDashboardListController',
|
||||
'view/(?P<id>\d+)/' => 'PhabricatorDashboardViewController',
|
||||
'manage/(?P<id>\d+)/' => 'PhabricatorDashboardManageController',
|
||||
'history/(?P<id>\d+)/' => 'PhabricatorDashboardHistoryController',
|
||||
'create/' => 'PhabricatorDashboardEditController',
|
||||
'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorDashboardEditController',
|
||||
'install/(?P<id>\d+)/' => 'PhabricatorDashboardInstallController',
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorDashboardHistoryController
|
||||
extends PhabricatorDashboardController {
|
||||
|
||||
private $id;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = $data['id'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
$id = $this->id;
|
||||
$dashboard_view_uri = $this->getApplicationURI('view/'.$id.'/');
|
||||
$dashboard_manage_uri = $this->getApplicationURI('manage/'.$id.'/');
|
||||
|
||||
$dashboard = id(new PhabricatorDashboardQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
->executeOne();
|
||||
if (!$dashboard) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$title = $dashboard->getName();
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addTextCrumb(
|
||||
pht('Dashboard %d', $dashboard->getID()),
|
||||
$dashboard_view_uri);
|
||||
$crumbs->addTextCrumb(
|
||||
pht('Manage'),
|
||||
$dashboard_manage_uri);
|
||||
$crumbs->addTextCrumb(pht('History'));
|
||||
|
||||
$timeline = $this->buildTransactions($dashboard);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
$crumbs,
|
||||
$timeline,
|
||||
),
|
||||
array(
|
||||
'title' => $title,
|
||||
'device' => true,
|
||||
));
|
||||
}
|
||||
|
||||
private function buildTransactions(PhabricatorDashboard $dashboard) {
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
|
||||
$xactions = id(new PhabricatorDashboardTransactionQuery())
|
||||
->setViewer($viewer)
|
||||
->withObjectPHIDs(array($dashboard->getPHID()))
|
||||
->execute();
|
||||
|
||||
$timeline = id(new PhabricatorApplicationTransactionView())
|
||||
->setUser($viewer)
|
||||
->setShouldTerminate(true)
|
||||
->setObjectPHID($dashboard->getPHID())
|
||||
->setTransactions($xactions);
|
||||
|
||||
return $timeline;
|
||||
}
|
||||
|
||||
}
|
|
@ -35,7 +35,6 @@ final class PhabricatorDashboardManageController
|
|||
$header = $this->buildHeaderView($dashboard);
|
||||
$actions = $this->buildActionView($dashboard);
|
||||
$properties = $this->buildPropertyView($dashboard);
|
||||
$timeline = $this->buildTransactions($dashboard);
|
||||
|
||||
$properties->setActionList($actions);
|
||||
$box = id(new PHUIObjectBoxView())
|
||||
|
@ -52,7 +51,6 @@ final class PhabricatorDashboardManageController
|
|||
array(
|
||||
$crumbs,
|
||||
$box,
|
||||
$timeline,
|
||||
$rendered_dashboard,
|
||||
),
|
||||
array(
|
||||
|
@ -111,6 +109,12 @@ final class PhabricatorDashboardManageController
|
|||
->setHref($this->getApplicationURI($href_install))
|
||||
->setWorkflow(true));
|
||||
|
||||
$actions->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setName(pht('View History'))
|
||||
->setIcon('fa-history')
|
||||
->setHref($this->getApplicationURI("history/{$id}/")));
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
|
@ -138,24 +142,4 @@ final class PhabricatorDashboardManageController
|
|||
|
||||
return $properties;
|
||||
}
|
||||
|
||||
private function buildTransactions(PhabricatorDashboard $dashboard) {
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
|
||||
$xactions = id(new PhabricatorDashboardTransactionQuery())
|
||||
->setViewer($viewer)
|
||||
->withObjectPHIDs(array($dashboard->getPHID()))
|
||||
->execute();
|
||||
|
||||
$engine = id(new PhabricatorMarkupEngine())
|
||||
->setViewer($viewer);
|
||||
|
||||
$timeline = id(new PhabricatorApplicationTransactionView())
|
||||
->setUser($viewer)
|
||||
->setObjectPHID($dashboard->getPHID())
|
||||
->setTransactions($xactions);
|
||||
|
||||
return $timeline;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,14 +47,15 @@ final class PhabricatorDashboardPanelViewController
|
|||
$view = id(new PHUIBoxView())
|
||||
->addMargin(PHUI::MARGIN_LARGE_LEFT)
|
||||
->addMargin(PHUI::MARGIN_LARGE_RIGHT)
|
||||
->addMargin(PHUI::MARGIN_LARGE_TOP)
|
||||
->appendChild($rendered_panel);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
$crumbs,
|
||||
$box,
|
||||
$timeline,
|
||||
$view,
|
||||
$timeline,
|
||||
),
|
||||
array(
|
||||
'title' => $title,
|
||||
|
@ -155,6 +156,7 @@ final class PhabricatorDashboardPanelViewController
|
|||
|
||||
$timeline = id(new PhabricatorApplicationTransactionView())
|
||||
->setUser($viewer)
|
||||
->setShouldTerminate(true)
|
||||
->setObjectPHID($panel->getPHID())
|
||||
->setTransactions($xactions);
|
||||
|
||||
|
|
Loading…
Reference in a new issue