UI: Optimized load jsZip

This commit is contained in:
Vladyslav_Prykhodko 2020-12-22 17:33:03 +02:00
parent 4c4ec36b5c
commit f239697758

View File

@ -54,7 +54,6 @@ import { ImportEntitiesResultInfo, ImportEntityData } from '@shared/models/entit
import { RequestConfig } from '@core/http/http-utils';
import { RuleChain, RuleChainImport, RuleChainMetaData } from '@shared/models/rule-chain.models';
import { RuleChainService } from '@core/http/rule-chain.service';
import * as JSZip from 'jszip';
import { FiltersInfo } from '@shared/models/query/query.models';
// @dynamic
@ -421,7 +420,8 @@ export class ImportExportService {
}
public exportJSZip(data: object, filename: string) {
const jsZip = new JSZip();
import('jszip').then((JSZip) => {
const jsZip = new JSZip.default();
for (const keyName in data) {
if (data.hasOwnProperty(keyName)) {
const valueData = data[keyName];
@ -431,6 +431,7 @@ export class ImportExportService {
jsZip.generateAsync({type: 'blob'}).then(content => {
this.downloadFile(content, filename, ZIP_TYPE);
});
});
}
private prepareRuleChain(ruleChain: RuleChain): RuleChain {