[ADF-4489] metadata errors demoshell (#4720)

* raise errors in demo shell for metadata

* remove commented out code
This commit is contained in:
Denys Vuika 2019-05-14 11:45:07 +01:00 committed by GitHub
parent 60a122f844
commit ac224a0b82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,16 +36,17 @@ import {
PermissionStyleModel, PermissionStyleModel,
UploadFilesEvent, UploadFilesEvent,
ConfirmDialogComponent, ConfirmDialogComponent,
LibraryDialogComponent LibraryDialogComponent,
ContentMetadataService
} from '@alfresco/adf-content-services'; } from '@alfresco/adf-content-services';
import { SelectAppsDialogComponent } from '@alfresco/adf-process-services'; import { SelectAppsDialogComponent } from '@alfresco/adf-process-services';
import { VersionManagerDialogAdapterComponent } from './version-manager-dialog-adapter.component'; import { VersionManagerDialogAdapterComponent } from './version-manager-dialog-adapter.component';
import { MetadataDialogAdapterComponent } from './metadata-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 { PreviewService } from '../../services/preview.service';
import { debounceTime } from 'rxjs/operators'; import { debounceTime, takeUntil } from 'rxjs/operators';
import { SearchEntry } from '@alfresco/js-api'; import { SearchEntry } from '@alfresco/js-api';
const DEFAULT_FOLDER_TO_SHOW = '-my-'; const DEFAULT_FOLDER_TO_SHOW = '-my-';
@ -57,6 +58,8 @@ const DEFAULT_FOLDER_TO_SHOW = '-my-';
}) })
export class FilesComponent implements OnInit, OnChanges, OnDestroy { export class FilesComponent implements OnInit, OnChanges, OnDestroy {
protected onDestroy$ = new Subject<boolean>();
errorMessage: string = null; errorMessage: string = null;
nodeId: any; nodeId: any;
showViewer = false; showViewer = false;
@ -213,7 +216,8 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
private preview: PreviewService, private preview: PreviewService,
@Optional() private route: ActivatedRoute, @Optional() private route: ActivatedRoute,
public authenticationService: AuthenticationService, public authenticationService: AuthenticationService,
public alfrescoApiService: AlfrescoApiService) { public alfrescoApiService: AlfrescoApiService,
private contentMetadataService: ContentMetadataService) {
} }
showFile(event) { showFile(event) {
@ -258,7 +262,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
}); });
} }
// this.disableDragArea = false;
this.uploadService.fileUploadComplete.asObservable() this.uploadService.fileUploadComplete.asObservable()
.pipe(debounceTime(300)) .pipe(debounceTime(300))
.subscribe((value) => this.onFileUploadEvent(value)); .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.onCreateFolder = this.contentService.folderCreate.subscribe((value) => this.onFolderAction(value));
this.onEditFolder = this.contentService.folderEdit.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.contentMetadataService.error
// this.permissionsStyle.push(new PermissionStyleModel('document-list__disable', AllowableOperationsEnum.NOT_CREATE, false, true)); .pipe(takeUntil(this.onDestroy$))
.subscribe((err: { message: string }) => {
this.notificationService.showError(err.message);
});
} }
ngOnDestroy() { ngOnDestroy() {
this.onCreateFolder.unsubscribe(); this.onCreateFolder.unsubscribe();
this.onEditFolder.unsubscribe(); this.onEditFolder.unsubscribe();
this.onDestroy$.next(true);
this.onDestroy$.complete();
} }
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {