mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-5839] migrate to latest JS-API types (#8859)
* [ci:force] migrate Minimal Node to Node * [ci:force] remove js-api wrappers and use real types * [ci:force] remove js-api wrappers and use real types * [ci:force] fix linting errors * [ci:force] fix linting errors * [ci:force] security fixes * [ci:force] sonarcloud bug fixes * [ci:force] dead code elimination, sonar suggested fixes
This commit is contained in:
@@ -121,7 +121,7 @@ will trigger the same action.) You can also add your own handler by implementing
|
||||
`execute` event.
|
||||
|
||||
Note that you can use _both_ a built-in handler and your own `execute`
|
||||
function in the same action. The `execute` function is passed a [`NodeMinimalEntry`](../../../lib/content-services/src/lib/document-list/models/document-library.model.ts) as its
|
||||
function in the same action. The `execute` function is passed a **NodeEntry** as its
|
||||
parameter. For
|
||||
example, with `handler="delete"` you could use `execute` to show a message with the name,
|
||||
type, and other details of the item just deleted:
|
||||
|
@@ -15,11 +15,11 @@ Extends from [`BaseCardViewUpdate`](../../../lib/core/src/lib/card-view/interfac
|
||||
```ts
|
||||
export interface BaseCardViewContentUpdate {
|
||||
itemUpdated$: Subject<UpdateNotification>;
|
||||
updatedAspect$: Subject<MinimalNode>;
|
||||
updatedAspect$: Subject<Node>;
|
||||
|
||||
update(property: CardViewBaseItemModel, newValue: any);
|
||||
updateElement(notification: CardViewBaseItemModel);
|
||||
updateNodeAspect(node: MinimalNode);
|
||||
updateNodeAspect(node: Node);
|
||||
}
|
||||
```
|
||||
|
||||
|
@@ -73,7 +73,7 @@ constructor(private contentDialogService: ContentNodeDialogService){}
|
||||
yourFunctionOnCopyOrMove(){
|
||||
this.contentDialogService
|
||||
.openCopyMoveDialog(actionName, targetNode, neededPermissionForAction)
|
||||
.subscribe((selections: MinimalNode[]) => {
|
||||
.subscribe((selections: Node[]) => {
|
||||
// place your action here on operation success!
|
||||
});
|
||||
}
|
||||
|
@@ -106,73 +106,6 @@ and the
|
||||
[REST API Explorer](https://api-explorer.alfresco.com/api-explorer/#/nodes)
|
||||
for more information.
|
||||
|
||||
### Getting node information
|
||||
|
||||
The `getNode` method gives access to the [`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md) object that represents the
|
||||
details of a node:
|
||||
|
||||
```ts
|
||||
interface MinimalNode extends Node {
|
||||
id: string;
|
||||
parentId: string;
|
||||
name: string;
|
||||
nodeType: string;
|
||||
isFolder: boolean;
|
||||
isFile: boolean;
|
||||
modifiedAt: Date;
|
||||
modifiedByUser: UserInfo;
|
||||
createdAt: Date;
|
||||
createdByUser: UserInfo;
|
||||
content: ContentInfo;
|
||||
path: PathInfoEntity;
|
||||
properties: NodeProperties;
|
||||
}
|
||||
```
|
||||
|
||||
This provides useful information about the node, such as its name, creation and
|
||||
modification dates, etc. Also, the `id` and `parentId` properties contain the node
|
||||
ID strings for the current node and its enclosing folder.
|
||||
|
||||
Sometimes, a [`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md) is provided directly, for example, the `folderNode` property
|
||||
of a [Document List component](../../content-services/components/document-list.component.md) or the data context of a
|
||||
[Document List row](../../content-services/components/document-list.component.md#underlying-node-object). In these cases,
|
||||
you might pass the `id` or `parentId` as a [route parameter](https://angular.io/guide/router)
|
||||
to a page describing the node in full detail. The component receiving the node ID can
|
||||
use the [Nodes Api service](nodes-api.service.md) to "decode" the ID string into a [`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md):
|
||||
|
||||
```ts
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { NodesApiService } from '@alfresco/adf-core';
|
||||
import { MinimalNode } from '@alfresco/js-api';
|
||||
...
|
||||
|
||||
export class RepositoryDetailsPageComponent implements OnInit {
|
||||
nodeId: string;
|
||||
nodeName: string;
|
||||
isFile: boolean;
|
||||
...
|
||||
|
||||
constructor(private router: Router,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private nodeService: NodesApiService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.nodeId = this.activatedRoute.snapshot.params['node-id'];
|
||||
this.nodeService.getNode(this.nodeId).subscribe((entry: MinimalNode) => {
|
||||
const node: MinimalNode = entry;
|
||||
this.nodeName = node.name;
|
||||
this.isFile = node.isFile;
|
||||
...
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
You can supply a number of extra options using the `options` parameter. See the
|
||||
[getNode](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodesApi.md#getNode)
|
||||
page in the Alfresco JS API docs for more information.
|
||||
|
||||
### Getting folder node contents
|
||||
|
||||
The `getNodeChildren` method returns the contents of a folder
|
||||
|
@@ -133,9 +133,9 @@ to _alfresco-1002_ as follows:
|
||||
You then need to pass the node as the input `values` object with the other properties:
|
||||
|
||||
```ts
|
||||
let node: MinimalNode = null;
|
||||
let node: Node = null;
|
||||
|
||||
this.nodesApiService.getNode(NODE_ID).subscribe((minimalNode) => this.node = minimalNode);
|
||||
this.nodesApiService.getNode(NODE_ID).subscribe((res) => this.node = res);
|
||||
|
||||
const formValues: FormValues = {
|
||||
'file' : node
|
||||
|
Reference in New Issue
Block a user