Skip to content

Commit

Permalink
Merge branch 'master' into feature/pwa
Browse files Browse the repository at this point in the history
  • Loading branch information
temi committed May 10, 2024
2 parents 4df0c7e + 5381720 commit 8ae0db6
Show file tree
Hide file tree
Showing 87 changed files with 3,715 additions and 1,269 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

- name: build biocollect before running js unit test to compile dependent js templates
uses: gradle/[email protected].0
uses: gradle/[email protected].2
with:
arguments: _Events
env:
Expand All @@ -86,19 +86,19 @@ jobs:
- name: Run javascript unit tests
run: node_modules/karma/bin/karma start karma.conf.js --single-run --browsers ChromeHeadless

# - name: Run BioCollect functional tests
# run: ./src/main/scripts/runFunctionalTests.sh chromeHeadless /tmp/ecodata feature/cognito
# env:
# GITHUB_ACTOR: ${{env.GITHUB_ACTOR}}
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Run BioCollect functional tests
run: ./src/main/scripts/runFunctionalTests.sh chromeHeadless /tmp/ecodata master
env:
GITHUB_ACTOR: ${{env.GITHUB_ACTOR}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Clean to remove clover instrumentation
uses: gradle/[email protected].0
uses: gradle/[email protected].2
with:
arguments: clean

- name: Publish the JAR to the repository
uses: gradle/[email protected].0
uses: gradle/[email protected].2
with:
arguments: publish
env:
Expand Down
8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ apply from: "${project.projectDir}/gradle/publish.gradle"
repositories {
mavenLocal()
//for missing jai_core.jar
//maven { url "https://mvnrepository.com" }
//maven { url "https://mvnrepository.com" }
maven { url "https://repo.osgeo.org/repository/release/" }
maven { url "https://repo.grails.org/grails/core" }
maven { url = uri("https://maven.pkg.github.com/atlasoflivingaustralia/ecodata-client-plugin")
Expand Down Expand Up @@ -146,7 +146,11 @@ dependencies {
implementation ("org.grails.plugins:ala-ws-plugin:$alaSecurityLibsVersion")
implementation "org.grails.plugins:ala-ws-security-plugin:$alaSecurityLibsVersion"
implementation "au.org.ala:userdetails-service-client:$alaSecurityLibsVersion"
<<<<<<< HEAD
runtimeOnly "org.grails.plugins:ala-bootstrap3:4.2.0"
=======
runtimeOnly "org.grails.plugins:ala-bootstrap3:4.4.0"
>>>>>>> master

// swagger API
implementation 'au.org.ala.plugins:openapi:1.1.0'
Expand All @@ -163,7 +167,7 @@ dependencies {
implementation "io.jsonwebtoken:jjwt-api:0.11.5"
if (!Boolean.valueOf(inplace)) {
implementation "org.grails.plugins:ala-map-plugin:3.0.1"
implementation "org.grails.plugins:ecodata-client-plugin:6.1-PWA-SNAPSHOT"
implementation "org.grails.plugins:ecodata-client-plugin:6.3-PWA-SNAPSHOT"
}

testCompileOnly "org.grails:grails-test-mixins:3.3.0"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
biocollectVersion=6.6-PWA-SNAPSHOT
biocollectVersion=6.9-PWA-SNAPSHOT
grailsVersion=5.1.9
grailsGradlePluginVersion=5.1.5
assetPipelineVersion=3.3.4
Expand Down
1 change: 1 addition & 0 deletions grails-app/assets/javascripts/common-bs4.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//= require knockout-dates.js
//= require knockout-custom-bindings.js
//= require knockout-custom-extenders.js
//= require knockout-utils.js
//= require wmd/wmd.js
//= require wmd/showdown.js
//= require pagination.js
Expand Down
1 change: 1 addition & 0 deletions grails-app/assets/javascripts/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//= require knockout-dates.js
//= require knockout-custom-bindings.js
//= require knockout-custom-extenders.js
//= require knockout-utils.js
//= require wmd/wmd.js
//= require wmd/showdown.js
//= require pagination.js
Expand Down
1 change: 1 addition & 0 deletions grails-app/assets/javascripts/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ function attachViewModelToFileUpload(uploadUrl, documentViewModel, uiSelector, p
$(uiSelector).fileupload({
url:uploadUrl,
pasteZone: null,
dropZone: null,
formData:function(form) {
return [{name:'document', value:documentViewModel.toJSONString()}]
},
Expand Down
3 changes: 3 additions & 0 deletions grails-app/assets/javascripts/hubs.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ var HubSettings = function (settings, config) {
self.content = ko.observable();
self.quickLinks = ko.observableArray();
self.customBreadCrumbs = ko.observableArray();
self.fathomSiteId = ko.observable();
self.pages = {
allRecords : new FacetConfigurationViewModel(settings.pages.allRecords, hubConfigs.availableDataFacets),
myRecords : new FacetConfigurationViewModel(settings.pages.myRecords, hubConfigs.availableDataFacets),
Expand Down Expand Up @@ -236,6 +237,7 @@ var HubSettings = function (settings, config) {
self.urlPath(settings.urlPath);
self.skin(settings.skin);
self.title(settings.title);
self.fathomSiteId(settings.fathomSiteId);
self.supportedPrograms(self.orEmptyArray(settings.supportedPrograms));
self.defaultProgram(settings.defaultProgram);
self.bannerUrl(self.orBlank(settings.bannerUrl));
Expand Down Expand Up @@ -478,6 +480,7 @@ function ContentViewModel(config) {
self.hideBreadCrumbs = ko.observable(config.hideBreadCrumbs || false);
self.hideProjectAndSurvey = ko.observable(config.hideProjectAndSurvey || false);
self.hideCancelButtonOnForm = ko.observable(config.hideCancelButtonOnForm || false);
self.hideNewButtonOnRecordView = ko.observable(config.hideNewButtonOnRecordView || false);
self.showNote = ko.observable(config.showNote || false);
self.recordNote = ko.observable(config.recordNote || '');
self.industries = ko.observable(config.industries || false);
Expand Down
49 changes: 49 additions & 0 deletions grails-app/assets/javascripts/i18n.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (C) 2019 Atlas of Living Australia
* All Rights Reserved.
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* Created by Temi on 15/11/19.
*/

(function() {
var messages = {},
deffer = $.Deferred();
$.get({
url: fcConfig.i18nURL,
cache: true
}).done(function (data) {
messages = data;
deffer.resolve();
}).fail(function () {
deffer.reject();
});

$i18n = function(key, defaultValue) {
if (messages[key] !== undefined) {
return messages[key];
} else {
return defaultValue || key;
}
};

$i18nAsync = function(key, defaultValue, callback) {
if (callback) {
deffer.done(function () {
callback($i18n(key, defaultValue));
}).fail(function () {
callback($i18n(key, defaultValue));
})
}
}

})();
51 changes: 48 additions & 3 deletions grails-app/assets/javascripts/knockout-custom-bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ ko.bindingHandlers.stagedImageUpload = {
$(element).fileupload({
url: config.url,
pasteZone: null,
dropZone: null,
autoUpload: true
}).on('fileuploadadd', function (e, data) {
complete(false);
Expand Down Expand Up @@ -706,8 +707,7 @@ ko.bindingHandlers.fileUploadNoImage = {
pasteZone: null, dropZone: dropzone
};
$.extend(settings, defaults, options());
$(element).fileupload(settings
).on('fileuploadadd', function (e, data) {
$(element).fileupload(settings).on('fileuploadadd', function (e, data) {
window.incrementAsyncCounter && window.incrementAsyncCounter();
}).on('fileuploaddone', function (e, data) {
window.decreaseAsyncCounter && window.decreaseAsyncCounter();
Expand Down Expand Up @@ -1148,4 +1148,49 @@ ko.bindingHandlers.debug = {
console.log(element);
console.log(ko.toJS(valueAccessor()));
}
};
};


/**
* This binding requires i18n.js to be loaded. It also requires fcConfig.i18nURL to be set.
* Params can be a string or an object. If string, it is treated as key and translated to text. Object parameter has the
* following properties:
* @contentType can be 'text' or 'html' (default is 'text')
* @key is the key to be translated
* @defaultValue is the default value to be used if the key is not found
*
* Usage examples:
* <div data-bind="i18n: 'g.cancel'"></div>
* <div data-bind="i18n: {key: 'record.edit.verificationStatusTypes.help', contentType: 'html', defaultValue: '<b>simple help</b>'}"></div>
*
*/
ko.bindingHandlers.i18n = {
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
var value = valueAccessor();
value = ko.unwrap(value);
var contentType = value && value.contentType || 'text'

// $i18nAsync is required to be defined
if(typeof $i18nAsync === 'undefined')
return

if( typeof value === 'string') {
$i18nAsync(value, '',function(text) {
$(element).text(text);
});
}
else if (typeof value === 'object') {
$i18nAsync(value.key, value.defaultValue,function(text) {
switch (contentType) {
default:
case 'text':
$(element).text(text);
break;
case 'html':
$(element).html(text);
break;
}
});
}
}
}
34 changes: 0 additions & 34 deletions grails-app/assets/javascripts/knockout-custom-extenders.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,39 +48,6 @@ ko.extenders.integer = function(target, options) {
return target;
};

ko.extenders.numericString = function(target, precision) {
//create a writable computed observable to intercept writes to our observable
var result = ko.computed({
read: target, //always return the original observables value
write: function(newValue) {
var val = newValue;
if (typeof val === 'string') {
val = newValue.replace(/,|\$/g, '');
}
var current = target(),
roundingMultiplier = Math.pow(10, precision),
newValueAsNum = isNaN(val) ? 0 : parseFloat(+val),
valueToWrite = Math.round(newValueAsNum * roundingMultiplier) / roundingMultiplier;

//only write if it changed
if (valueToWrite.toString() !== current || isNaN(val)) {
target(isNaN(val) ? newValue : valueToWrite.toString());
}
else {
if (newValue !== current) {
target.notifySubscribers(valueToWrite.toString());
}
}
}
}).extend({ notify: 'always' });

//initialize with current value to make sure it is rounded appropriately
result(target());

//return the new computed observable
return result;
};

ko.extenders.url = function(target) {
var result = ko.pureComputed({
read:target,
Expand Down Expand Up @@ -118,7 +85,6 @@ ko.extenders.markdown = function(target, options) {
return target;
};


// handles simple or deferred computed objects
// see activity/edit.gsp for an example of use
ko.extenders.async = function(computedDeferred, initialValue) {
Expand Down
2 changes: 2 additions & 0 deletions grails-app/assets/javascripts/outputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ ko.bindingHandlers.photoPointUpload = {
$(element).fileupload({
url:config.url,
pasteZone: null,
dropZone: null,
autoUpload:true
}).on('fileuploadadd', function(e, data) {
complete(false);
Expand Down Expand Up @@ -381,6 +382,7 @@ ko.bindingHandlers.fileUploadWithProgress = {
$(element).fileupload({
url: config.url,
pasteZone: null,
dropZone: null,
autoUpload: true
}).on('fileuploadadd', function (e, data) {
complete(false);
Expand Down
2 changes: 1 addition & 1 deletion grails-app/assets/javascripts/project-finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ function ProjectFinder(config) {

// Results view
var savedViewMode = amplify.store('pt-view-state');
savedViewMode = savedViewMode || "#grid-tab"; //Default is the new map-popup view
savedViewMode = savedViewMode || "grid-tab"; //Default is the new map-popup view
$('.project-finder-tab a#'+savedViewMode).tab('show');

// Filters view
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
}

.ui-front {
z-index: 100;
z-index: 2000;
}


Expand Down
21 changes: 10 additions & 11 deletions grails-app/conf/application.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ environments {
temp.dir = "/data/biocollect/temp"
// system level config
server.port = 8087
serverURL = "http://devt.ala.org.au:8087"
serverURL = "http://localhost:8087"
biocollect.system.email.replyTo = "biocollect-dev<no-reply>@ala.org.au"
sender = "[email protected]"
debugUI = true
Expand All @@ -36,11 +36,10 @@ environments {
}

test {
spring.autoconfigure.exclude="au.org.ala.ws.security.AlaWsSecurityConfiguration"
debugUI = false
loggerLevel = "DEBUG"
server.port = "8087"
grails.host = "http://devt.ala.org.au"
grails.host = "http://localhost"
serverName = "${grails.host}:${server.port}"
grails.serverURL = serverName
server.serverURL = serverName
Expand All @@ -51,8 +50,8 @@ environments {
grails.config.locations = []
security.oidc.discoveryUri = "http://localhost:${wiremock.port}/cas/oidc/.well-known"
security.oidc.allowUnsignedIdTokens = true
def casBaseUrl = "http://devt.ala.org.au:${wiremock.port}"

def casBaseUrl = "http://localhost:${wiremock.port}"
ehcache.directory = './ehcache'
security.cas.appServerName=serverName
security.cas.contextPath=
security.cas.casServerName="${casBaseUrl}"
Expand All @@ -61,17 +60,17 @@ environments {
security.cas.loginUrl="${security.cas.casServerUrlPrefix}/login"
security.cas.casLoginUrl="${security.cas.casServerUrlPrefix}/login"
security.cas.logoutUrl="${security.cas.casServerUrlPrefix}/logout"
userDetails.api.url = "${casBaseUrl}/userdetails/userDetails/"
security.jwt.discoveryUri="${casBaseUrl}/cas/oidc/.well-known"
userDetails.url = "${casBaseUrl}/userdetails/userDetails/"
userDetailsSingleUrl = "${userDetails.Url}getUserDetails"
userDetailsUrl = "${userDetatails.url}getUserListFull"
userDetailsSingleUrl = "${userDetails.url}getUserDetails"
logging.dir = '.'
upload.images.path = '/tmp'
upload.images.url = grails.serverURL+'/image/'
ecodata.baseUrl = 'http://devt.ala.org.au:8080/'
ecodata.baseURL = 'http://devt.ala.org.au:8080'
ecodata.service.url = 'http://devt.ala.org.au:8080/ws'
pdfgen.baseURL = "http://devt.ala.org.au:${wiremock.port}/"
ecodata.baseUrl = 'http://localhost:8080/'
ecodata.baseURL = 'http://localhost:8080'
ecodata.service.url = 'http://localhost:8080/ws'
pdfgen.baseURL = "http://localhost:${wiremock.port}/"
api_key='testapikey'
grails.cache.config = {
diskStore {
Expand Down
Loading

0 comments on commit 8ae0db6

Please sign in to comment.