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
410ab1ca
Commit
410ab1ca
authored
Jul 31, 2019
by
Lijiao
Committed by
chicm-ms
Jul 31, 2019
Browse files
[Fix issue#1208] Support search parameters (#1382)
* support search parameters * update font size * update placeholder
parent
1c29b08c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
15 deletions
+76
-15
src/webui/src/components/TrialsDetail.tsx
src/webui/src/components/TrialsDetail.tsx
+57
-12
src/webui/src/components/trial-detail/TableList.tsx
src/webui/src/components/trial-detail/TableList.tsx
+1
-3
src/webui/src/static/style/search.scss
src/webui/src/static/style/search.scss
+18
-0
No files found.
src/webui/src/components/TrialsDetail.tsx
View file @
410ab1ca
import
*
as
React
from
'
react
'
;
import
*
as
React
from
'
react
'
;
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
import
{
MANAGER_IP
}
from
'
../static/const
'
;
import
{
MANAGER_IP
}
from
'
../static/const
'
;
import
{
Row
,
Col
,
Tabs
,
Input
,
Select
,
Button
,
Icon
}
from
'
antd
'
;
import
{
Row
,
Col
,
Tabs
,
Select
,
Button
,
Icon
}
from
'
antd
'
;
const
Option
=
Select
.
Option
;
const
Option
=
Select
.
Option
;
import
{
TableObj
,
Parameters
}
from
'
../static/interface
'
;
import
{
TableObj
,
Parameters
}
from
'
../static/interface
'
;
import
{
getFinal
}
from
'
../static/function
'
;
import
{
getFinal
}
from
'
../static/function
'
;
...
@@ -13,6 +13,7 @@ import Intermediate from './trial-detail/Intermeidate';
...
@@ -13,6 +13,7 @@ import Intermediate from './trial-detail/Intermeidate';
import
TableList
from
'
./trial-detail/TableList
'
;
import
TableList
from
'
./trial-detail/TableList
'
;
const
TabPane
=
Tabs
.
TabPane
;
const
TabPane
=
Tabs
.
TabPane
;
import
'
../static/style/trialsDetail.scss
'
;
import
'
../static/style/trialsDetail.scss
'
;
import
'
../static/style/search.scss
'
;
interface
TrialDetailState
{
interface
TrialDetailState
{
accSource
:
object
;
accSource
:
object
;
...
@@ -31,6 +32,8 @@ interface TrialDetailState {
...
@@ -31,6 +32,8 @@ interface TrialDetailState {
hyperCounts
:
number
;
// user click the hyper-parameter counts
hyperCounts
:
number
;
// user click the hyper-parameter counts
durationCounts
:
number
;
durationCounts
:
number
;
intermediateCounts
:
number
;
intermediateCounts
:
number
;
searchFilter
:
string
;
searchPlaceHolder
:
string
;
}
}
interface
TrialsDetailProps
{
interface
TrialsDetailProps
{
...
@@ -46,6 +49,7 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
...
@@ -46,6 +49,7 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
public
interAllTableList
=
2
;
public
interAllTableList
=
2
;
public
tableList
:
TableList
|
null
;
public
tableList
:
TableList
|
null
;
public
searchInput
:
HTMLInputElement
|
null
;
private
titleOfacc
=
(
private
titleOfacc
=
(
<
Title1
text
=
"Default metric"
icon
=
"3.png"
/>
<
Title1
text
=
"Default metric"
icon
=
"3.png"
/>
...
@@ -85,7 +89,9 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
...
@@ -85,7 +89,9 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
isMultiPhase
:
false
,
isMultiPhase
:
false
,
hyperCounts
:
0
,
hyperCounts
:
0
,
durationCounts
:
0
,
durationCounts
:
0
,
intermediateCounts
:
0
intermediateCounts
:
0
,
searchFilter
:
'
id
'
,
searchPlaceHolder
:
'
Search by id
'
};
};
}
}
...
@@ -212,15 +218,33 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
...
@@ -212,15 +218,33 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
}));
}));
}
}
}
else
{
}
else
{
const
{
tableListSource
}
=
this
.
state
;
const
{
tableListSource
,
searchFilter
}
=
this
.
state
;
const
searchResultList
:
Array
<
TableObj
>
=
[];
const
searchResultList
:
Array
<
TableObj
>
=
[];
Object
.
keys
(
tableListSource
).
map
(
key
=>
{
Object
.
keys
(
tableListSource
).
map
(
key
=>
{
const
item
=
tableListSource
[
key
];
const
item
=
tableListSource
[
key
];
if
(
item
.
sequenceId
.
toString
()
===
targetValue
switch
(
searchFilter
)
{
||
item
.
id
.
includes
(
targetValue
)
case
'
id
'
:
||
item
.
status
.
toUpperCase
().
includes
(
targetValue
.
toUpperCase
())
if
(
item
.
id
.
toUpperCase
().
includes
(
targetValue
.
toUpperCase
()))
{
)
{
searchResultList
.
push
(
item
);
searchResultList
.
push
(
item
);
}
break
;
case
'
Trial No.
'
:
if
(
item
.
sequenceId
.
toString
()
===
targetValue
)
{
searchResultList
.
push
(
item
);
}
break
;
case
'
status
'
:
if
(
item
.
status
.
toUpperCase
().
includes
(
targetValue
.
toUpperCase
()))
{
searchResultList
.
push
(
item
);
}
break
;
case
'
parameters
'
:
const
strParameters
=
JSON
.
stringify
(
item
.
description
.
parameters
,
null
,
4
);
if
(
strParameters
.
includes
(
targetValue
))
{
searchResultList
.
push
(
item
);
}
break
;
default
:
}
}
});
});
if
(
this
.
_isMounted
)
{
if
(
this
.
_isMounted
)
{
...
@@ -282,6 +306,19 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
...
@@ -282,6 +306,19 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
alert
(
'
TableList component was not properly initialized.
'
);
alert
(
'
TableList component was not properly initialized.
'
);
}
}
getSearchFilter
=
(
value
:
string
)
=>
{
// clear input value and re-render table
if
(
this
.
searchInput
!==
null
)
{
this
.
searchInput
.
value
=
''
;
if
(
this
.
_isMounted
===
true
)
{
this
.
setState
(()
=>
({
isHasSearch
:
false
}));
}
}
if
(
this
.
_isMounted
===
true
)
{
this
.
setState
(()
=>
({
searchFilter
:
value
,
searchPlaceHolder
:
`Search by
${
value
}
`
}));
}
}
// get and set logCollection val
// get and set logCollection val
checkExperimentPlatform
=
()
=>
{
checkExperimentPlatform
=
()
=>
{
axios
(
`
${
MANAGER_IP
}
/experiment`
,
{
axios
(
`
${
MANAGER_IP
}
/experiment`
,
{
...
@@ -344,7 +381,7 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
...
@@ -344,7 +381,7 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
const
{
const
{
tableListSource
,
searchResultSource
,
isHasSearch
,
isMultiPhase
,
tableListSource
,
searchResultSource
,
isHasSearch
,
isMultiPhase
,
entriesTable
,
experimentPlatform
,
searchSpace
,
experimentLogCollection
,
entriesTable
,
experimentPlatform
,
searchSpace
,
experimentLogCollection
,
whichGraph
whichGraph
,
searchPlaceHolder
}
=
this
.
state
;
}
=
this
.
state
;
const
source
=
isHasSearch
?
searchResultSource
:
tableListSource
;
const
source
=
isHasSearch
?
searchResultSource
:
tableListSource
;
return
(
return
(
...
@@ -408,11 +445,19 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
...
@@ -408,11 +445,19 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
>
>
Compare
Compare
</
Button
>
</
Button
>
<
Input
<
Select
defaultValue
=
"id"
className
=
"filter"
onSelect
=
{
this
.
getSearchFilter
}
>
<
Option
value
=
"id"
>
Id
</
Option
>
<
Option
value
=
"Trial No."
>
Trial No.
</
Option
>
<
Option
value
=
"status"
>
Status
</
Option
>
<
Option
value
=
"parameters"
>
Parameters
</
Option
>
</
Select
>
<
input
type
=
"text"
type
=
"text"
placeholder
=
"Search by id, trial No. or status"
className
=
"search-input"
placeholder
=
{
searchPlaceHolder
}
onChange
=
{
this
.
searchTrial
}
onChange
=
{
this
.
searchTrial
}
style
=
{
{
width
:
230
,
marginLeft
:
6
}
}
style
=
{
{
width
:
230
}
}
ref
=
{
text
=>
(
this
.
searchInput
)
=
text
}
/>
/>
</
Col
>
</
Col
>
</
Row
>
</
Row
>
...
...
src/webui/src/components/trial-detail/TableList.tsx
View file @
410ab1ca
...
@@ -321,9 +321,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
...
@@ -321,9 +321,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
key
:
'
sequenceId
'
,
key
:
'
sequenceId
'
,
width
:
120
,
width
:
120
,
className
:
'
tableHead
'
,
className
:
'
tableHead
'
,
sorter
:
sorter
:
(
a
:
TableObj
,
b
:
TableObj
)
=>
(
a
.
sequenceId
as
number
)
-
(
b
.
sequenceId
as
number
)
(
a
:
TableObj
,
b
:
TableObj
)
=>
(
a
.
sequenceId
as
number
)
-
(
b
.
sequenceId
as
number
)
});
});
break
;
break
;
case
'
ID
'
:
case
'
ID
'
:
...
...
src/webui/src/static/style/search.scss
View file @
410ab1ca
...
@@ -11,6 +11,24 @@
...
@@ -11,6 +11,24 @@
color
:
#0071BC
;
color
:
#0071BC
;
border-radius
:
0
;
border-radius
:
0
;
}
}
.filter
{
width
:
100px
;
margin-left
:
8px
;
.ant-select-selection-selected-value
{
font-size
:
14px
;
}
}
.search-input
{
height
:
32px
;
outline
:
none
;
border
:
1px
solid
#d9d9d9
;
border-left
:
none
;
padding-left
:
8px
;
color
:
#333
;
}
.
search-input
:
:
placeholder
{
color
:
DarkGray
;
}
}
}
.entry
{
.entry
{
width
:
120px
;
width
:
120px
;
...
...
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