From 6b1129ce1d216fb8f78d6435efd05f9ba42f2104 Mon Sep 17 00:00:00 2001 From: Haokun-Chen Date: Wed, 6 Jun 2018 14:29:32 -0400 Subject: [PATCH] fixed job details search bar when empty input or duplicate input --- awx/ui/client/features/output/search.component.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/awx/ui/client/features/output/search.component.js b/awx/ui/client/features/output/search.component.js index bc446316f3..490b7c283e 100644 --- a/awx/ui/client/features/output/search.component.js +++ b/awx/ui/client/features/output/search.component.js @@ -64,9 +64,21 @@ function removeSearchTag (index) { } function submitSearch () { + // empty input, not submit new search, return. + if (!vm.value) { + return; + } + const currentQueryset = getCurrentQueryset(); + // check duplicate , see if search input already exists in current search tags + if (currentQueryset.search) { + if (currentQueryset.search.includes(vm.value)) { + return; + } + } const searchInputQueryset = qs.getSearchInputQueryset(vm.value, isFilterable); + const modifiedQueryset = qs.mergeQueryset(currentQueryset, searchInputQueryset); reloadQueryset(modifiedQueryset, strings.get('search.REJECT_INVALID'));