File tree Expand file tree Collapse file tree 4 files changed +14
-2
lines changed
e2e/page-objects/entities
shared/components/entity-editor Expand file tree Collapse file tree 4 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ export class EntityPage extends AppPage {
5353 return element ( by . css ( 'mdl-textfield[label=Version] input' ) ) ;
5454 }
5555
56+ get entityBaseUri ( ) {
57+ return element ( by . css ( 'mdl-textfield[label="Base URI"] input' ) ) ;
58+ }
59+
5660 getEntityBox ( entityName : string ) {
5761 return element ( by . cssContainingText ( 'app-entity-box div.title span' , entityName ) ) ;
5862 }
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ export class Entity {
160160 height : 100
161161 } ,
162162 'info' : {
163- 'baseUri' : null ,
163+ 'baseUri' : 'http://example.org' ,
164164 'description' : null ,
165165 'title' : null ,
166166 'version' : '0.0.1'
Original file line number Diff line number Diff line change 1818 < mdl-textfield type ="text " label ="Description " [(ngModel)] ="entity.info.description " floating-label > </ mdl-textfield >
1919 </ div >
2020 < div >
21- < mdl-textfield type ="text " label ="Base URI " [(ngModel)] ="entity.info.baseUri " floating-label > </ mdl-textfield >
21+ < mdl-textfield type ="text " label ="Base URI " required [(ngModel)] ="entity.info.baseUri " floating-label > </ mdl-textfield >
22+ < span *ngIf ="!validBaseUri " class ="alert-text "> A valid base uri is required, eg http://example.org</ span >
2223 </ div >
2324 < div class ="properties-heading ">
2425 < div class ="properties-title "> Properties</ div >
Original file line number Diff line number Diff line change @@ -49,12 +49,16 @@ export class EntityEditorComponent implements AfterViewChecked {
4949
5050 propAdded : boolean = false ;
5151 validTitle : boolean = true ;
52+ validBaseUri : boolean = true ;
5253
5354 // property name pattern: name cannot have space characters in it
5455 readonly PROPERTY_NAME_PATTERN = / ^ [ ^ \s ] + $ / ;
5556 // Entity title: no space or invalid characters
5657 readonly ENTITY_TITLE_REGEX = / ^ .* ?(? = [ \^ \s ! @ # % & $ \* : ; < > \? / \{ \| \} ] ) .* $ / ;
5758
59+ // Base URI: http://example.org/
60+ readonly BASE_URI_REGEX = / ^ (?: h t t p ( s ) ? : \/ \/ ) ? [ \w . - ] + (?: \. [ \w \. - ] + ) + [ \w \- \. _ ~ : / ? # [ \] @ ! \$ & ' \( \) \* \+ , ; = . ] / ;
61+
5862 constructor (
5963 private dialog : MdlDialogReference ,
6064 private dialogService : MdlDialogService ,
@@ -232,6 +236,9 @@ export class EntityEditorComponent implements AfterViewChecked {
232236 // invalid characters in title
233237 this . validTitle = false ;
234238 return ;
239+ } if ( ! this . BASE_URI_REGEX . test ( this . entity . info . baseUri ) || this . entity . info . baseUri === '' || this . entity . info . baseUri === null ) {
240+ this . validBaseUri = false ;
241+ return ;
235242 } else {
236243 this . validTitle = true ;
237244 // Set entity state based on property ui flags
You can’t perform that action at this time.
0 commit comments