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

Feature/issue2971 #2981

Merged
merged 27 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e0abc8c
ecodata-client-plugin 6.2-SNAPSHOT #2971
chrisala Aug 21, 2023
add81dd
Read js from ecodata-client-plugin for tests for #2971
chrisala Aug 21, 2023
081131c
Read js from ecodata-client-plugin for tests for #2971
chrisala Aug 21, 2023
291c784
Read js from ecodata-client-plugin for tests for #2971
chrisala Aug 21, 2023
3d48f3e
Read js from ecodata-client-plugin for tests for #2971
chrisala Aug 21, 2023
499384a
Update README.md
chrisala Aug 21, 2023
e8a4cee
Working around problem with spatial-test #2971
chrisala Aug 22, 2023
1207c4c
Working around problem with spatial-test #2971
chrisala Aug 22, 2023
7c11057
Working around problem with spatial-test #2971
chrisala Aug 22, 2023
a592d73
Working around problem with spatial-test #2971
chrisala Aug 22, 2023
bf2de5c
Working around problem with spatial-test #2971
chrisala Aug 22, 2023
76f55ee
Working around problem with spatial-test #2971
chrisala Aug 22, 2023
d8ecc48
Working around problem with spatial-test #2971
chrisala Aug 22, 2023
a14b468
Method to return site geojson for #2971
chrisala Aug 24, 2023
41ed42d
Basic site integration for data sets #2957
chrisala Aug 25, 2023
22919d0
Basic site integration for data sets #2957
chrisala Aug 25, 2023
c3299ee
Basic site integration for data sets #2957
chrisala Aug 25, 2023
fa79ded
Updated chromedriver #2975
chrisala Aug 25, 2023
beb14f3
Support signed jwt in functional tests for #2971
chrisala Aug 28, 2023
2f81cc6
Functional test for paratoo integration #2971
chrisala Aug 30, 2023
c030ff5
Dataset summary WIP #2957
chrisala Sep 4, 2023
087d332
Updated Monitor integration test to match changes #2828
chrisala Sep 6, 2023
1e02b3c
Added size of dataset question to dat set #2957
chrisala Sep 6, 2023
4f7d6af
Updated tests for changes to data set summary #2957
chrisala Sep 6, 2023
534baa5
View data set and functional test update #2957
chrisala Sep 6, 2023
4b8e076
Merge branch 'dev' into feature/issue2971
chrisala Sep 6, 2023
9e78477
Added new monitor functional test #2828
chrisala Sep 7, 2023
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
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ jobs:
with:
node-version: 16

- run: npm config set //npm.pkg.github.com/:_authToken $NODE_AUTH_TOKEN
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- run: npm install


- name: Validate Gradle wrapper
uses: gradle/[email protected]

Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@atlasoflivingaustralia:registry=https://npm.pkg.github.com
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ It is currently in use by the Australian Government.
This configuration file largely specifies URLs to MERIT dependencies. See https://github.com/AtlasOfLivingAustralia/fieldcapture/wiki/MERIT-Dependencies for information about these.
Note that you will need to obtain an ALA API key to use ALA services and a Google Maps API key and specify them in this file.

npm / nodejs are used to run javascript unit tests. There is a dependency on the ecodata-client-plugin for some javascript which is published to github packages which requires an access token to read.

* Install npm and nodejs (see https://www.npmjs.com/get-npm)
* Authenticate to github packages using your github username and access token setup for package:read
* Install the node dependencies for MERIT. Note these are currently only used for testing.

```
npm login --scope=@atlasoflivingaustralia --auth-type=legacy --registry=https://npm.pkg.github.com
npm install
npm install -g karma
```
Expand Down
28 changes: 22 additions & 6 deletions grails-app/assets/javascripts/dataSets.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var DataSetViewModel = function(dataSet, projectService, options) {

dataSet = dataSet || {};
self.dataSetId = dataSet.dataSetId;
self.surveyId = dataSet.surveyId; // Data set summaries created by a submission from the Monitor app will have a surveyId
self.name = ko.observable(dataSet.name );
self.grantId = dataSet.grantId;
self.projectName = dataSet.projectName;
Expand All @@ -79,16 +80,29 @@ var DataSetViewModel = function(dataSet, projectService, options) {
});

self.type = ko.observable(dataSet.type);
self.otherDataSetType = ko.observable(dataSet.otherDataSetType);
self.term = ko.observable(dataSet.term);

self.serviceAndOutcomes = ko.observable(_.find(options.projectOutcomes || [], function(outcome) {
return outcome.serviceId == dataSet.serviceId && _.isEqual(outcome.outcomes, dataSet.projectOutcomes);
}));
self.projectOutcomeList = ko.observableArray(options.projectOutcomes);
self.serviceId = ko.computed(function() {
return self.serviceAndOutcomes() && self.serviceAndOutcomes().serviceId;
});
self.projectOutcomes = ko.computed(function() {
return self.serviceAndOutcomes() && self.serviceAndOutcomes().outcomes;
});
if (dataSet.measurementTypes && !_.isArray(dataSet.measurementTypes)) {
dataSet.measurementTypes = [dataSet.measurementTypes];
}
self.measurementTypes = ko.observableArray(dataSet.measurementTypes);
self.otherMeasurementType = ko.observable(dataSet.otherMeasurementType);
self.methods = ko.observableArray(dataSet.methods);
self.methodDescription = ko.observable(dataSet.methodDescription);
self.collectionApp = ko.observable(dataSet.collectionApp);
self.location = ko.observable(dataSet.location);
self.siteId = ko.observable(dataSet.siteId);
self.siteUrl = options.viewSiteUrl + dataSet.siteId;
self.startDate = ko.observable(dataSet.startDate).extend({simpleDate:false});
self.endDate = ko.observable(dataSet.endDate).extend({simpleDate:false});
self.endDate.subscribe(function (endDate) {
Expand All @@ -99,16 +113,16 @@ var DataSetViewModel = function(dataSet, projectService, options) {
});
self.addition = ko.observable(dataSet.addition);
self.threatenedSpeciesIndex = ko.observable(dataSet.threatenedSpeciesIndex);
self.collectorType = ko.observable(dataSet.collectorType);
self.qa = ko.observable(dataSet.qa);
self.published = ko.observable(dataSet.published);
self.storageType = ko.observable(dataSet.storageType);
self.threatenedSpeciesIndexUploadDate = ko.observable(dataSet.threatenedSpeciesIndexUploadDate).extend({simpleDate:false});
self.publicationUrl = ko.observable(dataSet.publicationUrl);
self.format = ko.observable(dataSet.format);
if (dataSet.sensitivities && !_.isArray(dataSet.sensitivities)) {
dataSet.sensitivities = [dataSet.sensitivities];
}
self.sizeInKB = ko.observable(dataSet.sizeInKB);
self.sizeUnknown = ko.observable(dataSet.sizeUnknown);
self.sensitivities = ko.observableArray(dataSet.sensitivities);
self.otherSensitivity = ko.observable(dataSet.otherSensitivity);
self.owner = ko.observable(dataSet.owner);
self.custodian = ko.observable(dataSet.custodian);
self.progress = ko.observable(dataSet.progress);
Expand All @@ -124,6 +138,8 @@ var DataSetViewModel = function(dataSet, projectService, options) {
}
});

self.isAutoCreated = dataSet.surveyId != null;

self.validate = function() {
return $(config.validationContainerSelector).validationEngine('validate');
}
Expand All @@ -133,7 +149,7 @@ var DataSetViewModel = function(dataSet, projectService, options) {

if (valid) {
var dataSet = ko.mapping.toJS(self,
{ignore: ['grantId', 'projectName', 'programName', 'validate', 'save', 'cancel', 'investmentOtherSelected']});
{ignore: ['grantId', 'projectName', 'programName', 'validate', 'save', 'cancel', 'investmentOtherSelected', 'siteUrl', 'isAutoCreated', 'serviceAndOutcomes', 'projectOutcomeList']});
projectService.saveDataSet(dataSet).done(function() {
// return to project
window.location.href = config.returnToUrl;
Expand Down
4 changes: 2 additions & 2 deletions grails-app/assets/stylesheets/dataSets.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ table td.dataset-name, table th.dataset-name {
table td.report-start, table th.report-start {
width:15%;
}
div.otherPriority {
margin-top: 10px;
div.otherPriority, div.other {
margin-top: 5px;
}
table td.dataset-progress, table th.dataset-progress {
width:10em;
Expand Down
21 changes: 18 additions & 3 deletions grails-app/controllers/au/org/ala/merit/DataSetController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,26 @@ class DataSetController {
if (!priorities) {
priorities = ['n/a']
}
if (priorities){
priorities << 'Other'


List outcomeGroups = []
List projectServices = projectService.getProjectServices(project)
project.outputTargets?.each { Map outputTarget ->
if (outputTarget.outcomeTargets) {
Map service = projectServices.find{it.scores?.find{score -> score.scoreId == outputTarget.scoreId}}
outputTarget.outcomeTargets.each {
outcomeGroups << [
scoreId:outputTarget.scoreId,
serviceId: service.id,
service: service.name,
outcomes:it.relatedOutcomes,
label:service.name+" "+it.relatedOutcomes
]
}
}
}

[projectId:projectId, programName:programName, priorities:priorities, outcomes: outcomes, project:project]
[projectId:projectId, programName:programName, priorities:priorities, outcomes: outcomes, project:project, projectOutcomes:outcomeGroups]
}

// Note that authorization is done against a project, so the project id must be supplied to the method.
Expand Down
20 changes: 20 additions & 0 deletions grails-app/controllers/au/org/ala/merit/SiteController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class SiteController {
if (!isUserMemberOfSiteProjects(site)) {
flash.message = "Access denied: User does not have permission to view site: ${id}"
redirect(controller:'home', action:'index')
return
}

List userProjects = site.projects?.findAll { projectService.canUserViewProject(user?.userId, it.projectId) }
Expand Down Expand Up @@ -140,6 +141,25 @@ class SiteController {
}
}

/** Returns geojon for a site */
def geojson(String id) {
Map site = siteService.get(id)
if (!site) {
Map resp = [status:HttpStatus.SC_NOT_FOUND]
render resp as JSON
return
}
if (!isUserMemberOfSiteProjects(site)) {
Map resp = [status:HttpStatus.SC_UNAUTHORIZED]
render resp as JSON
return
}

Map resp = siteService.getSiteGeoJson(site.siteId)
resp = resp?.resp ?: resp // Render the geojson directly if successful, otherwise render the ecodata response including the status
render resp as JSON
}

@PreAuthorise(accessLevel = 'editor')
def ajaxDeleteSitesFromProject(String id){

Expand Down
2 changes: 1 addition & 1 deletion grails-app/services/au/org/ala/merit/SiteService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class SiteService {
}

Map getSiteGeoJson(String siteId) {
webService.getJson(grailsApplication.config.getProperty('ecodata.baseUrl') + 'site/' + siteId+'.geojson')
webService.getJson2(grailsApplication.config.getProperty('ecodata.baseUrl') + 'site/' + siteId+'.geojson')
}

def lookupLocationMetadataForSite(Map site) {
Expand Down
Loading