Skip to content

Commit

Permalink
Merge pull request #851 from HumanBrainProject/hotfix_bkwdCmpatNiftiL…
Browse files Browse the repository at this point in the history
…ayers

hotfix: backwards compatibility with urls in kg
  • Loading branch information
xgui3783 authored Feb 1, 2021
2 parents 770fb21 + 67a391e commit 1b3bc2b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
5 changes: 3 additions & 2 deletions docs/releases/v2.3.3.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# v2.3.3
# v2.3.2

## Bugfixes

- fix bug where fetching of regional features does not complete for logged in users (#826). (the viewer will only fetch released datasets)
- fix backwards compatibility with some URLs
- fix bug where fetching of regional features does not complete for logged in users (#826). (the viewer will only fetch released datasets)
18 changes: 17 additions & 1 deletion e2e/src/advanced/urlParsing.prod.e2e-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,23 @@ describe('> url parsing', () => {
expect(red).toEqual(blue)
})

it('> [bkwards compat] if ill defined labelIndex for regionsSelected are defined, should handle gracefully', async () => {
const url = '/?parcellationSelected=JuBrain+Cytoarchitectonic+Atlas&templateSelected=MNI+Colin+27&navigation=0_0_0_1__-0.2753947079181671_0.6631333827972412_-0.6360703706741333_0.2825356423854828__3000000__-17800000_-6700000_-7500000__200000&regionsSelected=142&niftiLayers=https%3A%2F%2Fneuroglancer.humanbrainproject.org%2Fprecomputed%2FJuBrain%2Fv2.2c%2FPMaps%2FBforebrain_4.nii'
await iavPage.goto(url)
await iavPage.clearAlerts()
await iavPage.wait(5000)
await iavPage.waitForAsync()
const log = await iavPage.getLog()
const filteredLog = log.filter(({ message }) => !/Access-Control-Allow-Origin/.test(message))

// expecting some errors in the console. In catastrophic event, there will most likely be looped errors (on each render cycle)
expect(
filteredLog.length
).toBeLessThan(50)
})

it('> if niftiLayers are defined, parcellation layer should be hidden', async () => {
const url = `/?templateSelected=MNI+152+ICBM+2009c+Nonlinear+Asymmetric&parcellationSelected=JuBrain+Cytoarchitectonic+Atlas&niftiLayers=https%3A%2F%2Fneuroglancer.humanbrainproject.eu%2Fprecomputed%2FJuBrain%2F17%2Ficbm152casym%2Fpmaps%2FVisual_hOc1_r_N10_nlin2MNI152ASYM2009C_2.4_publicP_a48ca5d938781ebaf1eaa25f59df74d0.nii.gz`
const url = `/?parcellationSelected=JuBrain+Cytoarchitectonic+Atlas&templateSelected=MNI+Colin+27&navigation=0_0_0_1__-0.2753947079181671_0.6631333827972412_-0.6360703706741333_0.2825356423854828__3000000__-17800000_-6700000_-7500000__200000&regionsSelected=142&niftiLayers=https%3A%2F%2Fneuroglancer.humanbrainproject.org%2Fprecomputed%2FJuBrain%2Fv2.2c%2FPMaps%2FBforebrain_4.nii`
await iavPage.goto(url)
await iavPage.clearAlerts()

Expand Down Expand Up @@ -149,4 +164,5 @@ describe('> url parsing', () => {
expect(visibleArr.length).toEqual(3)
expect(visibleArr).toEqual([true, true, true])
})

})
5 changes: 5 additions & 0 deletions e2e/util/selenium/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ class WdBase{
return result
}

async getLog() {
const browserLog = await this._browser.manage().logs().get('browser')
return browserLog
}

async getRgbAt({ position } = {}, cssSelector = null){
if (!position) throw new Error(`position is required for getRgbAt`)
const { x, y } = verifyPosition(position)
Expand Down
2 changes: 1 addition & 1 deletion src/atlasViewer/atlasViewer.urlUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const parseSearchParamForTemplateParcellationRegion = (searchparams: URLSearchPa
const selectedRegionsParam = searchparams.get('regionsSelected')
if (selectedRegionsParam) {
const ids = selectedRegionsParam.split('_')
return ids.map(labelIndexId => getRegionFromlabelIndexId({ labelIndexId }))
return ids.map(labelIndexId => getRegionFromlabelIndexId({ labelIndexId })).filter(v => !!v)
}

const cRegionsSelectedParam = searchparams.get('cRegionsSelected')
Expand Down

0 comments on commit 1b3bc2b

Please sign in to comment.