diff --git a/.github/workflows/docker_img.yml b/.github/workflows/docker_img.yml index 928c13769d4d699156888a04ee5cad19f0519a1b..daa098e920be68ce850beb81fd1450505dbfc1cd 100644 --- a/.github/workflows/docker_img.yml +++ b/.github/workflows/docker_img.yml @@ -48,22 +48,26 @@ jobs: - name: 'Set version variable & expmt feature flag' run: | + GIT_HASH=$(git rev-parse --short HEAD) + echo "Setting GIT_HASH: $GIT_HASH" + echo "GIT_HASH=$GIT_HASH" >> $GITHUB_ENV + + VERSION=$(jq -r '.version' package.json) + echo "Setting VERSION: $VERSION" + echo "VERSION=$VERSION" >> $GITHUB_ENV if [[ "$GITHUB_REF" == 'refs/heads/master' ]] || [[ "$GITHUB_REF" == 'refs/heads/staging' ]] then - echo "Either master or staging, using package.json" - VERSION=$(jq -r '.version' package.json) + echo "prod/staging build, do not enable experimental features" else - echo "Using git hash" - VERSION=$(git rev-parse --short HEAD) + echo "dev bulid, enable experimental features" echo "EXPERIMENTAL_FEATURE_FLAG=true" >> $GITHUB_ENV fi - echo "Setting VERSION: $VERSION" - echo "VERSION=$VERSION" >> $GITHUB_ENV - name: 'Build docker image' run: | DOCKER_BUILT_TAG=${{ env.DOCKER_REGISTRY }}siibra-explorer:$BRANCH_NAME echo "Building $DOCKER_BUILT_TAG" docker build \ + --build-arg GIT_HASH=$GIT_HASH \ --build-arg VERSION=$VERSION \ --build-arg MATOMO_URL=$MATOMO_URL \ --build-arg MATOMO_ID=$MATOMO_ID \ diff --git a/Dockerfile b/Dockerfile index bc614aacaf8dcef73da19f4a59285e6a31e51daf..3b017144535e201d255259c3b28ec4833d965e0c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,12 @@ ENV MATOMO_ID=${MATOMO_ID} ARG EXPERIMENTAL_FEATURE_FLAG ENV EXPERIMENTAL_FEATURE_FLAG=${EXPERIMENTAL_FEATURE_FLAG:-false} +ARG GIT_HASH +ENV GIT_HASH=${GIT_HASH:-unknownhash} + +ARG VERSION +ENV VERSION=${VERSION:-unknownversion} + COPY . /iv WORKDIR /iv @@ -33,8 +39,6 @@ RUN node ./src/environments/parseEnv.js # When building in local, where node_module already exist, prebuilt binary may throw an error RUN rm -rf ./node_modules -ARG VERSION -ENV VERSION=${VERSION} RUN npm i RUN npm run build-aot diff --git a/angular.json b/angular.json index 381d8126cb58142d0ab49b4dabda5cd8ad15124d..8e887675e54154cb46b0eac5e871ce64c6079695 100644 --- a/angular.json +++ b/angular.json @@ -34,9 +34,43 @@ "src/overwrite.scss", "src/extra_styles.css" ], - "scripts": [ - "worker/worker.js" - ] + "scripts": [{ + "input": "worker/worker.js", + "inject": false, + "bundleName": "worker" + },{ + "input": "worker/worker-plotly.js", + "inject": false, + "bundleName": "worker-plotly" + },{ + "input": "worker/worker-nifti.js", + "inject": false, + "bundleName": "worker-nifti" + }, + + { + "input": "third_party/catchSyntaxError.js", + "inject": false, + "bundleName": "catchSyntaxError" + },{ + "input": "third_party/syntaxError.js", + "inject": false, + "bundleName": "syntaxError" + }, + + { + "input": "third_party/vanilla_nehuba.js", + "inject": false, + "bundleName": "vanilla_nehuba" + },{ + "input": "export-nehuba/dist/min/main.bundle.js", + "inject": false, + "bundleName": "main.bundle" + },{ + "input": "export-nehuba/dist/min/chunk_worker.bundle.js", + "inject": false, + "bundleName": "chunk_worker.bundle" + }] }, "configurations": { "production": { @@ -47,7 +81,14 @@ } ], "buildOptimizer": true, - "optimization": false, + "optimization": { + "scripts": true, + "fonts": true, + "styles": { + "inlineCritical": false, + "minify": true + } + }, "vendorChunk": true, "extractLicenses": false, "sourceMap": false, diff --git a/deploy/csp/index.js b/deploy/csp/index.js index 4deecdda1795ff07c9e6f6f68fcf812c94540432..b7e07519626b1a0b3cf8f8f86728a1c6d7d333fd 100644 --- a/deploy/csp/index.js +++ b/deploy/csp/index.js @@ -116,8 +116,8 @@ module.exports = { 'unpkg.com/kg-dataset-previewer@1.2.0/', // preview component 'cdnjs.cloudflare.com/ajax/libs/mathjax/', // math jax 'https://unpkg.com/three-surfer@0.0.10/dist/bundle.js', // for threeSurfer (freesurfer support in browser) - 'https://unpkg.com/ng-layer-tune@0.0.2/dist/ng-layer-tune/ng-layer-tune.esm.js', // needed for ng layer control - (req, res) => res.locals.nonce ? `'nonce-${res.locals.nonce}'` : null, + 'https://unpkg.com/ng-layer-tune@0.0.2/dist/ng-layer-tune/', // needed for ng layer control + (req, res) => res.locals.nonce ? [`'nonce-${res.locals.nonce}'`] : [], ...SCRIPT_SRC, ...WHITE_LIST_SRC, ...defaultAllowedSites diff --git a/deploy/package-lock.json b/deploy/package-lock.json index 5d707a769ac807f9c1473f3940fe0464dba4657b..3a8058b86a578efd909ca7b5d28a32edd93e5492 100644 --- a/deploy/package-lock.json +++ b/deploy/package-lock.json @@ -379,11 +379,6 @@ } } }, - "bowser": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.5.4.tgz", - "integrity": "sha512-74GGwfc2nzYD19JCiA0RwCxdq7IY5jHeEaSrrgm/5kusEuK+7UK0qDG3gyzN47c4ViNyO4osaKtZE+aSV6nlpQ==" - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -436,11 +431,6 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" }, - "camelize": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz", - "integrity": "sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=" - }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -581,11 +571,6 @@ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" }, - "content-security-policy-builder": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/content-security-policy-builder/-/content-security-policy-builder-2.1.0.tgz", - "integrity": "sha512-/MtLWhJVvJNkA9dVLAp6fg9LxD2gfI6R2Fi1hPmfjYXSahJJzcfvoeDOxSyp4NvxMuwWv3WMssE9o31DoULHrQ==" - }, "content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", @@ -680,11 +665,6 @@ "assert-plus": "^1.0.0" } }, - "dasherize": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/dasherize/-/dasherize-2.0.0.tgz", - "integrity": "sha1-bYCcnNDPe7iVLYD8hPoT1H3bEwg=" - }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -1195,15 +1175,9 @@ "dev": true }, "helmet-csp": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/helmet-csp/-/helmet-csp-2.9.1.tgz", - "integrity": "sha512-HgdXSJ6AVyXiy5ohVGpK6L7DhjI9KVdKVB1xRoixxYKsFXFwoVqtLKgDnfe3u8FGGKf9Ml9k//C9rnncIIAmyA==", - "requires": { - "bowser": "2.5.4", - "camelize": "1.0.0", - "content-security-policy-builder": "2.1.0", - "dasherize": "2.0.0" - } + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/helmet-csp/-/helmet-csp-3.4.0.tgz", + "integrity": "sha512-a+YgzWw6dajqhQfb6ktxil0FsQuWTKzrLSUfy55dxS8fuvl1jidTIMPZ2udN15mjjcpBPgTHNHGF5tyWKYyR8w==" }, "http-cache-semantics": { "version": "4.0.4", diff --git a/deploy/package.json b/deploy/package.json index 8a165a87192525bf0b6bcd9ba86df86fe5ddb30c..a8b5d1488439346a9c7b6adc2322a57a482f218e 100644 --- a/deploy/package.json +++ b/deploy/package.json @@ -20,7 +20,7 @@ "express-session": "^1.15.6", "got": "^10.5.5", "hbp-seafile": "^0.2.0", - "helmet-csp": "^2.8.0", + "helmet-csp": "^3.4.0", "lru-cache": "^5.1.1", "memorystore": "^1.6.1", "nomiseco": "0.0.2", diff --git a/deploy/saneUrl/index.js b/deploy/saneUrl/index.js index 06659fa88748f40db5d57459c43c896b03e7babb..09fe10b25a57e336b25118d57f4b5849c1f8234d 100644 --- a/deploy/saneUrl/index.js +++ b/deploy/saneUrl/index.js @@ -36,7 +36,9 @@ const getFile = async name => { } const hardCodedMap = new Map([ + ['bigbrainGreyWhite', '#/a:juelich:iav:atlas:v1.0.0:1/t:minds:core:referencespace:v1.0.0:a1655b99-82f1-420f-a3c2-fe80fd4c8588/p:juelich:iav:atlas:v1.0.0:4/@:0.0.0.-W000.._eCwg.2-FUe3._-s_W.2_evlu..7LIx..gIW~.10AwC.B1KK~..1LSm'], ['whs4', '#/a:minds:core:parcellationatlas:v1.0.0:522b368e-49a3-49fa-88d3-0870a307974a/t:minds:core:referencespace:v1.0.0:d5717c4a-0fa1-46e6-918c-b8003069ade8/p:minds:core:parcellationatlas:v1.0.0:ebb923ba-b4d5-4b82-8088-fa9215c2e1fe-v4/@:0.0.0.-W000.._eCwg.2-FUe3._-s_W.2_evlu..kxV..0.0.0..8Yu'], + ['allen2017', '#/a:juelich:iav:atlas:v1.0.0:2/t:minds:core:referencespace:v1.0.0:265d32a0-3d84-40a5-926f-bf89f68212b9/p:minds:core:parcellationatlas:v1.0.0:05655b58-3b6f-49db-b285-64b5a0276f83/@:0.0.0.-W000.._eCwg.2-FUe3._-s_W.2_evlu..kxV..0.0.0..8Yu'], ['mebrains', '#/a:juelich:iav:atlas:v1.0.0:monkey/t:minds:core:referencespace:v1.0.0:MEBRAINS_T1.masked/p:minds:core:parcellationatlas:v1.0.0:mebrains-tmp-id/@:0.0.0.-W000.._eCwg.2-FUe3._-s_W.2_evlu..7LIx..0.0.0..1LSm'] ]) diff --git a/docs/releases/v2.5.7.md b/docs/releases/v2.5.7.md index 9aaabad886b2affba5f2747f71b3021ade63ddf6..5e6a2ef22cad04a1190c4fe5691eb45e870086a1 100644 --- a/docs/releases/v2.5.7.md +++ b/docs/releases/v2.5.7.md @@ -1,5 +1,16 @@ # v2.5.7 +## Bugfix + +- fixed version in console + ## Feature - Add menu to change perspective orientation by coronal/sagittal/axial views. + +## Under the hood + +- added saneurl for bigbrain isocortex, allen CCFv3 2017 +- fixed csp issues +- optimised build (assets should be smaller) +- added git hash in console diff --git a/package.json b/package.json index c87724a7533539c7f37e81b9be6f2b089996675e..1b8c4de04b3f608d8cba63b6abc8f96120f17696 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "2.5.7", "description": "HBP interactive atlas viewer. Integrating KG query, dataset previews & more. Based on humanbrainproject/nehuba & google/neuroglancer. Built with angular", "scripts": { - "build-aot": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'` ng build --prod && node ./third_party/matomo/processMatomo.js", + "build-aot": "ng build && node ./third_party/matomo/processMatomo.js", "dev-server-aot": "ng serve", "e2e": "echo NYI && exit 1", "wd": "webdriver-manager", @@ -11,7 +11,7 @@ "eslint": "eslint", "ng": "ng", "start": "ng serve", - "build": "ng build --prod", + "build": "ng build", "watch": "ng build --watch --configuration development", "test": "ng test", "test-ci": "ng test --progress false --watch false --browsers=ChromeHeadless" diff --git a/src/atlasViewer/atlasViewer.workerService.service.ts b/src/atlasViewer/atlasViewer.workerService.service.ts index 62395463088ed3939c419ec61329c18e68865993..653764d97a7670d16ca8805c1033f09775de0cb0 100644 --- a/src/atlasViewer/atlasViewer.workerService.service.ts +++ b/src/atlasViewer/atlasViewer.workerService.service.ts @@ -3,15 +3,7 @@ import { fromEvent } from "rxjs"; import { filter, take } from "rxjs/operators"; import { getUuid } from "src/util/fn"; -/* telling webpack to pack the worker file */ - -import '!!file-loader?name=worker.js!worker/worker.js' -import '!!file-loader?name=worker-plotly.js!worker/worker-plotly.js' -import '!!file-loader?name=worker-nifti.js!worker/worker-nifti.js' - -/** - * export the worker, so that services that does not require dependency injection can import the worker - */ +// worker is now exported in angular.json file export const worker = new Worker('worker.js') interface IWorkerMessage { diff --git a/src/environments/environment.common.ts b/src/environments/environment.common.ts index 52bdf0c70442a366f643e161bca3502346b756c4..85a5e68ae63408c740790bd514fb6ad3fdbe8bb2 100644 --- a/src/environments/environment.common.ts +++ b/src/environments/environment.common.ts @@ -1,6 +1,7 @@ export const environment = { - VERSION: 'unspecificied hash', + GIT_HASH: 'unknown hash', + VERSION: 'unknown version', PRODUCTION: true, BACKEND_URL: null, DATASET_PREVIEW_URL: 'https://hbp-kg-dataset-previewer.apps.hbp.eu/v2', diff --git a/src/environments/parseEnv.js b/src/environments/parseEnv.js index 2b3052d932dd2be8ca0f738ec2f4e26c91ef1801..84c95658b5b7466938de4d8c8f675950662b1162 100644 --- a/src/environments/parseEnv.js +++ b/src/environments/parseEnv.js @@ -13,17 +13,21 @@ const main = async () => { MATOMO_ID, BS_REST_URL, VERSION, - GIT_HASH, + GIT_HASH = 'unknown hash', EXPERIMENTAL_FEATURE_FLAG } = process.env const version = JSON.stringify( - VERSION || GIT_HASH || 'unspecificied hash' - ) + VERSION || 'unknown version' + ) + const gitHash = JSON.stringify( + GIT_HASH || 'unknown hash' + ) const outputTxt = ` import { environment as commonEnv } from './environment.common' export const environment = { ...commonEnv, + GIT_HASH: ${gitHash}, VERSION: ${version}, BS_REST_URL: ${JSON.stringify(BS_REST_URL)}, BACKEND_URL: ${JSON.stringify(BACKEND_URL)}, diff --git a/src/main-common.ts b/src/main-common.ts index 3afe8d0ad8e5dd329f4392e4e7de3aff1228fe00..c3f3f5ee2d1f07260b1932bbe9152d65c7e81dc7 100644 --- a/src/main-common.ts +++ b/src/main-common.ts @@ -1,17 +1,19 @@ // Included to include a copy of vanilla nehuba import '!!file-loader?context=third_party&name=vanilla.html!third_party/vanilla.html' import '!!file-loader?context=third_party&name=vanilla_styles.css!third_party/styles.css' -import '!!file-loader?context=third_party&name=vanilla_nehuba.js!third_party/vanilla_nehuba.js' import '!!file-loader?context=third_party&name=preinit_vanilla.html!third_party/preinit_vanilla.html' /** * Catching Safari 10 bug: * * https://bugs.webkit.org/show_bug.cgi?id=171041 -* +* +* moved to angular.json +* look for +* - third_party/catchSyntaxError.js +* - third_party/syntaxError.js */ -import '!!file-loader?context=third_party&name=catchSyntaxError.js!third_party/catchSyntaxError.js' -import '!!file-loader?context=third_party&name=syntaxError.js!third_party/syntaxError.js' + import '!!file-loader?context=src/res&name=icons/iav-icons.css!src/res/icons/iav-icons.css' import '!!file-loader?context=src/res&name=icons/iav-icons.ttf!src/res/icons/iav-icons.ttf' @@ -36,9 +38,9 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' import { MainModule } from './main.module'; import { environment } from 'src/environments/environment' -const { PRODUCTION, VERSION } = environment +const { PRODUCTION, VERSION, GIT_HASH } = environment if (PRODUCTION) enableProdMode() -if (PRODUCTION) { console.log(`Interactive Atlas Viewer: ${VERSION}`) } +if (PRODUCTION) { console.log(`Siibra Explorer: ${VERSION}::${GIT_HASH}`) } platformBrowserDynamic().bootstrapModule(MainModule) diff --git a/src/viewerModule/nehuba/nehubaViewer/nehubaViewer.component.ts b/src/viewerModule/nehuba/nehubaViewer/nehubaViewer.component.ts index 1d27731f97714e8000e71027ac174ab5473fb6de..84621341979625d6ee5c4b866f405e940b886fbc 100644 --- a/src/viewerModule/nehuba/nehubaViewer/nehubaViewer.component.ts +++ b/src/viewerModule/nehuba/nehubaViewer/nehubaViewer.component.ts @@ -10,8 +10,9 @@ import { deserialiseParcRegionId } from 'common/util' import { IMeshesToLoad, SET_MESHES_TO_LOAD } from "../constants"; import { IColorMap, SET_COLORMAP_OBS, SET_LAYER_VISIBILITY } from "../layerCtrl.service"; -import '!!file-loader?context=third_party&name=main.bundle.js!export-nehuba/dist/min/main.bundle.js' -import '!!file-loader?context=third_party&name=chunk_worker.bundle.js!export-nehuba/dist/min/chunk_worker.bundle.js' +/** + * import of nehuba js files moved to angular.json + */ import { INgLayerCtrl, NG_LAYER_CONTROL, SET_SEGMENT_VISIBILITY, TNgLayerCtrl } from "../layerCtrl.service/layerCtrl.util"; const NG_LANDMARK_LAYER_NAME = 'spatial landmark layer'