Merge branch 'develop/3.6' of github.com:thingsboard/thingsboard into develop/3.6
This commit is contained in:
commit
f3e89f7dff
@ -18,6 +18,7 @@ package org.thingsboard.server.service.entitiy.widgets.type;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.thingsboard.server.common.data.EntityType;
|
||||
import org.thingsboard.server.common.data.StringUtils;
|
||||
import org.thingsboard.server.common.data.User;
|
||||
import org.thingsboard.server.common.data.audit.ActionType;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
@ -42,7 +43,7 @@ public class DefaultWidgetTypeService extends AbstractTbEntityService implements
|
||||
@Override
|
||||
public WidgetTypeDetails save(WidgetTypeDetails widgetTypeDetails, boolean updateExistingByFqn, User user) throws Exception {
|
||||
TenantId tenantId = widgetTypeDetails.getTenantId();
|
||||
if (widgetTypeDetails.getId() == null && updateExistingByFqn) {
|
||||
if (widgetTypeDetails.getId() == null && StringUtils.isNotEmpty(widgetTypeDetails.getFqn()) && updateExistingByFqn) {
|
||||
WidgetType widgetType = widgetTypeService.findWidgetTypeByTenantIdAndFqn(tenantId, widgetTypeDetails.getFqn());
|
||||
if (widgetType != null) {
|
||||
widgetTypeDetails.setId(widgetType.getId());
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -75,6 +75,7 @@
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
<tb-entity-autocomplete
|
||||
useFullEntityId
|
||||
formControlName="customerId"
|
||||
labelText="device.assign-to-customer"
|
||||
[entityType]="entityType.CUSTOMER">
|
||||
|
||||
@ -22,7 +22,7 @@ $previewSize: 78px !default;
|
||||
|
||||
.tb-container {
|
||||
margin-top: 0;
|
||||
padding: 0;
|
||||
padding: 0 0 16px;
|
||||
label.tb-title {
|
||||
display: block;
|
||||
padding-bottom: 8px;
|
||||
@ -121,6 +121,7 @@ $previewSize: 78px !default;
|
||||
|
||||
.tb-hint{
|
||||
margin-top: 8px;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user