Skip to content

Commit

Permalink
Merge pull request #1361 from h-kataria/validate_new_dialog_name
Browse files Browse the repository at this point in the history
New dialog name validation added.
  • Loading branch information
Dan Clarizio authored May 17, 2017
2 parents f09d99e + 6828c70 commit 7ee8f63
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,16 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
angular.element('#confirmationModal').modal("hide");
}

$scope.dialogNameValidation = function() {
miqService.miqFlashClear();
$scope.angularForm.$setValidity("unchanged", true);

if (vm.dialogs.filter(function(e) { return e.label == vm.catalogItemModel.provisioning_dialog_name; }).length > 0) {
miqService.miqFlash("error", "Dialog name already exists");
$scope.angularForm.$setValidity("unchanged", false);
}
};

init();
}]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
.col-md-6{"ng-class" => "{'has-error': angularForm.#{prefix}_dialog_name.$invalid}", "ng-if" => "#{ng_model}.#{prefix}_dialog_existing == 'create'"}
%input.form-control{:type => "text",
'ng-model' => "#{ng_model}.#{prefix}_dialog_name",
'ng-change' => "dialogNameValidation()",
:name => "vm.#{prefix}_dialog_name",
:maxlength => 50,
"ng-required" => "vm.fieldsRequired('#{prefix}') && #{ng_model}.#{prefix}_dialog_existing == 'create'",
Expand Down

0 comments on commit 7ee8f63

Please sign in to comment.