From b331c1422d1f170f290dcb10f4e782a2ff32cc81 Mon Sep 17 00:00:00 2001 From: Urse Daniel Date: Tue, 28 Jul 2020 15:33:20 +0300 Subject: [PATCH] [ACA-100] FIX - View a previous version (#5915) * small fix, forgot to add the line when creating the last branch * fixing the wrong parameter passing * small fix, forgot to add the line when creating the last branch * fixing the wrong parameter passing * ACA-100: Exclude preview of a previous version e2e tests until ADF starts using ACS 7+ * ACA-100: Change protractor.conf.js path in Jasmine Opts * fixing the wrong parameter passing Co-authored-by: kristian --- e2e/protractor.excludes.json | 6 +++++- lib/core/viewer/components/viewer.component.ts | 8 ++++++-- lib/core/viewer/services/view-util.service.ts | 7 ++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/e2e/protractor.excludes.json b/e2e/protractor.excludes.json index aadce3d8ce..e21354116d 100644 --- a/e2e/protractor.excludes.json +++ b/e2e/protractor.excludes.json @@ -1,5 +1,9 @@ { "C290180": "https://issues.alfresco.com/jira/browse/ACS-364", - "C277201": "Investigate after NG10" + "C277201": "Investigate after NG10", + "C362240": "Include once ADF starts using ACS 7, https://issues.alfresco.com/jira/browse/ADF-5182", + "C362241": "Include once ADF starts using ACS 7, https://issues.alfresco.com/jira/browse/ADF-5182", + "C362242": "Include once ADF starts using ACS 7, https://issues.alfresco.com/jira/browse/ADF-5182", + "C362265": "Include once ADF starts using ACS 7, https://issues.alfresco.com/jira/browse/ADF-5182" } diff --git a/lib/core/viewer/components/viewer.component.ts b/lib/core/viewer/components/viewer.component.ts index 44ddc3858b..0c28ae580b 100644 --- a/lib/core/viewer/components/viewer.component.ts +++ b/lib/core/viewer/components/viewer.component.ts @@ -390,8 +390,8 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy { } this.fileTitle = this.getDisplayName(nodeData.name); - this.urlFileContent = versionData ? this.apiService.contentApi.getVersionContentUrl(this.nodeId, versionData.id) : + this.apiService.contentApi.getContentUrl(this.nodeId); this.urlFileContent = this.cacheBusterNumber ? this.urlFileContent + '&' + this.cacheBusterNumber : this.urlFileContent; this.extension = this.getFileExtension(versionData ? versionData.name : nodeData.name); @@ -404,7 +404,11 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy { } if (this.viewerType === 'unknown') { - setupNode = this.viewUtils.displayNodeRendition(nodeData.id, versionData ? versionData.id : undefined); + if (versionData) { + setupNode = this.viewUtils.displayNodeRendition(nodeData.id, versionData.id); + } else { + setupNode = this.viewUtils.displayNodeRendition(nodeData.id); + } } this.extensionChange.emit(this.extension); diff --git a/lib/core/viewer/services/view-util.service.ts b/lib/core/viewer/services/view-util.service.ts index ff5c73cdb4..55e0534b41 100644 --- a/lib/core/viewer/services/view-util.service.ts +++ b/lib/core/viewer/services/view-util.service.ts @@ -181,7 +181,8 @@ export class ViewUtilService { async displayNodeRendition(nodeId: string, versionId?: string) { try { - const rendition = await this.resolveNodeRendition(nodeId, 'pdf', versionId); + const rendition = versionId ? await this.resolveNodeRendition(nodeId, 'pdf', versionId) : + await this.resolveNodeRendition(nodeId, 'pdf'); if (rendition) { const renditionId = rendition.entry.id; @@ -226,7 +227,7 @@ export class ViewUtilService { this.viewerTypeChange.next('in_creation'); }); } - rendition = await this.waitNodeRendition(nodeId, renditionId, versionId); + rendition = versionId ? await this.waitNodeRendition(nodeId, renditionId, versionId) : await this.waitNodeRendition(nodeId, renditionId); } catch (err) { this.logService.error(err); } @@ -242,7 +243,7 @@ export class ViewUtilService { const intervalId = setInterval(() => { currentRetry++; if (this.maxRetries >= currentRetry) { - if (!versionId) { + if (versionId) { this.apiService.versionsApi.getVersionRendition(nodeId, versionId, renditionId).then((rendition: RenditionEntry) => { this.handleNodeRendition(rendition, nodeId, renditionId, versionId); clearInterval(intervalId);