[ACA-4676][ACA-4678] Added Non Responsive Preview Dialog to viewer component (#8428)

* [ACA-4676] Added NonResponsivePreview dialog to download file incase file preview takes longer than a set period of time.

* [ACA-4676] Updated button positioning for non responsive preview dialog

* [ACA-4676] Added documentation for NonResponsivePreviewDialog functionality for viewer.component.ts

* [ACA-4676] Added unit tests for NonResponsivePreviewDialog

* [ACA-4676] Updated template of NonResponsivePreviewDialog to use components and directives from mat-dialog. Removed non-responsive-dialog.component.scss. Removed unused methods from non-responsive-dialog.component.ts

* [ACA-4676] Corrected typo in NonResponsivePreviewDialog unit tests

* [ACA-4676] Added test cases for NonResponsivePreviewDialog in viewer.component.ts. NOT WORKING

* [ACA-4676] Fixed test cases for non-responsive preview dialog. Moved NonResponsivePreview dialog tests to separate describe block. Updated component code to make properties and methods visible to testing environment

* [ACA-4676] Migrated viewer component test env setup from setupTestBed() to TestBed.configureTestingModule(). Moved NonResponsivePreviewDialog unit tests to inside parent Viewer component describe block

* [ACA-4676] Removed unused async tag. Added license info to non-responsive-dialog.component.ts and non-responsive-preview-actions.enum.ts

* [ACA-4676] Updated code to use "viewer" appConfig object instead of "preview-config". Added non-responsive-preview-actions.enum.ts to public-api.ts

* [ACA-4676] Resolved potential lint issues

* [ACA-4676] Updated non responsive preview to look for viewer config object inside app.config instead of preview-config

* [ACA-4676] Removed duplicate import for @adf/core. Added NonResponsiveDialogComponent to adf/core exports

* [ACA-4676] Renamed properties/config/documentation from nonResponsivePreview to downloadPrompt. Renamed NonResponsivePreviewActionsEnum to DownloadPromptActions.

* [ACA-4676] Resolved linting and unit test failures

* [ACA-4676] Changed dataType for timers to number. Updated code to use window.setTimeout(), instead of just setTimeout(). Added missing whitespace. Updated method names in demo shell to use 'downloadPrompt' naming scheme.

* [ACA-4676] Fixed incorrect import statement in viewer.module.ts for download-prompt-dialog

* [ACA-4676] Testing disabled by default behaviour of downloadPrompt feature

* [ACA-4676] Changed default value for enableDownloadPrompt and enableDownloadPromptReminders to false in app.config.json

* [ACA-4676] Removed un-needed AppConfig configurations from unit tests
This commit is contained in:
swapnil-verma-gl
2023-04-12 19:32:34 +05:30
committed by GitHub
parent 662dfd9c3a
commit 0eb0ff167b
13 changed files with 423 additions and 29 deletions

View File

@@ -380,6 +380,31 @@ In the same way you can set a default zoom scaling value for the image viewer by
By default the viewer's zoom scaling is set to 100%.
## Handling non responsive file preview
It is possible that trying to load a large file, especially over a slow network, can cause the viewer component to get stuck in the loading state. To handle such cases,
the viewer can be configured to display a prompt to ask the user to either download the file locally and then close the viewer, or wait for the viewer to load the file.
In case the user decides to wait, the viewer can further be configured to display subsequent reminder prompts asking the same options.
In order to configure this feature, add the following code in `app.config.json`.
```
"viewer": {
"enableDownloadPrompt": true,
"enableDownloadPromptReminder": true,
"downloadPromptDelay": 50,
"downloadPromptReminderDelay": 30
}
```
Here `enableDownloadPrompt: true` enables the dialog to be visible after a set period of time. This time can be configured by updating the value in the
`downloadPromptDelay` property.
The second boolean flag `enableDownloadPromptReminder: true` can be used to configure whether the reminder prompts should be displayed or not.
`downloadPromptReminderDelay` property can be used to configure the time to wait between reminder prompts.
Note: All times in this configuration must be provided in seconds
## See also
- [Document List component](../../content-services/components/document-list.component.md)