From 61cc1c63bf69e6c2155a1d251ad7bdfae39c2119 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Tue, 28 Nov 2023 13:04:47 +0200 Subject: [PATCH] UI: Add support of inline images for exported entities. --- ui-ngx/src/app/core/http/asset-profile.service.ts | 4 ++++ ui-ngx/src/app/core/http/dashboard.service.ts | 4 ++++ ui-ngx/src/app/core/http/device-profile.service.ts | 4 ++++ ui-ngx/src/app/core/http/widget.service.ts | 9 +++++++-- .../app/shared/import-export/import-export.service.ts | 10 +++++----- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/ui-ngx/src/app/core/http/asset-profile.service.ts b/ui-ngx/src/app/core/http/asset-profile.service.ts index 0434f5f960..029e1afe5c 100644 --- a/ui-ngx/src/app/core/http/asset-profile.service.ts +++ b/ui-ngx/src/app/core/http/asset-profile.service.ts @@ -40,6 +40,10 @@ export class AssetProfileService { return this.http.get(`/api/assetProfile/${assetProfileId}`, defaultHttpOptionsFromConfig(config)); } + public exportAssetProfile(assetProfileId: string, config?: RequestConfig): Observable { + return this.http.get(`/api/assetProfile/${assetProfileId}?inlineImages=true`, defaultHttpOptionsFromConfig(config)); + } + public saveAssetProfile(assetProfile: AssetProfile, config?: RequestConfig): Observable { return this.http.post('/api/assetProfile', assetProfile, defaultHttpOptionsFromConfig(config)); } diff --git a/ui-ngx/src/app/core/http/dashboard.service.ts b/ui-ngx/src/app/core/http/dashboard.service.ts index 706967b70d..fc15e7aa74 100644 --- a/ui-ngx/src/app/core/http/dashboard.service.ts +++ b/ui-ngx/src/app/core/http/dashboard.service.ts @@ -71,6 +71,10 @@ export class DashboardService { return this.http.get(`/api/dashboard/${dashboardId}`, defaultHttpOptionsFromConfig(config)); } + public exportDashboard(dashboardId: string, config?: RequestConfig): Observable { + return this.http.get(`/api/dashboard/${dashboardId}?inlineImages=true`, defaultHttpOptionsFromConfig(config)); + } + public getDashboardInfo(dashboardId: string, config?: RequestConfig): Observable { return this.http.get(`/api/dashboard/info/${dashboardId}`, defaultHttpOptionsFromConfig(config)); } diff --git a/ui-ngx/src/app/core/http/device-profile.service.ts b/ui-ngx/src/app/core/http/device-profile.service.ts index 047374783e..fd7753a6ab 100644 --- a/ui-ngx/src/app/core/http/device-profile.service.ts +++ b/ui-ngx/src/app/core/http/device-profile.service.ts @@ -53,6 +53,10 @@ export class DeviceProfileService { return this.http.get(`/api/deviceProfile/${deviceProfileId}`, defaultHttpOptionsFromConfig(config)); } + public exportDeviceProfile(deviceProfileId: string, config?: RequestConfig): Observable { + return this.http.get(`/api/deviceProfile/${deviceProfileId}?inlineImages=true`, defaultHttpOptionsFromConfig(config)); + } + public getLwm2mObjects(sortOrder: SortOrder, objectIds?: string[], searchText?: string, config?: RequestConfig): Observable> { let url = `/api/resource/lwm2m/?sortProperty=${sortOrder.property}&sortOrder=${sortOrder.direction}`; diff --git a/ui-ngx/src/app/core/http/widget.service.ts b/ui-ngx/src/app/core/http/widget.service.ts index 89cdaa4431..16db878fdf 100644 --- a/ui-ngx/src/app/core/http/widget.service.ts +++ b/ui-ngx/src/app/core/http/widget.service.ts @@ -98,6 +98,11 @@ export class WidgetService { return this.http.get(`/api/widgetsBundle/${widgetsBundleId}`, defaultHttpOptionsFromConfig(config)); } + public exportWidgetsBundle(widgetsBundleId: string, + config?: RequestConfig): Observable { + return this.http.get(`/api/widgetsBundle/${widgetsBundleId}?inlineImages=true`, defaultHttpOptionsFromConfig(config)); + } + public saveWidgetsBundle(widgetsBundle: WidgetsBundle, config?: RequestConfig): Observable { return this.http.post('/api/widgetsBundle', widgetsBundle, @@ -137,9 +142,9 @@ export class WidgetService { defaultHttpOptionsFromConfig(config)); } - public getBundleWidgetTypesDetails(widgetsBundleId: string, + public exportBundleWidgetTypesDetails(widgetsBundleId: string, config?: RequestConfig): Observable> { - return this.http.get>(`/api/widgetTypesDetails?widgetsBundleId=${widgetsBundleId}`, + return this.http.get>(`/api/widgetTypesDetails?widgetsBundleId=${widgetsBundleId}?inlineImages=true`, defaultHttpOptionsFromConfig(config)); } diff --git a/ui-ngx/src/app/shared/import-export/import-export.service.ts b/ui-ngx/src/app/shared/import-export/import-export.service.ts index 0bd14d8f26..1a06739adb 100644 --- a/ui-ngx/src/app/shared/import-export/import-export.service.ts +++ b/ui-ngx/src/app/shared/import-export/import-export.service.ts @@ -139,7 +139,7 @@ export class ImportExportService { } public exportDashboard(dashboardId: string) { - this.dashboardService.getDashboard(dashboardId).subscribe( + this.dashboardService.exportDashboard(dashboardId).subscribe( (dashboard) => { let name = dashboard.title; name = name.toLowerCase().replace(/\W/g, '_'); @@ -348,7 +348,7 @@ export class ImportExportService { } public exportWidgetsBundle(widgetsBundleId: string) { - this.widgetService.getWidgetsBundle(widgetsBundleId).subscribe( + this.widgetService.exportWidgetsBundle(widgetsBundleId).subscribe( (widgetsBundle) => { this.dialog.open(ExportWidgetsBundleDialogComponent, { @@ -376,7 +376,7 @@ export class ImportExportService { } private exportWidgetsBundleWithWidgetTypes(widgetsBundle: WidgetsBundle) { - this.widgetService.getBundleWidgetTypesDetails(widgetsBundle.id.id).subscribe( + this.widgetService.exportBundleWidgetTypesDetails(widgetsBundle.id.id).subscribe( (widgetTypesDetails) => { const widgetsBundleItem: WidgetsBundleItem = { widgetsBundle: this.prepareExport(widgetsBundle), @@ -620,7 +620,7 @@ export class ImportExportService { } public exportDeviceProfile(deviceProfileId: string) { - this.deviceProfileService.getDeviceProfile(deviceProfileId).subscribe( + this.deviceProfileService.exportDeviceProfile(deviceProfileId).subscribe( (deviceProfile) => { let name = deviceProfile.name; name = name.toLowerCase().replace(/\W/g, '_'); @@ -651,7 +651,7 @@ export class ImportExportService { } public exportAssetProfile(assetProfileId: string) { - this.assetProfileService.getAssetProfile(assetProfileId).subscribe( + this.assetProfileService.exportAssetProfile(assetProfileId).subscribe( (assetProfile) => { let name = assetProfile.name; name = name.toLowerCase().replace(/\W/g, '_');