Skip to content

Commit

Permalink
Add error handling to sync-now on gbif comparison page.
Browse files Browse the repository at this point in the history
  • Loading branch information
matsbov committed Jan 30, 2025
1 parent 964bed8 commit 2ff4cad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
19 changes: 10 additions & 9 deletions grails-app/views/dataProvider/show.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@
</p>
</div>

<div class="well">
<h2>GBIF integration</h2>
<p>For data providers that publishes datasets from GBIF (full or repatriated).</p>
<p>
<g:link controller="gbif" action="compare" params="${['uid':instance.uid]}" class="btn btn-info">
Compare GBIF vs Atlas
</g:link>
</p>
</div>

<!-- description -->
<div class="show-section well">
<!-- Pub Desc -->
Expand Down Expand Up @@ -160,15 +170,6 @@
<!-- GBIF integration -->
<g:render template="/shared/gbif" model="[instance: instance, controller: 'dataProvider']"/>

<div class="well">
<h2>Datasets published from GBIF</h2>
<p>
<g:link controller="gbif" action="compare" params="${['uid':instance.uid]}" class="btn btn-info">
Compare GBIF vs Atlas
</g:link>
</p>
</div>

<!-- change history -->
<g:render template="/shared/changes" model="[changes: changes, instance: instance]"/>

Expand Down
8 changes: 6 additions & 2 deletions grails-app/views/gbif/compare.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,14 @@
$('#sync-now-link').on('click', function() {
if (confirm('This will sync meta data and download datasets from GBIF. Continue?')) {
var scanUrl = '${grailsApplication.config.getProperty("grails.serverURL")}/ws/gbif/scan/${dataProvider.uid}';
var scanUrl = '${raw(createLink(controller: "gbif", action: "scan", params: [uid:dataProvider.uid]))}';
$.getJSON(scanUrl, function(data) {
location.href = '${grailsApplication.config.getProperty("grails.serverURL")}' + data.trackingUrl;
});
})
.fail(function(data) {
console.log(data);
alert('Sync failed (HTTP status: ' + data.status + ')');
});
}
});
});
Expand Down

0 comments on commit 2ff4cad

Please sign in to comment.