[ACS-7679] Reduce the usage of AppConfigService in components and tests (#9563)

* remove unused app config setting

* remove unused app config setting

* remove unnecessary app config service reference

* remove unnecessary app config service reference

* remove unnecessary app config service reference

* remove unnecessary app config service reference

* remove unnecessary app config service reference

* support input params for the viewer; optional configuration

* remove useless imports [ci:force]

* fix imports [ci:force]
This commit is contained in:
Denys Vuika
2024-04-18 07:26:55 -04:00
committed by GitHub
parent 99ae729314
commit 4132517ba7
12 changed files with 51 additions and 128 deletions

View File

@@ -57,7 +57,8 @@ import {
DataRow,
DataTableService,
DataTableSchema,
DataColumn
DataColumn,
ViewerComponentConfig
} from '@alfresco/adf-core';
import { NodesApiService } from '../../common/services/nodes-api.service';
import { Node, NodeEntry, NodePaging, NodesApi, Pagination } from '@alfresco/js-api';
@@ -789,9 +790,10 @@ export class DocumentListComponent extends DataTableSchema implements OnInit, On
onPreviewFile(node: NodeEntry) {
if (node) {
const sizeInMB = node.entry?.content?.sizeInBytes / BYTES_TO_MB_CONVERSION_VALUE;
const config = this.appConfig.get<ViewerComponentConfig>('viewer');
const fileAutoDownloadFlag: boolean = this.appConfig.get('viewer.enableFileAutoDownload', true);
const sizeThreshold: number = this.appConfig.get('viewer.fileAutoDownloadSizeThresholdInMB', 15);
const fileAutoDownloadFlag = config?.enableFileAutoDownload ?? true;
const sizeThreshold = config?.fileAutoDownloadSizeThresholdInMB ?? 15;
if (fileAutoDownloadFlag && sizeInMB && sizeInMB > sizeThreshold) {
this.dialog.open(FileAutoDownloadComponent, { disableClose: true, data: node });