mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 02:32:42 +01:00
Enable typeahead's ondemand on details view page
Summary: the details pages are using preload instead of ondemand for typeahead, but the most common actions on the pages are commenting which would not need the preloaded info. To improve the performance of the pages, turn on ondemand according to the setting in the config file. Test Plan: verify it is working with both modes, for both pages. Reviewers: epriestley, nh Reviewed By: epriestley CC: aran, epriestley Differential Revision: 995
This commit is contained in:
parent
05b73f58ae
commit
1e3c10379a
6 changed files with 29 additions and 10 deletions
|
@ -120,11 +120,13 @@ final class DifferentialAddCommentView extends AphrontView {
|
||||||
'tokenizer' => 'add-reviewers-tokenizer',
|
'tokenizer' => 'add-reviewers-tokenizer',
|
||||||
'src' => '/typeahead/common/users/',
|
'src' => '/typeahead/common/users/',
|
||||||
'row' => 'add-reviewers',
|
'row' => 'add-reviewers',
|
||||||
|
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
|
||||||
),
|
),
|
||||||
'add_ccs' => array(
|
'add_ccs' => array(
|
||||||
'tokenizer' => 'add-ccs-tokenizer',
|
'tokenizer' => 'add-ccs-tokenizer',
|
||||||
'src' => '/typeahead/common/mailable/',
|
'src' => '/typeahead/common/mailable/',
|
||||||
'row' => 'add-ccs',
|
'row' => 'add-ccs',
|
||||||
|
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'select' => 'comment-action',
|
'select' => 'comment-action',
|
||||||
|
|
|
@ -10,6 +10,7 @@ phutil_require_module('phabricator', 'applications/differential/constants/action
|
||||||
phutil_require_module('phabricator', 'applications/differential/constants/lintstatus');
|
phutil_require_module('phabricator', 'applications/differential/constants/lintstatus');
|
||||||
phutil_require_module('phabricator', 'applications/differential/constants/unitstatus');
|
phutil_require_module('phabricator', 'applications/differential/constants/unitstatus');
|
||||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||||
|
phutil_require_module('phabricator', 'infrastructure/env');
|
||||||
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
||||||
phutil_require_module('phabricator', 'view/base');
|
phutil_require_module('phabricator', 'view/base');
|
||||||
phutil_require_module('phabricator', 'view/form/base');
|
phutil_require_module('phabricator', 'view/form/base');
|
||||||
|
|
|
@ -412,16 +412,19 @@ class ManiphestTaskDetailController extends ManiphestController {
|
||||||
ManiphestTransactionType::TYPE_PROJECTS => array(
|
ManiphestTransactionType::TYPE_PROJECTS => array(
|
||||||
'id' => 'projects-tokenizer',
|
'id' => 'projects-tokenizer',
|
||||||
'src' => '/typeahead/common/projects/',
|
'src' => '/typeahead/common/projects/',
|
||||||
|
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
|
||||||
),
|
),
|
||||||
ManiphestTransactionType::TYPE_OWNER => array(
|
ManiphestTransactionType::TYPE_OWNER => array(
|
||||||
'id' => 'assign-tokenizer',
|
'id' => 'assign-tokenizer',
|
||||||
'src' => '/typeahead/common/users/',
|
'src' => '/typeahead/common/users/',
|
||||||
'value' => $default_claim,
|
'value' => $default_claim,
|
||||||
'limit' => 1,
|
'limit' => 1,
|
||||||
|
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
|
||||||
),
|
),
|
||||||
ManiphestTransactionType::TYPE_CCS => array(
|
ManiphestTransactionType::TYPE_CCS => array(
|
||||||
'id' => 'cc-tokenizer',
|
'id' => 'cc-tokenizer',
|
||||||
'src' => '/typeahead/common/mailable/',
|
'src' => '/typeahead/common/mailable/',
|
||||||
|
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
|
@ -21,6 +21,7 @@ phutil_require_module('phabricator', 'applications/markup/engine');
|
||||||
phutil_require_module('phabricator', 'applications/phid/constants');
|
phutil_require_module('phabricator', 'applications/phid/constants');
|
||||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||||
|
phutil_require_module('phabricator', 'infrastructure/env');
|
||||||
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
||||||
phutil_require_module('phabricator', 'view/form/base');
|
phutil_require_module('phabricator', 'view/form/base');
|
||||||
phutil_require_module('phabricator', 'view/form/control/draganddropupload');
|
phutil_require_module('phabricator', 'view/form/control/draganddropupload');
|
||||||
|
|
|
@ -11,7 +11,13 @@ JX.behavior('differential-add-reviewers-and-ccs', function(config) {
|
||||||
|
|
||||||
function buildTokenizer(props) {
|
function buildTokenizer(props) {
|
||||||
var root = JX.$(props.tokenizer);
|
var root = JX.$(props.tokenizer);
|
||||||
var datasource = new JX.TypeaheadPreloadedSource(props.src);
|
|
||||||
|
var datasource;
|
||||||
|
if (props.ondemand) {
|
||||||
|
datasource = new JX.TypeaheadOnDemandSource(props.src);
|
||||||
|
} else {
|
||||||
|
datasource = new JX.TypeaheadPreloadedSource(props.src);
|
||||||
|
}
|
||||||
|
|
||||||
var typeahead = new JX.Typeahead(root);
|
var typeahead = new JX.Typeahead(root);
|
||||||
typeahead.setDatasource(datasource);
|
typeahead.setDatasource(datasource);
|
||||||
|
|
|
@ -14,7 +14,13 @@ JX.behavior('maniphest-transaction-controls', function(config) {
|
||||||
for (var k in config.tokenizers) {
|
for (var k in config.tokenizers) {
|
||||||
var tconfig = config.tokenizers[k];
|
var tconfig = config.tokenizers[k];
|
||||||
var root = JX.$(tconfig.id);
|
var root = JX.$(tconfig.id);
|
||||||
var datasource = new JX.TypeaheadPreloadedSource(tconfig.src);
|
|
||||||
|
var datasource;
|
||||||
|
if (tconfig.ondemand) {
|
||||||
|
datasource = new JX.TypeaheadOnDemandSource(tconfig.src);
|
||||||
|
} else {
|
||||||
|
datasource = new JX.TypeaheadPreloadedSource(tconfig.src);
|
||||||
|
}
|
||||||
|
|
||||||
var typeahead = new JX.Typeahead(root);
|
var typeahead = new JX.Typeahead(root);
|
||||||
typeahead.setDatasource(datasource);
|
typeahead.setDatasource(datasource);
|
||||||
|
|
Loading…
Reference in a new issue