修改volume添加页面确认按钮不生效的Bug

This commit is contained in:
wu ming 2016-09-29 15:42:48 +08:00
parent adb0638a4c
commit b6411bc87b
3 changed files with 16 additions and 22 deletions

File diff suppressed because one or more lines are too long

View File

@ -35,11 +35,11 @@
<th ng-show="ngDialogData.status" class="new_left sj_c_green">启用</th>
<th ng-hide="ngDialogData.status" class="new_left sj_c_green">停止</th>
<th colspan="10">
<input type="text" class="sj_txt_box03 mr10" ng-model="ngDialogData.name " ng-disabled="!{{ngDialogData.editable}}" ng-pattern="/^\w{2,15}$/" required="required"/>
<input type="text" class="sj_txt_box03 mr10" name="volumeName" ng-model="ngDialogData.name " ng-disabled="!{{ngDialogData.editable}}" ng-pattern="/^\w{2,15}$/" required="required"/>
</th>
<th>云目录:</th>
<th>
<input type="text" class="sj_txt_box02 mr5" ng-model="ngDialogData.path" ng-disabled="!{{ngDialogData.editable}}" ng-pattern="/^(\/[a-z0-9A-Z .%]+)+$/" required="required"/>
<input type="text" class="sj_txt_box02 mr5" name="volumePath" ng-model="ngDialogData.path" ng-disabled="!{{ngDialogData.editable}}" ng-pattern="/^(\/[a-z0-9A-Z _\-.%]+)+$/" required="required"/>
</th>
<th>
<button ng-show="ngDialogData.status" class="sj_btn_red fl" ng-click="stopVolume(ngDialogData)">停止</button>
@ -55,23 +55,23 @@
<input type="text" class="sj_txt_box04 mr5" value="服务器 {{$index + 1}} " ng-disabled="true" />
</th>
<th>
<input type="text" class="sj_txt_box05" ng-model="row.ip[0]" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required"/>
<input type="text" class="sj_txt_box05" ng-model="row.ip[0]" name="brickIp0" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required"/>
</th>
<th>.</th>
<th>
<input type="text" class="sj_txt_box05" ng-model="row.ip[1]" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required"/>
<input type="text" class="sj_txt_box05" ng-model="row.ip[1]" name="brickIp1" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required"/>
</th>
<th>.</th>
<th>
<input type="text" class="sj_txt_box05" ng-model="row.ip[2]" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required"/>
<input type="text" class="sj_txt_box05" ng-model="row.ip[2]" name="brickIp2" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required"/>
</th>
<th>.</th>
<th>
<input type="text" class="sj_txt_box05 mr10" ng-model="row.ip[3]" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required"/>
<input type="text" class="sj_txt_box05 mr10" ng-model="row.ip[3]" name="brickIp3" ng-disabled="!{{row.editable}}" ng-pattern="/^(([0-9]|([1-9]\d)|(1\d\d)|(2([0-4]\d|5[0-5]))))$/" required="required"/>
</th>
<th>存储块:</th>
<th>
<input type="text" class="sj_txt_box02 mr5" ng-model="row.path" ng-disabled="!{{row.editable}}" ng-pattern="/^(\/[a-z0-9A-Z .%]+)+$/" required="required"/>
<input type="text" class="sj_txt_box02 mr5" ng-model="row.path" name="brickPath" ng-disabled="!{{row.editable}}" ng-pattern="/^(\/[a-z0-9A-Z \-_.%]+)+$/" required="required"/>
</th>
<th>
<!--<button class="sj_btn_grey fl">连接</button>-->
@ -95,7 +95,7 @@
</tbody>
</table>
<div class="alert alert-warning" role="alert" ng-show="showMessage">"删除存储块失败:集群中至少包含一个存储块!"</div>
<span class="alert alert-danger" role="alert" ng-show="$scope.validForm.$valid && submitted">名称、路径、Ip不能为空</span>
<div class="alert alert-warning" role="alert" ng-show="volumeForm.$invalid && submitted">云盘的名称、路径或Ip输入不正确</div>
</form>
</div>
</script>

View File

@ -29,11 +29,7 @@ module Configs{
export var VolumeController = controller('VolumeController', ['$scope', '$http', ($scope, $http) => {
$scope.submitted = false;
$scope.status = $scope.ngDialogData.status;
$scope.save = (entity) =>{
$scope.$emit('update', entity);
$scope.closeThisDialog();
}
$scope.status = $scope.ngDialogData.status;
$scope. cancel = () =>{
$scope.closeThisDialog();
@ -67,8 +63,9 @@ module Configs{
}
$scope.onSubmit = (entity) => {
if($scope.validForm.$valid && $scope.validForm.$dirty){
$scope.onSubmit = (entity) => {
if($scope.volumeForm.$valid){
$scope.$emit('update', entity);
$scope.closeThisDialog();
}else{
$scope.submitted = true;