Skip to content

Commit

Permalink
FIX Updating CKAN link to point to dataset not resource. Fixes #166
Browse files Browse the repository at this point in the history
  • Loading branch information
ScopeyNZ committed Feb 4, 2019
1 parent 9de78fd commit 6cb18ca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

20 changes: 15 additions & 5 deletions client/src/components/CKANRegistryDisplay.js
Expand Up @@ -386,10 +386,20 @@ class CKANRegistryDisplay extends Component {
*
* @returns {HTMLElement|null}
*/
renderResourceLink() {
const { spec: { endpoint, dataset, identifier } } = this.props;
renderDatasetLink() {
const { spec: { endpoint, dataset } } = this.props;

if (!endpoint || !dataset) {
return null;
}

// Strip any trailing slash if it exists
return (
<a href={`${endpoint}/dataset/${dataset}/resource/${identifier}`}>
<a
href={`${endpoint.replace(/\/$/, '')}/dataset/${dataset}`}
target="_blank"
rel="noopener noreferrer"
>
{window.i18n.inject(
window.i18n._t(
'CKANRegistryDisplay.CKAN_LINK',
Expand Down Expand Up @@ -452,7 +462,7 @@ class CKANRegistryDisplay extends Component {
<div className={classes}>
<p>{errorMessage}</p>
<div className="ckan-registry__other-actions ckan-registry__other-actions--error">
{ this.renderResourceLink() }
{ this.renderDatasetLink() }
{ this.renderDownloadLink() }
</div>
</div>
Expand All @@ -464,7 +474,7 @@ class CKANRegistryDisplay extends Component {
{ this.renderLoading() }
{ this.renderDataGrid() }
<div className="ckan-registry__other-actions">
{ this.renderResourceLink() }
{ this.renderDatasetLink() }
{ this.renderDownloadLink() }
</div>
</div>
Expand Down

0 comments on commit 6cb18ca

Please sign in to comment.