From dac0a63bfa8ea39c1c2aad206b1719d860299a4b Mon Sep 17 00:00:00 2001 From: Zita Nemeckova Date: Fri, 16 Jun 2017 15:53:07 +0200 Subject: [PATCH 1/2] Add git protocol to URL for Ansible repo Allow git protocol as valid input --- app/assets/javascripts/directives/url_validation.js | 2 +- app/views/ansible_repository/_repository_form.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/directives/url_validation.js b/app/assets/javascripts/directives/url_validation.js index e44fa241cbf..3604e52a64e 100644 --- a/app/assets/javascripts/directives/url_validation.js +++ b/app/assets/javascripts/directives/url_validation.js @@ -10,7 +10,7 @@ ManageIQ.angular.app.directive('urlValidation', function() { }; var validUrl = function(s) { - return s.substring(0, 8) === 'https://' || s.substring(0, 7) === 'http://'; + return s.substring(0, 8) === 'https://' || s.substring(0, 7) === 'http://' || s.substring(0, 4) === 'git@'; }; } } diff --git a/app/views/ansible_repository/_repository_form.html.haml b/app/views/ansible_repository/_repository_form.html.haml index 4ed7b3a098f..a3003a759cc 100644 --- a/app/views/ansible_repository/_repository_form.html.haml +++ b/app/views/ansible_repository/_repository_form.html.haml @@ -53,7 +53,7 @@ %span.help-block{"ng-show" => "angularForm.scm_url.$error.required"} = _("Required") %span.help-block{"ng-show" => "angularForm.scm_url.$error.urlValidation"} - = _("URL must include a protocol (http:// or https://)") + = _("URL must include a protocol (http://, https:// or git@)") .form-group %label.col-md-2.control-label = _('SCM credentials') From 68a176dfdfe0cfb58f43160663049357ff1d9c58 Mon Sep 17 00:00:00 2001 From: Zita Nemeckova Date: Fri, 16 Jun 2017 16:14:45 +0200 Subject: [PATCH 2/2] Allow user@user typo of git URL --- app/assets/javascripts/directives/url_validation.js | 2 +- app/views/ansible_repository/_repository_form.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/directives/url_validation.js b/app/assets/javascripts/directives/url_validation.js index 3604e52a64e..7952c48992e 100644 --- a/app/assets/javascripts/directives/url_validation.js +++ b/app/assets/javascripts/directives/url_validation.js @@ -10,7 +10,7 @@ ManageIQ.angular.app.directive('urlValidation', function() { }; var validUrl = function(s) { - return s.substring(0, 8) === 'https://' || s.substring(0, 7) === 'http://' || s.substring(0, 4) === 'git@'; + return s.substring(0, 8) === 'https://' || s.substring(0, 7) === 'http://' || s.match(/^[-\w:.]+@.*:/); }; } } diff --git a/app/views/ansible_repository/_repository_form.html.haml b/app/views/ansible_repository/_repository_form.html.haml index a3003a759cc..a78ab9a3f18 100644 --- a/app/views/ansible_repository/_repository_form.html.haml +++ b/app/views/ansible_repository/_repository_form.html.haml @@ -53,7 +53,7 @@ %span.help-block{"ng-show" => "angularForm.scm_url.$error.required"} = _("Required") %span.help-block{"ng-show" => "angularForm.scm_url.$error.urlValidation"} - = _("URL must include a protocol (http://, https:// or git@)") + = _("URL must include a protocol (http:// or https://) or be a valid SSH path (user@server:path)") .form-group %label.col-md-2.control-label = _('SCM credentials')