Browse Source

Merge branch 'thingsboard:master' into improvement/widget-editor/save-as-dialog

pull/9468/head
Vladyslav 3 years ago
committed by GitHub
parent
commit
34605133c4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      ui-ngx/src/app/modules/home/pages/widget/widgets-bundle-widgets.component.ts

8
ui-ngx/src/app/modules/home/pages/widget/widgets-bundle-widgets.component.ts

@ -205,14 +205,16 @@ export class WidgetsBundleWidgetsComponent extends PageComponent implements OnIn
const isExistWidget = this.widgets.some(widget => widget.id.id === widgetType.id.id); const isExistWidget = this.widgets.some(widget => widget.id.id === widgetType.id.id);
if (isExistWidget) { if (isExistWidget) {
this.widgets = this.widgets.map(widget => widget.id.id !== widgetType.id.id ? widget : widgetType); this.widgets = this.widgets.map(widget => widget.id.id !== widgetType.id.id ? widget : widgetType);
} else {
this.widgets.push(widgetType);
} }
if (this.editMode) { if (this.editMode) {
this.widgets.push(widgetType);
this.isDirty = true; this.isDirty = true;
this.cd.markForCheck(); this.cd.markForCheck();
} else if (!isExistWidget) { } else if (!isExistWidget) {
this.widgetsService.addWidgetFqnToWidgetBundle(this.widgetsBundle.id.id, widgetType.fqn).subscribe(() => {}); this.widgetsService.addWidgetFqnToWidgetBundle(this.widgetsBundle.id.id, widgetType.fqn).subscribe(() => {
this.widgets.push(widgetType);
this.cd.markForCheck();
});
} }
} }
} }

Loading…
Cancel
Save