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);
 | 
			
		||||
          if (isExistWidget) {
 | 
			
		||||
            this.widgets = this.widgets.map(widget => widget.id.id !== widgetType.id.id ? widget : widgetType);
 | 
			
		||||
          } else {
 | 
			
		||||
            this.widgets.push(widgetType);
 | 
			
		||||
          }
 | 
			
		||||
          if (this.editMode) {
 | 
			
		||||
            this.widgets.push(widgetType);
 | 
			
		||||
            this.isDirty = true;
 | 
			
		||||
            this.cd.markForCheck();
 | 
			
		||||
          } 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