1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 07:20:57 +01:00
phorge-phorge/webroot/rsrc/js/application/differential
epriestley 2b4c551b0e Provide a global router for Ajax requests
Summary:
Fixes T430. Fixes T4834. Obsoletes D7641. Currently, we do some things less-well than we could:

  - We just let the browser queue and prioritize requests, so if you load a revision with 50 changes and then click "Award Token", the action blocks until the changes load in most/all browsers. It would be better to prioritize this action and queue it immediately.
  - Similarly, changes tend to load in order, even if the user has clicked to a specific file. When the user expresses a preference for a specific file, we should prioritize it.
  - We show a spinning GIF when waiting on requests. This is appropriate for some types of reuqests, but distracting for others.

To fix this:

  - Queue all (or, at least, most) requests into a new queue in JX.Router.
  - JX.Router handles prioritizing the requests. Principally:
    - You can submit a request with a specific priority (500 = general content loading, 1000 = default, 2000 = explicit user action) and JX.Router will get the higher stuff fired off sooner.
    - You can name requests and then adjust their prorities later, if the user expresses an interest in specific results.
  - Only use the spinner gif for "workflow" requests, which is bascially when the user clicked something and we're waiting on the server. I think it's useful and not-annoying in this case.
  - Don't show any status for draft requests.
  - For content requests, show a subtle hipster-style top loading bar.

Test Plan:
  - Viewed a diff with 93 changes, and clicked award token.
    - Prior to this patch, the action took many many seconds to resolve.
    - After this patch, it resolves quickly.
  - Viewed a diff with 93 changes and saw a pleasant subtle hipster-style loading bar.
  - Viewed a diff with 93 changes and typed some draft text. Previews populated fairly quickly and there was no spinner.
  - Viewed a diff with 93 changes and clicked something with workflow, saw a spinner after a moment.
  - Viewed a diff with 93 changes and clicked a file in the table of contents near the end of the list.
    - Prior to this patch, it took a long time to show up.
    - After this patch, it loads directly.

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T430, T4834

Differential Revision: https://secure.phabricator.com/D8979
2014-05-05 10:57:42 -07:00
..
behavior-add-reviewers-and-ccs.js Various linter fixes. 2014-02-26 12:44:58 -08:00
behavior-comment-jump.js Use JsShrink if jsxmin is not available 2013-05-18 17:04:22 -07:00
behavior-comment-preview.js Use JsShrink if jsxmin is not available 2013-05-18 17:04:22 -07:00
behavior-diff-radios.js Bring Javelin into Phabricator via git submodule, not copy-and-paste 2011-05-08 13:20:10 -07:00
behavior-dropdown-menus.js Begin rebuilding dropdown menus on ActionList 2014-05-05 10:56:14 -07:00
behavior-edit-inline-comments.js Various linter fixes. 2014-02-26 12:44:58 -08:00
behavior-keyboard-nav.js Various linter fixes. 2014-02-26 12:44:58 -08:00
behavior-populate.js Provide a global router for Ajax requests 2014-05-05 10:57:42 -07:00
behavior-show-all-comments.js Hide seen transactions by default in all modern applications 2014-02-14 10:23:07 -08:00
behavior-show-field-details.js Further improve unit/lint rendering 2012-05-01 10:15:56 -07:00
behavior-show-more.js Don't mangle inline comments with tables in them in Differential 2013-09-10 15:31:32 -07:00
behavior-toggle-files.js Better JS for Differential File Collapsing Undo 2013-08-13 16:14:26 -07:00
behavior-user-select.js Enable selecting text in Differential shield and gap 2012-09-20 15:20:47 -07:00
DifferentialInlineCommentEditor.js Don't mangle inline comments with tables in them in Differential 2013-09-10 15:31:32 -07:00