mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Add coverage tooltips in Diffusion file browse mode
Summary: Fixes T10816. The way these work is a little unusual since these chunks of file-rendering code are unusuall performance-sensitive, so the Differential version doesn't adapt directly to Diffusion. Both can possibly be unified at some point in the future, although they do slightly different things. Test Plan: {F1220170} Reviewers: chad Reviewed By: chad Maniphest Tasks: T10816 Differential Revision: https://secure.phabricator.com/D15719
This commit is contained in:
parent
fad9e043c3
commit
0534002894
3 changed files with 68 additions and 1 deletions
|
@ -393,6 +393,7 @@ return array(
|
||||||
'rsrc/js/application/diffusion/behavior-audit-preview.js' => 'd835b03a',
|
'rsrc/js/application/diffusion/behavior-audit-preview.js' => 'd835b03a',
|
||||||
'rsrc/js/application/diffusion/behavior-commit-branches.js' => 'bdaf4d04',
|
'rsrc/js/application/diffusion/behavior-commit-branches.js' => 'bdaf4d04',
|
||||||
'rsrc/js/application/diffusion/behavior-commit-graph.js' => '5a0b1a64',
|
'rsrc/js/application/diffusion/behavior-commit-graph.js' => '5a0b1a64',
|
||||||
|
'rsrc/js/application/diffusion/behavior-diffusion-browse-file.js' => '054a0f0b',
|
||||||
'rsrc/js/application/diffusion/behavior-jump-to.js' => '73d09eef',
|
'rsrc/js/application/diffusion/behavior-jump-to.js' => '73d09eef',
|
||||||
'rsrc/js/application/diffusion/behavior-load-blame.js' => '42126667',
|
'rsrc/js/application/diffusion/behavior-load-blame.js' => '42126667',
|
||||||
'rsrc/js/application/diffusion/behavior-locate-file.js' => '6d3e1947',
|
'rsrc/js/application/diffusion/behavior-locate-file.js' => '6d3e1947',
|
||||||
|
@ -606,6 +607,7 @@ return array(
|
||||||
'javelin-behavior-differential-populate' => '8694b1df',
|
'javelin-behavior-differential-populate' => '8694b1df',
|
||||||
'javelin-behavior-differential-toggle-files' => 'ca3f91eb',
|
'javelin-behavior-differential-toggle-files' => 'ca3f91eb',
|
||||||
'javelin-behavior-differential-user-select' => 'a8d8459d',
|
'javelin-behavior-differential-user-select' => 'a8d8459d',
|
||||||
|
'javelin-behavior-diffusion-browse-file' => '054a0f0b',
|
||||||
'javelin-behavior-diffusion-commit-branches' => 'bdaf4d04',
|
'javelin-behavior-diffusion-commit-branches' => 'bdaf4d04',
|
||||||
'javelin-behavior-diffusion-commit-graph' => '5a0b1a64',
|
'javelin-behavior-diffusion-commit-graph' => '5a0b1a64',
|
||||||
'javelin-behavior-diffusion-jump-to' => '73d09eef',
|
'javelin-behavior-diffusion-jump-to' => '73d09eef',
|
||||||
|
@ -918,6 +920,12 @@ return array(
|
||||||
'javelin-util',
|
'javelin-util',
|
||||||
'javelin-magical-init',
|
'javelin-magical-init',
|
||||||
),
|
),
|
||||||
|
'054a0f0b' => array(
|
||||||
|
'javelin-behavior',
|
||||||
|
'javelin-dom',
|
||||||
|
'javelin-util',
|
||||||
|
'phabricator-tooltip',
|
||||||
|
),
|
||||||
'056da01b' => array(
|
'056da01b' => array(
|
||||||
'aphront-typeahead-control-css',
|
'aphront-typeahead-control-css',
|
||||||
'phui-tag-view-css',
|
'phui-tag-view-css',
|
||||||
|
|
|
@ -1187,6 +1187,19 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
$commit_links = $this->renderCommitLinks($blame_commits, $handles);
|
$commit_links = $this->renderCommitLinks($blame_commits, $handles);
|
||||||
$revision_links = $this->renderRevisionLinks($revisions, $handles);
|
$revision_links = $this->renderRevisionLinks($revisions, $handles);
|
||||||
|
|
||||||
|
if ($this->coverage) {
|
||||||
|
require_celerity_resource('differential-changeset-view-css');
|
||||||
|
Javelin::initBehavior(
|
||||||
|
'diffusion-browse-file',
|
||||||
|
array(
|
||||||
|
'labels' => array(
|
||||||
|
'cov-C' => pht('Covered'),
|
||||||
|
'cov-N' => pht('Not Covered'),
|
||||||
|
'cov-U' => pht('Not Executable'),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
$skip_text = pht('Skip Past This Commit');
|
$skip_text = pht('Skip Past This Commit');
|
||||||
foreach ($display as $line_index => $line) {
|
foreach ($display as $line_index => $line) {
|
||||||
$row = array();
|
$row = array();
|
||||||
|
@ -1304,7 +1317,6 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($this->coverage) {
|
if ($this->coverage) {
|
||||||
require_celerity_resource('differential-changeset-view-css');
|
|
||||||
$cov_index = $line_index;
|
$cov_index = $line_index;
|
||||||
|
|
||||||
if (isset($this->coverage[$cov_index])) {
|
if (isset($this->coverage[$cov_index])) {
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
/**
|
||||||
|
* @provides javelin-behavior-diffusion-browse-file
|
||||||
|
* @requires javelin-behavior
|
||||||
|
* javelin-dom
|
||||||
|
* javelin-util
|
||||||
|
* phabricator-tooltip
|
||||||
|
*/
|
||||||
|
|
||||||
|
JX.behavior('diffusion-browse-file', function(config, statics) {
|
||||||
|
if (statics.installed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
statics.installed = true;
|
||||||
|
|
||||||
|
var map = config.labels;
|
||||||
|
|
||||||
|
JX.Stratcom.listen(
|
||||||
|
['mouseover', 'mouseout'],
|
||||||
|
['phabricator-source', 'tag:td'],
|
||||||
|
function(e) {
|
||||||
|
var target = e.getTarget();
|
||||||
|
|
||||||
|
// NOTE: We're using raw classnames instead of sigils and metadata here
|
||||||
|
// because these elements are unusual: there are a lot of them on the
|
||||||
|
// page, and rendering all the extra metadata to do this in a normal way
|
||||||
|
// would be needlessly expensive. This is an unusual case.
|
||||||
|
|
||||||
|
if (!target.className.match(/cov-/)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.getType() == 'mouseout') {
|
||||||
|
JX.Tooltip.hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var k in map) {
|
||||||
|
if (!target.className.match(k)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var label = map[k];
|
||||||
|
JX.Tooltip.show(target, 300, 'E', label);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in a new issue