mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
76cefde0b3
Summary: Fixes T5373. Ref T5281. Several changes: - The `marshallExceptions` thing is useful if JS throws an exception when invoked from Flash, so set it. The resulting exceptions are a little odd (not escaped correctly, e.g.) but way better than nothing. - Put connection status in the notification menu. - When the connection fails, try to provide contextual help where we can. Test Plan: {F169493} Reviewers: chad, joshuaspence Reviewed By: joshuaspence Subscribers: epriestley Maniphest Tasks: T5281, T5373 Differential Revision: https://secure.phabricator.com/D9700
47 lines
962 B
JavaScript
47 lines
962 B
JavaScript
/**
|
|
* @provides javelin-behavior-aphlict-status
|
|
* @requires javelin-behavior
|
|
* javelin-aphlict
|
|
* phabricator-phtize
|
|
* javelin-dom
|
|
* @javelin
|
|
*/
|
|
|
|
JX.behavior('aphlict-status', function(config) {
|
|
var pht = JX.phtize(config.pht);
|
|
|
|
function update() {
|
|
var client = JX.Aphlict.getInstance();
|
|
if (!client) {
|
|
return;
|
|
}
|
|
|
|
var node;
|
|
try {
|
|
node = JX.$(config.nodeID);
|
|
} catch (ignored) {
|
|
return;
|
|
}
|
|
|
|
var tip = null;
|
|
var status = client.getStatus();
|
|
|
|
if (status == 'error') {
|
|
tip = pht(client.getStatusCode());
|
|
}
|
|
|
|
var status_node = JX.$N(
|
|
'span',
|
|
{
|
|
className: 'aphlict-connection-status-' + status,
|
|
sigil: tip ? 'has-tooltip' : null,
|
|
meta: tip ? {tip: tip, align: 'S', size: 300} : {}
|
|
},
|
|
pht(status));
|
|
|
|
JX.DOM.setContent(node, status_node);
|
|
}
|
|
|
|
JX.Aphlict.listen('didChangeStatus', update);
|
|
update();
|
|
});
|