mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 21:40:55 +01:00
Object selector does live-updates without requiring user to hit 'search'
Summary: Editing Maniphest tasks for a Differential Revision required user to hit 'search' every time he changed search parameters. Now select and text input changes trigger search automatically. Test Plan: Tested that changing the select and entering text automatically gave the correct results. Reviewed By: epriestley Reviewers: epriestley, jungejason Commenters: jungejason CC: epriestley, jungejason Differential Revision: 102
This commit is contained in:
parent
c72d9980d5
commit
1c6487197f
2 changed files with 23 additions and 21 deletions
|
@ -101,9 +101,6 @@ class PhabricatorObjectSelectorDialog {
|
||||||
<td class="phabricator-object-selector-search-text">
|
<td class="phabricator-object-selector-search-text">
|
||||||
<input type="text" id="'.$query_id.'" />
|
<input type="text" id="'.$query_id.'" />
|
||||||
</td>
|
</td>
|
||||||
<td class="phabricator-object-selector-search-button">
|
|
||||||
<button>Search</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>');
|
</table>');
|
||||||
$result_box =
|
$result_box =
|
||||||
|
|
|
@ -12,6 +12,8 @@ JX.behavior('phabricator-object-selector', function(config) {
|
||||||
phids[k] = true;
|
phids[k] = true;
|
||||||
}
|
}
|
||||||
var attach_list = {};
|
var attach_list = {};
|
||||||
|
var query_timer = null;
|
||||||
|
var query_delay = 50;
|
||||||
|
|
||||||
var phid_input = JX.DOM.find(
|
var phid_input = JX.DOM.find(
|
||||||
JX.$(config.form),
|
JX.$(config.form),
|
||||||
|
@ -94,6 +96,7 @@ JX.behavior('phabricator-object-selector', function(config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendQuery() {
|
function sendQuery() {
|
||||||
|
query_timer = null;
|
||||||
JX.DOM.setContent(JX.$(config.results), renderNote('Loading...'))
|
JX.DOM.setContent(JX.$(config.results), renderNote('Loading...'))
|
||||||
new JX.Request(config.uri, JX.bind(null, onreceive, ++n))
|
new JX.Request(config.uri, JX.bind(null, onreceive, ++n))
|
||||||
.setData({
|
.setData({
|
||||||
|
@ -103,24 +106,6 @@ JX.behavior('phabricator-object-selector', function(config) {
|
||||||
.send();
|
.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
JX.DOM.listen(
|
|
||||||
JX.$(config.search),
|
|
||||||
'submit',
|
|
||||||
null,
|
|
||||||
function(e) {
|
|
||||||
e.kill();
|
|
||||||
sendQuery();
|
|
||||||
});
|
|
||||||
JX.DOM.listen(
|
|
||||||
JX.$(config.search),
|
|
||||||
'click',
|
|
||||||
'tag:button',
|
|
||||||
function(e) {
|
|
||||||
e.kill();
|
|
||||||
sendQuery();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
JX.DOM.listen(
|
JX.DOM.listen(
|
||||||
JX.$(config.results),
|
JX.$(config.results),
|
||||||
'click',
|
'click',
|
||||||
|
@ -162,6 +147,26 @@ JX.behavior('phabricator-object-selector', function(config) {
|
||||||
redrawAttached();
|
redrawAttached();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
JX.DOM.listen(
|
||||||
|
JX.$(config.filter),
|
||||||
|
'change',
|
||||||
|
null,
|
||||||
|
function(e) {
|
||||||
|
e.kill();
|
||||||
|
sendQuery();
|
||||||
|
});
|
||||||
|
|
||||||
|
JX.DOM.listen(
|
||||||
|
JX.$(config.query),
|
||||||
|
'keydown',
|
||||||
|
null,
|
||||||
|
function(e) {
|
||||||
|
if (query_timer) {
|
||||||
|
query_timer.stop();
|
||||||
|
}
|
||||||
|
query_timer = JX.defer(sendQuery, query_delay);
|
||||||
|
});
|
||||||
|
|
||||||
sendQuery();
|
sendQuery();
|
||||||
redrawAttached();
|
redrawAttached();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue