mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-4681] Added file auto download feature to DocumentList component (#8423)
* [ACA-4681] Added feature in DocumentListComponent to auto download a file if it exceeds a pre defined file size threshold * [ACA-4681] Added test cases for file auto download feature in document list (NOT WORKING) * [ACA-4681] Fixed unit tests for file auto download feature of document list * [ACA-4681] Removed unused variables from app.config.json * [ACA-4681] Resolved code review findings. Local constants are no longer upper case only (used camelCase instead). FileAutoDownload component template now uses mat-dialog provided directives and components. Removed file-auto-download.component.scss. Removed unused methods from file-auto-download.component.ts * [ACA-4681] Added licence info to file-auto-download-actions.enum.ts * [ACA-4681] Added license info to file-auto-download.component.ts * [ACA-4681] Removed empty constructor * [ACA-4681] Updated appConfig property name from "preview-config" to "viewer". * [ACA-4681] Added JSDoc for FileAutoDownloadActionsEnum * [ACA-4681] Updated ADF demo shell application to use "viewer" appConfig object instead of "preview-config" * [ACA-4681] Resolved lint issues * [ACA-4681] Removed dependency from NodeActionsService inside DocumentListComponent. FileAutoDownload component now directly triggers the file download, instead of emitting FileAutoDownloadActionsEnum.Download. * [ACA-4681] Removed unused async. Updated import statement * [ACA-4681] Added FileAutoDownloadComponent to public-api.ts
This commit is contained in:
@@ -790,6 +790,27 @@ This will give the following output:
|
||||
|
||||

|
||||
|
||||
### File Auto downloading
|
||||
|
||||
In case of files exceeding a predefined file size, the document list component can be configured to automatically download those file when trying to preview them.
|
||||
This can help in reducing server load, and ensuring quick access to such files. After turning this feature on, whenever the user tries to preview a file with a large
|
||||
file size, the Document List component will first preview a dialog, asking for confirmation from the user on whether they want to download the file, or cancel the preview altogether.
|
||||
|
||||
In order to configure the Document List to automatically download the files, the following environment variables would need to be set up in app.config.json -
|
||||
|
||||
```
|
||||
"viewer": {
|
||||
"enableFileAutoDownload": true,
|
||||
"fileAutoDownloadSizeThresholdInMB": 15
|
||||
}
|
||||
```
|
||||
|
||||
Here, `"enableFileAutoDownload": true,` would enable the file auto download feature on the Document List component. Setting this flag to false disables this feature, and always
|
||||
triggers a file preview when trying to view a file, regardless of its size.
|
||||
|
||||
The second configuration here, `"fileAutoDownloadSizeThresholdInMB": 15` specifies the file size threshold (in MB), after which the Document List component will start downloading the file.
|
||||
In the example provided above, any file greater than 15MB in size would trigger the auto download functionality. Files lower than 15MB in size would continue to preview normally.
|
||||
|
||||
## See also
|
||||
|
||||
- [Datatable component](../../core/components/datatable.component.md)
|
||||
|
Reference in New Issue
Block a user