From b7071a48c2ab9c339bccbe1da21655f8a7a1322a Mon Sep 17 00:00:00 2001 From: gconsidine Date: Mon, 9 Oct 2017 11:06:55 -0400 Subject: [PATCH] Set lookup value changed from something to nothing to be null --- awx/ui/client/lib/components/form/form.directive.js | 4 ++-- awx/ui/client/lib/components/input/lookup.directive.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/awx/ui/client/lib/components/form/form.directive.js b/awx/ui/client/lib/components/form/form.directive.js index e4956d1101..4e04dd31f0 100644 --- a/awx/ui/client/lib/components/form/form.directive.js +++ b/awx/ui/client/lib/components/form/form.directive.js @@ -32,7 +32,7 @@ function AtFormController (eventService, strings) { vm.setListeners(); }; - vm.register = (category, component, el) => { + vm.register = (category, component, el) => { component.category = category; component.form = vm.state; @@ -66,7 +66,7 @@ function AtFormController (eventService, strings) { let data = vm.components .filter(component => component.category === 'input') .reduce((values, component) => { - if (!component.state._value) { + if (component.state._value === undefined) { return values; } diff --git a/awx/ui/client/lib/components/input/lookup.directive.js b/awx/ui/client/lib/components/input/lookup.directive.js index b2c60e15bd..9d6d9089d6 100644 --- a/awx/ui/client/lib/components/input/lookup.directive.js +++ b/awx/ui/client/lib/components/input/lookup.directive.js @@ -12,7 +12,7 @@ function atInputLookupLink (scope, element, attrs, controllers) { inputController.init(scope, element, formController); } -function AtInputLookupController (baseInputController, $q, $state, $stateParams) { +function AtInputLookupController (baseInputController, $q, $state) { let vm = this || {}; let scope; @@ -75,13 +75,14 @@ function AtInputLookupController (baseInputController, $q, $state, $stateParams) vm.resetDebounce = () => { clearTimeout(vm.debounce); - vm.searchAfterDebounce(); + vm.searchAfterDebounce(); }; vm.search = () => { scope.state._touched = true; if (scope.state._displayValue === '' && !scope.state._required) { + scope.state._value = null; return vm.check({ isValid: true }); } @@ -116,8 +117,7 @@ function AtInputLookupController (baseInputController, $q, $state, $stateParams) AtInputLookupController.$inject = [ 'BaseInputController', '$q', - '$state', - '$stateParams' + '$state' ]; function atInputLookup (pathService) {