Unverified Commit a7278d2d authored by Lijiaoa's avatar Lijiaoa Committed by GitHub
Browse files

fix search broken bug with incomplete filter (#3935)

parent 5eb43ea7
...@@ -154,6 +154,15 @@ function Search(props): any { ...@@ -154,6 +154,15 @@ function Search(props): any {
} }
allFilterConditions.forEach(eachFilterConditionStr => { allFilterConditions.forEach(eachFilterConditionStr => {
// input content looks like that: `Trial id:`
if (
eachFilterConditionStr.endsWith(':') ||
eachFilterConditionStr.endsWith('<') ||
eachFilterConditionStr.endsWith('>') ||
eachFilterConditionStr.endsWith('')
) {
return;
} else {
let eachFilterConditionArr: string[] = []; let eachFilterConditionArr: string[] = [];
// EXPERIMENT.searchSpace[parameter]._type === 'choice' // EXPERIMENT.searchSpace[parameter]._type === 'choice'
...@@ -181,13 +190,15 @@ function Search(props): any { ...@@ -181,13 +190,15 @@ function Search(props): any {
choice: isChoicesType ? convertStringArrToList(eachFilterConditionArr[1]) : [], choice: isChoicesType ? convertStringArrToList(eachFilterConditionArr[1]) : [],
isChoice: isChoicesType ? true : false isChoice: isChoicesType ? true : false
}); });
} else { } else if (eachFilterConditionStr.includes(':')) {
// = : conv_size:[1,2,3,4]; Trial id:3; hidden_size:[1,2], status:[val1,val2,val3] // = : conv_size:[1,2,3,4]; Trial id:3; hidden_size:[1,2], status:[val1,val2,val3]
eachFilterConditionArr = eachFilterConditionStr.trim().split(':'); eachFilterConditionArr = eachFilterConditionStr.trim().split(':');
const filterName = eachFilterConditionArr[0] === 'Status' ? 'StatusNNI' : eachFilterConditionArr[0]; const filterName = eachFilterConditionArr[0] === 'Status' ? 'StatusNNI' : eachFilterConditionArr[0];
const isChoicesType = isChoiceType(filterName); const isChoicesType = isChoiceType(filterName);
const isArray = const isArray =
eachFilterConditionArr.length > 1 && eachFilterConditionArr[1].includes('[' || ']') ? true : false; eachFilterConditionArr.length > 1 && eachFilterConditionArr[1].includes('[' || ']')
? true
: false;
if (isArray === true) { if (isArray === true) {
if (isChoicesType === true) { if (isChoicesType === true) {
// status:[SUCCEEDED] // status:[SUCCEEDED]
...@@ -220,9 +231,12 @@ function Search(props): any { ...@@ -220,9 +231,12 @@ function Search(props): any {
isChoice: false isChoice: false
}); });
} }
} else {
// user input: Trial id
return;
}
} }
}); });
changeTableListPage(newSearchFilter); changeTableListPage(newSearchFilter);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment