[ACS-9406] Add getContentRenditionTypePreview to process-content service (#10743)

* [ACS-9406] Add getContentRenditionTypePreview to process-content service

* [ACS-9406] remove extra space

* [ACS-9406] fix unit tests

* [ACS-9406] fix unit tests

* [ACS-9406] cr fixes
This commit is contained in:
Mykyta Maliarchuk
2025-04-02 14:07:20 +02:00
committed by GitHub
parent c85245b241
commit 8e0ea373f0
14 changed files with 119 additions and 10 deletions

View File

@@ -64,6 +64,7 @@ Using with file [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob):
| urlFile | `string` | "" | If you want to load an external file that does not come from ACS you can use this URL to specify where to load the file from. |
| viewerTemplateExtensions | [`TemplateRef`](https://angular.io/api/core/TemplateRef)`<any>` | null | Template containing ViewerExtensionDirective instances providing different viewer extensions based on supported file extension. |
| nodeId | `string` | null | Identifier of a node opened by a viewer. |
| customError | `string` | undefined | Custom error message to be displayed in the viewer. |
### Events

View File

@@ -90,6 +90,7 @@ See the [Custom layout](#custom-layout) section for full details of all availabl
| viewerExtensions | [`TemplateRef`](https://angular.io/api/core/TemplateRef)`<any>` | null | Template containing ViewerExtensionDirective instances providing different viewer extensions based on supported file extension. |
| nodeId | `string` | null | Identifier of a node opened by a viewer. |
| nodeMimeType | `string` | undefined | Original node mime type, should be provided when renditiona mime type is different. |
| customError | `string` | undefined | Custom error message to be displayed in the viewer. |
### Events

View File

@@ -40,6 +40,10 @@ Manipulates content related to a Process Instance or Task Instance in APS.
Gets the thumbnail for a related content file.
- _contentId:_ `number` - ID of the related content
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)`>` - Binary data of the thumbnail image
- **getContentRenditionTypePreview**(contentId: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)`>`<br/>
Gets the preview rendition for a related content file.
- _contentId:_ `number` - ID of the related content
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)`>` - Binary data of the related content
- **getFileContent**(contentId: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`RelatedContentRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-activiti-rest-api/docs/RelatedContentRepresentation.md)`>`<br/>
Gets the metadata for a related content item.
- _contentId:_ `number` - ID of the content item
@@ -325,6 +329,26 @@ The response looks like in this sample:
See `getProcessRelatedContent` and `getTaskRelatedContent` for how to get to the `contentId`.
#### getContentRenditionTypePreview(contentId: number): Observable`<Blob>`
Get the preview type rendition for a related content file. A content file might be for example an
MS Word document. This method would give you the PDF preview for this document,
if it has been generated:
```ts
const contentId = 1;
this.contentService.getContentRenditionTypePreview(contentId).subscribe(
res => {
console.log('Response Preview BLOB: ', res);
}, error => {
console.log('Error: ', error);
});
```
The preview BLOB response looks something like this:
`Blob(44101) {size: 44101, type: "application/pdf"}`
#### getProcessRelatedContent(processId: string): Observable`<any>`
Get related content items for passed in Process Instance ID, only metadata for related content is returned: