mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
Minor tidying of Aphlict code
Summary: Just some housekeeping... mostly just removing some unused variables. Test Plan: Checked that I was still about to receive notifications from `/notification/status/`. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11398
This commit is contained in:
parent
7ab5d108a4
commit
f55647736a
5 changed files with 63 additions and 74 deletions
|
@ -8,7 +8,7 @@
|
||||||
return array(
|
return array(
|
||||||
'names' => array(
|
'names' => array(
|
||||||
'core.pkg.css' => '8d1c0f87',
|
'core.pkg.css' => '8d1c0f87',
|
||||||
'core.pkg.js' => '27bb3264',
|
'core.pkg.js' => 'b6a9c22a',
|
||||||
'darkconsole.pkg.js' => '8ab24e01',
|
'darkconsole.pkg.js' => '8ab24e01',
|
||||||
'differential.pkg.css' => '8af45893',
|
'differential.pkg.css' => '8af45893',
|
||||||
'differential.pkg.js' => 'dad3622f',
|
'differential.pkg.js' => 'dad3622f',
|
||||||
|
@ -342,10 +342,10 @@ return array(
|
||||||
'rsrc/image/texture/table_header.png' => '5c433037',
|
'rsrc/image/texture/table_header.png' => '5c433037',
|
||||||
'rsrc/image/texture/table_header_hover.png' => '038ec3b9',
|
'rsrc/image/texture/table_header_hover.png' => '038ec3b9',
|
||||||
'rsrc/image/texture/table_header_tall.png' => 'd56b434f',
|
'rsrc/image/texture/table_header_tall.png' => 'd56b434f',
|
||||||
'rsrc/js/application/aphlict/Aphlict.js' => '464d333a',
|
'rsrc/js/application/aphlict/Aphlict.js' => 'b300dac3',
|
||||||
'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => 'f6bc26f0',
|
'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '335470d7',
|
||||||
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '1162a152',
|
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '62998733',
|
||||||
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => '58f7803f',
|
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761',
|
||||||
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
|
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
|
||||||
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
|
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
|
||||||
'rsrc/js/application/conpherence/behavior-menu.js' => 'f0a41b9f',
|
'rsrc/js/application/conpherence/behavior-menu.js' => 'f0a41b9f',
|
||||||
|
@ -535,11 +535,11 @@ return array(
|
||||||
'herald-rule-editor' => '335fd41f',
|
'herald-rule-editor' => '335fd41f',
|
||||||
'herald-test-css' => '778b008e',
|
'herald-test-css' => '778b008e',
|
||||||
'inline-comment-summary-css' => '8cfd34e8',
|
'inline-comment-summary-css' => '8cfd34e8',
|
||||||
'javelin-aphlict' => '464d333a',
|
'javelin-aphlict' => 'b300dac3',
|
||||||
'javelin-behavior' => '61cbc29a',
|
'javelin-behavior' => '61cbc29a',
|
||||||
'javelin-behavior-aphlict-dropdown' => 'f6bc26f0',
|
'javelin-behavior-aphlict-dropdown' => '335470d7',
|
||||||
'javelin-behavior-aphlict-listen' => '1162a152',
|
'javelin-behavior-aphlict-listen' => '62998733',
|
||||||
'javelin-behavior-aphlict-status' => '58f7803f',
|
'javelin-behavior-aphlict-status' => 'ea681761',
|
||||||
'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884',
|
'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884',
|
||||||
'javelin-behavior-aphront-crop' => 'fa0f4fc2',
|
'javelin-behavior-aphront-crop' => 'fa0f4fc2',
|
||||||
'javelin-behavior-aphront-drag-and-drop-textarea' => '92eb531d',
|
'javelin-behavior-aphront-drag-and-drop-textarea' => '92eb531d',
|
||||||
|
@ -902,18 +902,6 @@ return array(
|
||||||
'javelin-install',
|
'javelin-install',
|
||||||
'javelin-util',
|
'javelin-util',
|
||||||
),
|
),
|
||||||
'1162a152' => array(
|
|
||||||
'javelin-behavior',
|
|
||||||
'javelin-aphlict',
|
|
||||||
'javelin-stratcom',
|
|
||||||
'javelin-request',
|
|
||||||
'javelin-uri',
|
|
||||||
'javelin-dom',
|
|
||||||
'javelin-json',
|
|
||||||
'javelin-router',
|
|
||||||
'javelin-util',
|
|
||||||
'phabricator-notification',
|
|
||||||
),
|
|
||||||
'13c739ea' => array(
|
'13c739ea' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-stratcom',
|
'javelin-stratcom',
|
||||||
|
@ -1002,6 +990,16 @@ return array(
|
||||||
'javelin-install',
|
'javelin-install',
|
||||||
'javelin-typeahead-source',
|
'javelin-typeahead-source',
|
||||||
),
|
),
|
||||||
|
'335470d7' => array(
|
||||||
|
'javelin-behavior',
|
||||||
|
'javelin-request',
|
||||||
|
'javelin-stratcom',
|
||||||
|
'javelin-vector',
|
||||||
|
'javelin-dom',
|
||||||
|
'javelin-uri',
|
||||||
|
'javelin-behavior-device',
|
||||||
|
'phabricator-title',
|
||||||
|
),
|
||||||
'335fd41f' => array(
|
'335fd41f' => array(
|
||||||
'multirow-row-manager',
|
'multirow-row-manager',
|
||||||
'javelin-install',
|
'javelin-install',
|
||||||
|
@ -1089,13 +1087,6 @@ return array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
),
|
),
|
||||||
'464d333a' => array(
|
|
||||||
'javelin-install',
|
|
||||||
'javelin-util',
|
|
||||||
'javelin-websocket',
|
|
||||||
'javelin-leader',
|
|
||||||
'javelin-json',
|
|
||||||
),
|
|
||||||
'469c0d9e' => array(
|
'469c0d9e' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
|
@ -1173,12 +1164,6 @@ return array(
|
||||||
'javelin-vector',
|
'javelin-vector',
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
),
|
),
|
||||||
'58f7803f' => array(
|
|
||||||
'javelin-behavior',
|
|
||||||
'javelin-aphlict',
|
|
||||||
'phabricator-phtize',
|
|
||||||
'javelin-dom',
|
|
||||||
),
|
|
||||||
'59b251eb' => array(
|
'59b251eb' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-stratcom',
|
'javelin-stratcom',
|
||||||
|
@ -1227,6 +1212,18 @@ return array(
|
||||||
'javelin-magical-init',
|
'javelin-magical-init',
|
||||||
'javelin-util',
|
'javelin-util',
|
||||||
),
|
),
|
||||||
|
62998733 => array(
|
||||||
|
'javelin-behavior',
|
||||||
|
'javelin-aphlict',
|
||||||
|
'javelin-stratcom',
|
||||||
|
'javelin-request',
|
||||||
|
'javelin-uri',
|
||||||
|
'javelin-dom',
|
||||||
|
'javelin-json',
|
||||||
|
'javelin-router',
|
||||||
|
'javelin-util',
|
||||||
|
'phabricator-notification',
|
||||||
|
),
|
||||||
'6453c869' => array(
|
'6453c869' => array(
|
||||||
'javelin-install',
|
'javelin-install',
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
|
@ -1584,6 +1581,13 @@ return array(
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
'phortune-credit-card-form',
|
'phortune-credit-card-form',
|
||||||
),
|
),
|
||||||
|
'b300dac3' => array(
|
||||||
|
'javelin-install',
|
||||||
|
'javelin-util',
|
||||||
|
'javelin-websocket',
|
||||||
|
'javelin-leader',
|
||||||
|
'javelin-json',
|
||||||
|
),
|
||||||
'b3a4b884' => array(
|
'b3a4b884' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'phabricator-prefab',
|
'phabricator-prefab',
|
||||||
|
@ -1839,6 +1843,12 @@ return array(
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
'phabricator-draggable-list',
|
'phabricator-draggable-list',
|
||||||
),
|
),
|
||||||
|
'ea681761' => array(
|
||||||
|
'javelin-behavior',
|
||||||
|
'javelin-aphlict',
|
||||||
|
'phabricator-phtize',
|
||||||
|
'javelin-dom',
|
||||||
|
),
|
||||||
'efe49472' => array(
|
'efe49472' => array(
|
||||||
'javelin-install',
|
'javelin-install',
|
||||||
'javelin-util',
|
'javelin-util',
|
||||||
|
@ -1892,16 +1902,6 @@ return array(
|
||||||
'javelin-util',
|
'javelin-util',
|
||||||
'javelin-reactor',
|
'javelin-reactor',
|
||||||
),
|
),
|
||||||
'f6bc26f0' => array(
|
|
||||||
'javelin-behavior',
|
|
||||||
'javelin-request',
|
|
||||||
'javelin-stratcom',
|
|
||||||
'javelin-vector',
|
|
||||||
'javelin-dom',
|
|
||||||
'javelin-uri',
|
|
||||||
'javelin-behavior-device',
|
|
||||||
'phabricator-title',
|
|
||||||
),
|
|
||||||
'f7379f45' => array(
|
'f7379f45' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
|
|
|
@ -36,13 +36,12 @@ JX.install('Aphlict', {
|
||||||
events: ['didChangeStatus'],
|
events: ['didChangeStatus'],
|
||||||
|
|
||||||
members: {
|
members: {
|
||||||
_server: null,
|
_uri: null,
|
||||||
_port: null,
|
_socket: null,
|
||||||
_subscriptions: null,
|
_subscriptions: null,
|
||||||
_status: null,
|
_status: null,
|
||||||
_statusCode: null,
|
|
||||||
|
|
||||||
start: function(node, uri) {
|
start: function() {
|
||||||
JX.Leader.listen('onBecomeLeader', JX.bind(this, this._lead));
|
JX.Leader.listen('onBecomeLeader', JX.bind(this, this._lead));
|
||||||
JX.Leader.listen('onReceiveBroadcast', JX.bind(this, this._receive));
|
JX.Leader.listen('onReceiveBroadcast', JX.bind(this, this._receive));
|
||||||
JX.Leader.start();
|
JX.Leader.start();
|
||||||
|
@ -64,14 +63,12 @@ JX.install('Aphlict', {
|
||||||
},
|
},
|
||||||
|
|
||||||
_lead: function() {
|
_lead: function() {
|
||||||
var socket = new JX.WebSocket(this._uri);
|
this._socket = new JX.WebSocket(this._uri);
|
||||||
socket.setOpenHandler(JX.bind(this, this._open));
|
this._socket.setOpenHandler(JX.bind(this, this._open));
|
||||||
socket.setMessageHandler(JX.bind(this, this._message));
|
this._socket.setMessageHandler(JX.bind(this, this._message));
|
||||||
socket.setCloseHandler(JX.bind(this, this._close));
|
this._socket.setCloseHandler(JX.bind(this, this._close));
|
||||||
|
|
||||||
this._socket = socket;
|
this._socket.open();
|
||||||
|
|
||||||
socket.open();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_open: function() {
|
_open: function() {
|
||||||
|
@ -97,16 +94,19 @@ JX.install('Aphlict', {
|
||||||
case 'aphlict.status':
|
case 'aphlict.status':
|
||||||
this._setStatus(message.data);
|
this._setStatus(message.data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'aphlict.getstatus':
|
case 'aphlict.getstatus':
|
||||||
if (is_leader) {
|
if (is_leader) {
|
||||||
this._broadcastStatus(this.getStatus());
|
this._broadcastStatus(this.getStatus());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'aphlict.getsubscribers':
|
case 'aphlict.getsubscribers':
|
||||||
JX.Leader.broadcast(
|
JX.Leader.broadcast(
|
||||||
null,
|
null,
|
||||||
{type: 'aphlict.subscribe', data: this._subscriptions});
|
{type: 'aphlict.subscribe', data: this._subscriptions});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'aphlict.subscribe':
|
case 'aphlict.subscribe':
|
||||||
if (is_leader) {
|
if (is_leader) {
|
||||||
this._write({
|
this._write({
|
||||||
|
@ -115,6 +115,7 @@ JX.install('Aphlict', {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'aphlict.server':
|
case 'aphlict.server':
|
||||||
var handler = this.getHandler();
|
var handler = this.getHandler();
|
||||||
handler && handler(message.data);
|
handler && handler(message.data);
|
||||||
|
|
|
@ -37,7 +37,8 @@ JX.behavior('aphlict-dropdown', function(config, statics) {
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request) { //already fetching
|
if (request) {
|
||||||
|
// Already fetching.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +111,6 @@ JX.behavior('aphlict-dropdown', function(config, statics) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
JX.DOM.listen(
|
JX.DOM.listen(
|
||||||
bubble,
|
bubble,
|
||||||
'click',
|
'click',
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
JX.behavior('aphlict-listen', function(config) {
|
JX.behavior('aphlict-listen', function(config) {
|
||||||
|
|
||||||
var showing_reload = false;
|
var showing_reload = false;
|
||||||
|
|
||||||
JX.Stratcom.listen('aphlict-receive-message', null, function(e) {
|
JX.Stratcom.listen('aphlict-receive-message', null, function(e) {
|
||||||
|
@ -25,7 +24,7 @@ JX.behavior('aphlict-listen', function(config) {
|
||||||
|
|
||||||
var request = new JX.Request(
|
var request = new JX.Request(
|
||||||
'/notification/individual/',
|
'/notification/individual/',
|
||||||
onnotification);
|
onNotification);
|
||||||
|
|
||||||
var routable = request
|
var routable = request
|
||||||
.addData({key: message.key})
|
.addData({key: message.key})
|
||||||
|
@ -38,16 +37,14 @@ JX.behavior('aphlict-listen', function(config) {
|
||||||
JX.Router.getInstance().queue(routable);
|
JX.Router.getInstance().queue(routable);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Respond to a notification from the Aphlict notification server. We send
|
// Respond to a notification from the Aphlict notification server. We send
|
||||||
// a request to Phabricator to get notification details.
|
// a request to Phabricator to get notification details.
|
||||||
function onaphlictmessage(message) {
|
function onAphlictMessage(message) {
|
||||||
JX.Stratcom.invoke('aphlict-receive-message', null, message);
|
JX.Stratcom.invoke('aphlict-receive-message', null, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Respond to a response from Phabricator about a specific notification.
|
// Respond to a response from Phabricator about a specific notification.
|
||||||
function onnotification(response) {
|
function onNotification(response) {
|
||||||
if (!response.pertinent) {
|
if (!response.pertinent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +56,6 @@ JX.behavior('aphlict-listen', function(config) {
|
||||||
.setContent(JX.$H(response.content))
|
.setContent(JX.$H(response.content))
|
||||||
.show();
|
.show();
|
||||||
|
|
||||||
|
|
||||||
// If the notification affected an object on this page, show a
|
// If the notification affected an object on this page, show a
|
||||||
// permanent reload notification if we aren't already.
|
// permanent reload notification if we aren't already.
|
||||||
if ((response.primaryObjectPHID in config.pageObjects) && !showing_reload) {
|
if ((response.primaryObjectPHID in config.pageObjects) && !showing_reload) {
|
||||||
|
@ -79,7 +75,7 @@ JX.behavior('aphlict-listen', function(config) {
|
||||||
config.subscriptions);
|
config.subscriptions);
|
||||||
|
|
||||||
client
|
client
|
||||||
.setHandler(onaphlictmessage)
|
.setHandler(onAphlictMessage)
|
||||||
.start();
|
.start();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,19 +23,11 @@ JX.behavior('aphlict-status', function(config) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tip = null;
|
|
||||||
var status = client.getStatus();
|
var status = client.getStatus();
|
||||||
|
|
||||||
if (status == 'error') {
|
|
||||||
tip = pht(client.getStatusCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
var status_node = JX.$N(
|
var status_node = JX.$N(
|
||||||
'span',
|
'span',
|
||||||
{
|
{
|
||||||
className: 'aphlict-connection-status-' + status,
|
className: 'aphlict-connection-status-' + status
|
||||||
sigil: tip ? 'has-tooltip' : null,
|
|
||||||
meta: tip ? {tip: tip, align: 'S', size: 300} : {}
|
|
||||||
},
|
},
|
||||||
pht(status));
|
pht(status));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue