mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Support new data export infrastructure in Maniphest
Summary: Depends on D18958. Ref T13049. Support the new stuff. There are a couple more fields this needs to strictly improve on the old export, but I'll add them as extensions shortly. Test Plan: Exported tasks to Excel, saw reasonble-looking data in the export. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13049 Differential Revision: https://secure.phabricator.com/D18959
This commit is contained in:
parent
00b4eae1f4
commit
2ac4e1991b
4 changed files with 114 additions and 1 deletions
|
@ -4322,6 +4322,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorUIExample' => 'applications/uiexample/examples/PhabricatorUIExample.php',
|
'PhabricatorUIExample' => 'applications/uiexample/examples/PhabricatorUIExample.php',
|
||||||
'PhabricatorUIExampleRenderController' => 'applications/uiexample/controller/PhabricatorUIExampleRenderController.php',
|
'PhabricatorUIExampleRenderController' => 'applications/uiexample/controller/PhabricatorUIExampleRenderController.php',
|
||||||
'PhabricatorUIExamplesApplication' => 'applications/uiexample/application/PhabricatorUIExamplesApplication.php',
|
'PhabricatorUIExamplesApplication' => 'applications/uiexample/application/PhabricatorUIExamplesApplication.php',
|
||||||
|
'PhabricatorURIExportField' => 'infrastructure/export/field/PhabricatorURIExportField.php',
|
||||||
'PhabricatorUSEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php',
|
'PhabricatorUSEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php',
|
||||||
'PhabricatorUnifiedDiffsSetting' => 'applications/settings/setting/PhabricatorUnifiedDiffsSetting.php',
|
'PhabricatorUnifiedDiffsSetting' => 'applications/settings/setting/PhabricatorUnifiedDiffsSetting.php',
|
||||||
'PhabricatorUnitTestContentSource' => 'infrastructure/contentsource/PhabricatorUnitTestContentSource.php',
|
'PhabricatorUnitTestContentSource' => 'infrastructure/contentsource/PhabricatorUnitTestContentSource.php',
|
||||||
|
@ -10023,6 +10024,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorUIExample' => 'Phobject',
|
'PhabricatorUIExample' => 'Phobject',
|
||||||
'PhabricatorUIExampleRenderController' => 'PhabricatorController',
|
'PhabricatorUIExampleRenderController' => 'PhabricatorController',
|
||||||
'PhabricatorUIExamplesApplication' => 'PhabricatorApplication',
|
'PhabricatorUIExamplesApplication' => 'PhabricatorApplication',
|
||||||
|
'PhabricatorURIExportField' => 'PhabricatorExportField',
|
||||||
'PhabricatorUSEnglishTranslation' => 'PhutilTranslation',
|
'PhabricatorUSEnglishTranslation' => 'PhutilTranslation',
|
||||||
'PhabricatorUnifiedDiffsSetting' => 'PhabricatorSelectSetting',
|
'PhabricatorUnifiedDiffsSetting' => 'PhabricatorSelectSetting',
|
||||||
'PhabricatorUnitTestContentSource' => 'PhabricatorContentSource',
|
'PhabricatorUnitTestContentSource' => 'PhabricatorContentSource',
|
||||||
|
|
|
@ -50,7 +50,7 @@ final class PhabricatorManiphestApplication extends PhabricatorApplication {
|
||||||
return array(
|
return array(
|
||||||
'/T(?P<id>[1-9]\d*)' => 'ManiphestTaskDetailController',
|
'/T(?P<id>[1-9]\d*)' => 'ManiphestTaskDetailController',
|
||||||
'/maniphest/' => array(
|
'/maniphest/' => array(
|
||||||
'(?:query/(?P<queryKey>[^/]+)/)?' => 'ManiphestTaskListController',
|
$this->getQueryRoutePattern() => 'ManiphestTaskListController',
|
||||||
'report/(?:(?P<view>\w+)/)?' => 'ManiphestReportController',
|
'report/(?:(?P<view>\w+)/)?' => 'ManiphestReportController',
|
||||||
$this->getBulkRoutePattern('bulk/') => 'ManiphestBulkEditController',
|
$this->getBulkRoutePattern('bulk/') => 'ManiphestBulkEditController',
|
||||||
'task/' => array(
|
'task/' => array(
|
||||||
|
|
|
@ -432,4 +432,111 @@ final class ManiphestTaskSearchEngine
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function newExportFields() {
|
||||||
|
$fields = array(
|
||||||
|
id(new PhabricatorStringExportField())
|
||||||
|
->setKey('monogram')
|
||||||
|
->setLabel(pht('Monogram')),
|
||||||
|
id(new PhabricatorPHIDExportField())
|
||||||
|
->setKey('authorPHID')
|
||||||
|
->setLabel(pht('Author PHID')),
|
||||||
|
id(new PhabricatorStringExportField())
|
||||||
|
->setKey('author')
|
||||||
|
->setLabel(pht('Author')),
|
||||||
|
id(new PhabricatorPHIDExportField())
|
||||||
|
->setKey('ownerPHID')
|
||||||
|
->setLabel(pht('Owner PHID')),
|
||||||
|
id(new PhabricatorStringExportField())
|
||||||
|
->setKey('owner')
|
||||||
|
->setLabel(pht('Owner')),
|
||||||
|
id(new PhabricatorStringExportField())
|
||||||
|
->setKey('status')
|
||||||
|
->setLabel(pht('Status')),
|
||||||
|
id(new PhabricatorStringExportField())
|
||||||
|
->setKey('statusName')
|
||||||
|
->setLabel(pht('Status Name')),
|
||||||
|
id(new PhabricatorStringExportField())
|
||||||
|
->setKey('priority')
|
||||||
|
->setLabel(pht('Priority')),
|
||||||
|
id(new PhabricatorStringExportField())
|
||||||
|
->setKey('priorityName')
|
||||||
|
->setLabel(pht('Priority Name')),
|
||||||
|
id(new PhabricatorStringExportField())
|
||||||
|
->setKey('subtype')
|
||||||
|
->setLabel('string'),
|
||||||
|
id(new PhabricatorURIExportField())
|
||||||
|
->setKey('uri')
|
||||||
|
->setLabel(pht('URI')),
|
||||||
|
id(new PhabricatorStringExportField())
|
||||||
|
->setKey('title')
|
||||||
|
->setLabel(pht('Title')),
|
||||||
|
id(new PhabricatorStringExportField())
|
||||||
|
->setKey('description')
|
||||||
|
->setLabel(pht('Description')),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (ManiphestTaskPoints::getIsEnabled()) {
|
||||||
|
$fields[] = id(new PhabricatorIntExportField())
|
||||||
|
->setKey('points')
|
||||||
|
->setLabel('Points');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function newExportData(array $tasks) {
|
||||||
|
$viewer = $this->requireViewer();
|
||||||
|
|
||||||
|
$phids = array();
|
||||||
|
foreach ($tasks as $task) {
|
||||||
|
$phids[] = $task->getAuthorPHID();
|
||||||
|
$phids[] = $task->getOwnerPHID();
|
||||||
|
}
|
||||||
|
$handles = $viewer->loadHandles($phids);
|
||||||
|
|
||||||
|
$export = array();
|
||||||
|
foreach ($tasks as $task) {
|
||||||
|
|
||||||
|
$author_phid = $task->getAuthorPHID();
|
||||||
|
if ($author_phid) {
|
||||||
|
$author_name = $handles[$author_phid]->getName();
|
||||||
|
} else {
|
||||||
|
$author_name = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$owner_phid = $task->getOwnerPHID();
|
||||||
|
if ($owner_phid) {
|
||||||
|
$owner_name = $handles[$owner_phid]->getName();
|
||||||
|
} else {
|
||||||
|
$owner_name = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$status_value = $task->getStatus();
|
||||||
|
$status_name = ManiphestTaskStatus::getTaskStatusName($status_value);
|
||||||
|
|
||||||
|
$priority_value = $task->getPriority();
|
||||||
|
$priority_name = ManiphestTaskPriority::getTaskPriorityName(
|
||||||
|
$priority_value);
|
||||||
|
|
||||||
|
$export[] = array(
|
||||||
|
'monogram' => $task->getMonogram(),
|
||||||
|
'authorPHID' => $author_phid,
|
||||||
|
'author' => $author_name,
|
||||||
|
'ownerPHID' => $owner_phid,
|
||||||
|
'owner' => $owner_name,
|
||||||
|
'status' => $status_value,
|
||||||
|
'statusName' => $status_name,
|
||||||
|
'priority' => $priority_value,
|
||||||
|
'priorityName' => $priority_name,
|
||||||
|
'points' => $task->getPoints(),
|
||||||
|
'subtype' => $task->getSubtype(),
|
||||||
|
'title' => $task->getTitle(),
|
||||||
|
'uri' => PhabricatorEnv::getProductionURI($task->getURI()),
|
||||||
|
'description' => $task->getDescription(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $export;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorURIExportField
|
||||||
|
extends PhabricatorExportField {}
|
Loading…
Reference in a new issue