mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
parent
1ce013bb74
commit
5791622f6e
@ -54,6 +54,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
isValidPath = true;
|
||||
isSmallScreen = false;
|
||||
isAdmin = false;
|
||||
selectedNode: MinimalNodeEntity;
|
||||
|
||||
private nodePath: PathElement[];
|
||||
|
||||
@ -147,6 +148,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
|
||||
navigateTo(node: MinimalNodeEntity) {
|
||||
if (node && node.entry) {
|
||||
this.selectedNode = node;
|
||||
const { id, isFolder } = node.entry;
|
||||
|
||||
if (isFolder) {
|
||||
@ -176,7 +178,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
|
||||
// check root and child nodes
|
||||
if (node && node.entry && node.entry.parentId === this.getParentNodeId()) {
|
||||
this.reload();
|
||||
this.reload(this.selectedNode);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -214,7 +216,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
if (alreadyDisplayedParentFolder) {
|
||||
return;
|
||||
}
|
||||
this.reload();
|
||||
this.reload(this.selectedNode);
|
||||
}
|
||||
|
||||
onContentCopied(nodes: MinimalNodeEntity[]) {
|
||||
@ -224,7 +226,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
});
|
||||
if (newNode) {
|
||||
this.reload();
|
||||
this.reload(this.selectedNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,8 @@ import {
|
||||
isInfoDrawerOpened,
|
||||
getSharedUrl,
|
||||
ViewNodeAction,
|
||||
ViewNodeExtras
|
||||
ViewNodeExtras,
|
||||
SetSelectedNodesAction
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { isLocked, isLibrary } from '../utils/node.utils';
|
||||
|
||||
@ -131,8 +132,11 @@ export abstract class PageComponent implements OnInit, OnDestroy {
|
||||
return null;
|
||||
}
|
||||
|
||||
reload(): void {
|
||||
reload(selectedNode?: MinimalNodeEntity): void {
|
||||
this.store.dispatch(new ReloadDocumentListAction());
|
||||
if (selectedNode) {
|
||||
this.store.dispatch(new SetSelectedNodesAction([selectedNode]));
|
||||
}
|
||||
}
|
||||
|
||||
trackByActionId(_: number, action: ContentActionRef) {
|
||||
|
@ -32,12 +32,14 @@ import { Store } from '@ngrx/store';
|
||||
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { takeUntil, filter } from 'rxjs/operators';
|
||||
import { ContentManagementService } from '../services/content-management.service';
|
||||
import { MinimalNodeEntity } from '@alfresco/js-api';
|
||||
|
||||
@Directive({
|
||||
selector: '[acaDocumentList]'
|
||||
})
|
||||
export class DocumentListDirective implements OnInit, OnDestroy {
|
||||
private isLibrary = false;
|
||||
selectedNode: MinimalNodeEntity;
|
||||
|
||||
onDestroy$ = new Subject<boolean>();
|
||||
|
||||
@ -88,7 +90,7 @@ export class DocumentListDirective implements OnInit, OnDestroy {
|
||||
.subscribe(() => this.onReady());
|
||||
|
||||
this.content.reload.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
|
||||
this.reload();
|
||||
this.reload(this.selectedNode);
|
||||
});
|
||||
|
||||
this.content.reset.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
|
||||
@ -119,6 +121,7 @@ export class DocumentListDirective implements OnInit, OnDestroy {
|
||||
onNodeSelect(event: CustomEvent) {
|
||||
if (!!event.detail && !!event.detail.node) {
|
||||
this.updateSelection();
|
||||
this.selectedNode = event.detail.node;
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,9 +143,13 @@ export class DocumentListDirective implements OnInit, OnDestroy {
|
||||
this.store.dispatch(new SetSelectedNodesAction(selection));
|
||||
}
|
||||
|
||||
private reload() {
|
||||
private reload(selectedNode?: MinimalNodeEntity) {
|
||||
this.documentList.resetSelection();
|
||||
this.store.dispatch(new SetSelectedNodesAction([]));
|
||||
if (selectedNode) {
|
||||
this.store.dispatch(new SetSelectedNodesAction([selectedNode]));
|
||||
} else {
|
||||
this.store.dispatch(new SetSelectedNodesAction([]));
|
||||
}
|
||||
this.documentList.reload();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user