mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
5b619862cb
Summary: Ref T182. Replace the total mess we had before with a sort-of-reasonable element. This automatically updates using "javascript". Test Plan: {F901983} {F901984} Used "Land Revision", saw the land status go from "Waiting" -> "Working" -> "Landed" without having to mash reload over and over again. Reviewers: chad Reviewed By: chad Maniphest Tasks: T182 Differential Revision: https://secure.phabricator.com/D14314
32 lines
606 B
JavaScript
32 lines
606 B
JavaScript
/**
|
|
* @provides javelin-behavior-drydock-live-operation-status
|
|
* @requires javelin-behavior
|
|
* javelin-dom
|
|
* javelin-request
|
|
* @javelin
|
|
*/
|
|
|
|
JX.behavior('drydock-live-operation-status', function(config) {
|
|
var node = JX.$(config.statusID);
|
|
|
|
function update() {
|
|
new JX.Request(config.updateURI, onresponse)
|
|
.send();
|
|
}
|
|
|
|
function onresponse(r) {
|
|
var new_node = JX.$H(r.markup).getNode();
|
|
JX.DOM.replace(node, new_node);
|
|
node = new_node;
|
|
|
|
if (r.isUnderway) {
|
|
poll();
|
|
}
|
|
}
|
|
|
|
function poll() {
|
|
setTimeout(update, 1000);
|
|
}
|
|
|
|
poll();
|
|
});
|