alfresco-ng2-components/docs/core/node-restore.directive.md
Andy Stark 431bde3ddf [ADF-3587] Fixed doc comment problems (#3822)
* [ADF-3587] Fixed missing docs for accessor properties

* [ADF-3587] Fixed badly formed doc comments with deprecated tag

* [ADF-3587] Fixed linting issue with doc comment
2018-09-25 21:45:16 +01:00

2.0 KiB

Added, Status, Last reviewed
Added Status Last reviewed
v2.0.0 Active 2018-04-10

Node Restore directive

Restores deleted nodes to their original location.

Basic Usage

<adf-toolbar title="toolbar example">
    <button mat-icon-button
        location="/files"
        [adf-restore]="documentList.selection"
        (restore)="onRestore($event)">
        <mat-icon>restore</mat-icon>
    </button>
</adf-toolbar>

<adf-document-list #documentList
    currentFolderId="-trash-" ...>
    ...
</adf-document-list>
    onRestore(restoreMessage: RestoreMessageModel) {
        this.notificationService
            .openSnackMessageAction(
                restoreMessage.message,
                restoreMessage.action
            )
            .onAction()
            .subscribe(() => this.navigateLocation(restoreMessage.path));
        this.documentList.reload();
    }

    navigateLocation(path: PathInfoEntity) {
        const parent = path.elements[path.elements.length - 1];
        this.router.navigate(['files/', parent.id]);
    }

Class members

Properties

Name Type Default value Description
location string "" (Deprecated: 2.4.0) Path to restored node.
selection DeletedNodeEntry[] Array of deleted nodes to restore.

Events

Name Type Description
restore EventEmitter<RestoreMessageModel> Emitted when restoration is complete.

Details

The directive takes a selection of DeletedNodeEntry instances and restores them to their original locations. If the original location doesn't exist anymore then they remain in the trash list.

When you restore a single node, you can use the location property to show where the node has been restored. The property specifies the route path where the list of nodes are rendered.

See Also