MichalKinas 76e2870c66
Adjust ADF to latest JS-API version (#8882)
* Bump js-api version

* Fix imports

* Fix content-services unit tests

* Fix process-services unit tests

* [ci:force] Trigger CI

* Fix code smells

* Fix orderBy param

* Fix code smells

* Fix failing unit tests

* Bump js-api version and align with new changes

* Remove dangling coma

* Fix delete return type

* Add correct date format in task filters e2es

* Fix typing in task filter sorting

* Fix activiti content api import

* Add null check for has avatar

* Make User class instead of type

* Fix user type in comment model

* Fix sonar cloud issue

* Type fixes

* Update js-api version
2023-09-07 07:29:42 -04:00

73 lines
2.3 KiB
Markdown

---
Title: Node Restore directive
Added: v2.0.0
Status: Active
Last reviewed: 2019-01-16
---
# [Node Restore directive](../../../lib/content-services/src/lib/directives/node-restore.directive.ts "Defined in node-restore.directive.ts")
Restores deleted nodes to their original location.
## Basic Usage
```html
<adf-toolbar title="toolbar example">
<button mat-icon-button
[adf-restore]="documentList.selection"
(restore)="onRestore($event)">
<mat-icon>restore</mat-icon>
</button>
</adf-toolbar>
<adf-document-list #documentList
currentFolderId="-trash-" ...>
...
</adf-document-list>
```
```ts
onRestore(restoreMessage: RestoreMessageModel) {
this.notificationService
.openSnackMessageAction(
restoreMessage.message,
restoreMessage.action
)
.onAction()
.subscribe(() => this.navigateLocation(restoreMessage.path));
this.documentList.reload();
}
navigateLocation(path: PathInfo) {
const parent = path.elements[path.elements.length - 1];
this.router.navigate(['files/', parent.id]);
}
```
## Class members
### Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| selection | [`DeletedNodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/DeletedNodeEntry.md)`[]` | | Array of deleted nodes to restore. |
### Events
| Name | Type | Description |
| ---- | ---- | ----------- |
| restore | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`RestoreMessageModel`](../../../lib/content-services/src/lib/interfaces/restore-message-model.interface.ts)`>` | Emitted when restoration is complete. |
## Details
The directive takes a selection of [`DeletedNodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/DeletedNodeEntry.md) 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
- [Node delete directive](node-delete.directive.md)