Merge pull request #526 from wknet123/master

Update for destination interaction refinements.
This commit is contained in:
kun wang 2016-07-13 13:36:14 +08:00 committed by GitHub
commit a86a82dba3
2 changed files with 16 additions and 23 deletions

View File

@ -63,7 +63,7 @@
<div class="form-group col-md-12 form-group-custom">
<div class="col-md-3"></div>
<div class="col-md-9">
<button type="button" class="btn btn-default" ng-disabled="vm.notAvailable || !vm.pingAvailable" ng-click="vm.pingDestination()" loading-progress hide-target="false" toggle-in-progress="vm.pingTIP">// 'test_connection' | tr //</button>
<button type="button" class="btn btn-default" ng-disabled="vm.notAvailable" ng-click="vm.pingDestination()" loading-progress hide-target="false" toggle-in-progress="vm.pingTIP">// 'test_connection' | tr //</button>
</div>
</div>
<div class="form-group col-md-12 form-group-custom">
@ -75,7 +75,7 @@
</div>
</div>
<div class="modal-footer">
<button ng-show="vm.editable" type="submit" class="btn btn-primary" id="btnOk" ng-click="vm.save(destination)">// 'ok' | tr //</button>
<button ng-show="vm.editable" type="submit" class="btn btn-primary" id="btnOk" ng-click="form.$valid && vm.save(destination)">// 'ok' | tr //</button>
<button type="button" class="btn btn-default" data-dismiss="modal">// 'close' | tr //</button>
</div>
</div><!-- /.modal-content -->

View File

@ -34,17 +34,13 @@
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;
$timeout(function(){
$scope.$watch('destination.endpoint', function(current) {
if(current) {
vm.notAvailable = false;
@ -52,6 +48,7 @@
vm.notAvailable = true;
}
});
});
function addNew() {
vm.modalTitle = $filter('tr')('add_new_destination', []);
@ -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 : '');
}
@ -196,8 +190,8 @@
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);
});
});