Skip to content

Commit 6e2feba

Browse files
committed
refactor(int-generic-group-config): update file upload logic to simplify JSON handling
Signed-off-by: Manuel Abascal <mjabascal10@gmail.com>
1 parent dab2aec commit 6e2feba

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

frontend/src/app/app-module/conf/int-generic-group-config/int-generic-group-config.component.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ export class IntGenericGroupConfigComponent implements OnInit, OnChanges, OnDest
293293
return groups.some(group => this.pendingChangesForGroup(group));
294294
}
295295

296-
onFileUpload($event: any[], group: UtmModuleGroupType, integrationConfig: UtmModuleGroupConfType) {
296+
/*onFileUpload($event: any[], group: UtmModuleGroupType, integrationConfig: UtmModuleGroupConfType) {
297297
if (integrationConfig.confKey === 'jsonKey') {
298298
this.encryptService.encrypt(JSON.stringify($event[0])).subscribe(response => {
299299
const indexGroup = this.groups.findIndex(value => value.id === group.id);
@@ -302,8 +302,22 @@ export class IntGenericGroupConfigComponent implements OnInit, OnChanges, OnDest
302302
this.addChange(integrationConfig);
303303
});
304304
}
305+
}*/
306+
307+
onFileUpload($event: any[], group: UtmModuleGroupType, integrationConfig: UtmModuleGroupConfType) {
308+
if (integrationConfig.confKey === 'jsonKey') {
309+
const json = JSON.stringify($event[0]);
310+
311+
const indexGroup = this.groups.findIndex(value => value.id === group.id);
312+
const indexConf = this.groups[indexGroup].moduleGroupConfigurations.findIndex(value => value.id === integrationConfig.id);
313+
314+
this.groups[indexGroup].moduleGroupConfigurations[indexConf].confValue = json;
315+
316+
this.addChange(integrationConfig);
317+
}
305318
}
306319

320+
307321
collectorValid(groups: UtmModuleGroupType[]) {
308322
return groups.every(group => this.tenantIsConfigValid(group));
309323
}

0 commit comments

Comments
 (0)