diff --git a/ui-ngx/src/app/modules/home/components/import-export/export-widgets-bundle-dialog.component.ts b/ui-ngx/src/app/modules/home/components/import-export/export-widgets-bundle-dialog.component.ts index 6b9d680815..728fa74157 100644 --- a/ui-ngx/src/app/modules/home/components/import-export/export-widgets-bundle-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/import-export/export-widgets-bundle-dialog.component.ts @@ -46,17 +46,14 @@ export class ExportWidgetsBundleDialogComponent extends DialogComponent, protected router: Router, @Inject(MAT_DIALOG_DATA) public data: ExportWidgetsBundleDialogData, public dialogRef: MatDialogRef) { super(store, router, dialogRef); this.widgetsBundle = data.widgetsBundle; - this.includeBundleWidgetsInExport = data.includeBundleWidgetsInExport; - if (this.includeBundleWidgetsInExport) { - this.exportWidgetsFormControl.patchValue(this.includeBundleWidgetsInExport, {emitEvent: false}); + if (data.includeBundleWidgetsInExport) { + this.exportWidgetsFormControl.patchValue(data.includeBundleWidgetsInExport, {emitEvent: false}); } } @@ -68,9 +65,6 @@ export class ExportWidgetsBundleDialogComponent extends DialogComponent { - if(settings) { - includeBundleWidgetsInExport = settings; - } - }); + const tasks = { + includeBundleWidgetsInExport: this.store.pipe(select(selectUserSettingsProperty( 'includeBundleWidgetsInExport'))).pipe(take(1)), + widgetsBundle: this.widgetService.getWidgetsBundle(widgetsBundleId) + }; - this.widgetService.getWidgetsBundle(widgetsBundleId).subscribe( - (widgetsBundle) => { + forkJoin(tasks).subscribe({ + next: ({includeBundleWidgetsInExport, widgetsBundle}) => { this.dialog.open(ExportWidgetsBundleDialogComponent, { disableClose: true, @@ -337,6 +334,9 @@ export class ImportExportService { }).afterClosed().subscribe( (result) => { if (result) { + if (includeBundleWidgetsInExport !== result.exportWidgets) { + this.store.dispatch(new ActionPreferencesPutUserSettings({includeBundleWidgetsInExport: result.exportWidgets})); + } if (result.exportWidgets) { this.exportWidgetsBundleWithWidgetTypes(widgetsBundle); } else { @@ -346,10 +346,10 @@ export class ImportExportService { } ); }, - (e) => { + error: (e) => { this.handleExportError(e, 'widgets-bundle.export-failed-error'); } - ); + }); } private exportWidgetsBundleWithWidgetTypes(widgetsBundle: WidgetsBundle) {