diff --git a/awx/ui/client/src/configuration/configuration.controller.js b/awx/ui/client/src/configuration/configuration.controller.js index 8a3c110838..bcfcb14a6a 100644 --- a/awx/ui/client/src/configuration/configuration.controller.js +++ b/awx/ui/client/src/configuration/configuration.controller.js @@ -297,10 +297,12 @@ export default [ $scope[key] = $scope.configDataResolve[key].default; if($scope[key + '_field'].type === "select"){ // We need to re-instantiate the Select2 element - // after resetting the value. Example: - // `$scope.$broadcast(AD_HOC_COMMANDS_populated)` + // after resetting the value. Example: $scope.$broadcast(key+'_populated', null, false); } + if($scope[key + '_field'].reset === "CUSTOM_LOGO"){ + $scope.$broadcast(key+'_reverted'); + } loginUpdate(); }) .catch(function(error) { diff --git a/awx/ui/client/src/shared/directives.js b/awx/ui/client/src/shared/directives.js index ad8a44b374..d41ef32eb4 100644 --- a/awx/ui/client/src/shared/directives.js +++ b/awx/ui/client/src/shared/directives.js @@ -168,12 +168,18 @@ function(ConfigurationUtils, i18n, $rootScope) { scope.imageData = $rootScope.custom_logo; }); - scope.update = function(e) { - if(scope.$parent[fieldKey]) { + scope.$on(fieldKey+'_reverted', function(e) { + scope.update(e, true); + }); + + scope.update = function(e, flag) { + if(scope.$parent[fieldKey] || flag ) { e.preventDefault(); scope.$parent[fieldKey] = ''; filePickerButton.html(browseText); filePickerText.val(''); + filePicker.value = ""; + scope.imagePresent = false; } else { // Nothing exists so open file picker