Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GA fix bad links #417

Merged
merged 3 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions application/frontend/src/pages/GapAnalysis/GapAnalysis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { LoadingAndErrorIndicator } from '../../components/LoadingAndErrorIndica
import { useEnvironment } from '../../hooks';
import { GapAnalysisPathStart } from '../../types';
import { getDocumentDisplayName } from '../../utils';
import { getInternalUrl } from '../../utils/document';

const GetSegmentText = (segment, segmentID) => {
let textPart = segment.end;
Expand Down Expand Up @@ -66,7 +67,7 @@ const GetResultLine = (path, gapAnalysis, key) => {
let segmentID = gapAnalysis[key].start.id;
return (
<div key={path.end.id} style={{ marginBottom: '.25em', fontWeight: 'bold' }}>
<a href={`/node/standard/${path.end.name}/section/${path.end.section}`} target="_blank">
<a href={getInternalUrl(path.end)} target="_blank">
<Popup
wide="very"
size="large"
Expand Down Expand Up @@ -231,10 +232,7 @@ export const GapAnalysis = () => {
{Object.keys(gapAnalysis).map((key) => (
<Table.Row key={key}>
<Table.Cell textAlign="left" verticalAlign="top" selectable>
<a
href={`/node/standard/${gapAnalysis[key].start.name}/section/${gapAnalysis[key].start.section}`}
target="_blank"
>
<a href={getInternalUrl(gapAnalysis[key].start)} target="_blank">
<p>
<b>{getDocumentDisplayName(gapAnalysis[key].start, true)}</b>
</p>
Expand Down
2 changes: 1 addition & 1 deletion application/frontend/src/utils/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const groupBy = <T, K extends keyof any>(list: T[], getKey: (item: T) =>
return previous;
}, {} as Record<K, T[]>);

export const getInternalUrl = (doc: Document): String => {
export const getInternalUrl = (doc: Document): string => {
if (doc.doctype.toLowerCase() != 'cre') {
var standardAPIPath = `/node/${doc.doctype.toLowerCase()}/${doc.name}/`;
if (doc) {
Expand Down
Loading