diff --git a/static/resources/js/components/system-management/create-destination.directive.html b/static/resources/js/components/system-management/create-destination.directive.html index 1f0d8bd5a..10bd34d37 100644 --- a/static/resources/js/components/system-management/create-destination.directive.html +++ b/static/resources/js/components/system-management/create-destination.directive.html @@ -63,7 +63,7 @@
- +
@@ -75,7 +75,7 @@
diff --git a/static/resources/js/components/system-management/create-destination.directive.js b/static/resources/js/components/system-management/create-destination.directive.js index a05c4f155..0dfab3550 100644 --- a/static/resources/js/components/system-management/create-destination.directive.js +++ b/static/resources/js/components/system-management/create-destination.directive.js @@ -33,26 +33,23 @@ vm.create = create; vm.update = update; vm.pingDestination = pingDestination; - - vm.editable = true; - vm.notAvailable = false; - vm.pingAvailable = true; - vm.pingMessage = ''; vm.closeError = closeError; vm.toggleErrorMessage = false; vm.errorMessages = []; vm.pingTIP = false; - - $scope.$watch('destination.endpoint', function(current) { - if(current) { - vm.notAvailable = false; - }else{ - vm.notAvailable = true; - } + + $timeout(function(){ + $scope.$watch('destination.endpoint', function(current) { + if(current) { + vm.notAvailable = false; + }else{ + vm.notAvailable = true; + } + }); }); - + function addNew() { vm.modalTitle = $filter('tr')('add_new_destination', []); vm0.name = ''; @@ -69,7 +66,7 @@ .error(getDestinationFailed); } - function create(destination) { + function create(destination) { CreateDestinationService(destination.name, destination.endpoint, destination.username, destination.password) .success(createDestinationSuccess) @@ -143,7 +140,6 @@ function pingDestination() { vm.pingTIP = true; - vm.pingAvailable = false; var target = { 'name': vm0.name, @@ -162,12 +158,10 @@ } function pingDestinationSuccess(data, status) { - vm.pingAvailable = true; vm.pingTIP = false; vm.pingMessage = $filter('tr')('successful_ping_target', []); } function pingDestinationFailed(data, status) { - vm.pingTIP = false; vm.pingMessage = $filter('tr')('failed_to_ping_target', []) + (data && data.length > 0 ? ':' + data : ''); } @@ -195,9 +189,9 @@ scope.$apply(function(){ scope.form.$setPristine(); scope.form.$setUntouched(); - - ctrl.notAvailble = false; - ctrl.pingAvailable = true; + + ctrl.editable = true; + ctrl.notAvailble = true; ctrl.pingMessage = ''; ctrl.pingTIP = false; @@ -218,7 +212,6 @@ ctrl.toggleErrorMessage = true; } }, true); - }); });