mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +01:00
Settings History
Summary: Shows a timeline of all modified settings Fixes T6545 Will show all settings (no pagination, should be not so difficult to add if needed but most installs won't have hundreds of settings changes) I'm not happy by how the PhabricatorConfigTransaction object is instructed to render the config keys but i don't see any other reasonable way. We could always show the keys though. Test Plan: Changed settings and called the history page Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6545 Differential Revision: https://secure.phabricator.com/D11088
This commit is contained in:
parent
1ff6972f7e
commit
86eb7c0ec4
6 changed files with 103 additions and 1 deletions
|
@ -1479,6 +1479,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorConfigEntryQuery' => 'applications/config/query/PhabricatorConfigEntryQuery.php',
|
'PhabricatorConfigEntryQuery' => 'applications/config/query/PhabricatorConfigEntryQuery.php',
|
||||||
'PhabricatorConfigFileSource' => 'infrastructure/env/PhabricatorConfigFileSource.php',
|
'PhabricatorConfigFileSource' => 'infrastructure/env/PhabricatorConfigFileSource.php',
|
||||||
'PhabricatorConfigGroupController' => 'applications/config/controller/PhabricatorConfigGroupController.php',
|
'PhabricatorConfigGroupController' => 'applications/config/controller/PhabricatorConfigGroupController.php',
|
||||||
|
'PhabricatorConfigHistoryController' => 'applications/config/controller/PhabricatorConfigHistoryController.php',
|
||||||
'PhabricatorConfigIgnoreController' => 'applications/config/controller/PhabricatorConfigIgnoreController.php',
|
'PhabricatorConfigIgnoreController' => 'applications/config/controller/PhabricatorConfigIgnoreController.php',
|
||||||
'PhabricatorConfigIssueListController' => 'applications/config/controller/PhabricatorConfigIssueListController.php',
|
'PhabricatorConfigIssueListController' => 'applications/config/controller/PhabricatorConfigIssueListController.php',
|
||||||
'PhabricatorConfigIssueViewController' => 'applications/config/controller/PhabricatorConfigIssueViewController.php',
|
'PhabricatorConfigIssueViewController' => 'applications/config/controller/PhabricatorConfigIssueViewController.php',
|
||||||
|
@ -4641,6 +4642,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorConfigEntryQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorConfigEntryQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PhabricatorConfigFileSource' => 'PhabricatorConfigProxySource',
|
'PhabricatorConfigFileSource' => 'PhabricatorConfigProxySource',
|
||||||
'PhabricatorConfigGroupController' => 'PhabricatorConfigController',
|
'PhabricatorConfigGroupController' => 'PhabricatorConfigController',
|
||||||
|
'PhabricatorConfigHistoryController' => 'PhabricatorConfigController',
|
||||||
'PhabricatorConfigIgnoreController' => 'PhabricatorConfigController',
|
'PhabricatorConfigIgnoreController' => 'PhabricatorConfigController',
|
||||||
'PhabricatorConfigIssueListController' => 'PhabricatorConfigController',
|
'PhabricatorConfigIssueListController' => 'PhabricatorConfigController',
|
||||||
'PhabricatorConfigIssueViewController' => 'PhabricatorConfigController',
|
'PhabricatorConfigIssueViewController' => 'PhabricatorConfigController',
|
||||||
|
|
|
@ -39,6 +39,7 @@ final class PhabricatorConfigApplication extends PhabricatorApplication {
|
||||||
'/config/' => array(
|
'/config/' => array(
|
||||||
'' => 'PhabricatorConfigListController',
|
'' => 'PhabricatorConfigListController',
|
||||||
'all/' => 'PhabricatorConfigAllController',
|
'all/' => 'PhabricatorConfigAllController',
|
||||||
|
'history/' => 'PhabricatorConfigHistoryController',
|
||||||
'edit/(?P<key>[\w\.\-]+)/' => 'PhabricatorConfigEditController',
|
'edit/(?P<key>[\w\.\-]+)/' => 'PhabricatorConfigEditController',
|
||||||
'group/(?P<key>[^/]+)/' => 'PhabricatorConfigGroupController',
|
'group/(?P<key>[^/]+)/' => 'PhabricatorConfigGroupController',
|
||||||
'welcome/' => 'PhabricatorConfigWelcomeController',
|
'welcome/' => 'PhabricatorConfigWelcomeController',
|
||||||
|
|
|
@ -14,6 +14,7 @@ abstract class PhabricatorConfigController extends PhabricatorController {
|
||||||
$nav->addLabel(pht('Configuration'));
|
$nav->addLabel(pht('Configuration'));
|
||||||
$nav->addFilter('/', pht('Browse Settings'));
|
$nav->addFilter('/', pht('Browse Settings'));
|
||||||
$nav->addFilter('all/', pht('All Settings'));
|
$nav->addFilter('all/', pht('All Settings'));
|
||||||
|
$nav->addFilter('history/', pht('Settings History'));
|
||||||
$nav->addLabel(pht('Setup'));
|
$nav->addLabel(pht('Setup'));
|
||||||
$nav->addFilter('issue/', pht('Setup Issues'));
|
$nav->addFilter('issue/', pht('Setup Issues'));
|
||||||
$nav->addLabel(pht('Database'));
|
$nav->addLabel(pht('Database'));
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorConfigHistoryController
|
||||||
|
extends PhabricatorConfigController {
|
||||||
|
|
||||||
|
|
||||||
|
public function processRequest() {
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$user = $request->getUser();
|
||||||
|
|
||||||
|
$xactions = id(new PhabricatorConfigTransactionQuery())
|
||||||
|
->setViewer($user)
|
||||||
|
->needComments(true)
|
||||||
|
->setReversePaging(false)
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$object = new PhabricatorConfigEntry();
|
||||||
|
|
||||||
|
$xaction = $object->getApplicationTransactionTemplate();
|
||||||
|
|
||||||
|
$view = $xaction->getApplicationTransactionViewObject();
|
||||||
|
|
||||||
|
$timeline = $view
|
||||||
|
->setUser($user)
|
||||||
|
->setTransactions($xactions)
|
||||||
|
->setRenderAsFeed(true)
|
||||||
|
->setObjectPHID(PhabricatorPHIDConstants::PHID_VOID);
|
||||||
|
|
||||||
|
$timeline->setShouldTerminate(true);
|
||||||
|
|
||||||
|
$object->willRenderTimeline($timeline, $this->getRequest());
|
||||||
|
|
||||||
|
$title = pht('Settings History');
|
||||||
|
|
||||||
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
|
$crumbs->addTextCrumb('Config', $this->getApplicationURI());
|
||||||
|
|
||||||
|
$crumbs->addTextCrumb($title, '/config/history/');
|
||||||
|
|
||||||
|
return $this->buildApplicationPage(
|
||||||
|
array(
|
||||||
|
$crumbs,
|
||||||
|
$timeline,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'title' => $title,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -55,6 +55,44 @@ final class PhabricatorConfigTransaction
|
||||||
return parent::getTitle();
|
return parent::getTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTitleForFeed(PhabricatorFeedStory $story = null) {
|
||||||
|
$author_phid = $this->getAuthorPHID();
|
||||||
|
|
||||||
|
$old = $this->getOldValue();
|
||||||
|
$new = $this->getNewValue();
|
||||||
|
|
||||||
|
switch ($this->getTransactionType()) {
|
||||||
|
case self::TYPE_EDIT:
|
||||||
|
$old_del = idx($old, 'deleted');
|
||||||
|
$new_del = idx($new, 'deleted');
|
||||||
|
if ($old_del && !$new_del) {
|
||||||
|
return pht(
|
||||||
|
'%s created %s.',
|
||||||
|
$this->renderHandleLink($author_phid),
|
||||||
|
$this->getObject()->getConfigKey());
|
||||||
|
} else if (!$old_del && $new_del) {
|
||||||
|
return pht(
|
||||||
|
'%s deleted %s.',
|
||||||
|
$this->renderHandleLink($author_phid),
|
||||||
|
$this->getObject()->getConfigKey());
|
||||||
|
} else if ($old_del && $new_del) {
|
||||||
|
// This is a bug.
|
||||||
|
return pht(
|
||||||
|
'%s deleted %s (again?).',
|
||||||
|
$this->renderHandleLink($author_phid),
|
||||||
|
$this->getObject()->getConfigKey());
|
||||||
|
} else {
|
||||||
|
return pht(
|
||||||
|
'%s edited %s.',
|
||||||
|
$this->renderHandleLink($author_phid),
|
||||||
|
$this->getObject()->getConfigKey());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getIcon() {
|
public function getIcon() {
|
||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
|
|
|
@ -14,8 +14,14 @@ class PhabricatorApplicationTransactionView extends AphrontView {
|
||||||
private $quoteTargetID;
|
private $quoteTargetID;
|
||||||
private $quoteRef;
|
private $quoteRef;
|
||||||
private $pager;
|
private $pager;
|
||||||
|
private $renderAsFeed;
|
||||||
private $renderData = array();
|
private $renderData = array();
|
||||||
|
|
||||||
|
public function setRenderAsFeed($feed) {
|
||||||
|
$this->renderAsFeed = $feed;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function setQuoteRef($quote_ref) {
|
public function setQuoteRef($quote_ref) {
|
||||||
$this->quoteRef = $quote_ref;
|
$this->quoteRef = $quote_ref;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -390,7 +396,11 @@ class PhabricatorApplicationTransactionView extends AphrontView {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->shouldSuppressTitle($xaction, $group)) {
|
if (!$this->shouldSuppressTitle($xaction, $group)) {
|
||||||
$title = $xaction->getTitle();
|
if ($this->renderAsFeed) {
|
||||||
|
$title = $xaction->getTitleForFeed();
|
||||||
|
} else {
|
||||||
|
$title = $xaction->getTitle();
|
||||||
|
}
|
||||||
if ($xaction->hasChangeDetails()) {
|
if ($xaction->hasChangeDetails()) {
|
||||||
if (!$this->isPreview) {
|
if (!$this->isPreview) {
|
||||||
$details = $this->buildChangeDetailsLink($xaction);
|
$details = $this->buildChangeDetailsLink($xaction);
|
||||||
|
|
Loading…
Reference in a new issue