Skip to content

Commit

Permalink
fix: make breadcrumb work from sites and modules (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvergez authored and andriacap committed Sep 7, 2023
1 parent 793dfa0 commit 45ea2eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
10 changes: 6 additions & 4 deletions backend/gn_module_monitoring/monitoring/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,12 @@ def breadcrumbs(self, params):
if params["parents_path"]:
object_type = params.get("parents_path", []).pop()
next = MonitoringObject(self._module_code, object_type)

id_field_name = next.config_param("id_field_name")
next._id = self.get_value(id_field_name) or params.get(id_field_name)
next.get(0)
if next._object_type == "module":
next.get(field_name="module_code", value=self._module_code)
else:
id_field_name = next.config_param('id_field_name')
next._id = self.get_value(id_field_name) or params.get(id_field_name)
next.get(0)
else:
next = self.get_parent()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ export class MonitoringVisitsComponent extends MonitoringGeomComponent implement
const moduleCode = $event.id;
//create_object/cheveches_sites_group/visit?id_base_site=47
this._configService.init(moduleCode).subscribe(() => {
this.router.navigate([
`monitorings/create_object/${moduleCode}/visit`,
{ queryParams: { id_base_site: this.site.id_base_site } },
]);
const keys = Object.keys(this._configService.config()[moduleCode])
const parent_paths = ["sites_group", "site"].filter(item => keys.includes(item))
this.router.navigate([`monitorings/create_object/${moduleCode}/visit`], {
queryParams: { id_base_site: this.site.id_base_site, parents_path: parent_paths },
});
});
}
}

0 comments on commit 45ea2eb

Please sign in to comment.