Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
54496c29
Unverified
Commit
54496c29
authored
Jun 12, 2020
by
Lijiaoa
Committed by
GitHub
Jun 12, 2020
Browse files
[WebUI] fix issue#2530: duration and intermediate results pictures don't update (#2531)
parent
89fa23cb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
70 deletions
+57
-70
src/webui/src/components/Modals/CustomizedTrial.tsx
src/webui/src/components/Modals/CustomizedTrial.tsx
+8
-6
src/webui/src/components/TrialsDetail.tsx
src/webui/src/components/TrialsDetail.tsx
+9
-9
src/webui/src/components/overview/SuccessTable.tsx
src/webui/src/components/overview/SuccessTable.tsx
+5
-3
src/webui/src/components/trial-detail/Duration.tsx
src/webui/src/components/trial-detail/Duration.tsx
+5
-28
src/webui/src/components/trial-detail/Intermediate.tsx
src/webui/src/components/trial-detail/Intermediate.tsx
+14
-12
src/webui/src/components/trial-detail/Para.tsx
src/webui/src/components/trial-detail/Para.tsx
+6
-4
src/webui/src/components/trial-detail/TableList.tsx
src/webui/src/components/trial-detail/TableList.tsx
+10
-8
No files found.
src/webui/src/components/Modals/CustomizedTrial.tsx
View file @
54496c29
...
@@ -151,14 +151,16 @@ class Customize extends React.Component<CustomizeProps, CustomizeState> {
...
@@ -151,14 +151,16 @@ class Customize extends React.Component<CustomizeProps, CustomizeState> {
}
}
}
}
componentWillReceiveProps
(
nextProps
:
CustomizeProps
):
void
{
componentDidUpdate
(
prevProps
:
CustomizeProps
):
void
{
const
{
copyTrialId
}
=
nextProps
;
if
(
this
.
props
.
copyTrialId
!==
prevProps
.
copyTrialId
)
{
if
(
copyTrialId
!==
undefined
&&
TRIALS
.
getTrial
(
copyTrialId
)
!==
undefined
)
{
const
{
copyTrialId
}
=
this
.
props
;
const
originCopyTrialPara
=
TRIALS
.
getTrial
(
copyTrialId
).
description
.
parameters
;
if
(
copyTrialId
!==
undefined
&&
TRIALS
.
getTrial
(
copyTrialId
)
!==
undefined
)
{
this
.
setState
(()
=>
({
copyTrialParameter
:
originCopyTrialPara
}));
const
originCopyTrialPara
=
TRIALS
.
getTrial
(
copyTrialId
).
description
.
parameters
;
this
.
setState
(()
=>
({
copyTrialParameter
:
originCopyTrialPara
}));
}
}
}
}
}
render
():
React
.
ReactNode
{
render
():
React
.
ReactNode
{
const
{
closeCustomizeModal
,
visible
}
=
this
.
props
;
const
{
closeCustomizeModal
,
visible
}
=
this
.
props
;
const
{
isShowSubmitSucceed
,
isShowSubmitFailed
,
isShowWarning
,
customID
,
copyTrialParameter
}
=
this
.
state
;
const
{
isShowSubmitSucceed
,
isShowSubmitFailed
,
isShowWarning
,
customID
,
copyTrialParameter
}
=
this
.
state
;
...
...
src/webui/src/components/TrialsDetail.tsx
View file @
54496c29
...
@@ -39,7 +39,7 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
...
@@ -39,7 +39,7 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
tablePageSize
:
20
,
tablePageSize
:
20
,
whichGraph
:
'
1
'
,
whichGraph
:
'
Default metric
'
,
searchType
:
'
Id
'
,
searchType
:
'
Id
'
,
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/explicit-function-return-type
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/explicit-function-return-type
searchFilter
:
trial
=>
true
searchFilter
:
trial
=>
true
...
@@ -81,8 +81,8 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
...
@@ -81,8 +81,8 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
}
}
}
}
handleWhichTabs
=
(
activeKey
:
string
):
void
=>
{
handleWhichTabs
=
(
item
:
any
):
void
=>
{
this
.
setState
({
whichGraph
:
activeKey
});
this
.
setState
({
whichGraph
:
item
.
props
.
headerText
});
}
}
updateSearchFilterType
=
(
event
:
React
.
FormEvent
<
HTMLDivElement
>
,
item
:
IDropdownOption
|
undefined
):
void
=>
{
updateSearchFilterType
=
(
event
:
React
.
FormEvent
<
HTMLDivElement
>
,
item
:
IDropdownOption
|
undefined
):
void
=>
{
...
@@ -109,19 +109,19 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
...
@@ -109,19 +109,19 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
return
(
return
(
<
div
>
<
div
>
<
div
className
=
"trial"
id
=
"tabsty"
>
<
div
className
=
"trial"
id
=
"tabsty"
>
<
Pivot
defaultSelectedKey
=
{
"
0
"
}
className
=
"detial-title"
>
<
Pivot
defaultSelectedKey
=
{
"
0
"
}
className
=
"detial-title"
onLinkClick
=
{
this
.
handleWhichTabs
}
selectedKey
=
{
whichGraph
}
>
{
/* <PivotItem tab={this.titleOfacc} key="1"> doesn't work*/
}
{
/* <PivotItem tab={this.titleOfacc} key="1"> doesn't work*/
}
<
PivotItem
headerText
=
"Default metric"
itemIcon
=
"HomeGroup"
key
=
"
1
"
>
<
PivotItem
headerText
=
"Default metric"
itemIcon
=
"HomeGroup"
key
=
"
Default metric
"
>
<
Stack
className
=
"graph"
>
<
Stack
className
=
"graph"
>
<
DefaultPoint
<
DefaultPoint
trialIds
=
{
trialIds
}
trialIds
=
{
trialIds
}
visible
=
{
whichGraph
===
'
1
'
}
visible
=
{
whichGraph
===
'
Default metric
'
}
trialsUpdateBroadcast
=
{
this
.
props
.
trialsUpdateBroadcast
}
trialsUpdateBroadcast
=
{
this
.
props
.
trialsUpdateBroadcast
}
/>
/>
</
Stack
>
</
Stack
>
</
PivotItem
>
</
PivotItem
>
{
/* <PivotItem tab={this.titleOfhyper} key="2"> */
}
{
/* <PivotItem tab={this.titleOfhyper} key="2"> */
}
<
PivotItem
headerText
=
"Hyper-parameter"
itemIcon
=
"Equalizer"
key
=
"
2
"
>
<
PivotItem
headerText
=
"Hyper-parameter"
itemIcon
=
"Equalizer"
key
=
"
Hyper-parameter
"
>
<
Stack
className
=
"graph"
>
<
Stack
className
=
"graph"
>
<
Para
<
Para
dataSource
=
{
source
}
dataSource
=
{
source
}
...
@@ -131,11 +131,11 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
...
@@ -131,11 +131,11 @@ class TrialsDetail extends React.Component<TrialsDetailProps, TrialDetailState>
</
Stack
>
</
Stack
>
</
PivotItem
>
</
PivotItem
>
{
/* <PivotItem tab={this.titleOfDuration} key="3"> */
}
{
/* <PivotItem tab={this.titleOfDuration} key="3"> */
}
<
PivotItem
headerText
=
"Duration"
itemIcon
=
"BarChartHorizontal"
key
=
"
3
"
>
<
PivotItem
headerText
=
"Duration"
itemIcon
=
"BarChartHorizontal"
key
=
"
Duration
"
>
<
Duration
source
=
{
source
}
whichGraph
=
{
whichGraph
}
/>
<
Duration
source
=
{
source
}
whichGraph
=
{
whichGraph
}
/>
</
PivotItem
>
</
PivotItem
>
{
/* <PivotItem tab={this.titleOfIntermediate} key="4"> */
}
{
/* <PivotItem tab={this.titleOfIntermediate} key="4"> */
}
<
PivotItem
headerText
=
"Intermediate result"
itemIcon
=
"StackedLineChart"
key
=
"
4
"
>
<
PivotItem
headerText
=
"Intermediate result"
itemIcon
=
"StackedLineChart"
key
=
"
Intermediate result
"
>
{
/* *why this graph has small footprint? */
}
{
/* *why this graph has small footprint? */
}
<
Intermediate
source
=
{
source
}
whichGraph
=
{
whichGraph
}
/>
<
Intermediate
source
=
{
source
}
whichGraph
=
{
whichGraph
}
/>
</
PivotItem
>
</
PivotItem
>
...
...
src/webui/src/components/overview/SuccessTable.tsx
View file @
54496c29
...
@@ -126,9 +126,11 @@ class SuccessTable extends React.Component<SuccessTableProps, SuccessTableState>
...
@@ -126,9 +126,11 @@ class SuccessTable extends React.Component<SuccessTableProps, SuccessTableState>
}
}
];
];
componentWillReceiveProps
(
nextProps
:
SuccessTableProps
):
void
{
componentDidUpdate
(
prevProps
:
SuccessTableProps
):
void
{
const
{
trialIds
}
=
nextProps
;
if
(
this
.
props
.
trialIds
!==
prevProps
.
trialIds
){
this
.
setState
(()
=>
({
source
:
TRIALS
.
table
(
trialIds
)
}));
const
{
trialIds
}
=
this
.
props
;
this
.
setState
(()
=>
({
source
:
TRIALS
.
table
(
trialIds
)
}));
}
}
}
render
():
React
.
ReactNode
{
render
():
React
.
ReactNode
{
...
...
src/webui/src/components/trial-detail/Duration.tsx
View file @
54496c29
...
@@ -167,36 +167,13 @@ class Duration extends React.Component<DurationProps, DurationState> {
...
@@ -167,36 +167,13 @@ class Duration extends React.Component<DurationProps, DurationState> {
this
.
drawDurationGraph
(
source
);
this
.
drawDurationGraph
(
source
);
}
}
componentWillReceiveProps
(
nextProps
:
DurationProps
):
void
{
componentDidUpdate
(
prevProps
:
DurationProps
):
void
{
const
{
whichGraph
,
source
}
=
nextProps
;
// add this if to prevent endless loop
if
(
whichGraph
===
'
3
'
)
{
if
(
this
.
props
.
source
!==
prevProps
.
source
)
{
this
.
drawDurationGraph
(
source
);
if
(
this
.
props
.
whichGraph
===
'
Duration
'
)
{
}
this
.
drawDurationGraph
(
this
.
props
.
source
);
}
shouldComponentUpdate
(
nextProps
:
DurationProps
):
boolean
{
const
{
whichGraph
,
source
}
=
nextProps
;
if
(
whichGraph
===
'
3
'
)
{
const
beforeSource
=
this
.
props
.
source
;
if
(
whichGraph
!==
this
.
props
.
whichGraph
)
{
return
true
;
}
if
(
source
.
length
!==
beforeSource
.
length
)
{
return
true
;
}
if
(
beforeSource
[
beforeSource
.
length
-
1
]
!==
undefined
)
{
if
(
source
[
source
.
length
-
1
].
duration
!==
beforeSource
[
beforeSource
.
length
-
1
].
duration
)
{
return
true
;
}
if
(
source
[
source
.
length
-
1
].
status
!==
beforeSource
[
beforeSource
.
length
-
1
].
status
)
{
return
true
;
}
}
}
}
}
return
false
;
}
}
render
():
React
.
ReactNode
{
render
():
React
.
ReactNode
{
...
...
src/webui/src/components/trial-detail/Intermediate.tsx
View file @
54496c29
...
@@ -212,21 +212,23 @@ class Intermediate extends React.Component<IntermediateProps, IntermediateState>
...
@@ -212,21 +212,23 @@ class Intermediate extends React.Component<IntermediateProps, IntermediateState>
this
.
drawIntermediate
(
source
);
this
.
drawIntermediate
(
source
);
}
}
componentWillReceiveProps
(
nextProps
:
IntermediateProps
,
nextState
:
IntermediateState
):
void
{
componentDidUpdate
(
prevProps
:
IntermediateProps
,
prevState
:
any
):
void
{
const
{
isFilter
,
filterSource
}
=
nextState
;
if
(
this
.
props
.
source
!==
prevProps
.
source
||
this
.
state
.
isFilter
!==
prevState
.
isFilter
)
{
const
{
whichGraph
,
source
}
=
nextProps
;
const
{
isFilter
,
filterSource
}
=
this
.
state
;
const
{
whichGraph
,
source
}
=
this
.
props
;
if
(
whichGraph
===
'
4
'
)
{
if
(
whichGraph
===
'
Intermediate result
'
)
{
if
(
isFilter
===
true
)
{
if
(
isFilter
===
true
)
{
const
pointVal
=
this
.
pointInput
!==
null
?
this
.
pointInput
.
value
:
''
;
const
pointVal
=
this
.
pointInput
!==
null
?
this
.
pointInput
.
value
:
''
;
const
minVal
=
this
.
minValInput
!==
null
?
this
.
minValInput
.
value
:
''
;
const
minVal
=
this
.
minValInput
!==
null
?
this
.
minValInput
.
value
:
''
;
if
(
pointVal
===
''
&&
minVal
===
''
)
{
if
(
pointVal
===
''
&&
minVal
===
''
)
{
this
.
drawIntermediate
(
source
);
this
.
drawIntermediate
(
source
);
}
else
{
this
.
drawIntermediate
(
filterSource
);
}
}
else
{
}
else
{
this
.
drawIntermediate
(
filterS
ource
);
this
.
drawIntermediate
(
s
ource
);
}
}
}
else
{
this
.
drawIntermediate
(
source
);
}
}
}
}
}
}
...
...
src/webui/src/components/trial-detail/Para.tsx
View file @
54496c29
...
@@ -591,10 +591,12 @@ class Para extends React.Component<ParaProps, ParaState> {
...
@@ -591,10 +591,12 @@ class Para extends React.Component<ParaProps, ParaState> {
this
.
reInit
();
this
.
reInit
();
}
}
componentWillReceiveProps
(
nextProps
:
ParaProps
):
void
{
componentDidUpdate
(
prevProps
:
ParaProps
):
void
{
const
{
dataSource
,
expSearchSpace
,
whichGraph
}
=
nextProps
;
if
(
this
.
props
.
dataSource
!==
prevProps
.
dataSource
)
{
if
(
whichGraph
===
'
2
'
)
{
const
{
dataSource
,
expSearchSpace
,
whichGraph
}
=
this
.
props
;
this
.
hyperParaPic
(
dataSource
,
expSearchSpace
);
if
(
whichGraph
===
'
Hyper-parameter
'
)
{
this
.
hyperParaPic
(
dataSource
,
expSearchSpace
);
}
}
}
}
}
...
...
src/webui/src/components/trial-detail/TableList.tsx
View file @
54496c29
...
@@ -569,15 +569,17 @@ class TableList extends React.Component<TableListProps, TableListState> {
...
@@ -569,15 +569,17 @@ class TableList extends React.Component<TableListProps, TableListState> {
window
.
addEventListener
(
'
resize
'
,
this
.
onWindowResize
);
window
.
addEventListener
(
'
resize
'
,
this
.
onWindowResize
);
}
}
UNSAFE_componentWillReceiveProps
(
nextProps
:
TableListProps
):
void
{
componentDidUpdate
(
prevProps
:
TableListProps
):
void
{
const
{
columnList
,
tableSource
}
=
nextProps
;
if
(
this
.
props
.
columnList
!==
prevProps
.
columnList
||
this
.
props
.
tableSource
!==
prevProps
.
tableSource
)
{
this
.
setState
({
const
{
columnList
,
tableSource
}
=
this
.
props
;
tableSourceForSort
:
tableSource
,
this
.
setState
({
tableColumns
:
this
.
initTableColumnList
(
columnList
),
tableSourceForSort
:
tableSource
,
allColumnList
:
this
.
getAllColumnKeys
()
tableColumns
:
this
.
initTableColumnList
(
columnList
),
});
allColumnList
:
this
.
getAllColumnKeys
()
});
}
}
}
render
():
React
.
ReactNode
{
render
():
React
.
ReactNode
{
const
{
intermediateKey
,
modalIntermediateWidth
,
modalIntermediateHeight
,
const
{
intermediateKey
,
modalIntermediateWidth
,
modalIntermediateHeight
,
tableColumns
,
allColumnList
,
isShowColumn
,
modalVisible
,
tableColumns
,
allColumnList
,
isShowColumn
,
modalVisible
,
...
...
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