Update widgets-bundle-widgets.component.ts
This commit is contained in:
parent
d23c6c1047
commit
7b33629019
@ -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…
x
Reference in New Issue
Block a user