Browse Source
Merge pull request #9289 from vvlladd28/improvement/import-widgets-bundle/support-old-format
Add support import widgets bundles in old format
pull/9294/head
Igor Kulikov
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
12 additions and
1 deletions
-
ui-ngx/src/app/modules/home/components/import-export/import-export.service.ts
|
|
|
@ -398,7 +398,9 @@ export class ImportExportService { |
|
|
|
const widgetTypesDetails = widgetsBundleItem.widgetTypes; |
|
|
|
const saveWidgetTypesObservables: Array<Observable<WidgetTypeDetails>> = []; |
|
|
|
for (const widgetTypeDetails of widgetTypesDetails) { |
|
|
|
saveWidgetTypesObservables.push(this.widgetService.saveImportedWidgetTypeDetails(widgetTypeDetails)); |
|
|
|
saveWidgetTypesObservables.push( |
|
|
|
this.widgetService.saveImportedWidgetTypeDetails(this.prepareWidgetType(widgetTypeDetails, savedWidgetsBundle)) |
|
|
|
); |
|
|
|
} |
|
|
|
widgetTypesObservable = forkJoin(saveWidgetTypesObservables); |
|
|
|
} else { |
|
|
|
@ -432,6 +434,15 @@ export class ImportExportService { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
private prepareWidgetType(widgetType: WidgetTypeDetails & {alias?: string}, widgetsBundle: WidgetsBundle): WidgetTypeDetails { |
|
|
|
if (!widgetType.fqn) { |
|
|
|
widgetType.fqn = `${widgetsBundle.alias}.${widgetType.alias |
|
|
|
? widgetType.alias |
|
|
|
: widgetType.name.toLowerCase().replace(/\W/g, '_')}`;
|
|
|
|
} |
|
|
|
return widgetType; |
|
|
|
} |
|
|
|
|
|
|
|
public bulkImportEntities(entitiesData: BulkImportRequest, entityType: EntityType, config?: RequestConfig): Observable<BulkImportResult> { |
|
|
|
switch (entityType) { |
|
|
|
case EntityType.DEVICE: |
|
|
|
|