Merge pull request #9289 from vvlladd28/improvement/import-widgets-bundle/support-old-format
Add support import widgets bundles in old format
This commit is contained in:
		
						commit
						a0250a7122
					
				@ -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:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user