Skip to content

Commit

Permalink
Merge pull request #1267 from VirtualFlyBrain/development
Browse files Browse the repository at this point in the history
test and search fixes from dev
  • Loading branch information
Robbie1977 authored Dec 3, 2021
2 parents 49eb7dd + a26c593 commit 6e82b52
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 52 deletions.
48 changes: 3 additions & 45 deletions components/VFBMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class VFBMain extends React.Component {

constructor (props) {
super(props);
this.datasourceConfiguration = require('./configuration/VFBMain/searchConfiguration').datasourceConfiguration;

this.state = {
canvasAvailable: false,
Expand All @@ -55,8 +54,7 @@ class VFBMain extends React.Component {
UIUpdated: true,
wireframeVisible: false,
downloadContentsVisible : true,
uploaderContentsVisible : true,
searchDataSourceConfiguration : this.datasourceConfiguration
uploaderContentsVisible : true
};

this.addVfbId = this.addVfbId.bind(this);
Expand All @@ -74,7 +72,6 @@ class VFBMain extends React.Component {
this.handlerInstanceUpdate = this.handlerInstanceUpdate.bind(this);
this.handleSceneAndTermInfoCallback = this.handleSceneAndTermInfoCallback.bind(this);
this.instancesFromDifferentTemplates = this.instancesFromDifferentTemplates.bind(this);
this.filterSelection = this.filterSelection.bind(this);

this.vfbLoadBuffer = [];
this.tutorialRender = undefined;
Expand Down Expand Up @@ -103,6 +100,7 @@ class VFBMain extends React.Component {

this.searchStyle = require('./configuration/VFBMain/searchConfiguration').searchStyle;
this.searchConfiguration = require('./configuration/VFBMain/searchConfiguration').searchConfiguration;
this.datasourceConfiguration = require('./configuration/VFBMain/searchConfiguration').datasourceConfiguration;

this.queryResultsColMeta = require('./configuration/VFBMain/queryBuilderConfiguration').queryResultsColMeta;
this.queryResultsColumns = require('./configuration/VFBMain/queryBuilderConfiguration').queryResultsColumns;
Expand Down Expand Up @@ -1641,45 +1639,6 @@ class VFBMain extends React.Component {
}
}
}

lookupFilter (item, bq, filterValue){
let lookup = "facets_annotation:" + item.key;
let re = new RegExp(lookup, 'g');
let found = bq.match(re);
if ( found ){
return bq.replace(found[0] + filterValue, "");
}
return bq;
}

filterSelection (item) {
let bq = this.state.searchDataSourceConfiguration.query_settings.bq;

switch (item.enabled) {
case "disabled":
bq = this.lookupFilter(item, bq, this.searchConfiguration.filter_positive);
bq = this.lookupFilter(item, bq, this.searchConfiguration.filter_negative);
break;
case "positive":
bq = this.lookupFilter(item, bq, this.searchConfiguration.filter_negative);
bq += " facets_annotation:" + item.key + "^100";
break;
case "negative":
bq = this.lookupFilter(item, bq, this.searchConfiguration.filter_positive);
bq += " facets_annotation:" + item.key + "^0.001";
break;
default:
break;
}
let updatedConfiguration = Object.assign(this.state.searchDataSourceConfiguration, {
query_settings : {
...this.state.searchDataSourceConfiguration.query_settings,
bq : bq
}
});
this.setState({ searchDataSourceConfiguration : updatedConfiguration })

}

render () {
if ((this.state.tutorialWidgetVisible == true) && (this.tutorialRender == undefined)) {
Expand Down Expand Up @@ -1800,10 +1759,9 @@ class VFBMain extends React.Component {

<Search ref="searchRef"
datasource="SOLR"
filtersListener={this.filterSelection}
searchStyle={this.searchStyle}
searchConfiguration={this.searchConfiguration}
datasourceConfiguration={this.state.searchDataSourceConfiguration} />
datasourceConfiguration={this.datasourceConfiguration} />

<VFBDownloadContents ref="downloadContentsRef" open={false} />

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@babel/runtime": "^7.4.5",
"@babel/plugin-transform-runtime": "^7.4.5",
"@geppettoengine/geppetto-client": "file:./geppetto-client",
"@material-ui/icons": "3.0.1",
"@material-ui/icons": "^4.0.0",
"@material-ui/lab": "^4.0.0-alpha.57",
"@types/react-rnd": "^8.0.0",
"axios": "^0.19.2",
Expand All @@ -46,7 +46,7 @@
"puppeteer": "^1.17.0",
"react-collapsible": "^2.3.1",
"react-color": "^2.17.3",
"react-tabs": "3.0.0",
"react-tabs": "^3.2.3",
"react-redux": "^7.0.3",
"redux": "^4.0.1",
"style-loader": "^0.13.2",
Expand Down
2 changes: 1 addition & 1 deletion tests/jest/vfb/batch1/focus-term-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('VFB Focus Term Tests', () => {
await page.evaluate(async () => {
let tabs = document.getElementsByClassName('MuiListItem-root ');
for ( var i = 0; i < tabs.length ; i ++ ) {
if ( tabs[i].innerText === "medulla (FBbt_00003748)" ) {
if ( tabs[i].innerText.split('\n')[0] === "medulla (FBbt_00003748)" ) {
tabs[i].click();
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/jest/vfb/batch1/spotlight-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ describe('VFB Spotlight Tests', () => {
await page.evaluate(async () => {
let tabs = document.getElementsByClassName('MuiListItem-root ');
for ( var i = 0; i < tabs.length ; i ++ ) {
if ( tabs[i].innerText === "fru-M-200266 (VFB_00000001)" ) {
if ( tabs[i].innerText.split('\n')[0] === "fru-M-200266 (VFB_00000001)" ) {
tabs[i].click();
}
}
}
});
await wait4selector(page, ST.SPOT_LIGHT_SELECTOR, { hidden: true, timeout : 50000 });
})
Expand Down
2 changes: 1 addition & 1 deletion tests/jest/vfb/batch2/tree-browser-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ describe('VFB Tree Browser Component Tests', () => {
await page.evaluate(async () => {
let tabs = document.getElementsByClassName('MuiListItem-root ');
for ( var i = 0; i < tabs.length ; i ++ ) {
if ( tabs[i].innerText === "medulla (FBbt_00003748)" ) {
if ( tabs[i].innerText.split('\n')[0] === "medulla (FBbt_00003748)" ) {
tabs[i].click();
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/jest/vfb/batch3/term-context-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('VFB Term Context Component Tests', () => {
await page.evaluate(async () => {
let tabs = document.getElementsByClassName('MuiListItem-root ');
for ( var i = 0; i < tabs.length ; i ++ ) {
if ( tabs[i].innerText === "medulla (FBbt_00003748)" ) {
if ( tabs[i].innerText.split('\n')[0] === "medulla (FBbt_00003748)" ) {
tabs[i].click();
}
}
Expand Down

0 comments on commit 6e82b52

Please sign in to comment.