diff --git a/.gitignore b/.gitignore index a4cc86707..12084bde7 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ /js/assets/fonts /js/assets/images js/config-local.js +js/version.js package-lock.json diff --git a/js/pages/home/home.html b/js/pages/home/home.html index 68321c69b..57d288cfc 100644 --- a/js/pages/home/home.html +++ b/js/pages/home/home.html @@ -25,20 +25,23 @@
Release Notes
- ATLAS Version Release Notes + ATLAS Version Release Notes
- WebAPI Version Release Notes + WebAPI Version Release Notes
-
-
This latest release contains feature enhancements and issue resolutions: -
+
+
+
This latest release contains feature enhancements and issue resolutions: +
-
-
- - +
+
+ + +
+
diff --git a/js/pages/home/home.js b/js/pages/home/home.js index 6d722d2ad..a01dbab63 100644 --- a/js/pages/home/home.js +++ b/js/pages/home/home.js @@ -9,6 +9,7 @@ define([ 'services/BuildInfoService', 'atlas-state', 'lodash', + 'version', 'components/heading', ], function ( ko, @@ -20,7 +21,8 @@ define([ authApi, buildInfoService, sharedState, - lodash + lodash, + version, ) { class Home extends Page { constructor(params) { @@ -34,9 +36,11 @@ define([ this.canSearch = ko.computed(() => { return authApi.isAuthenticated(); }); - this.version = ko.observable(); + this.atlasVersion = ko.observable(this.formatVersion(version)); + this.webapiVersion = ko.observable(); this.atlasReleaseTag = ko.observable(); this.webapiReleaseTag = ko.observable(); + this.loading = ko.observable(); this.atlasReleaseUrl = ko.computed(() => consts.releaseNotesUrl('Atlas', this.atlasReleaseTag())); this.webapiReleaseUrl = ko.computed(() => consts.releaseNotesUrl('WebAPI', this.webapiReleaseTag())); } @@ -49,7 +53,7 @@ define([ const webapiReleaseTag = lodash.get(info, 'buildInfo.webapiRepositoryInfo.releaseTag'); this.atlasReleaseTag(atlasReleaseTag); this.webapiReleaseTag(webapiReleaseTag); - this.version(this.getVersion(info)); + this.webapiVersion(this.getWebapiVersion(info)); const atlasIssues = await this.getIssuesFromAllPages('OHDSI/Atlas', atlasMilestoneId); const webapiIssues = await this.getIssuesFromAllPages('OHDSI/WebAPI', webapiMilestoneId); let issues = lodash.orderBy([...atlasIssues, ...webapiIssues], ['closed_at'], ['desc']); @@ -60,15 +64,24 @@ define([ async getIssuesFromAllPages(repo, milestone, page = 1, list = []) { - const { data } = await buildInfoService.getIssues(repo, milestone, page); - if (data.length === buildInfoService.ISSUES_PAGE_SIZE) { - return this.getIssuesFromAllPages(repo, milestone, page + 1, list.concat(data)); - } else { - return list.concat(data); + this.loading(true); + try { + const {data} = await buildInfoService.getIssues(repo, milestone, page); + if (data.length === buildInfoService.ISSUES_PAGE_SIZE) { + return this.getIssuesFromAllPages(repo, milestone, page + 1, list.concat(data)); + } else { + return list.concat(data); + } + } finally { + this.loading(false); } } - getVersion(info) { + formatVersion(ver) { + return ver.replace(/(\d+\.\d+\.\d+)-(.*)/, "$1 $2"); + } + + getWebapiVersion(info) { let qualifier = false; const artifactVersion = (info.buildInfo && info.buildInfo.artifactVersion) || ''; if (artifactVersion.match(/.*-SNAPSHOT/)) { diff --git a/package.json b/package.json index fe1b58534..f55e2e4b7 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,15 @@ { "name": "atlas", - "version": "2.8.0", + "version": "2.8.0-DEV", "description": "is an open source software tool for researchers to conduct scientific analyses on standardized observational data converted to the OMOP Common Data Model V5", "main": "js/main.js", "scripts": { - "prep": "npm i && npm run clean", + "prep": "npm i && npm run clean && npm run genversion", "clean": "rimraf ./js/assets/bundle && rimraf ./js/assets/fonts && rimraf ./js/assets/images", "build": "npm run prep && npm run build:dev", "build:dev": "node build/optimize.js && npm run compress", - "compress": "terser ./js/assets/bundle/bundle.js -o ./js/assets/bundle/bundle.js -c --source-map" + "compress": "terser ./js/assets/bundle/bundle.js -o ./js/assets/bundle/bundle.js -c --source-map", + "genversion": "genversion -s js/version/version.js && r_js -convert js/version js/ && rimraf js/version" }, "repository": { "type": "git", @@ -38,7 +39,8 @@ "@babel/preset-env": "^7.1.5", "esprima": "^4.0.1", "html-document": "^0.8.1", - "requirejs": "^2.3.4", + "genversion": "^2.2.0", + "requirejs": "^2.3.6", "rimraf": "^2.6.2", "terser": "3.17.0" },