From ac224a0b82cfa3894e83cb186341f53b6eaf6bbc Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 14 May 2019 11:45:07 +0100 Subject: [PATCH] [ADF-4489] metadata errors demoshell (#4720) * raise errors in demo shell for metadata * remove commented out code --- .../app/components/files/files.component.ts | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/demo-shell/src/app/components/files/files.component.ts b/demo-shell/src/app/components/files/files.component.ts index ef9fcc77d4..18f39ea8c6 100644 --- a/demo-shell/src/app/components/files/files.component.ts +++ b/demo-shell/src/app/components/files/files.component.ts @@ -36,16 +36,17 @@ import { PermissionStyleModel, UploadFilesEvent, ConfirmDialogComponent, - LibraryDialogComponent + LibraryDialogComponent, + ContentMetadataService } from '@alfresco/adf-content-services'; import { SelectAppsDialogComponent } from '@alfresco/adf-process-services'; import { VersionManagerDialogAdapterComponent } from './version-manager-dialog-adapter.component'; import { MetadataDialogAdapterComponent } from './metadata-dialog-adapter.component'; -import { Subscription } from 'rxjs'; +import { Subscription, Subject } from 'rxjs'; import { PreviewService } from '../../services/preview.service'; -import { debounceTime } from 'rxjs/operators'; +import { debounceTime, takeUntil } from 'rxjs/operators'; import { SearchEntry } from '@alfresco/js-api'; const DEFAULT_FOLDER_TO_SHOW = '-my-'; @@ -57,6 +58,8 @@ const DEFAULT_FOLDER_TO_SHOW = '-my-'; }) export class FilesComponent implements OnInit, OnChanges, OnDestroy { + protected onDestroy$ = new Subject(); + errorMessage: string = null; nodeId: any; showViewer = false; @@ -213,7 +216,8 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { private preview: PreviewService, @Optional() private route: ActivatedRoute, public authenticationService: AuthenticationService, - public alfrescoApiService: AlfrescoApiService) { + public alfrescoApiService: AlfrescoApiService, + private contentMetadataService: ContentMetadataService) { } showFile(event) { @@ -258,7 +262,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { }); } - // this.disableDragArea = false; this.uploadService.fileUploadComplete.asObservable() .pipe(debounceTime(300)) .subscribe((value) => this.onFileUploadEvent(value)); @@ -267,13 +270,19 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { this.onCreateFolder = this.contentService.folderCreate.subscribe((value) => this.onFolderAction(value)); this.onEditFolder = this.contentService.folderEdit.subscribe((value) => this.onFolderAction(value)); - // this.permissionsStyle.push(new PermissionStyleModel('document-list__create', AllowableOperationsEnum.CREATE)); - // this.permissionsStyle.push(new PermissionStyleModel('document-list__disable', AllowableOperationsEnum.NOT_CREATE, false, true)); + this.contentMetadataService.error + .pipe(takeUntil(this.onDestroy$)) + .subscribe((err: { message: string }) => { + this.notificationService.showError(err.message); + }); } ngOnDestroy() { this.onCreateFolder.unsubscribe(); this.onEditFolder.unsubscribe(); + + this.onDestroy$.next(true); + this.onDestroy$.complete(); } ngOnChanges(changes: SimpleChanges) {