fixed destination editable issue.

This commit is contained in:
kunw 2016-07-13 13:17:31 +08:00
parent eda4b499b5
commit b9e7273ac7
2 changed files with 8 additions and 17 deletions

View File

@ -63,7 +63,7 @@
<div class="form-group col-md-12 form-group-custom"> <div class="form-group col-md-12 form-group-custom">
<div class="col-md-3"></div> <div class="col-md-3"></div>
<div class="col-md-9"> <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> </div>
<div class="form-group col-md-12 form-group-custom"> <div class="form-group col-md-12 form-group-custom">
@ -75,7 +75,7 @@
</div> </div>
</div> </div>
<div class="modal-footer"> <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> <button type="button" class="btn btn-default" data-dismiss="modal">// 'close' | tr //</button>
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->

View File

@ -34,11 +34,6 @@
vm.update = update; vm.update = update;
vm.pingDestination = pingDestination; vm.pingDestination = pingDestination;
vm.editable = true;
vm.notAvailable = false;
vm.pingAvailable = true;
vm.pingMessage = '';
vm.closeError = closeError; vm.closeError = closeError;
vm.toggleErrorMessage = false; vm.toggleErrorMessage = false;
vm.errorMessages = []; vm.errorMessages = [];
@ -143,7 +138,6 @@
function pingDestination() { function pingDestination() {
vm.pingTIP = true; vm.pingTIP = true;
vm.pingAvailable = false;
var target = { var target = {
'name': vm0.name, 'name': vm0.name,
@ -162,12 +156,10 @@
} }
function pingDestinationSuccess(data, status) { function pingDestinationSuccess(data, status) {
vm.pingAvailable = true;
vm.pingTIP = false; vm.pingTIP = false;
vm.pingMessage = $filter('tr')('successful_ping_target', []); vm.pingMessage = $filter('tr')('successful_ping_target', []);
} }
function pingDestinationFailed(data, status) { function pingDestinationFailed(data, status) {
vm.pingTIP = false; vm.pingTIP = false;
vm.pingMessage = $filter('tr')('failed_to_ping_target', []) + (data && data.length > 0 ? ':' + data : ''); vm.pingMessage = $filter('tr')('failed_to_ping_target', []) + (data && data.length > 0 ? ':' + data : '');
} }
@ -196,8 +188,8 @@
scope.form.$setPristine(); scope.form.$setPristine();
scope.form.$setUntouched(); scope.form.$setUntouched();
ctrl.notAvailble = false; ctrl.editable = true;
ctrl.pingAvailable = true; ctrl.notAvailble = true;
ctrl.pingMessage = ''; ctrl.pingMessage = '';
ctrl.pingTIP = false; ctrl.pingTIP = false;
@ -218,7 +210,6 @@
ctrl.toggleErrorMessage = true; ctrl.toggleErrorMessage = true;
} }
}, true); }, true);
}); });
}); });