This repository was archived by the owner on May 14, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-9
lines changed
ui/src/app/apps/apps-register Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 1
- import { FormControl , FormGroup } from '@angular/forms' ;
2
- import { AppsRegisterValidator } from './apps-register.validator' ;
1
+ import { FormControl , FormGroup } from '@angular/forms' ;
2
+ import { AppsRegisterValidator } from './apps-register.validator' ;
3
3
4
4
/**
5
5
* Test Application Register Validator functions {AppsRegisterValidator}.
@@ -30,14 +30,13 @@ describe('AppsRegisterValidator', () => {
30
30
31
31
} ) ;
32
32
33
- // TODO: to complete
34
33
describe ( 'uri' , ( ) => {
35
34
it ( 'invalid' , ( ) => {
36
35
[
37
36
' ' ,
38
- /* 'http://foo. bar',
37
+ 'http://foo. bar' ,
39
38
'http://foo.b@r' ,
40
- 'http://foo.b%%r',*/
39
+ 'http://foo.b%%r' ,
41
40
'f'
42
41
] . forEach ( ( mock ) => {
43
42
const uri : FormControl = new FormControl ( mock ) ;
@@ -57,6 +56,11 @@ describe('AppsRegisterValidator', () => {
57
56
'http://foo.bar:bar.foo:bar' ,
58
57
'http://foo.bar:bar.foo-foo:bar' ,
59
58
'http://foo.bar:bar.foo-foo:bar-bar' ,
59
+ 'docker:sabby/xfmr:0.0.7.BUILD-SNAPSHOT' ,
60
+ 'http://bit.ly/Celsius-BUILD-SNAPSHOT-stream-applications-kafka-10-maven' ,
61
+ 'http://bit.ly/Clark-BUILD-SNAPSHOT-task-applications-maven' ,
62
+ 'docker:springcloudstream/counter-sink-rabbit:1.3.1.RELEASE' ,
63
+ 'docker:spring_cloud_stream/counter-sink_rabbit:1.3.1.RELEASE'
60
64
] . forEach ( ( mock ) => {
61
65
const uri : FormControl = new FormControl ( mock ) ;
62
66
const result = AppsRegisterValidator . uri ( uri ) ;
Original file line number Diff line number Diff line change 1
- import { FormControl , FormGroup } from '@angular/forms' ;
1
+ import { FormControl } from '@angular/forms' ;
2
2
3
3
/**
4
4
* Validators for Register Form
@@ -18,6 +18,12 @@ export class AppsRegisterValidator {
18
18
*/
19
19
static uriRegex = / ^ ( [ a - z A - Z 0 - 9 - ] + : \/ \/ ) ( [ \\ w \\ . : - ] + ) ? ( [ a - z A - Z 0 - 9 -\/ . : - ] + ) * $ / ;
20
20
21
+
22
+ /**
23
+ * Docker artifact regex
24
+ */
25
+ static dockerArtifactRegex = / ^ ( d o c k e r : ) ( [ a - z A - Z 0 - 9 - .- _ ] * ) ( \/ ) ( [ a - z A - Z 0 - 9 - .- _ ] * ) ( \: ) ( [ a - z A - Z 0 - 9 - .- _ ] * ) $ / ;
26
+
21
27
/**
22
28
* Validate the name conditions: no space, 2 characters min, no specials characters
23
29
*
@@ -30,7 +36,7 @@ export class AppsRegisterValidator {
30
36
}
31
37
32
38
if ( ! AppsRegisterValidator . nameRegex . test ( formControl . value ) ) {
33
- return { invalid : true } ;
39
+ return { invalid : true } ;
34
40
}
35
41
36
42
return null ;
@@ -47,8 +53,8 @@ export class AppsRegisterValidator {
47
53
return null ;
48
54
}
49
55
50
- if ( ! AppsRegisterValidator . uriRegex . test ( formControl . value ) ) {
51
- return { invalid : true } ;
56
+ if ( ! AppsRegisterValidator . uriRegex . test ( formControl . value ) && ! AppsRegisterValidator . dockerArtifactRegex . test ( formControl . value ) ) {
57
+ return { invalid : true } ;
52
58
}
53
59
54
60
return null ;
You can’t perform that action at this time.
0 commit comments