From b9a8b195cecfd0256b4d26e9555f2a913d3e1d53 Mon Sep 17 00:00:00 2001 From: esikkala <esko.ikkala@aalto.fi> Date: Thu, 11 Oct 2018 23:00:01 +0300 Subject: [PATCH] Update sdbm links --- src/client/components/ResultTable.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/client/components/ResultTable.js b/src/client/components/ResultTable.js index 2366c559..ed5a91ab 100644 --- a/src/client/components/ResultTable.js +++ b/src/client/components/ResultTable.js @@ -12,6 +12,7 @@ import TableHead from '@material-ui/core/TableHead'; import Tooltip from '@material-ui/core/Tooltip'; import FacetDialog from './FacetDialog'; import ResultTablePaginationActions from './ResultTablePaginationActions'; +import { has } from 'lodash'; const styles = () => ({ root: { @@ -90,20 +91,18 @@ class ResultTable extends React.Component { }; idRenderer = (row) => { - let cell = row.id.replace('http://ldf.fi/mmm/manifestation_singleton/', ''); - let sdbmUrl = ''; - let id = ''; - if (row.manuscriptRecord == '-') { - id = cell.replace('orphan_', ''); - sdbmUrl = 'https://sdbm.library.upenn.edu/entries/' + id; + let sdbmLink = ''; + let id = row.id.replace('http://ldf.fi/mmm/manifestation_singleton/', ''); + if (has(row, 'manuscriptRecord')) { + sdbmLink = row.manuscriptRecord; } else { - id = cell; - sdbmUrl = row.manuscriptRecord; + sdbmLink = row.entry; + id = id.replace('orphan_', ''); } id = id.replace('part_', ''); return ( <div className={this.props.classes.tableColumn}> - <a target='_blank' rel='noopener noreferrer' href={sdbmUrl}>{id}</a> + <a target='_blank' rel='noopener noreferrer' href={sdbmLink}>{id}</a> </div> ); }; -- GitLab