1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Conpherence - improve performance by handling dropdowns (notifications, threads) as standard response data

Summary: Ref T7708. Rather than invoking the general client -> server dropdown refresh path, return the data with the various conpherence requests and update the dropdowns that way. Saves 2 client -> server requests per conpherence action.

Test Plan: loaded up /conpherence/ and noted message count deduct correctly. clicked specific message and noted message count deduct successfully. did same two tests via durable column and again saw message counts deduct successfully.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7708

Differential Revision: https://secure.phabricator.com/D12761
This commit is contained in:
Bob Trahan 2015-05-07 16:04:56 -07:00
parent ef3b62564e
commit 33e7038b96
6 changed files with 80 additions and 43 deletions

View file

@ -8,7 +8,7 @@
return array(
'names' => array(
'core.pkg.css' => 'ca3f6a60',
'core.pkg.js' => 'dcd6c8e3',
'core.pkg.js' => '919c56b5',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => 'bb338e4b',
'differential.pkg.js' => '895b8d62',
@ -341,12 +341,12 @@ return array(
'rsrc/image/texture/table_header_hover.png' => '038ec3b9',
'rsrc/image/texture/table_header_tall.png' => 'd56b434f',
'rsrc/js/application/aphlict/Aphlict.js' => '5359e785',
'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '0323afdd',
'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '995ad707',
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'b1a59974',
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761',
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '7a608e21',
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '9e507b59',
'rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js' => 'cf86d16a',
'rsrc/js/application/conpherence/behavior-durable-column.js' => '657c2b50',
'rsrc/js/application/conpherence/behavior-menu.js' => '804b0773',
@ -513,7 +513,7 @@ return array(
'conpherence-menu-css' => 'f389e048',
'conpherence-message-pane-css' => '3150e2a2',
'conpherence-notification-css' => 'd208f806',
'conpherence-thread-manager' => '7a608e21',
'conpherence-thread-manager' => '9e507b59',
'conpherence-transaction-css' => '25138b7f',
'conpherence-update-css' => '1099a660',
'conpherence-widget-pane-css' => '2af42ebe',
@ -541,7 +541,7 @@ return array(
'inline-comment-summary-css' => 'eb5f8e8c',
'javelin-aphlict' => '5359e785',
'javelin-behavior' => '61cbc29a',
'javelin-behavior-aphlict-dropdown' => '0323afdd',
'javelin-behavior-aphlict-dropdown' => '995ad707',
'javelin-behavior-aphlict-listen' => 'b1a59974',
'javelin-behavior-aphlict-status' => 'ea681761',
'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884',
@ -836,16 +836,6 @@ return array(
'029a133d' => array(
'aphront-dialog-view-css',
),
'0323afdd' => array(
'javelin-behavior',
'javelin-request',
'javelin-stratcom',
'javelin-vector',
'javelin-dom',
'javelin-uri',
'javelin-behavior-device',
'phabricator-title',
),
'048330fa' => array(
'javelin-behavior',
'javelin-typeahead-ondemand-source',
@ -1387,17 +1377,6 @@ return array(
'javelin-behavior',
'javelin-quicksand',
),
'7a608e21' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-aphlict',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
),
'7a68dda3' => array(
'owners-path-editor',
'javelin-behavior',
@ -1589,6 +1568,16 @@ return array(
'javelin-dom',
'javelin-reactor-dom',
),
'995ad707' => array(
'javelin-behavior',
'javelin-request',
'javelin-stratcom',
'javelin-vector',
'javelin-dom',
'javelin-uri',
'javelin-behavior-device',
'phabricator-title',
),
'9a340b3d' => array(
'javelin-behavior',
'javelin-dom',
@ -1598,6 +1587,17 @@ return array(
'phuix-action-view',
'javelin-workflow',
),
'9e507b59' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-aphlict',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
),
'9f36c42d' => array(
'javelin-behavior',
'javelin-stratcom',

View file

@ -88,12 +88,19 @@ final class ConpherenceColumnViewController extends
PhabricatorPolicyCapability::CAN_EDIT);
}
$dropdown_query = id(new AphlictDropdownDataQuery())
->setViewer($user);
$dropdown_query->execute();
$response = array(
'content' => hsprintf('%s', $durable_column),
'threadID' => $conpherence_id,
'threadPHID' => $conpherence_phid,
'latestTransactionID' => $latest_transaction_id,
'canEdit' => $can_edit,
'aphlictDropdownData' => array(
$dropdown_query->getNotificationData(),
$dropdown_query->getConpherenceData(),
),
);
return id(new AphrontAjaxResponse())->setContent($response);

View file

@ -543,8 +543,10 @@ final class ConpherenceUpdateController
break;
}
}
$data = $conpherence->getDisplayData($user);
$dropdown_query = id(new AphlictDropdownDataQuery())
->setViewer($user);
$dropdown_query->execute();
$content = array(
'non_update' => $non_update,
'transactions' => hsprintf('%s', $rendered_transactions),
@ -555,6 +557,10 @@ final class ConpherenceUpdateController
'header' => $header,
'file_widget' => $file_widget,
'people_widget' => $people_widget,
'aphlictDropdownData' => array(
$dropdown_query->getNotificationData(),
$dropdown_query->getConpherenceData(),
),
);
return $content;

View file

@ -94,6 +94,9 @@ final class ConpherenceViewController extends
$content['title'] = $title = $d_data['title'];
if ($request->isAjax()) {
$dropdown_query = id(new AphlictDropdownDataQuery())
->setViewer($user);
$dropdown_query->execute();
$content['threadID'] = $conpherence->getID();
$content['threadPHID'] = $conpherence->getPHID();
$content['latestTransactionID'] = $data['latest_transaction_id'];
@ -101,6 +104,10 @@ final class ConpherenceViewController extends
$user,
$conpherence,
PhabricatorPolicyCapability::CAN_EDIT);
$content['aphlictDropdownData'] = array(
$dropdown_query->getNotificationData(),
$dropdown_query->getConpherenceData(),
);
return id(new AphrontAjaxResponse())->setContent($content);
}

View file

@ -93,23 +93,34 @@ JX.behavior('aphlict-dropdown', function(config, statics) {
if (!data.fromServer) {
return;
}
var updated = false;
var new_data = data.newResponse.aphlictDropdownData;
for (var ii = 0; ii < new_data.length; ii++) {
if (new_data[ii].countType != config.countType) {
continue;
}
if (!new_data[ii].isInstalled) {
continue;
}
updated = true;
_updateCount(parseInt(new_data[ii].count));
}
if (updated) {
dirty = true;
}
update_counts(new_data);
});
JX.Stratcom.listen(
'conpherence-redraw-aphlict',
null,
function (e) {
update_counts(e.getData());
});
function update_counts(new_data) {
var updated = false;
for (var ii = 0; ii < new_data.length; ii++) {
if (new_data[ii].countType != config.countType) {
continue;
}
if (!new_data[ii].isInstalled) {
continue;
}
updated = true;
_updateCount(parseInt(new_data[ii].count));
}
if (updated) {
dirty = true;
}
}
function set_visible(menu, icon) {
if (menu) {
statics.visible = {menu: menu, icon: icon};

View file

@ -205,7 +205,10 @@ JX.install('ConpherenceThreadManager', {
_markUpdated: function(r) {
this._updating.knownID = r.latest_transaction_id;
this._latestTransactionID = r.latest_transaction_id;
JX.Stratcom.invoke('notification-panel-update', null, {});
JX.Stratcom.invoke(
'conpherence-redraw-aphlict',
null,
r.aphlictDropdownData);
},
_updateThread: function() {
@ -298,7 +301,10 @@ JX.install('ConpherenceThreadManager', {
this._latestTransactionID = r.latestTransactionID;
this._canEditLoadedThread = r.canEdit;
JX.Stratcom.invoke('notification-panel-update', null, {});
JX.Stratcom.invoke(
'conpherence-redraw-aphlict',
null,
r.aphlictDropdownData);
this._didLoadThreadCallback(r);