diff --git a/application/frontend/src/components/DocumentNode/DocumentNode.tsx b/application/frontend/src/components/DocumentNode/DocumentNode.tsx index f97c2c305..2e86b36c1 100644 --- a/application/frontend/src/components/DocumentNode/DocumentNode.tsx +++ b/application/frontend/src/components/DocumentNode/DocumentNode.tsx @@ -143,7 +143,7 @@ export const DocumentNode: FunctionComponent = ({
{idx > 0 &&
}
- Which {getDocumentTypeText(type, links[0].document.doctype)}: + Which {getDocumentTypeText(type, links[0].document.doctype, node.doctype)}: {/* Risk here of mixed doctype in here causing odd output */}
diff --git a/application/frontend/src/const.ts b/application/frontend/src/const.ts index 340c5d7f4..231f78447 100644 --- a/application/frontend/src/const.ts +++ b/application/frontend/src/const.ts @@ -1,5 +1,6 @@ export const TYPE_IS_PART_OF = 'Is Part Of'; export const TYPE_LINKED_TO = 'Linked To'; +export const TYPE_LINKED_FROM = 'Linked From'; export const TYPE_CONTAINS = 'Contains'; export const TYPE_RELATED = 'Related'; export const TYPE_SAME = 'SAME'; @@ -10,6 +11,7 @@ export const DOCUMENT_TYPE_NAMES = { [TYPE_SAM]: ' has been automatically mapped to', [TYPE_LINKED_TO]: ' is linked to sources', [TYPE_IS_PART_OF]: ' is part of CREs', + [TYPE_LINKED_FROM]: 'is linked from CREs', [TYPE_CONTAINS]: ' contains CREs', [TYPE_RELATED]: ' is related to CREs', }; diff --git a/application/frontend/src/pages/Standard/StandardSection.tsx b/application/frontend/src/pages/Standard/StandardSection.tsx index 6fb50c22c..303766a72 100644 --- a/application/frontend/src/pages/Standard/StandardSection.tsx +++ b/application/frontend/src/pages/Standard/StandardSection.tsx @@ -74,7 +74,7 @@ export const StandardSection = () => { Object.entries(linksByType).map(([type, links]) => (
- Which {getDocumentTypeText(type, links[0].document.doctype)}: + Which {getDocumentTypeText(type, links[0].document.doctype, document.doctype)}: {/* Risk here of mixed doctype in here causing odd output */}
{links diff --git a/application/frontend/src/utils/document.ts b/application/frontend/src/utils/document.ts index 71011fa4a..54007d167 100644 --- a/application/frontend/src/utils/document.ts +++ b/application/frontend/src/utils/document.ts @@ -1,4 +1,4 @@ -import { DOCUMENT_TYPES, DOCUMENT_TYPE_NAMES, TYPE_IS_PART_OF, TYPE_LINKED_TO } from '../const'; +import { DOCUMENT_TYPES, DOCUMENT_TYPE_NAMES, TYPE_IS_PART_OF, TYPE_LINKED_FROM, TYPE_LINKED_TO } from '../const'; import { Document, LinkedDocument } from '../types'; export const getDocumentDisplayName = (document: Document) => { @@ -73,10 +73,10 @@ export const getApiEndpoint = (doc: Document, apiUrl: string): string => { return `${apiUrl}/id/${doc.id}`; }; -export const getDocumentTypeText = (linkType, docType): string => { +export const getDocumentTypeText = (linkType, docType, parentDocType = ""): string => { let docText = DOCUMENT_TYPE_NAMES[linkType]; if (linkType === TYPE_LINKED_TO && docType === DOCUMENT_TYPES.TYPE_CRE) { - docText = DOCUMENT_TYPE_NAMES[TYPE_IS_PART_OF]; + docText = parentDocType === DOCUMENT_TYPES.TYPE_STANDARD ? DOCUMENT_TYPE_NAMES[TYPE_LINKED_FROM] : DOCUMENT_TYPE_NAMES[TYPE_IS_PART_OF]; } return docText; };