From dc450a3af2e498c3e10139d546e95d03c8b592a1 Mon Sep 17 00:00:00 2001 From: arditdomi <32884230+arditdomi@users.noreply.github.com> Date: Sat, 13 Jul 2019 11:35:21 +0100 Subject: [PATCH] [ADF-4480] Change Viewer behaviour when opening unsupported files (#4922) * [ADF-4480] Change Viewer behaviour when opening unsuported files * [ADF-4480] Fix identations * [ADF-4480] Make timeout of rendition retry constant --- lib/core/i18n/en.json | 2 +- .../unknown-format/unknown-format.component.html | 2 +- lib/core/viewer/components/viewer.component.ts | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/core/i18n/en.json b/lib/core/i18n/en.json index 91833526ce..8ef8e7a3ca 100644 --- a/lib/core/i18n/en.json +++ b/lib/core/i18n/en.json @@ -298,7 +298,7 @@ "OF": "of" }, "LOADING": "Loading", - "UNKNOWN_FORMAT": "Couldn't load preview", + "UNKNOWN_FORMAT": "Couldn't load preview. Unknown format.", "SIDEBAR": { "THUMBNAILS": { "PAGE": "Page {{ pageNum }}" diff --git a/lib/core/viewer/components/unknown-format/unknown-format.component.html b/lib/core/viewer/components/unknown-format/unknown-format.component.html index 7488627192..2e09cb1bf8 100644 --- a/lib/core/viewer/components/unknown-format/unknown-format.component.html +++ b/lib/core/viewer/components/unknown-format/unknown-format.component.html @@ -1,6 +1,6 @@
- wifi_tethering + error
{{ 'ADF_VIEWER.UNKNOWN_FORMAT' | translate }}
diff --git a/lib/core/viewer/components/viewer.component.ts b/lib/core/viewer/components/viewer.component.ts index 573f798d88..fbd9163775 100644 --- a/lib/core/viewer/components/viewer.component.ts +++ b/lib/core/viewer/components/viewer.component.ts @@ -200,6 +200,8 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy { @Output() invalidSharedLink = new EventEmitter(); + TRY_TIMEOUT: number = 2000; + viewerType = 'unknown'; isLoading = false; nodeEntry: NodeEntry; @@ -692,8 +694,12 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy { this.viewerType = 'error_in_creation'; return reject(); }); + } else { + this.isLoading = false; + this.viewerType = 'error_in_creation'; + clearInterval(intervalId); } - }, 1000); + }, this.TRY_TIMEOUT); }); }