UI: Fixed incorrect merging of default SCADA symbol settings with user-defined settings
This commit is contained in:
		
							parent
							
								
									7fcf52df56
								
							
						
					
					
						commit
						91e7e09582
					
				@ -52,6 +52,7 @@ import {
 | 
			
		||||
  isUndefined,
 | 
			
		||||
  isUndefinedOrNull,
 | 
			
		||||
  mergeDeep,
 | 
			
		||||
  mergeDeepIgnoreArray,
 | 
			
		||||
  parseFunction
 | 
			
		||||
} from '@core/utils';
 | 
			
		||||
import { BehaviorSubject, forkJoin, Observable, Observer, of, Subject } from 'rxjs';
 | 
			
		||||
@ -564,7 +565,7 @@ export class ScadaSymbolObject {
 | 
			
		||||
    const doc: XMLDocument = new DOMParser().parseFromString(this.svgContent, 'image/svg+xml');
 | 
			
		||||
    this.metadata = parseScadaSymbolMetadataFromDom(doc);
 | 
			
		||||
    const defaults = defaultScadaSymbolObjectSettings(this.metadata);
 | 
			
		||||
    this.settings = mergeDeep<ScadaSymbolObjectSettings>({} as ScadaSymbolObjectSettings,
 | 
			
		||||
    this.settings = mergeDeepIgnoreArray<ScadaSymbolObjectSettings>({} as ScadaSymbolObjectSettings,
 | 
			
		||||
      defaults, this.inputSettings || {} as ScadaSymbolObjectSettings);
 | 
			
		||||
    this.prepareMetadata();
 | 
			
		||||
    this.prepareSvgShape(doc);
 | 
			
		||||
 | 
			
		||||
@ -48,7 +48,7 @@ import {
 | 
			
		||||
} from '@home/components/widget/lib/scada/scada-symbol.models';
 | 
			
		||||
import { IAliasController } from '@core/api/widget-api.models';
 | 
			
		||||
import { TargetDevice, widgetType } from '@shared/models/widget.models';
 | 
			
		||||
import { isDefinedAndNotNull, mergeDeep } from '@core/utils';
 | 
			
		||||
import { isDefinedAndNotNull, mergeDeepIgnoreArray } from '@core/utils';
 | 
			
		||||
import {
 | 
			
		||||
  ScadaSymbolBehaviorGroup,
 | 
			
		||||
  ScadaSymbolPropertyRow,
 | 
			
		||||
@ -288,7 +288,7 @@ export class ScadaSymbolObjectSettingsComponent implements OnInit, OnChanges, Co
 | 
			
		||||
  private setupValue() {
 | 
			
		||||
    if (this.metadata) {
 | 
			
		||||
      const defaults = defaultScadaSymbolObjectSettings(this.metadata);
 | 
			
		||||
      this.modelValue = mergeDeep<ScadaSymbolObjectSettings>(defaults, this.modelValue);
 | 
			
		||||
      this.modelValue = mergeDeepIgnoreArray<ScadaSymbolObjectSettings>(defaults, this.modelValue);
 | 
			
		||||
      this.scadaSymbolObjectSettingsFormGroup.patchValue(
 | 
			
		||||
        this.modelValue, {emitEvent: false}
 | 
			
		||||
      );
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user