mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Fix 'Transcript' links in Differential
Summary: add filtering for MetaMTA transcripts, add Herald transcripts, also fixed PhabricatorObjectHandleData to support commits. Note that paging in the transcripts pages will be in a different diff. Test Plan: test the transcripts for both MetaMTA and Herald. Reviewed By: epriestley Reviewers: epriestley, tuomaspelkonen CC: jungejason, epriestley Differential Revision: 114
This commit is contained in:
parent
73bf36505b
commit
cca849c762
8 changed files with 70 additions and 48 deletions
|
@ -313,6 +313,12 @@ class DifferentialRevisionViewController extends DifferentialController {
|
||||||
'href' => "/mail/?phid={$revision_phid}",
|
'href' => "/mail/?phid={$revision_phid}",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$links[] = array(
|
||||||
|
'class' => 'transcripts-herald',
|
||||||
|
'name' => 'Herald Transcripts',
|
||||||
|
'href' => "/herald/transcript/?phid={$revision_phid}",
|
||||||
|
);
|
||||||
|
|
||||||
return $links;
|
return $links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,12 +24,26 @@ class HeraldTranscriptListController extends HeraldController {
|
||||||
|
|
||||||
// Pull these objects manually since the serialized fields are gigantic.
|
// Pull these objects manually since the serialized fields are gigantic.
|
||||||
$transcript = new HeraldTranscript();
|
$transcript = new HeraldTranscript();
|
||||||
|
|
||||||
|
$conn_r = $transcript->establishConnection('r');
|
||||||
|
$phid = $request->getStr('phid');
|
||||||
|
$where_clause = '';
|
||||||
|
if ($phid) {
|
||||||
|
$where_clause = qsprintf(
|
||||||
|
$conn_r,
|
||||||
|
'WHERE objectPHID = %s',
|
||||||
|
$phid
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$data = queryfx_all(
|
$data = queryfx_all(
|
||||||
$transcript->establishConnection('r'),
|
$conn_r,
|
||||||
'SELECT id, objectPHID, time, duration, dryRun FROM %T
|
'SELECT id, objectPHID, time, duration, dryRun FROM %T
|
||||||
|
%Q
|
||||||
ORDER BY id DESC
|
ORDER BY id DESC
|
||||||
LIMIT 100',
|
LIMIT 100',
|
||||||
$transcript->getTableName());
|
$transcript->getTableName(),
|
||||||
|
$where_clause);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
phutil_require_module('phabricator', 'applications/herald/controller/base');
|
phutil_require_module('phabricator', 'applications/herald/controller/base');
|
||||||
phutil_require_module('phabricator', 'applications/herald/storage/transcript/base');
|
phutil_require_module('phabricator', 'applications/herald/storage/transcript/base');
|
||||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||||
|
phutil_require_module('phabricator', 'storage/qsprintf');
|
||||||
phutil_require_module('phabricator', 'storage/queryfx');
|
phutil_require_module('phabricator', 'storage/queryfx');
|
||||||
phutil_require_module('phabricator', 'view/control/table');
|
phutil_require_module('phabricator', 'view/control/table');
|
||||||
phutil_require_module('phabricator', 'view/layout/panel');
|
phutil_require_module('phabricator', 'view/layout/panel');
|
||||||
|
|
|
@ -19,8 +19,16 @@
|
||||||
class PhabricatorMetaMTAListController extends PhabricatorMetaMTAController {
|
class PhabricatorMetaMTAListController extends PhabricatorMetaMTAController {
|
||||||
|
|
||||||
public function processRequest() {
|
public function processRequest() {
|
||||||
$mails = id(new PhabricatorMetaMTAMail())->loadAllWhere(
|
$related_phid = $this->getRequest()->getStr('phid');
|
||||||
'1 = 1 ORDER BY id DESC LIMIT 100');
|
|
||||||
|
if ($related_phid) {
|
||||||
|
$mails = id(new PhabricatorMetaMTAMail())->loadAllWhere(
|
||||||
|
'relatedPHID = %s ORDER BY id DESC LIMIT 100',
|
||||||
|
$related_phid);
|
||||||
|
} else {
|
||||||
|
$mails = id(new PhabricatorMetaMTAMail())->loadAllWhere(
|
||||||
|
'1 = 1 ORDER BY id DESC LIMIT 100');
|
||||||
|
}
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach ($mails as $mail) {
|
foreach ($mails as $mail) {
|
||||||
|
|
|
@ -134,6 +134,36 @@ class PhabricatorObjectHandleData {
|
||||||
$handles[$phid] = $handle;
|
$handles[$phid] = $handle;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case PhabricatorPHIDConstants::PHID_TYPE_CMIT:
|
||||||
|
$class = 'PhabricatorRepositoryCommit';
|
||||||
|
PhutilSymbolLoader::loadClass($class);
|
||||||
|
$object = newv($class, array());
|
||||||
|
|
||||||
|
$commits = $object->loadAllWhere('phid in (%Ls)', $phids);
|
||||||
|
$commits = mpull($commits, null, 'getPHID');
|
||||||
|
|
||||||
|
$repository_ids = mpull($commits, 'getRepositoryID');
|
||||||
|
$repositories = id(new PhabricatorRepository())->loadAllWhere(
|
||||||
|
'id in (%Ld)', array_unique($repository_ids));
|
||||||
|
$callsigns = mpull($repositories, 'getCallsign');
|
||||||
|
|
||||||
|
foreach ($phids as $phid) {
|
||||||
|
$handle = new PhabricatorObjectHandle();
|
||||||
|
$handle->setPHID($phid);
|
||||||
|
$handle->setType($type);
|
||||||
|
if (empty($commits[$phid])) {
|
||||||
|
$handle->setName('Unknown Commit');
|
||||||
|
} else {
|
||||||
|
$commit = $commits[$phid];
|
||||||
|
$callsign = $callsigns[$repository_ids[$phid]];
|
||||||
|
$commit_identifier = $commit->getCommitIdentifier();
|
||||||
|
$handle->setName('Commit '.'r'.$callsign.$commit_identifier);
|
||||||
|
$handle->setURI('/r'.$callsign.$commit_identifier);
|
||||||
|
$handle->setFullName('r'.$callsign.$commit_identifier);
|
||||||
|
}
|
||||||
|
$handles[$phid] = $handle;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case PhabricatorPHIDConstants::PHID_TYPE_TASK:
|
case PhabricatorPHIDConstants::PHID_TYPE_TASK:
|
||||||
$class = 'ManiphestTask';
|
$class = 'ManiphestTask';
|
||||||
PhutilSymbolLoader::loadClass($class);
|
PhutilSymbolLoader::loadClass($class);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
phutil_require_module('phabricator', 'applications/files/uri');
|
phutil_require_module('phabricator', 'applications/files/uri');
|
||||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||||
phutil_require_module('phabricator', 'applications/phid/handle');
|
phutil_require_module('phabricator', 'applications/phid/handle');
|
||||||
|
phutil_require_module('phabricator', 'applications/repository/storage/repository');
|
||||||
phutil_require_module('phabricator', 'infrastructure/env');
|
phutil_require_module('phabricator', 'infrastructure/env');
|
||||||
|
|
||||||
phutil_require_module('phutil', 'symbols');
|
phutil_require_module('phutil', 'symbols');
|
||||||
|
|
|
@ -50,4 +50,9 @@
|
||||||
|
|
||||||
.aphront-headsup-action-list .transcripts-metamta {
|
.aphront-headsup-action-list .transcripts-metamta {
|
||||||
background-image: url(/rsrc/image/icon/tango/log.png);
|
background-image: url(/rsrc/image/icon/tango/log.png);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aphront-headsup-action-list .transcripts-herald {
|
||||||
|
background-image: url(/rsrc/image/icon/tango/log.png);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,46 +28,3 @@
|
||||||
margin-right: 265px;
|
margin-right: 265px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.differential-revision-actions {
|
|
||||||
float: right;
|
|
||||||
width: 250px;
|
|
||||||
background: #cfcfbf;
|
|
||||||
border: 1px solid #666622;
|
|
||||||
border-width: 0px 0px 1px 1px;
|
|
||||||
margin: -15px -20px 1em 0;
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-revision-actions a,
|
|
||||||
.differential-revision-actions span {
|
|
||||||
background-position: 8px center;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
display: block;
|
|
||||||
padding: 4px 4px 4px 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-revision-actions span.unavailable {
|
|
||||||
color: #666666;
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-revision-actions .subscribe-rem {
|
|
||||||
background-image: url(/rsrc/image/icon/unsubscribe.png);
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-revision-actions .subscribe-add {
|
|
||||||
background-image: url(/rsrc/image/icon/subscribe.png);
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-revision-actions .revision-edit {
|
|
||||||
background-image: url(/rsrc/image/icon/tango/edit.png);
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-revision-actions .attach-maniphest {
|
|
||||||
background-image: url(/rsrc/image/icon/tango/attachment.png);
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-revision-actions .transcripts-metamta {
|
|
||||||
background-image: url(/rsrc/image/icon/tango/log.png);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue