diff --git a/frontend/app/components/monitoring-properties-g/monitoring-properties-g.component.ts b/frontend/app/components/monitoring-properties-g/monitoring-properties-g.component.ts index d534aeee1..32336f5cd 100644 --- a/frontend/app/components/monitoring-properties-g/monitoring-properties-g.component.ts +++ b/frontend/app/components/monitoring-properties-g/monitoring-properties-g.component.ts @@ -33,7 +33,6 @@ export class MonitoringPropertiesGComponent implements OnInit { constructor(private _formService: FormService, private _objService: ObjectService) {} ngOnInit() { - this.initProperties(); } initProperties() { @@ -56,7 +55,7 @@ export class MonitoringPropertiesGComponent implements OnInit { } ngOnChanges(changes: SimpleChanges): void { - if (this.newParentType.template.fieldNames.length != 0) { + if (this.newParentType && this.newParentType.template.fieldNames.length != 0) { this.initProperties(); } } diff --git a/frontend/app/components/monitoring-sites/monitoring-sites.component.ts b/frontend/app/components/monitoring-sites/monitoring-sites.component.ts index c4c2ea572..9100cb12d 100644 --- a/frontend/app/components/monitoring-sites/monitoring-sites.component.ts +++ b/frontend/app/components/monitoring-sites/monitoring-sites.component.ts @@ -57,9 +57,6 @@ export class MonitoringSitesComponent extends MonitoringGeomComponent implements this.objForm = this._formBuilder.group({}); // this._sitesGroupService.init() this._objService.changeObjectTypeParent(this._sitesGroupService.objectObs, true); - this._objService.currentObjectTypeParent.subscribe((objParent) => { - this.objParent = objParent; - }); this._objService.changeObjectType(this._siteService.objectObs, true); this.initSite(); } @@ -74,19 +71,19 @@ export class MonitoringSitesComponent extends MonitoringGeomComponent implements }); }), mergeMap((id: number) => - forkJoin({ + {return forkJoin({ sitesGroup: this._sitesGroupService.getById(id), sites: this._sitesGroupService.getSitesChild(1, this.limit, { id_sites_group: id, }), - }) - ), - map((data)=>{ - return data + }).pipe(map((data) => {return data})) }), mergeMap((data)=>{ - return this._siteService.initConfig().pipe(map((objecObs)=>{ - return {data, objectObs: objecObs} + return forkJoin({ + objObsSite: this._siteService.initConfig(), + objObsSiteGp: this._sitesGroupService.initConfig(), + }).pipe(map((objObs)=>{ + return {data, objectObs: objObs} })) }) ) @@ -106,8 +103,8 @@ export class MonitoringSitesComponent extends MonitoringGeomComponent implements // () => {} // ); this.baseFilters = { id_sites_group: this.sitesGroup.id_sites_group }; - this.colsname = objectObs.dataTable.colNameObj; - this._objService.changeSelectedParentObj(data.sitesGroup, true); + this.colsname = objectObs.objObsSite.dataTable.colNameObj; + this.objParent = objectObs.objObsSiteGp; this.updateBreadCrumb(data.sitesGroup); }); }