Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
a7278d2d
Unverified
Commit
a7278d2d
authored
Jul 15, 2021
by
Lijiaoa
Committed by
GitHub
Jul 15, 2021
Browse files
fix search broken bug with incomplete filter (#3935)
parent
5eb43ea7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
57 deletions
+71
-57
ts/webui/src/components/trial-detail/search/Search.tsx
ts/webui/src/components/trial-detail/search/Search.tsx
+71
-57
No files found.
ts/webui/src/components/trial-detail/search/Search.tsx
View file @
a7278d2d
...
@@ -154,75 +154,89 @@ function Search(props): any {
...
@@ -154,75 +154,89 @@ function Search(props): any {
}
}
allFilterConditions
.
forEach
(
eachFilterConditionStr
=>
{
allFilterConditions
.
forEach
(
eachFilterConditionStr
=>
{
let
eachFilterConditionArr
:
string
[]
=
[];
// input content looks like that: `Trial id:`
if
(
// EXPERIMENT.searchSpace[parameter]._type === 'choice'
eachFilterConditionStr
.
endsWith
(
'
:
'
)
||
if
(
eachFilterConditionStr
.
includes
(
'
>
'
||
'
<
'
))
{
eachFilterConditionStr
.
endsWith
(
'
<
'
)
||
const
operator
=
eachFilterConditionStr
.
includes
(
'
>
'
)
===
true
?
'
>
'
:
'
<
'
;
eachFilterConditionStr
.
endsWith
(
'
>
'
)
||
eachFilterConditionArr
=
eachFilterConditionStr
.
trim
().
split
(
operator
);
eachFilterConditionStr
.
endsWith
(
'
≠
'
)
newSearchFilter
.
push
({
)
{
name
:
eachFilterConditionArr
[
0
],
return
;
operator
:
operator
,
value1
:
eachFilterConditionArr
[
1
],
value2
:
''
,
choice
:
[],
isChoice
:
false
});
}
else
if
(
eachFilterConditionStr
.
includes
(
'
≠
'
))
{
// drop_rate≠6; status≠[x,xx,xxx]; conv_size≠[3,7]
eachFilterConditionArr
=
eachFilterConditionStr
.
trim
().
split
(
'
≠
'
);
const
filterName
=
eachFilterConditionArr
[
0
]
===
'
Status
'
?
'
StatusNNI
'
:
eachFilterConditionArr
[
0
];
const
isChoicesType
=
isChoiceType
(
filterName
);
newSearchFilter
.
push
({
name
:
filterName
,
operator
:
'
≠
'
,
value1
:
isChoicesType
?
''
:
JSON
.
parse
(
eachFilterConditionArr
[
1
]),
value2
:
''
,
choice
:
isChoicesType
?
convertStringArrToList
(
eachFilterConditionArr
[
1
])
:
[],
isChoice
:
isChoicesType
?
true
:
false
});
}
else
{
}
else
{
// = : conv_size:[1,2,3,4]; Trial id:3; hidden_size:[1,2], status:[val1,val2,val3]
let
eachFilterConditionArr
:
string
[]
=
[];
eachFilterConditionArr
=
eachFilterConditionStr
.
trim
().
split
(
'
:
'
);
const
filterName
=
eachFilterConditionArr
[
0
]
===
'
Status
'
?
'
StatusNNI
'
:
eachFilterConditionArr
[
0
];
// EXPERIMENT.searchSpace[parameter]._type === 'choice'
const
isChoicesType
=
isChoiceType
(
filterName
);
if
(
eachFilterConditionStr
.
includes
(
'
>
'
||
'
<
'
))
{
const
isArray
=
const
operator
=
eachFilterConditionStr
.
includes
(
'
>
'
)
===
true
?
'
>
'
:
'
<
'
;
eachFilterConditionArr
.
length
>
1
&&
eachFilterConditionArr
[
1
].
includes
(
'
[
'
||
'
]
'
)
?
true
:
false
;
eachFilterConditionArr
=
eachFilterConditionStr
.
trim
().
split
(
operator
);
if
(
isArray
===
true
)
{
newSearchFilter
.
push
({
if
(
isChoicesType
===
true
)
{
name
:
eachFilterConditionArr
[
0
],
// status:[SUCCEEDED]
operator
:
operator
,
newSearchFilter
.
push
({
value1
:
eachFilterConditionArr
[
1
],
name
:
filterName
,
value2
:
''
,
operator
:
'
=
'
,
choice
:
[],
value1
:
''
,
isChoice
:
false
value2
:
''
,
});
choice
:
convertStringArrToList
(
eachFilterConditionArr
[
1
]),
}
else
if
(
eachFilterConditionStr
.
includes
(
'
≠
'
))
{
isChoice
:
true
// drop_rate≠6; status≠[x,xx,xxx]; conv_size≠[3,7]
});
eachFilterConditionArr
=
eachFilterConditionStr
.
trim
().
split
(
'
≠
'
);
const
filterName
=
eachFilterConditionArr
[
0
]
===
'
Status
'
?
'
StatusNNI
'
:
eachFilterConditionArr
[
0
];
const
isChoicesType
=
isChoiceType
(
filterName
);
newSearchFilter
.
push
({
name
:
filterName
,
operator
:
'
≠
'
,
value1
:
isChoicesType
?
''
:
JSON
.
parse
(
eachFilterConditionArr
[
1
]),
value2
:
''
,
choice
:
isChoicesType
?
convertStringArrToList
(
eachFilterConditionArr
[
1
])
:
[],
isChoice
:
isChoicesType
?
true
:
false
});
}
else
if
(
eachFilterConditionStr
.
includes
(
'
:
'
))
{
// = : conv_size:[1,2,3,4]; Trial id:3; hidden_size:[1,2], status:[val1,val2,val3]
eachFilterConditionArr
=
eachFilterConditionStr
.
trim
().
split
(
'
:
'
);
const
filterName
=
eachFilterConditionArr
[
0
]
===
'
Status
'
?
'
StatusNNI
'
:
eachFilterConditionArr
[
0
];
const
isChoicesType
=
isChoiceType
(
filterName
);
const
isArray
=
eachFilterConditionArr
.
length
>
1
&&
eachFilterConditionArr
[
1
].
includes
(
'
[
'
||
'
]
'
)
?
true
:
false
;
if
(
isArray
===
true
)
{
if
(
isChoicesType
===
true
)
{
// status:[SUCCEEDED]
newSearchFilter
.
push
({
name
:
filterName
,
operator
:
'
=
'
,
value1
:
''
,
value2
:
''
,
choice
:
convertStringArrToList
(
eachFilterConditionArr
[
1
]),
isChoice
:
true
});
}
else
{
// drop_rate:[1,10]
newSearchFilter
.
push
({
name
:
eachFilterConditionArr
[
0
],
operator
:
'
between
'
,
value1
:
JSON
.
parse
(
eachFilterConditionArr
[
1
])[
0
],
value2
:
JSON
.
parse
(
eachFilterConditionArr
[
1
])[
1
],
choice
:
[],
isChoice
:
false
});
}
}
else
{
}
else
{
// drop_rate:[1,10]
newSearchFilter
.
push
({
newSearchFilter
.
push
({
name
:
eachFilterConditionArr
[
0
],
name
:
eachFilterConditionArr
[
0
],
operator
:
'
between
'
,
operator
:
'
=
'
,
value1
:
JSON
.
parse
(
eachFilterConditionArr
[
1
]
)[
0
]
,
value1
:
eachFilterConditionArr
[
1
],
value2
:
JSON
.
parse
(
eachFilterConditionArr
[
1
])[
1
]
,
value2
:
''
,
choice
:
[],
choice
:
[],
isChoice
:
false
isChoice
:
false
});
});
}
}
}
else
{
}
else
{
newSearchFilter
.
push
({
// user input: Trial id
name
:
eachFilterConditionArr
[
0
],
return
;
operator
:
'
=
'
,
value1
:
eachFilterConditionArr
[
1
],
value2
:
''
,
choice
:
[],
isChoice
:
false
});
}
}
}
}
});
});
changeTableListPage
(
newSearchFilter
);
changeTableListPage
(
newSearchFilter
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment