diff --git a/.eslintrc.js b/.eslintrc.js index 54af39fd8e639934ed7c4c2658f668a4facc8536..0e79e8f287d1ef96ada9140ca7aeb51938fdbec3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,7 +7,6 @@ module.exports = { "@typescript-eslint/no-empty-interface": "off", "@typescript-eslint/no-inferrable-types": "off", "@typescript-eslint/interface-name-prefix": [0], - // "no-unused-vars": "off", "semi": "off", "indent": "off", "@typescript-eslint/member-delimiter-style": [2, { diff --git a/.github/workflows/deploy-on-okd.yml b/.github/workflows/deploy-on-okd.yml new file mode 100644 index 0000000000000000000000000000000000000000..d587449ec01cc971180d8b87cfefbe12b568205b --- /dev/null +++ b/.github/workflows/deploy-on-okd.yml @@ -0,0 +1,85 @@ +name: Trigger deploy on OKD +on: + workflow_call: + + inputs: + FULL_DEPLOY_ID: + required: true + type: string + OKD_ENDPOINT: + required: true + type: string + OKD_PROJECT: + required: true + type: string + + + DEPLOY_ID: + required: false + type: string + BRANCH_NAME: + required: false + type: string + ROUTE_HOST: + required: false + type: string + ROUTE_PATH: + required: false + type: string + BUILD_TEXT: + required: false + type: string + + secrets: + OKD_TOKEN: + required: true +env: + OC_TEMPLATE_NAME: 'siibra-explorer-branch-deploy-2' +jobs: + trigger-deploy: + runs-on: ubuntu-latest + steps: + - name: 'Login' + run: | + oc login ${{ inputs.OKD_ENDPOINT }} --token=${{ secrets.OKD_TOKEN }} + oc project ${{ inputs.OKD_PROJECT }} + - name: 'Login and import image' + run: | + if oc get dc ${{ inputs.FULL_DEPLOY_ID }}; then + # trigger redeploy if deployconfig exists already + echo "dc ${{ inputs.FULL_DEPLOY_ID }} already exist, redeploy..." + oc rollout latest dc/${{ inputs.FULL_DEPLOY_ID }} + else + # create new app if deployconfig does not yet exist + echo "dc ${{ inputs.FULL_DEPLOY_ID }} does not yet exist, create new app..." + + if [[ -z "${{ inputs.ROUTE_HOST }}" ]] + then + echo "ROUTE_HOST not defined!" + exit 1 + fi + + if [[ -z "${{ inputs.ROUTE_PATH }}" ]] + then + echo "ROUTE_PATH not defined!" + exit 1 + fi + + if [[ -z "${{ inputs.BUILD_TEXT }}" ]] + then + echo "BUILD_TEXT not defined!" + exit 1 + fi + if [[ -z "${{ inputs.BRANCH_NAME }}" ]] + then + echo "BRANCH_NAME not defined!" + exit 1 + fi + + oc new-app --template ${{ env.OC_TEMPLATE_NAME }} \ + -p BRANCH_NAME=${{ inputs.BRANCH_NAME }} \ + -p DEPLOY_ID=${{ inputs.DEPLOY_ID }} \ + -p ROUTE_HOST=${{ inputs.ROUTE_HOST }} \ + -p ROUTE_PATH=${{ inputs.ROUTE_PATH }} \ + -p BUILD_TEXT=${{ inputs.BUILD_TEXT }} + fi diff --git a/.github/workflows/docker_img.yml b/.github/workflows/docker_img.yml index eb5368f03107d568f2157cbee31359bae1f03f6b..539d138b3ccd567998a5305e55169ce60e6f71a4 100644 --- a/.github/workflows/docker_img.yml +++ b/.github/workflows/docker_img.yml @@ -111,118 +111,128 @@ jobs: echo "Pushing $DOCKER_BUILT_TAG" docker push $DOCKER_BUILT_TAG - trigger-deploy: + setting-vars: if: success() runs-on: ubuntu-latest - env: - GITHUB_API_ROOT: https://api.github.com/repos/fzj-inm1-bda/siibra-explorer - OC_TEMPLATE_NAME: 'siibra-explorer-branch-deploy-2' - - needs: build-docker-img + outputs: + BRANCH_NAME: ${{ steps.set-vars.outputs.BRANCH_NAME }} + BUILD_TEXT: ${{ steps.set-vars.outputs.BUILD_TEXT }} + DEPLOY_ID: ${{ steps.set-vars.outputs.DEPLOY_ID }} steps: - uses: actions/checkout@v3 - - name: Set env var + - id: set-vars + name: Set vars run: | echo "Using github.ref: $GITHUB_REF" + BRANCH_NAME=${GITHUB_REF#refs/heads/} - echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV - + echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT + echo "Branch is $BRANCH_NAME ." if [[ "$BRANCH_NAME" == 'master' ]] then - echo "BUILD_TEXT=" >> $GITHUB_ENV + echo "BUILD_TEXT=" >> $GITHUB_OUTPUT else - echo "BUILD_TEXT=$BRANCH_NAME" >> $GITHUB_ENV + echo "BUILD_TEXT=$BRANCH_NAME" >> $GITHUB_OUTPUT fi # DEPLOY_ID == remove _ / and lowercase everything from branch DEPLOY_ID=$(echo ${BRANCH_NAME//[_\/]/} | awk '{ print tolower($0) }') - echo "DEPLOY_ID=$DEPLOY_ID" >> $GITHUB_ENV - - if [[ "$BRANCH_NAME" == 'master' ]] || [[ "$BRANCH_NAME" == 'staging' ]] - then - echo "OKD_URL=https://okd.hbp.eu:443" >> $GITHUB_ENV - echo "OKD_SECRET=${{ secrets.OKD_PROD_SECRET }}" >> $GITHUB_ENV - echo "OKD_PROJECT=interactive-viewer" >> $GITHUB_ENV - echo "ROUTE_HOST=siibra-explorer.apps.hbp.eu" >> $GITHUB_ENV - - if [[ "$BRANCH_NAME" == 'master' ]] - then - FULL_DEPLOY_ID=siibra-explorer-branch-deploy-2-prodpathviewer - FULL_DEPLOY_ID2=siibra-explorer-branch-deploy-2-iav-legacy - echo "FULL_DEPLOY_ID=$FULL_DEPLOY_ID" >> $GITHUB_ENV - echo "FULL_DEPLOY_ID2=$FULL_DEPLOY_ID2" >> $GITHUB_ENV - else - FULL_DEPLOY_ID=siibra-explorer-branch-deploy-2-stagingpathed - echo "FULL_DEPLOY_ID=$FULL_DEPLOY_ID" >> $GITHUB_ENV - fi - - echo "Deploy on **prod** cluster..." - echo "Deploy id: **${FULL_DEPLOY_ID}** ..." - if [ ! -z "$FULL_DEPLOY_ID2" ] - then - echo "Secondary deploy id: **$FULL_DEPLOY_ID2** ..." - fi - else - echo "OKD_URL=https://okd-dev.hbp.eu:443" >> $GITHUB_ENV - echo "OKD_SECRET=${{ secrets.OKD_DEV_SECRET }}" >> $GITHUB_ENV - echo "OKD_PROJECT=interactive-atlas-viewer" >> $GITHUB_ENV - echo "ROUTE_HOST=siibra-explorer.apps-dev.hbp.eu" >> $GITHUB_ENV - echo "BUILD_TEXT=$BRANCH_NAME" >> $GITHUB_ENV - FULL_DEPLOY_ID=${{ env.OC_TEMPLATE_NAME }}-$DEPLOY_ID - echo "FULL_DEPLOY_ID=$FULL_DEPLOY_ID" >> $GITHUB_ENV - echo "Deploy on **dev** cluster ..." - echo "Deploy id: **${FULL_DEPLOY_ID}** ..." - fi - - name: 'Login via oc cli & deploy' - run: | - oc login $OKD_URL --token=$OKD_SECRET - oc project $OKD_PROJECT - - ROUTE_PATH=/$DEPLOY_ID - echo "ROUTE_PATH=$ROUTE_PATH" >> $GITHUB_ENV - - echo "Working branch name: $BRANCH_NAME, deploy_id: $DEPLOY_ID" - echo "full deploy id: $FULL_DEPLOY_ID, secondary deploy id: $FULL_DEPLOY_ID2" - - # check if the deploy already exist - - if oc get dc $FULL_DEPLOY_ID; then - # trigger redeploy if deployconfig exists already - echo "dc $FULL_DEPLOY_ID already exist, redeploy..." - oc rollout latest dc/$FULL_DEPLOY_ID - else - # create new app if deployconfig does not yet exist - echo "dc $FULL_DEPLOY_ID does not yet exist, create new app..." - oc new-app --template ${{ env.OC_TEMPLATE_NAME }} \ - -p BRANCH_NAME=$BRANCH_NAME \ - -p DEPLOY_ID=$DEPLOY_ID \ - -p ROUTE_HOST=$ROUTE_HOST \ - -p ROUTE_PATH=$ROUTE_PATH \ - -p BUILD_TEXT=$BUILD_TEXT - fi - - if [ ! -z "$FULL_DEPLOY_ID2" ] - then - echo "FULL_DEPLOY_ID2 is defined, trying to redeploy $FULL_DEPLOY_ID2 ..." - oc rollout latest dc/$FULL_DEPLOY_ID2 - fi - - - name: 'Update status badge' - if: success() - run: | - - DEPLOY_URL=https://$ROUTE_HOST$ROUTE_PATH - curl -v \ - -X POST \ - -H "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - -H 'accept: application/vnd.github.v3+json' \ - ${GITHUB_API_ROOT}/statuses/${GITHUB_SHA} \ - -d '{ - "target_url":"'$DEPLOY_URL'", - "name": "Deployed at OKD", - "description": "Deployed at OKD", - "context": "[ebrains-okd-deploy] Deployed at OKD", - "state": "success" - }' + echo "DEPLOY_ID=$DEPLOY_ID" >> $GITHUB_OUTPUT + + trigger-deploy-master-prod: + if: ${{ needs.setting-vars.outputs.BRANCH_NAME == 'master' && success() }} + needs: + - build-docker-img + - setting-vars + uses: ./.github/workflows/deploy-on-okd.yml + with: + FULL_DEPLOY_ID: siibra-explorer-branch-deploy-2-prodpathviewer + OKD_ENDPOINT: https://okd.hbp.eu:443 + OKD_PROJECT: interactive-viewer + secrets: + okd_token: ${{ secrets.OKD_PROD_SECRET }} + + trigger-deploy-master-legacy: + if: ${{ needs.setting-vars.outputs.BRANCH_NAME == 'master' && success() }} + needs: + - build-docker-img + - setting-vars + uses: ./.github/workflows/deploy-on-okd.yml + with: + FULL_DEPLOY_ID: siibra-explorer-branch-deploy-2-iav-legacy + OKD_ENDPOINT: https://okd.hbp.eu:443 + OKD_PROJECT: interactive-viewer + secrets: + okd_token: ${{ secrets.OKD_PROD_SECRET }} + + trigger-deploy-staging-viewer-validation: + if: ${{ needs.setting-vars.outputs.BRANCH_NAME == 'staging' && success() }} + needs: + - build-docker-img + - setting-vars + uses: ./.github/workflows/deploy-on-okd.yml + with: + FULL_DEPLOY_ID: siibra-explorer-branch-deploy-2-stagingpathed + OKD_ENDPOINT: https://okd.hbp.eu:443 + OKD_PROJECT: interactive-viewer + secrets: + okd_token: ${{ secrets.OKD_PROD_SECRET }} + + trigger-deploy-staging-data-validation: + if: ${{ needs.setting-vars.outputs.BRANCH_NAME == 'staging' && success() }} + needs: + - build-docker-img + - setting-vars + uses: ./.github/workflows/deploy-on-okd.yml + with: + FULL_DEPLOY_ID: siibra-explorer-rc + OKD_ENDPOINT: https://okd.jsc.hbp.eu:443 + OKD_PROJECT: siibra-explorer + secrets: + okd_token: ${{ secrets.OKD_JSC_TOKEN }} + + trigger-deploy-other-viewer: + # n.b. "env" context not available in "if" block + if: ${{ needs.setting-vars.outputs.BRANCH_NAME != 'staging' && needs.setting-vars.outputs.BRANCH_NAME != 'master' && success() }} + uses: ./.github/workflows/deploy-on-okd.yml + needs: + - build-docker-img + - setting-vars + with: + FULL_DEPLOY_ID: siibra-explorer-branch-deploy-2-${{ needs.setting-vars.outputs.DEPLOY_ID }} + OKD_ENDPOINT: https://okd-dev.hbp.eu:443 + OKD_PROJECT: interactive-atlas-viewer + BRANCH_NAME: ${{ needs.setting-vars.outputs.BRANCH_NAME }} + DEPLOY_ID: ${{ needs.setting-vars.outputs.DEPLOY_ID }} + ROUTE_HOST: siibra-explorer.apps-dev.hbp.eu + ROUTE_PATH: /${{ needs.setting-vars.outputs.DEPLOY_ID }} + BUILD_TEXT: ${{ needs.setting-vars.outputs.BRANCH_NAME }} + secrets: + okd_token: ${{ secrets.OKD_DEV_SECRET }} + + trigger-deploy-other-badge: + if: ${{ needs.setting-vars.outputs.BRANCH_NAME != 'staging' && needs.setting-vars.outputs.BRANCH_NAME != 'master' && success() }} + runs-on: ubuntu-latest + env: + DEPLOY_URL: https://siibra-explorer.apps-dev.hbp.eu/${{ needs.setting-vars.outputs.DEPLOY_ID }} + GITHUB_API_ROOT: https://api.github.com/repos/fzj-inm1-bda/siibra-explorer + needs: + - trigger-deploy-other-viewer + - setting-vars + steps: + - name: "Update Badge" + run: | + curl -v \ + -X POST \ + -H "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H 'accept: application/vnd.github.v3+json' \ + ${GITHUB_API_ROOT}/statuses/${GITHUB_SHA} \ + -d '{ + "target_url":"${{ env.DEPLOY_URL }}", + "name": "Deployed at OKD", + "description": "Deployed at OKD", + "context": "[ebrains-okd-deploy] Deployed at OKD", + "state": "success" + }' diff --git a/deploy/csp/index.js b/deploy/csp/index.js index 92ee364fd5cd7691811cf45956712bf98fd184c6..5f04bbcd2144b19ca15ba1acc765c4fba7afb45c 100644 --- a/deploy/csp/index.js +++ b/deploy/csp/index.js @@ -115,7 +115,7 @@ module.exports = { 'https://unpkg.com/d3@6.2.0/', // required for preview component 'https://unpkg.com/mathjax@3.1.2/', // math jax 'https://unpkg.com/three-surfer@0.0.13/dist/bundle.js', // for threeSurfer (freesurfer support in browser) - 'https://unpkg.com/ng-layer-tune@0.0.14/dist/ng-layer-tune/', // needed for ng layer control + 'https://unpkg.com/ng-layer-tune@0.0.16/dist/ng-layer-tune/', // needed for ng layer control 'https://unpkg.com/hbp-connectivity-component@0.6.6/', // needed for connectivity component (req, res) => res.locals.nonce ? `'nonce-${res.locals.nonce}'` : null, ...SCRIPT_SRC, diff --git a/docs/releases/v2.12.1.md b/docs/releases/v2.12.1.md new file mode 100644 index 0000000000000000000000000000000000000000..0d9308e1ec98b17cd2e785314cb3b25259b01323 --- /dev/null +++ b/docs/releases/v2.12.1.md @@ -0,0 +1,10 @@ +# v2.12.1 + +# Feature + +- added the option to use red/green/blue colormaps (#1366) + +## Bugfix + +- fixed touch devices unable to navigate viewer +- fixed some volume controls not working diff --git a/mkdocs.yml b/mkdocs.yml index a43dc55650094669690740ca9fe1e1fb13acc07b..207b2580cd9132c87e0721534a3a192cbbfd4711 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -33,6 +33,7 @@ nav: - Fetching datasets: 'advanced/datasets.md' - Display non-atlas volumes: 'advanced/otherVolumes.md' - Release notes: + - v2.12.1: 'releases/v2.12.1.md' - v2.12.0: 'releases/v2.12.0.md' - v2.11.4: 'releases/v2.11.4.md' - v2.11.3: 'releases/v2.11.3.md' diff --git a/package-lock.json b/package-lock.json index c6e536b6eb6532373f96bd0d1c06c34e690ec417..988893d143b1661bf6bca7685e244e46e87c2898 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "siibra-explorer", - "version": "2.12.0", + "version": "2.12.1", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index 5362349f32bea024d80e831723fa469611008978..5314a2daa6a1cc8d13088e24bd5568e42ab66b97 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "siibra-explorer", - "version": "2.12.0", + "version": "2.12.1", "description": "siibra-explorer - explore brain atlases. Based on humanbrainproject/nehuba & google/neuroglancer. Built with angular", "scripts": { "lint": "eslint src --ext .ts", diff --git a/src/atlasComponents/sapi/sapi.service.ts b/src/atlasComponents/sapi/sapi.service.ts index 0750c09315d429dee2d64b41680eecdd6288b35a..50db1238456bd0f706188dfbd8651bdf489ae8ee 100644 --- a/src/atlasComponents/sapi/sapi.service.ts +++ b/src/atlasComponents/sapi/sapi.service.ts @@ -22,7 +22,7 @@ export const useViewer = { } as const export const SIIBRA_API_VERSION_HEADER_KEY='x-siibra-api-version' -export const EXPECTED_SIIBRA_API_VERSION = '0.3.9' +export const EXPECTED_SIIBRA_API_VERSION = '0.3.10' let BS_ENDPOINT_CACHED_VALUE: Observable<string> = null diff --git a/src/index.html b/src/index.html index 625cc65955195124a32d39c78486382edb8a9737..b1c5716a7c0ffaa17c6da0b9c126f82f9b8532a2 100644 --- a/src/index.html +++ b/src/index.html @@ -14,7 +14,7 @@ <script src="extra_js.js"></script> <script src="https://unpkg.com/kg-dataset-previewer@1.2.0/dist/kg-dataset-previewer/kg-dataset-previewer.js" defer></script> <script src="https://unpkg.com/three-surfer@0.0.13/dist/bundle.js" defer></script> - <script type="module" src="https://unpkg.com/ng-layer-tune@0.0.14/dist/ng-layer-tune/ng-layer-tune.esm.js"></script> + <script type="module" src="https://unpkg.com/ng-layer-tune@0.0.16/dist/ng-layer-tune/ng-layer-tune.esm.js"></script> <script type="module" src="https://unpkg.com/hbp-connectivity-component@0.6.6/dist/connectivity-component/connectivity-component.js" ></script> <script defer src="https://unpkg.com/mathjax@3.1.2/es5/tex-svg.js"></script> <script defer src="https://unpkg.com/d3@6.2.0/dist/d3.min.js"></script> diff --git a/src/viewerModule/nehuba/nehubaViewer/nehubaViewer.component.ts b/src/viewerModule/nehuba/nehubaViewer/nehubaViewer.component.ts index 0bee1941f311aee0df808e66678299649bcc6128..94d1cc93950caa1c85a8850b485ebb9bba51e1f8 100644 --- a/src/viewerModule/nehuba/nehubaViewer/nehubaViewer.component.ts +++ b/src/viewerModule/nehuba/nehubaViewer/nehubaViewer.component.ts @@ -847,7 +847,7 @@ const patchSliceViewPanel = (sliceViewPanel: any) => { const viewportToDataEv = new CustomEvent('viewportToData', { bubbles: true, detail: { - viewportToData : this.sliceView.viewportToData, + viewportToData : this.sliceView.invViewMatrix, }, }) this.element.dispatchEvent(viewportToDataEv) diff --git a/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerTouch.directive.ts b/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerTouch.directive.ts index 6223e187fe07f0bd19f2f5774c793594ff17851f..371cc99e778aaa79ac3ba7d7ec645a27bb2c4f60 100644 --- a/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerTouch.directive.ts +++ b/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerTouch.directive.ts @@ -66,12 +66,12 @@ export class NehubaViewerTouchDirective implements OnDestroy{ * Touchend also needs to be listened to, as user could start * with multitouch, and end up as single touch */ - const touchStart$ = fromEvent(this.el.nativeElement, 'touchstart').pipe( + const touchStart$ = fromEvent(this.el.nativeElement, 'touchstart', { capture: true }).pipe( shareReplay(1), ) this.singleTouchStart$ = merge( touchStart$, - fromEvent(this.el.nativeElement, 'touchend') + fromEvent(this.el.nativeElement, 'touchend', { capture: true }) ).pipe( filter((ev: TouchEvent) => ev.touches.length === 1), shareReplay(1), @@ -81,18 +81,18 @@ export class NehubaViewerTouchDirective implements OnDestroy{ filter((ev: TouchEvent) => ev.touches.length > 1), ) - this.touchEnd$ = fromEvent(this.el.nativeElement, 'touchend').pipe( + this.touchEnd$ = fromEvent(this.el.nativeElement, 'touchend', { capture: true }).pipe( map(ev => ev as TouchEvent), ) - this.touchMove$ = fromEvent(this.el.nativeElement, 'touchmove') + this.touchMove$ = fromEvent(this.el.nativeElement, 'touchmove', { capture: true }) const multiTouch$ = this.multiTouchStart$.pipe( // only tracks first 2 touches map((ev: TouchEvent) => [ this.findPanelIndex(ev.touches[0].target as HTMLElement), this.findPanelIndex(ev.touches[0].target as HTMLElement) ]), filter(indicies => indicies[0] >= 0 && indicies[0] === indicies[1]), map(indicies => indicies[0]), - switchMap(panelIndex => fromEvent(this.el.nativeElement, 'touchmove').pipe( + switchMap(panelIndex => fromEvent(this.el.nativeElement, 'touchmove', { capture: true }).pipe( filter((ev: TouchEvent) => ev.touches.length > 1), pairwise(), map(([ev0, ev1]) => { @@ -256,7 +256,7 @@ export class NehubaViewerTouchDirective implements OnDestroy{ ).subscribe(({ panelIndex, deltaX, deltaY }) => { if (isNaN(deltaX) || isNaN(deltaX)) return const { position } = this.ngViewer.navigationState - const pos = position.spatialCoordinates + const pos = position.value const { vec3 } = this.exportNehuba vec3.set(pos, deltaX, deltaY, 0) vec3.transformMat4(pos, pos, this.viewportToData[panelIndex])