mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3309] solve rendition preview (#3573)
* solve rendition preview * fix tslint * missing semicolon * solve packaging issues * reinsert maxretry logic
This commit is contained in:
committed by
Eugenio Romano
parent
809f4c06d3
commit
9b804f72f2
@@ -175,7 +175,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
* There is a delay of at least one second between attempts.
|
* There is a delay of at least one second between attempts.
|
||||||
*/
|
*/
|
||||||
@Input()
|
@Input()
|
||||||
maxRetries = 5;
|
maxRetries = 10;
|
||||||
|
|
||||||
/** Emitted when user clicks the 'Back' button. */
|
/** Emitted when user clicks the 'Back' button. */
|
||||||
@Output()
|
@Output()
|
||||||
@@ -678,9 +678,11 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async waitRendition(nodeId: string, renditionId: string, retries: number): Promise<RenditionEntry> {
|
private async waitRendition(nodeId: string, renditionId: string, retries: number): Promise<RenditionEntry> {
|
||||||
|
let currentRetry = 0;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let intervalId = setInterval(() => {
|
let intervalId = setInterval(() => {
|
||||||
|
currentRetry++;
|
||||||
|
if (this.maxRetries >= currentRetry) {
|
||||||
this.apiService.renditionsApi.getRendition(nodeId, renditionId).then((rendition) => {
|
this.apiService.renditionsApi.getRendition(nodeId, renditionId).then((rendition) => {
|
||||||
const status = rendition.entry.status.toString();
|
const status = rendition.entry.status.toString();
|
||||||
if (status === 'CREATED') {
|
if (status === 'CREATED') {
|
||||||
@@ -700,6 +702,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
this.viewerType = 'error_in_creation';
|
this.viewerType = 'error_in_creation';
|
||||||
return reject();
|
return reject();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user