mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
imporove sorting management and reduce repetitive code (#381)
* rework sorting management * remove fdescribe * test fixes * unified desctructor * unified page reload * test fixes * code fixes * test fixes * test fixes
This commit is contained in:
committed by
Cilibiu Bogdan
parent
0ac33f820b
commit
7bb0905045
@@ -25,18 +25,36 @@
|
||||
|
||||
import { MinimalNodeEntity, MinimalNodeEntryEntity, Pagination } from 'alfresco-js-api';
|
||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { ShareDataRow } from '@alfresco/adf-content-services';
|
||||
import { ShareDataRow, DocumentListComponent } from '@alfresco/adf-content-services';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { OnDestroy, ViewChild } from '@angular/core';
|
||||
import { Subscription } from 'rxjs/Rx';
|
||||
|
||||
export abstract class PageComponent implements OnDestroy {
|
||||
|
||||
@ViewChild(DocumentListComponent)
|
||||
documentList: DocumentListComponent;
|
||||
|
||||
export abstract class PageComponent {
|
||||
title = 'Page';
|
||||
infoDrawerOpened = false;
|
||||
node: MinimalNodeEntryEntity;
|
||||
|
||||
protected subscriptions: Subscription[] = [];
|
||||
|
||||
get sortingPreferenceKey(): string {
|
||||
return this.route.snapshot.data.sortingPreferenceKey;
|
||||
}
|
||||
|
||||
static isLockedNode(node) {
|
||||
return node.isLocked || (node.properties && node.properties['cm:lockType'] === 'READ_ONLY_LOCK');
|
||||
}
|
||||
|
||||
constructor(protected preferences: UserPreferencesService) {
|
||||
constructor(protected preferences: UserPreferencesService, protected route: ActivatedRoute) {
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => subscription.unsubscribe());
|
||||
this.subscriptions = [];
|
||||
}
|
||||
|
||||
getParentNodeId(): string {
|
||||
@@ -121,4 +139,11 @@ export abstract class PageComponent {
|
||||
|
||||
this.infoDrawerOpened = !this.infoDrawerOpened;
|
||||
}
|
||||
|
||||
reload(): void {
|
||||
if (this.documentList) {
|
||||
this.documentList.resetSelection();
|
||||
this.documentList.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user