Skip to content

Commit

Permalink
AtlasOfLivingAustralia#235 add links to public event dr page
Browse files Browse the repository at this point in the history
(cherry picked from commit d592c46)
  • Loading branch information
Adam Collins authored and matsbov committed Sep 18, 2024
1 parent 60a6643 commit 5de602a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
2 changes: 2 additions & 0 deletions grails-app/conf/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ disableAlertLinks: false
disableLoggerLinks: false
biocacheServicesUrl: https://biocache.ala.org.au/ws
biocacheUiURL: https://biocache.ala.org.au
#eventsUiURL: https://events.ala.org.au/?datasetKey=
#eventsURL: https://api.ala.org.au/event/graphql
isPipelinesCompatible: true
showExtraInfoInDataSetsView.enabled: false
showExtraInfoInDataSetsView.relativeTime: false
Expand Down
1 change: 1 addition & 0 deletions grails-app/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public.show.rt.des04=Looking up... the number of records that
public.show.rt.des05=can be accessed through the {0}
public.show.rt.des06=Click to view all records for the
public.show.rt.des07=No database records for this collection can be accessed through the {0}
public.show.rt.des08=events
public.show.setprogress.01=There is no estimate of the total number of {0} in this collection.
public.show.setprogress.02=No records are available for viewing in the {0}
public.show.setprogress.accessions=accessions
Expand Down
33 changes: 32 additions & 1 deletion grails-app/views/public/_charts.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
};

// records
if (${!instance.hasProperty('resourceType') || instance.resourceType == 'records'}) {
if (${!instance.hasProperty('resourceType') || instance.resourceType == 'records' || instance.resourceType == 'events'}) {
// summary biocache data
var queryUrl = CHARTS_CONFIG.biocacheServicesUrl + "/occurrences/search?pageSize=0&q=${facet}:${instance.uid}";

Expand Down Expand Up @@ -40,6 +40,37 @@
});
}

if (${instance.resourceType == 'events' && org.apache.commons.lang.StringUtils.isNotEmpty(grailsApplication.config.eventsURL ?: '')}) {
// summary events data
var queryUrl = '${grailsApplication.config.eventsURL}';
var body = {
query: 'query list($datasetKey: JSON){' +
'eventSearch(predicate: {type: equals, key: \"datasetKey\", value: $datasetKey}) {' +
'documents(size: 1) {total}' +
'}' +
'}',
variables: '{"datasetKey":"${instance.uid}"}'
}

$.ajax({
url: queryUrl,
dataType: 'json',
data: body,
timeout: 30000,
complete: function(jqXHR, textStatus) {
if (textStatus == 'timeout' || textStatus == 'error') {
// noData();
}
},
success: function(data) {
if (data.data.eventSearch.documents.total > 0){
$('#eventRecordsWrapper').css({display:'block'});
$('#totalEventCount').html(data.data.eventSearch.documents.total.toLocaleString() + " ${g.message(code: 'public.show.rt.des08')}");
}
}
});
}

</asset:script>

<asset:script type="text/javascript">
Expand Down
6 changes: 5 additions & 1 deletion grails-app/views/public/_dataAccess.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<a id="totalRecordCountLink" href="${grailsApplication.config.biocacheUiURL}/occurrences/search?q=${facet}:${instance.uid}">
</a>
</h3>
<h3 id="eventRecordsWrapper" style="display:none">
<a id="totalEventCount" href="${grailsApplication.config.eventsUiURL}${instance.uid}">
</a>
</h3>

<h4><g:message code="dataAccess.title"/></h4>
<div class="dataAccess btn-group-vertical">
Expand All @@ -20,4 +24,4 @@
<cl:createNewAnnotationsAlertsLink query="${facet}:${instance.uid}" displayName="${instance.name}"
linkText="${g.message(code:'dataAccess.alert.annotations.alt')}" altText="${g.message(code:'dataAccess.alert.annotations')} ${instance.name}"/>
</div>
</div>
</div>

0 comments on commit 5de602a

Please sign in to comment.