1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 23:40:57 +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:
lkassianik 2014-05-24 12:29:27 -07:00 committed by epriestley
parent eace05e4a5
commit 7de4e80907
5 changed files with 80 additions and 23 deletions

View file

@ -1467,6 +1467,7 @@ phutil_register_library_map(array(
'PhabricatorDashboardController' => 'applications/dashboard/controller/PhabricatorDashboardController.php', 'PhabricatorDashboardController' => 'applications/dashboard/controller/PhabricatorDashboardController.php',
'PhabricatorDashboardDAO' => 'applications/dashboard/storage/PhabricatorDashboardDAO.php', 'PhabricatorDashboardDAO' => 'applications/dashboard/storage/PhabricatorDashboardDAO.php',
'PhabricatorDashboardEditController' => 'applications/dashboard/controller/PhabricatorDashboardEditController.php', 'PhabricatorDashboardEditController' => 'applications/dashboard/controller/PhabricatorDashboardEditController.php',
'PhabricatorDashboardHistoryController' => 'applications/dashboard/controller/PhabricatorDashboardHistoryController.php',
'PhabricatorDashboardInstall' => 'applications/dashboard/storage/PhabricatorDashboardInstall.php', 'PhabricatorDashboardInstall' => 'applications/dashboard/storage/PhabricatorDashboardInstall.php',
'PhabricatorDashboardInstallController' => 'applications/dashboard/controller/PhabricatorDashboardInstallController.php', 'PhabricatorDashboardInstallController' => 'applications/dashboard/controller/PhabricatorDashboardInstallController.php',
'PhabricatorDashboardLayoutConfig' => 'applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php', 'PhabricatorDashboardLayoutConfig' => 'applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php',
@ -4266,6 +4267,7 @@ phutil_register_library_map(array(
'PhabricatorDashboardController' => 'PhabricatorController', 'PhabricatorDashboardController' => 'PhabricatorController',
'PhabricatorDashboardDAO' => 'PhabricatorLiskDAO', 'PhabricatorDashboardDAO' => 'PhabricatorLiskDAO',
'PhabricatorDashboardEditController' => 'PhabricatorDashboardController', 'PhabricatorDashboardEditController' => 'PhabricatorDashboardController',
'PhabricatorDashboardHistoryController' => 'PhabricatorDashboardController',
'PhabricatorDashboardInstall' => 'PhabricatorDashboardDAO', 'PhabricatorDashboardInstall' => 'PhabricatorDashboardDAO',
'PhabricatorDashboardInstallController' => 'PhabricatorDashboardController', 'PhabricatorDashboardInstallController' => 'PhabricatorDashboardController',
'PhabricatorDashboardListController' => 'PhabricatorDashboardController', 'PhabricatorDashboardListController' => 'PhabricatorDashboardController',

View file

@ -22,6 +22,7 @@ final class PhabricatorApplicationDashboard extends PhabricatorApplication {
=> 'PhabricatorDashboardListController', => 'PhabricatorDashboardListController',
'view/(?P<id>\d+)/' => 'PhabricatorDashboardViewController', 'view/(?P<id>\d+)/' => 'PhabricatorDashboardViewController',
'manage/(?P<id>\d+)/' => 'PhabricatorDashboardManageController', 'manage/(?P<id>\d+)/' => 'PhabricatorDashboardManageController',
'history/(?P<id>\d+)/' => 'PhabricatorDashboardHistoryController',
'create/' => 'PhabricatorDashboardEditController', 'create/' => 'PhabricatorDashboardEditController',
'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorDashboardEditController', 'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorDashboardEditController',
'install/(?P<id>\d+)/' => 'PhabricatorDashboardInstallController', 'install/(?P<id>\d+)/' => 'PhabricatorDashboardInstallController',

View file

@ -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;
}
}

View file

@ -35,7 +35,6 @@ final class PhabricatorDashboardManageController
$header = $this->buildHeaderView($dashboard); $header = $this->buildHeaderView($dashboard);
$actions = $this->buildActionView($dashboard); $actions = $this->buildActionView($dashboard);
$properties = $this->buildPropertyView($dashboard); $properties = $this->buildPropertyView($dashboard);
$timeline = $this->buildTransactions($dashboard);
$properties->setActionList($actions); $properties->setActionList($actions);
$box = id(new PHUIObjectBoxView()) $box = id(new PHUIObjectBoxView())
@ -52,7 +51,6 @@ final class PhabricatorDashboardManageController
array( array(
$crumbs, $crumbs,
$box, $box,
$timeline,
$rendered_dashboard, $rendered_dashboard,
), ),
array( array(
@ -111,6 +109,12 @@ final class PhabricatorDashboardManageController
->setHref($this->getApplicationURI($href_install)) ->setHref($this->getApplicationURI($href_install))
->setWorkflow(true)); ->setWorkflow(true));
$actions->addAction(
id(new PhabricatorActionView())
->setName(pht('View History'))
->setIcon('fa-history')
->setHref($this->getApplicationURI("history/{$id}/")));
return $actions; return $actions;
} }
@ -138,24 +142,4 @@ final class PhabricatorDashboardManageController
return $properties; 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;
}
} }

View file

@ -47,14 +47,15 @@ final class PhabricatorDashboardPanelViewController
$view = id(new PHUIBoxView()) $view = id(new PHUIBoxView())
->addMargin(PHUI::MARGIN_LARGE_LEFT) ->addMargin(PHUI::MARGIN_LARGE_LEFT)
->addMargin(PHUI::MARGIN_LARGE_RIGHT) ->addMargin(PHUI::MARGIN_LARGE_RIGHT)
->addMargin(PHUI::MARGIN_LARGE_TOP)
->appendChild($rendered_panel); ->appendChild($rendered_panel);
return $this->buildApplicationPage( return $this->buildApplicationPage(
array( array(
$crumbs, $crumbs,
$box, $box,
$timeline,
$view, $view,
$timeline,
), ),
array( array(
'title' => $title, 'title' => $title,
@ -155,6 +156,7 @@ final class PhabricatorDashboardPanelViewController
$timeline = id(new PhabricatorApplicationTransactionView()) $timeline = id(new PhabricatorApplicationTransactionView())
->setUser($viewer) ->setUser($viewer)
->setShouldTerminate(true)
->setObjectPHID($panel->getPHID()) ->setObjectPHID($panel->getPHID())
->setTransactions($xactions); ->setTransactions($xactions);