1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +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:
Jason Ge 2011-10-07 18:25:54 -07:00
parent 05b73f58ae
commit 1e3c10379a
6 changed files with 29 additions and 10 deletions

View file

@ -120,11 +120,13 @@ final class DifferentialAddCommentView extends AphrontView {
'tokenizer' => 'add-reviewers-tokenizer',
'src' => '/typeahead/common/users/',
'row' => 'add-reviewers',
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
),
'add_ccs' => array(
'tokenizer' => 'add-ccs-tokenizer',
'src' => '/typeahead/common/mailable/',
'row' => 'add-ccs',
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
),
),
'select' => 'comment-action',

View file

@ -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/unitstatus');
phutil_require_module('phabricator', 'infrastructure/celerity/api');
phutil_require_module('phabricator', 'infrastructure/env');
phutil_require_module('phabricator', 'infrastructure/javelin/api');
phutil_require_module('phabricator', 'view/base');
phutil_require_module('phabricator', 'view/form/base');

View file

@ -412,16 +412,19 @@ class ManiphestTaskDetailController extends ManiphestController {
ManiphestTransactionType::TYPE_PROJECTS => array(
'id' => 'projects-tokenizer',
'src' => '/typeahead/common/projects/',
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
),
ManiphestTransactionType::TYPE_OWNER => array(
'id' => 'assign-tokenizer',
'src' => '/typeahead/common/users/',
'value' => $default_claim,
'limit' => 1,
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
),
ManiphestTransactionType::TYPE_CCS => array(
'id' => 'cc-tokenizer',
'src' => '/typeahead/common/mailable/',
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
),
),
));

View file

@ -21,6 +21,7 @@ phutil_require_module('phabricator', 'applications/markup/engine');
phutil_require_module('phabricator', 'applications/phid/constants');
phutil_require_module('phabricator', 'applications/phid/handle/data');
phutil_require_module('phabricator', 'infrastructure/celerity/api');
phutil_require_module('phabricator', 'infrastructure/env');
phutil_require_module('phabricator', 'infrastructure/javelin/api');
phutil_require_module('phabricator', 'view/form/base');
phutil_require_module('phabricator', 'view/form/control/draganddropupload');

View file

@ -11,7 +11,13 @@ JX.behavior('differential-add-reviewers-and-ccs', function(config) {
function buildTokenizer(props) {
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);
typeahead.setDatasource(datasource);

View file

@ -14,7 +14,13 @@ JX.behavior('maniphest-transaction-controls', function(config) {
for (var k in config.tokenizers) {
var tconfig = config.tokenizers[k];
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);
typeahead.setDatasource(datasource);