Skip to content

Commit

Permalink
Merge pull request #820 from HumanBrainProject/staging
Browse files Browse the repository at this point in the history
hotfix v2.3.1
  • Loading branch information
xgui3783 authored Dec 15, 2020
2 parents ab0c6cf + f24f5ff commit 032644f
Show file tree
Hide file tree
Showing 11 changed files with 243 additions and 9 deletions.
44 changes: 44 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,50 @@ jobs:
- NODE_ENV=test
- PORT=12234

- stage: Check version numbers and release notes
name: Check version number advanced (package.json)
if: |
(type = pull_request AND branch = staging) OR \
(type = pull_request AND branch = master AND NOT head_branch = staging)
script:
- MASTER_VERSION=$(git show origin/master:package.json | jq '.version')
- THIS_VERSION=$(jq '.version' < package.json)
- test "$MASTER_VERSION" == "$THIS_VERSION" && exit 1 || exit 0

- name: Check release notes authored (docs/releases/v?.?.?.md)
if: |
(type = pull_request AND branch = staging) OR \
(type = pull_request AND branch = master AND NOT head_branch = staging)
script:
- |
VERSION_NUM=$(jq '.version' < package.json) && \
VERSION_NUM=${VERSION_NUM#\"} && \
VERSION_NUM=${VERSION_NUM%\"} && \
test -f docs/releases/v$VERSION_NUM.md && exit 0 || exit 1
- name: Release notes linked in mkdocs.yml
if: |
(type = pull_request AND branch = staging) OR \
(type = pull_request AND branch = master AND NOT head_branch = staging)
script:
- VERSION_NUM=$(jq '.version' < package.json)
- VERSION_NUM=${VERSION_NUM#\"}
- VERSION_NUM=${VERSION_NUM%\"}
- 'echo "VERSION_NUM: $VERSION_NUM"'
- cat mkdocs.yml
- GREP_VERSION_NUM=$(cat mkdocs.yml | grep $VERSION_NUM)
- 'echo GREP_VERSION_NUM: $GREP_VERSION_NUM'
- test -z "$GREP_VERSION_NUM" && exit 1 || exit 0

- stage: Create github release
if: |
type = push AND \
branch = master
before_script:
- chmod ugo+x ./release.sh
script: ./release.sh
env:
- secure: "mERkfztriSCECF/liheC4zFmq4h+MxausY8N0soTytOWUuTmz+NfxObsQ8w8Zl0h3XVe0BZdueJ15zeoipNBDisHZ2kbfLYnCJ8nsym+0O7mpYUSEiT5nDVE0Yj/9a+ZOAW0h0mvWNOwQZId0uTPr8rEst4IvCr+HkLZEUOM06lnftz1edYN3EsVih6MuTymXNLUaYkMBCErq2AFGvgOy6oP6Mq/D2QkBvM+RUNIxcJ2SrM9lMw4i5L/PeOnxbm0MBUndFhR/P0rJ7qz0j4kRP3DvgXfeW+hQsYcECGsnxMgC+Q59ULTBrRGuD03PnHI+7H8CrX+8maHYy+yf7S/iblaCcr0E5gZq/U0mUJbicymBhw4Ygu76X2Rj6E4jUeoC60MqDZovSisV6xuRXXFDqbfYxlBgFSsSS4Ozbl/RUA5MtLx/N4LwAKv5kafktFwZih/ZfQMAOZQfUDB60y4Mvh1Eg6XK4HhnRxdBE8GWP1tQLq/3n8NLr9KBIR4ceHUNEFXjWw3nPIAujnCqUoxSJotfDEnFUpV6KMgZxiC9vv/vq7IgnzzTXRGdvFfjzBbFmYv4+nqYzZhqKb7BI9y++0v+4Jdu9eHGdYVIpiYzzEKhqImK6I4CsUdcakXiPecdxlwA1zc/yET8qyBNGPGnXvYAw1hBt1VbtP8Rf3PKfo="


# Temporarily disabling browserstack e2e tests. They seem to fail without any reason

Expand Down
4 changes: 3 additions & 1 deletion docs/releases/v2.3.0.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# v2.3.0

11 Dec 2020

## New features

- update dataset preview functionality, allow the previewing of png
Expand All @@ -16,7 +18,7 @@
- reworked regional dataset previews (iEEG & receptor density)
- **experimental** : previewing of curated regional features: iEEG coordinates

## Bugfixes:
## Bugfixes

- dataset list view explicitly show loading status
- fixed a few typos
Expand Down
7 changes: 7 additions & 0 deletions docs/releases/v2.3.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# v2.3.1

## Bugfixes

- fixes iEEG panel sometimes not loading spatial data (#816 #744)
- fixes fetching of non-existent data when in big brain reference space (#817)
- restore CI for staging/release
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pages:
- Fetching datasets: 'advanced/datasets.md'
- Display non-atlas volumes: 'advanced/otherVolumes.md'
- Release notes:
- v2.3.1: 'releases/v2.3.1.md'
- v2.3.0: 'releases/v2.3.0.md'
- v2.2.7: 'releases/v2.2.7.md'
- v2.2.6: 'releases/v2.2.6.md'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "interactive-viewer",
"version": "2.3.0",
"version": "2.3.1",
"description": "HBP interactive atlas viewer. Integrating KG query, dataset previews & more. Based on humanbrainproject/nehuba & google/neuroglancer. Built with angular.io",
"scripts": {
"dev-server-export": "webpack-dev-server --config webpack.export.js",
Expand Down
1 change: 1 addition & 0 deletions src/glue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ export class DatasetPreviewGlue implements IDatasetPreviewGlue, OnDestroy{
}

public datasetPreviewDisplayed(file: DatasetPreview, dataset?: IKgDataEntry){
if (!file) return of(false)
return this.previewingDatasetFiles$.pipe(
map(datasetPreviews => {
const { filename, datasetId } = file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@
<ng-template [ngIf]="matExpansionPanel.expanded">
<feature-container
[feature]="feature"
[region]="region$ | async">
[region]="region$ | async"
(viewChanged)="detectChange()">
</feature-container>
</ng-template>
</mat-expansion-panel>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
import { CommonModule } from "@angular/common"
import { ChangeDetectorRef, Component, ComponentRef, EventEmitter, NgModule } from "@angular/core"
import { async, TestBed } from "@angular/core/testing"
import { By } from "@angular/platform-browser"
import { RegionalFeaturesService } from "../regionalFeature.service"
import { ISingleFeature } from "../singleFeatures/interfaces"
import { FeatureContainer } from "./featureContainer.component"

const dummyCmpType = 'dummyType'

@Component({
template: `{{ text }}`
})

class DummyComponent implements ISingleFeature{
text = 'hello world'
feature: any
region: any
viewChanged = new EventEmitter<boolean>()
}

@Component({
template: ''
})

class HostCmp{
public feature: any
public region: any

constructor(public cdr: ChangeDetectorRef){

}

detectChange(){
this.cdr.detectChanges()
}
}

const serviceStub = {
mapFeatToCmp: new Map([
[dummyCmpType, DummyComponent]
])
}

@NgModule({
declarations: [
FeatureContainer,
DummyComponent,
],
entryComponents: [
DummyComponent
],
providers: [
{
provide: RegionalFeaturesService,
useValue: serviceStub
}
],
exports: [
FeatureContainer,
DummyComponent,
]
})

class DummyModule{}

describe('> featureContainer.component.ts', () => {
describe('> FeatureContainer', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
CommonModule,
DummyModule,
],
declarations: [
HostCmp,
],
}).overrideComponent(HostCmp, {
set: {
template: `
<feature-container
[feature]="feature"
[region]="region"
(viewChanged)="detectChange()">
</feature-container>`
}
}).compileComponents()

}))

it('> can be created', () => {
const fixture = TestBed.createComponent(HostCmp)
expect(fixture).toBeTruthy()
const featContainer = fixture.debugElement.query(By.directive(FeatureContainer))
expect(featContainer).toBeTruthy()
})

describe('> if inputs change', () => {
it('> if input changed, but feature is not one of them, map.get will not be called', () => {
const fixture = TestBed.createComponent(HostCmp)
// const featContainer = fixture.debugElement.query(By.directive(FeatureContainer))
spyOn(serviceStub.mapFeatToCmp, 'get').and.callThrough()
fixture.componentInstance.region = {
name: 'tesla'
}
fixture.detectChanges()
expect(serviceStub.mapFeatToCmp.get).not.toHaveBeenCalled()
})

it('> if input changed, feature is one of them, will not call map.get', () => {
const fixture = TestBed.createComponent(HostCmp)
const dummyFeature = {
type: dummyCmpType
}
spyOn(serviceStub.mapFeatToCmp, 'get').and.callThrough()
fixture.componentInstance.feature = dummyFeature
fixture.detectChanges()
expect(serviceStub.mapFeatToCmp.get).toHaveBeenCalledWith(dummyCmpType)
})

it('> should render default txt', () => {
const fixture = TestBed.createComponent(HostCmp)
const dummyFeature = {
type: dummyCmpType
}
fixture.componentInstance.feature = dummyFeature
fixture.detectChanges()
const text = fixture.nativeElement.textContent
expect(text).toContain('hello world')
})

it('> if inner component changes, if view changed does not emit, will not change ui', () => {

const fixture = TestBed.createComponent(HostCmp)
const dummyFeature = {
type: dummyCmpType
}
fixture.componentInstance.feature = dummyFeature
fixture.detectChanges()
const featureContainer = fixture.debugElement.query(
By.directive(FeatureContainer)
)
const cr = (featureContainer.componentInstance as FeatureContainer)['cr'] as ComponentRef<DummyComponent>
cr.instance.text = 'foo bar'
const text = fixture.nativeElement.textContent
expect(text).toContain('hello world')
})

it('> if inner component changes, and viewChanged is emitted, ui should change accordingly', () => {

const fixture = TestBed.createComponent(HostCmp)
const dummyFeature = {
type: dummyCmpType
}
fixture.componentInstance.feature = dummyFeature
fixture.detectChanges()
const featureContainer = fixture.debugElement.query(
By.directive(FeatureContainer)
)
const cr = (featureContainer.componentInstance as FeatureContainer)['cr'] as ComponentRef<DummyComponent>
cr.instance.text = 'foo bar'
cr.instance.viewChanged.emit(true)
const text = fixture.nativeElement.textContent
expect(text).toContain('foo bar')
})
})
})
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ComponentFactoryResolver, ComponentRef, Input, OnChanges, SimpleChanges, ViewContainerRef } from "@angular/core";
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ComponentFactoryResolver, ComponentRef, Input, OnChanges, Output, SimpleChanges, ViewContainerRef, EventEmitter } from "@angular/core";
import { Subscription } from "rxjs";
import { IFeature, RegionalFeaturesService } from "../regionalFeature.service";
import { ISingleFeature } from "../singleFeatures/interfaces";
Expand All @@ -16,13 +16,15 @@ export class FeatureContainer implements OnChanges{
@Input()
region: any

@Output()
viewChanged: EventEmitter<boolean> = new EventEmitter()

private cr: ComponentRef<ISingleFeature>

constructor(
private vCRef: ViewContainerRef,
private rService: RegionalFeaturesService,
private cfr: ComponentFactoryResolver,
private cdr: ChangeDetectorRef
){
}

Expand All @@ -33,15 +35,22 @@ export class FeatureContainer implements OnChanges{
const { currentValue, previousValue } = simpleChanges.feature
if (currentValue === previousValue) return
this.clear()

/**
* catching instances where currentValue for feature is falsy
*/
if (!currentValue) return

/**
* TODO catch if map is undefined
*/
const comp = this.rService.mapFeatToCmp.get(currentValue.type)
if (!comp) throw new Error(`mapFeatToCmp for ${currentValue.type} not defined`)
const cf = this.cfr.resolveComponentFactory<ISingleFeature>(comp)
this.cr = this.vCRef.createComponent(cf)
this.cr.instance.feature = this.feature
this.cr.instance.region = this.region
this.viewChangedSub = this.cr.instance.viewChanged.subscribe(() => this.cdr.detectChanges())
this.viewChangedSub = this.cr.instance.viewChanged.subscribe(() => this.viewChanged.emit(true))
}

clear(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class IEEGRecordingsCmp extends RegionFeatureBase implements ISingleFeatu
super(regionFeatureService)
}

public viewChanged = new EventEmitter<null>()
public viewChanged = new EventEmitter<boolean>()

ngOnInit(){
if (this.regClickIntp) {
Expand Down Expand Up @@ -71,7 +71,7 @@ export class IEEGRecordingsCmp extends RegionFeatureBase implements ISingleFeatu
)

this.sub.push(
this.dataIsLoading$.subscribe(() => this.viewChanged.emit(null))
this.dataIsLoading$.subscribe(() => this.viewChanged.emit(true))
)

this.onDestroyCb.push(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/regionalFeatures/singleFeatures/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { IFeature } from "../regionalFeature.service";
export interface ISingleFeature{
feature: IFeature
region: any
viewChanged: EventEmitter<null>
viewChanged: EventEmitter<boolean>
}

0 comments on commit 032644f

Please sign in to comment.