Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues #1238 and #1239 #1241

Merged
merged 5 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ARG geppettoSimulationRelease=vfb_20200604_a
ARG geppettoDatasourceRelease=vfb_20200604_a
ARG geppettoModelSwcRelease=v1.0.1
ARG geppettoFrontendRelease=development
ARG geppettoClientRelease=VFBv2.2.0.7
ARG geppettoClientRelease=VFBv2.2.0.7-feature/1238
ARG ukAcVfbGeppettoRelease=download

ARG mvnOpt="-Dhttps.protocols=TLSv1.2 -DskipTests --quiet -Pmaster"
Expand Down
48 changes: 45 additions & 3 deletions components/VFBMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class VFBMain extends React.Component {

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

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

this.addVfbId = this.addVfbId.bind(this);
Expand All @@ -72,6 +74,7 @@ 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 @@ -100,7 +103,6 @@ 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 @@ -1639,6 +1641,45 @@ 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 @@ -1759,9 +1800,10 @@ class VFBMain extends React.Component {

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

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

Expand Down
8 changes: 6 additions & 2 deletions components/configuration/VFBMain/searchConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var searchStyle = {
singleResult: {
"color": "white",
"fontSize": "18px",

"whiteSpace" : "normal",
":hover": {
"color": "#11bffe",
"background-color": "#252323",
Expand Down Expand Up @@ -107,9 +107,13 @@ var searchConfiguration = {
"resultsMapping":
{
"name": "label",
"id": "short_form"
"id": "short_form",
"labels" : "facets_annotation"
},
"label_manipulation" : label => label,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Robbie1977 this is the function I mentioned to you at the sprint call, fyi

"filters_expanded": true,
"filter_positive" : "^100",
"filter_negative" : "^0.001",
"filters": [
{
"key": "facets_annotation",
Expand Down