mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 06:42:42 +01:00
When you swap between document rendering engines, populate or redraw blame if appropriate
Summary: Depends on D19311. Ref T13105. Currently, blame only renders on the initial request. Instead, redraw blame after swapping views. Test Plan: Swapped from "Source -> Hexdump -> Source" and "Hexdump -> Source". Saw blame on source in all cases. Maniphest Tasks: T13105 Differential Revision: https://secure.phabricator.com/D19312
This commit is contained in:
parent
eca7dc25f2
commit
eb80f0a2d9
2 changed files with 28 additions and 12 deletions
|
@ -390,7 +390,7 @@ return array(
|
|||
'rsrc/js/application/diffusion/behavior-pull-lastmodified.js' => 'f01586dc',
|
||||
'rsrc/js/application/doorkeeper/behavior-doorkeeper-tag.js' => '1db13e70',
|
||||
'rsrc/js/application/drydock/drydock-live-operation-status.js' => '901935ef',
|
||||
'rsrc/js/application/files/behavior-document-engine.js' => 'ac52a3be',
|
||||
'rsrc/js/application/files/behavior-document-engine.js' => 'ed539253',
|
||||
'rsrc/js/application/files/behavior-icon-composer.js' => '8499b6ab',
|
||||
'rsrc/js/application/files/behavior-launch-icon-composer.js' => '48086888',
|
||||
'rsrc/js/application/harbormaster/behavior-harbormaster-log.js' => '191b4909',
|
||||
|
@ -604,7 +604,7 @@ return array(
|
|||
'javelin-behavior-diffusion-jump-to' => '73d09eef',
|
||||
'javelin-behavior-diffusion-locate-file' => '6d3e1947',
|
||||
'javelin-behavior-diffusion-pull-lastmodified' => 'f01586dc',
|
||||
'javelin-behavior-document-engine' => 'ac52a3be',
|
||||
'javelin-behavior-document-engine' => 'ed539253',
|
||||
'javelin-behavior-doorkeeper-tag' => '1db13e70',
|
||||
'javelin-behavior-drydock-live-operation-status' => '901935ef',
|
||||
'javelin-behavior-durable-column' => '2ae077e1',
|
||||
|
@ -1764,11 +1764,6 @@ return array(
|
|||
'javelin-dom',
|
||||
'javelin-typeahead-normalizer',
|
||||
),
|
||||
'ac52a3be' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
),
|
||||
'acd29eee' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
|
@ -2121,6 +2116,11 @@ return array(
|
|||
'javelin-stratcom',
|
||||
'javelin-vector',
|
||||
),
|
||||
'ed539253' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
),
|
||||
'edf8a145' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-uri',
|
||||
|
|
|
@ -151,7 +151,7 @@ JX.behavior('document-engine', function(config, statics) {
|
|||
}
|
||||
|
||||
data.sequence = (data.sequence || 0) + 1;
|
||||
var handler = JX.bind(null, onrender, data, data.sequence);
|
||||
var handler = JX.bind(null, onrender, data, data.sequence, spec);
|
||||
|
||||
data.viewKey = spec.viewKey;
|
||||
|
||||
|
@ -190,7 +190,7 @@ JX.behavior('document-engine', function(config, statics) {
|
|||
JX.DOM.setContent(viewport, JX.$H(spec.loadingMarkup));
|
||||
}
|
||||
|
||||
function onrender(data, sequence, r) {
|
||||
function onrender(data, sequence, spec, r) {
|
||||
// If this isn't the most recent request we sent, throw it away. This can
|
||||
// happen if the user makes multiple selections from the menu while we are
|
||||
// still rendering the first view.
|
||||
|
@ -209,19 +209,34 @@ JX.behavior('document-engine', function(config, statics) {
|
|||
data.loadingView = false;
|
||||
|
||||
JX.DOM.setContent(viewport, JX.$H(r.markup));
|
||||
|
||||
// If this engine supports rendering blame, populate or draw it.
|
||||
if (spec.canBlame) {
|
||||
blame(data);
|
||||
}
|
||||
}
|
||||
|
||||
function blame(data) {
|
||||
// If the rendering engine can't handle blame, bail.
|
||||
if (!data.blame.uri) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.blame.value) {
|
||||
new JX.Request(data.blame.uri, JX.bind(null, onblame, data))
|
||||
.send();
|
||||
// If we already have an outstanding request for blame data, bail.
|
||||
if (data.blame.request) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we don't have blame data yet, request it and then try rendering
|
||||
// again later.
|
||||
if (!data.blame.value) {
|
||||
var req = new JX.Request(data.blame.uri, JX.bind(null, onblame, data));
|
||||
data.blame.request = req;
|
||||
req.send();
|
||||
return;
|
||||
}
|
||||
|
||||
// We're ready to render.
|
||||
var viewport = JX.$(data.viewportID);
|
||||
|
||||
var cells = JX.DOM.scry(viewport, 'th');
|
||||
|
@ -253,6 +268,7 @@ JX.behavior('document-engine', function(config, statics) {
|
|||
}
|
||||
|
||||
function onblame(data, r) {
|
||||
data.blame.request = null;
|
||||
data.blame.value = r;
|
||||
blame(data);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue