From 70c16417b6b628cd7c3236e532e60146dc28ea35 Mon Sep 17 00:00:00 2001 From: dlicheva Date: Sat, 22 Jun 2024 17:13:36 +0300 Subject: [PATCH 1/2] remove unnecessary console.log --- application/frontend/src/pages/Explorer/LinkedStandards.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/application/frontend/src/pages/Explorer/LinkedStandards.tsx b/application/frontend/src/pages/Explorer/LinkedStandards.tsx index aec2d108..87ffaff1 100644 --- a/application/frontend/src/pages/Explorer/LinkedStandards.tsx +++ b/application/frontend/src/pages/Explorer/LinkedStandards.tsx @@ -23,7 +23,6 @@ export const LinkedStandards = ({ creCode, linkedTo, applyHighlight, filter }) = */ function isExternalLink(x: LinkedTreeDocument, linkedTo: any) { if (!x.document.hyperlink) { - console.log(x.document); return false; } const siblingCount = linkedTo.reduce((count, obj) => { From d1ef0058fd4d9eaa8c9402d0fb206092f71e6aa8 Mon Sep 17 00:00:00 2001 From: dlicheva Date: Sun, 23 Jun 2024 18:28:46 +0300 Subject: [PATCH 2/2] fix missing leaf CREs --- application/frontend/src/pages/Explorer/explorer.tsx | 6 ++++++ application/frontend/src/providers/DataProvider.tsx | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/application/frontend/src/pages/Explorer/explorer.tsx b/application/frontend/src/pages/Explorer/explorer.tsx index fc5cc6d1..4836e2df 100644 --- a/application/frontend/src/pages/Explorer/explorer.tsx +++ b/application/frontend/src/pages/Explorer/explorer.tsx @@ -9,6 +9,8 @@ import { TYPE_CONTAINS, TYPE_LINKED_TO } from '../../const'; import { useDataStore } from '../../providers/DataProvider'; import { LinkedTreeDocument, TreeDocument } from '../../types'; import { LinkedStandards } from './LinkedStandards'; +import { getDocumentDisplayName } from '../../utils'; +import { getInternalUrl } from '../../utils/document'; export const Explorer = () => { const { dataLoading, dataTree } = useDataStore(); @@ -80,6 +82,10 @@ export const Explorer = () => { if (!item) { return <>; } + item.displayName = item.displayName ?? getDocumentDisplayName(item); + item.url = item.url ?? getInternalUrl(item); + item.links = item.links ?? []; + const contains = item.links.filter((x) => x.ltype === TYPE_CONTAINS); const linkedTo = item.links.filter((x) => x.ltype === TYPE_LINKED_TO); diff --git a/application/frontend/src/providers/DataProvider.tsx b/application/frontend/src/providers/DataProvider.tsx index 21c5e4e7..d389c6cb 100644 --- a/application/frontend/src/providers/DataProvider.tsx +++ b/application/frontend/src/providers/DataProvider.tsx @@ -46,7 +46,9 @@ export const DataProvider = ({ children }: { children: React.ReactNode }) => { ); if (!creLinks.length) { - storedDoc.links = []; + // leaves of the tree can be links that are included in the keyPath. + // If we don't add this here, the leaves are filtered out above (see ticket #514 on OpenCRE) + storedDoc.links = initialLinks.filter((x) => x.ltype === 'Contains' && !!x.document); return storedDoc; }