23
23
requirejs . config ( {
24
24
baseUrl : '/bower_components' ,
25
25
paths : {
26
- 'jquery' : 'jquery/dist/jquery.min' ,
26
+ 'jquery' : 'jquery/dist/jquery.min'
27
27
}
28
28
} ) ;
29
29
@@ -43,7 +43,7 @@ require(['jquery'],
43
43
*/
44
44
require ( [ 'jquery' ] ,
45
45
function ( $ ) {
46
- var generalPattern = "\\/([A-Za-z0-9_.-]+)\\/([A-Za-z0-9_.-]+)\\/?(?:tree|blob)\\/([^/]+)(?: \\/(.+\\.cwl)) $" ;
46
+ var generalPattern = "\\/([A-Za-z0-9_.-]+)\\/([A-Za-z0-9_.-]+)\\/?(?:(?: tree|blob)\\/([^/]+)\\/?(.*)?)? $" ;
47
47
var githubPattern = new RegExp ( "^https?:\\/\\/github\\.com" + generalPattern ) ;
48
48
var gitlabPattern = new RegExp ( "^https?:\\/\\/gitlab\\.com" + generalPattern ) ;
49
49
var gitPattern = new RegExp ( "^((git|ssh|http(s)?)|(git@[\\w\\.]+))(:(//)?)([\\w\\.@\\:/\\-~]+)(\\.git)(/)?$" ) ;
@@ -76,24 +76,25 @@ require(['jquery'],
76
76
* Validate form before submit
77
77
*/
78
78
$ ( '#add' ) . submit ( function ( ) {
79
- var pathPattern = new RegExp ( "^\\/?([^\\/]*\\/)*[^\\/]+\\.cwl$" ) ;
80
79
var input = $ ( "#url" ) . val ( ) ;
81
80
if ( gitPattern . test ( input ) ) {
82
- var success = true ;
83
- if ( ! $ ( "#branch" ) . val ( ) ) {
84
- addWarning ( "branch" , "You must provide a branch name for the workflow" ) ;
85
- success = false ;
86
- }
87
- if ( ! $ ( "#path" ) . val ( ) ) {
88
- addWarning ( "path" , "You must provide a path to the workflow" ) ;
89
- success = false ;
90
- } else if ( ! pathPattern . test ( $ ( "#path" ) . val ( ) ) ) {
91
- addWarning ( "path" , "Must be a valid path from the root to a .cwl workflow" ) ;
92
- success = false ;
81
+ var success = false ;
82
+ if ( input . startsWith ( "ssh" ) || input . startsWith ( "git@" ) ) {
83
+ addWarning ( "url" , "SSH is not supported as a protocol, please provide a HTTPS URL to clone" ) ;
84
+ } else {
85
+ success = true ;
86
+ if ( ! $ ( "#branch" ) . val ( ) ) {
87
+ addWarning ( "branch" , "You must provide a branch name for the workflow" ) ;
88
+ success = false ;
89
+ }
90
+ if ( ! $ ( "#path" ) . val ( ) ) {
91
+ addWarning ( "path" , "You must provide a path to the workflow or a directory of workflows" ) ;
92
+ success = false ;
93
+ }
93
94
}
94
95
return success ;
95
96
} else if ( ! githubPattern . test ( input ) && ! gitlabPattern . test ( input ) ) {
96
- addWarning ( "url" , "Must be a URL to a workflow on Gitlab or Github, or a Git repository URL" ) ;
97
+ addWarning ( "url" , "Must be a URL to a workflow or directory of workflows on Gitlab or Github, or a Git repository URL" ) ;
97
98
return false ;
98
99
}
99
100
} ) ;
0 commit comments