Skip to content

Commit

Permalink
fix: loading config object site
Browse files Browse the repository at this point in the history
Alternative to the "resolver"  in order to load config and necessary items to
display site properties and data table

Reviewed-by: andriacap
  • Loading branch information
andriacap committed Jun 1, 2023
1 parent 2ed2008 commit 1429320
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export class MonitoringPropertiesGComponent implements OnInit {
constructor(private _formService: FormService, private _objService: ObjectService) {}

ngOnInit() {
this.initProperties();
}

initProperties() {
Expand All @@ -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();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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}
}))
})
)
Expand All @@ -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);
});
}
Expand Down

0 comments on commit 1429320

Please sign in to comment.