diff --git a/ui/src/app/apps/apps-add/apps-add.validator.spec.ts b/ui/src/app/apps/apps-add/apps-add.validator.spec.ts index f67de03a0..a871f4b9f 100644 --- a/ui/src/app/apps/apps-add/apps-add.validator.spec.ts +++ b/ui/src/app/apps/apps-add/apps-add.validator.spec.ts @@ -13,7 +13,6 @@ describe('AppsAddValidator', () => { [ ' ', 'bb', - ' http://foo.ly/foo', 'b b' ].forEach((mock) => { const uri: FormControl = new FormControl(mock); @@ -23,7 +22,9 @@ describe('AppsAddValidator', () => { it('valid', () => { [ 'http://foo.ly/foo', - 'http://foo.bar:bar.foo-foo:bar-bar' + 'http://foo.bar:bar.foo-foo:bar-bar', + 'http://foo.bar/foo.bar&a=a', + 'http://foo.bar/foo.bar&b=b?a=a' ].forEach((mock) => { const uri: FormControl = new FormControl(mock); expect(AppsAddValidator.uri(uri)).toBeNull(); diff --git a/ui/src/app/apps/apps-add/apps-add.validator.ts b/ui/src/app/apps/apps-add/apps-add.validator.ts index 570ca6dcb..e9deff827 100644 --- a/ui/src/app/apps/apps-add/apps-add.validator.ts +++ b/ui/src/app/apps/apps-add/apps-add.validator.ts @@ -1,4 +1,4 @@ -import {FormControl, FormGroup} from '@angular/forms'; +import { FormControl, FormGroup } from '@angular/forms'; /** * Validators for Bulk Import Form @@ -11,7 +11,7 @@ export class AppsAddValidator { /** * Uri regex */ - static uriRegex = /^([a-zA-Z0-9-]+:\/\/)([\\w\\.:-]+)?([a-zA-Z0-9-\/.:-]+)*$/; + static uriRegex = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/; /** * Validate the uri conditions diff --git a/ui/src/app/apps/apps-add/uri/apps-bulk-import-uri.component.ts b/ui/src/app/apps/apps-add/uri/apps-bulk-import-uri.component.ts index 792900a02..72dc498ab 100644 --- a/ui/src/app/apps/apps-add/uri/apps-bulk-import-uri.component.ts +++ b/ui/src/app/apps/apps-add/uri/apps-bulk-import-uri.component.ts @@ -8,6 +8,7 @@ import { AppsService } from '../../apps.service'; import { BusyService } from '../../../shared/services/busy.service'; import { NotificationService } from '../../../shared/services/notification.service'; import { AppsAddValidator } from '../apps-add.validator'; +import { AppError } from '../../../shared/model/error.model'; /** * Applications Bulk Import @@ -83,6 +84,8 @@ export class AppsBulkImportUriComponent implements OnDestroy { .subscribe(data => { this.notificationService.success('Apps Imported.'); this.router.navigate(['apps']); + }, (error) => { + this.notificationService.error(AppError.is(error) ? error.getMessage() : error); }); this.busyService.addSubscription(busy);