mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-26 17:24:45 +00:00
[ACA-1957] Create Library - check existent site title by field (#765)
* clean form controls * check found site by title field
This commit is contained in:
parent
0b65ff46a0
commit
fd692b6b8c
@ -9,7 +9,7 @@
|
|||||||
placeholder="{{ 'LIBRARY.DIALOG.FORM.NAME' | translate }}"
|
placeholder="{{ 'LIBRARY.DIALOG.FORM.NAME' | translate }}"
|
||||||
required
|
required
|
||||||
matInput
|
matInput
|
||||||
[formControl]="form.controls['title']"
|
formControlName="title"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<mat-hint *ngIf="libraryTitleExists">{{ 'LIBRARY.HINTS.SITE_TITLE_EXISTS' | translate }}</mat-hint>
|
<mat-hint *ngIf="libraryTitleExists">{{ 'LIBRARY.HINTS.SITE_TITLE_EXISTS' | translate }}</mat-hint>
|
||||||
@ -23,7 +23,7 @@
|
|||||||
required
|
required
|
||||||
placeholder="{{ 'LIBRARY.DIALOG.FORM.SITE_ID' | translate }}"
|
placeholder="{{ 'LIBRARY.DIALOG.FORM.SITE_ID' | translate }}"
|
||||||
matInput
|
matInput
|
||||||
[formControl]="form.controls['id']"
|
formControlName="id"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<mat-error *ngIf="form.controls['id'].errors?.message">
|
<mat-error *ngIf="form.controls['id'].errors?.message">
|
||||||
@ -40,7 +40,7 @@
|
|||||||
matInput
|
matInput
|
||||||
placeholder="{{ 'LIBRARY.DIALOG.FORM.DESCRIPTION' | translate }}"
|
placeholder="{{ 'LIBRARY.DIALOG.FORM.DESCRIPTION' | translate }}"
|
||||||
rows="3"
|
rows="3"
|
||||||
[formControl]="form.controls['description']"></textarea>
|
formControlName="description"></textarea>
|
||||||
|
|
||||||
<mat-error *ngIf="form.controls['description'].hasError('maxlength')">
|
<mat-error *ngIf="form.controls['description'].hasError('maxlength')">
|
||||||
{{ 'LIBRARY.ERRORS.DESCRIPTION_TOO_LONG' | translate }}
|
{{ 'LIBRARY.ERRORS.DESCRIPTION_TOO_LONG' | translate }}
|
||||||
|
@ -182,13 +182,21 @@ export class LibraryDialogComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
private async checkLibraryNameExists(libraryTitle: string) {
|
private async checkLibraryNameExists(libraryTitle: string) {
|
||||||
const { entries } = (await this.findLibraryByTitle(libraryTitle)).list;
|
const { entries } = (await this.findLibraryByTitle(libraryTitle)).list;
|
||||||
this.libraryTitleExists = !!entries.length;
|
|
||||||
|
if (entries.length) {
|
||||||
|
this.libraryTitleExists = entries[0].entry.title === libraryTitle;
|
||||||
|
} else {
|
||||||
|
this.libraryTitleExists = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private findLibraryByTitle(libraryTitle: string): Promise<SitePaging> {
|
private findLibraryByTitle(libraryTitle: string): Promise<SitePaging> {
|
||||||
return this.alfrescoApiService
|
return this.alfrescoApiService
|
||||||
.getInstance()
|
.getInstance()
|
||||||
.core.queriesApi.findSites(libraryTitle)
|
.core.queriesApi.findSites(libraryTitle, {
|
||||||
|
maxItems: 1,
|
||||||
|
fields: ['title']
|
||||||
|
})
|
||||||
.catch(() => ({ list: { entries: [] } }));
|
.catch(() => ({ list: { entries: [] } }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user