You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2020/05/12 22:45:32 UTC
[airavata-django-portal] 03/04: AIRAVATA-3324 Debounce search
queries
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch AIRAVATA-3324-custom-input-editor-autocomplete-input-editor
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit 812fdd7a3149230d9eca3f07b84c191859ccbed4
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed Apr 29 09:50:34 2020 -0400
AIRAVATA-3324 Debounce search queries
---
django_airavata/apps/workspace/package.json | 1 +
.../components/experiment/input-editors/AutocompleteInputEditor.vue | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/django_airavata/apps/workspace/package.json b/django_airavata/apps/workspace/package.json
index 7ffab05..424c5ed 100644
--- a/django_airavata/apps/workspace/package.json
+++ b/django_airavata/apps/workspace/package.json
@@ -19,6 +19,7 @@
"django-airavata-api": "link:../api",
"django-airavata-common-ui": "link:../../static/common",
"django-airavata-workspace-plugin-api": "link:django-airavata-workspace-plugin-api",
+ "lodash": "^4.17.15",
"moment": "^2.21.0",
"terser": "^4.1.2",
"vue": "^2.5.22",
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/AutocompleteInputEditor.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/AutocompleteInputEditor.vue
index 83934d5..b107471 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/AutocompleteInputEditor.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/AutocompleteInputEditor.vue
@@ -20,6 +20,7 @@
import { utils } from "django-airavata-api";
import { InputEditorMixin } from "django-airavata-workspace-plugin-api";
import { components } from "django-airavata-common-ui";
+import _ from "lodash";
export default {
name: "autocomplete-input-editor",
@@ -99,7 +100,8 @@ export default {
this.text = suggestion.name;
this.valueChanged();
},
- searchChanged(newValue) {
+ searchChanged: _.debounce(function(newValue) {
+ // TODO: don't query when search value is empty string
this.searchString = newValue;
const currentTime = Date.now();
if (this.autocompleteUrl) {
@@ -117,7 +119,7 @@ export default {
}
});
}
- }
+ }, 200),
},
created() {
if (this.value) {