diff --git a/frontend/src/global/breadcrumbs.ts b/frontend/src/global/breadcrumbs.ts index 86d40f31..3dae8224 100644 --- a/frontend/src/global/breadcrumbs.ts +++ b/frontend/src/global/breadcrumbs.ts @@ -1,10 +1,15 @@ import { ref } from "vue"; +import { pick } from "lodash"; import type { DirectionalAssociation, Node } from "@/api/model"; import { parse } from "@/util/object"; +const breadcrumbKeys = ["id", "category", "name", "in_taxon_label"] as const; + +export type BreadcrumbNode = Pick; + export type Breadcrumb = { /** node we're coming from */ - node: Partial; + node: BreadcrumbNode; /** association between the previous node and the current node */ association: Partial; /** @@ -15,6 +20,11 @@ export type Breadcrumb = { noEntry?: boolean; }; +export function toBreadcrumbNode(node: Node) { + const obj: BreadcrumbNode = pick(node, breadcrumbKeys); + return obj; +} + /** breadcrumbs object for breadcrumbs section on node page */ export const breadcrumbs = ref([]); diff --git a/frontend/src/pages/node/SectionHierarchy.vue b/frontend/src/pages/node/SectionHierarchy.vue index 7d66a069..b1aa9958 100644 --- a/frontend/src/pages/node/SectionHierarchy.vue +++ b/frontend/src/pages/node/SectionHierarchy.vue @@ -27,7 +27,7 @@ :node="_class" :breadcrumbs="[ { - node, + node: toBreadcrumbNode(node), association: { predicate: 'is super class of', direction: AssociationDirectionEnum.incoming, @@ -40,7 +40,7 @@