diff --git a/e2e/suites/pagination/multiple-pages-libraries.test.ts b/e2e/suites/pagination/multiple-pages-libraries.test.ts index 3ab5e5b91..9409f1adc 100755 --- a/e2e/suites/pagination/multiple-pages-libraries.test.ts +++ b/e2e/suites/pagination/multiple-pages-libraries.test.ts @@ -51,12 +51,12 @@ describe('Pagination on multiple pages', () => { await userApi.sites.waitForApi({ expect: initialSitesTotalItems + 101 }); await loginPage.loginWith(username); - }, 150000); + }, 450000); afterAll(async () => { await userApi.sites.deleteSites(sites); await userApi.sites.waitForApi({ expect: initialSitesTotalItems }); - }, 120000); + }, 420000); describe('on My Libraries', () => { beforeAll(async () => { diff --git a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.html b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.html index 0d49a135c..eb0ef6318 100644 --- a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.html +++ b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.html @@ -1,8 +1,6 @@ -
+
@@ -20,9 +18,7 @@
-
+
@@ -40,9 +36,7 @@
-
+
@@ -53,18 +47,14 @@ - {{ - getVisibilityLabel(form.controls.visibility.value) | translate - }} + {{ getVisibilityLabel(form.controls.visibility.value) | translate }}
-
+
@@ -98,29 +88,20 @@ required placeholder="{{ 'LIBRARY.DIALOG.FORM.NAME' | translate }}" formControlName="title" + [errorStateMatcher]="matcher" /> - - {{ - 'LIBRARY.HINTS.SITE_TITLE_EXISTS' | translate - }} - + {{ 'LIBRARY.HINTS.SITE_TITLE_EXISTS' | translate }} + {{ 'LIBRARY.ERRORS.TITLE_TOO_LONG' | translate }} - + - + {{ type.label | translate }} @@ -133,9 +114,9 @@ placeholder="{{ 'LIBRARY.DIALOG.FORM.DESCRIPTION' | translate }}" rows="3" formControlName="description" + [errorStateMatcher]="matcher" > - - + {{ 'LIBRARY.ERRORS.DESCRIPTION_TOO_LONG' | translate }} @@ -146,12 +127,7 @@ - diff --git a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts index db247d473..f91d8091d 100644 --- a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts +++ b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts @@ -24,13 +24,21 @@ */ import { Component, Input, OnInit, OnChanges, OnDestroy } from '@angular/core'; -import { FormGroup, FormControl, Validators } from '@angular/forms'; +import { FormGroup, FormControl, Validators, FormGroupDirective, NgForm } from '@angular/forms'; import { SiteEntry, SitePaging } from '@alfresco/js-api'; import { Store } from '@ngrx/store'; import { AppStore, UpdateLibraryAction } from '@alfresco/aca-shared/store'; import { debounceTime, mergeMap, takeUntil } from 'rxjs/operators'; import { AlfrescoApiService } from '@alfresco/adf-core'; import { Observable, from, Subject } from 'rxjs'; +import { ErrorStateMatcher } from '@angular/material/core'; + +export class InstantErrorStateMatcher implements ErrorStateMatcher { + isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean { + const isSubmitted = form && form.submitted; + return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted)); + } +} @Component({ selector: 'app-library-metadata-form', @@ -56,6 +64,8 @@ export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestro visibility: new FormControl(this.libraryType[0].value) }); + matcher = new InstantErrorStateMatcher(); + onDestroy$: Subject = new Subject(); constructor(private alfrescoApiService: AlfrescoApiService, protected store: Store) {}