summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-07-22 07:32:09 +0000
committerGerrit Code Review <review@openstack.org>2021-07-22 07:32:09 +0000
commit9ba9a54d0f67b302faa517a67ffdcae782485af0 (patch)
tree82fdb87f11443df1ddc593dd5ea3c2b20afbf0f4
parentb58ac2894b9b901d6ed433fb049502d988222ceb (diff)
parentca429efbd8e9c6b0ed90777b54181a6a12cfa634 (diff)
downloadhorizon-9ba9a54d0f67b302faa517a67ffdcae782485af0.tar.gz
Merge "Magic Search filter facet removal fix"
-rw-r--r--horizon/static/framework/widgets/magic-search/magic-search.controller.js4
-rw-r--r--horizon/static/framework/widgets/magic-search/magic-search.controller.spec.js8
2 files changed, 12 insertions, 0 deletions
diff --git a/horizon/static/framework/widgets/magic-search/magic-search.controller.js b/horizon/static/framework/widgets/magic-search/magic-search.controller.js
index 47a29ae58..12901e5ce 100644
--- a/horizon/static/framework/widgets/magic-search/magic-search.controller.js
+++ b/horizon/static/framework/widgets/magic-search/magic-search.controller.js
@@ -334,6 +334,10 @@
delete ctrl.textSearch;
} else {
$scope.$emit(magicSearchEvents.SEARCH_UPDATED, query);
+ if (angular.isDefined(ctrl.textSearch)) {
+ // emit text search if text facet remains
+ emitTextSearch(ctrl.textSearch || '');
+ }
if (ctrl.currentSearch.length > 0) {
// prune facets as needed from menus
var newFacet = ctrl.currentSearch[ctrl.currentSearch.length - 1].name;
diff --git a/horizon/static/framework/widgets/magic-search/magic-search.controller.spec.js b/horizon/static/framework/widgets/magic-search/magic-search.controller.spec.js
index 2652a53b5..8f307b366 100644
--- a/horizon/static/framework/widgets/magic-search/magic-search.controller.spec.js
+++ b/horizon/static/framework/widgets/magic-search/magic-search.controller.spec.js
@@ -509,6 +509,14 @@
expect(scope.strings.prompt).toEqual('');
});
+ it("emits textSearch if text facet remains", function() {
+ spyOn(scope, '$emit');
+ ctrl.currentSearch = [{}];
+ ctrl.textSearch = 'cat';
+ ctrl.removeFacet(0);
+ expect(scope.$emit).toHaveBeenCalledWith(magicSearchEvents.TEXT_SEARCH, 'cat', undefined);
+ });
+
it("resets state if facet selected", function() {
ctrl.currentSearch = [{}];
ctrl.facetSelected = {};