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
8dc2a975
Commit
8dc2a975
authored
Nov 28, 2018
by
Lijiao
Committed by
chicm-ms
Nov 28, 2018
Browse files
Fix bug of webui's table (#407)
* Fix bug * fix lint
parent
194af6f0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
57 deletions
+43
-57
src/webui/src/components/Overview.tsx
src/webui/src/components/Overview.tsx
+3
-13
src/webui/src/components/TrialsDetail.tsx
src/webui/src/components/TrialsDetail.tsx
+5
-26
src/webui/src/components/overview/SuccessTable.tsx
src/webui/src/components/overview/SuccessTable.tsx
+1
-1
src/webui/src/components/trial-detail/Para.tsx
src/webui/src/components/trial-detail/Para.tsx
+5
-13
src/webui/src/components/trial-detail/TableList.tsx
src/webui/src/components/trial-detail/TableList.tsx
+1
-1
src/webui/src/static/function.ts
src/webui/src/static/function.ts
+22
-1
src/webui/src/static/interface.ts
src/webui/src/static/interface.ts
+6
-2
No files found.
src/webui/src/components/Overview.tsx
View file @
8dc2a975
...
@@ -6,6 +6,7 @@ import {
...
@@ -6,6 +6,7 @@ import {
Experiment
,
TableObj
,
Experiment
,
TableObj
,
Parameters
,
TrialNumber
Parameters
,
TrialNumber
}
from
'
../static/interface
'
;
}
from
'
../static/interface
'
;
import
{
getFinalResult
}
from
'
../static/function
'
;
import
SuccessTable
from
'
./overview/SuccessTable
'
;
import
SuccessTable
from
'
./overview/SuccessTable
'
;
import
Title1
from
'
./overview/Title1
'
;
import
Title1
from
'
./overview/Title1
'
;
import
Progressed
from
'
./overview/Progress
'
;
import
Progressed
from
'
./overview/Progress
'
;
...
@@ -215,18 +216,7 @@ class Overview extends React.Component<{}, OverviewState> {
...
@@ -215,18 +216,7 @@ class Overview extends React.Component<{}, OverviewState> {
parameters
:
{}
parameters
:
{}
};
};
const
duration
=
(
tableData
[
item
].
endTime
-
tableData
[
item
].
startTime
)
/
1000
;
const
duration
=
(
tableData
[
item
].
endTime
-
tableData
[
item
].
startTime
)
/
1000
;
let
acc
;
const
acc
=
getFinalResult
(
tableData
[
item
].
finalMetricData
);
let
tableAcc
=
0
;
if
(
tableData
[
item
].
finalMetricData
)
{
acc
=
JSON
.
parse
(
tableData
[
item
].
finalMetricData
.
data
);
if
(
typeof
(
acc
)
===
'
object
'
)
{
if
(
acc
.
default
)
{
tableAcc
=
acc
.
default
;
}
}
else
{
tableAcc
=
acc
;
}
}
// if hyperparameters is undefine, show error message, else, show parameters value
// if hyperparameters is undefine, show error message, else, show parameters value
if
(
tableData
[
item
].
hyperParameters
)
{
if
(
tableData
[
item
].
hyperParameters
)
{
desJobDetail
.
parameters
=
JSON
.
parse
(
tableData
[
item
].
hyperParameters
).
parameters
;
desJobDetail
.
parameters
=
JSON
.
parse
(
tableData
[
item
].
hyperParameters
).
parameters
;
...
@@ -246,7 +236,7 @@ class Overview extends React.Component<{}, OverviewState> {
...
@@ -246,7 +236,7 @@ class Overview extends React.Component<{}, OverviewState> {
id
:
tableData
[
item
].
id
,
id
:
tableData
[
item
].
id
,
duration
:
duration
,
duration
:
duration
,
status
:
tableData
[
item
].
status
,
status
:
tableData
[
item
].
status
,
acc
:
tableA
cc
,
acc
:
a
cc
,
description
:
desJobDetail
description
:
desJobDetail
});
});
break
;
break
;
...
...
src/webui/src/components/TrialsDetail.tsx
View file @
8dc2a975
...
@@ -4,6 +4,7 @@ import { MANAGER_IP } from '../static/const';
...
@@ -4,6 +4,7 @@ import { MANAGER_IP } from '../static/const';
import
{
Row
,
Col
,
Button
,
Tabs
,
Input
}
from
'
antd
'
;
import
{
Row
,
Col
,
Button
,
Tabs
,
Input
}
from
'
antd
'
;
const
Search
=
Input
.
Search
;
const
Search
=
Input
.
Search
;
import
{
TableObj
,
Parameters
,
DetailAccurPoint
,
TooltipForAccuracy
}
from
'
../static/interface
'
;
import
{
TableObj
,
Parameters
,
DetailAccurPoint
,
TooltipForAccuracy
}
from
'
../static/interface
'
;
import
{
getFinalResult
}
from
'
../static/function
'
;
import
Accuracy
from
'
./overview/Accuracy
'
;
import
Accuracy
from
'
./overview/Accuracy
'
;
import
Duration
from
'
./trial-detail/Duration
'
;
import
Duration
from
'
./trial-detail/Duration
'
;
import
Title1
from
'
./overview/Title1
'
;
import
Title1
from
'
./overview/Title1
'
;
...
@@ -47,24 +48,13 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
...
@@ -47,24 +48,13 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
const
accSource
:
Array
<
DetailAccurPoint
>
=
[];
const
accSource
:
Array
<
DetailAccurPoint
>
=
[];
Object
.
keys
(
accData
).
map
(
item
=>
{
Object
.
keys
(
accData
).
map
(
item
=>
{
if
(
accData
[
item
].
status
===
'
SUCCEEDED
'
&&
accData
[
item
].
finalMetricData
)
{
if
(
accData
[
item
].
status
===
'
SUCCEEDED
'
&&
accData
[
item
].
finalMetricData
)
{
let
acc
;
let
tableAcc
;
let
searchSpace
:
object
=
{};
let
searchSpace
:
object
=
{};
if
(
accData
[
item
].
finalMetricData
)
{
const
acc
=
getFinalResult
(
accData
[
item
].
finalMetricData
);
acc
=
JSON
.
parse
(
accData
[
item
].
finalMetricData
.
data
);
if
(
typeof
(
acc
)
===
'
object
'
)
{
if
(
acc
.
default
)
{
tableAcc
=
acc
.
default
;
}
}
else
{
tableAcc
=
acc
;
}
}
if
(
accData
[
item
].
hyperParameters
)
{
if
(
accData
[
item
].
hyperParameters
)
{
searchSpace
=
JSON
.
parse
(
accData
[
item
].
hyperParameters
).
parameters
;
searchSpace
=
JSON
.
parse
(
accData
[
item
].
hyperParameters
).
parameters
;
}
}
accSource
.
push
({
accSource
.
push
({
acc
:
tableA
cc
,
acc
:
a
cc
,
index
:
accData
[
item
].
sequenceId
,
index
:
accData
[
item
].
sequenceId
,
searchSpace
:
JSON
.
stringify
(
searchSpace
)
searchSpace
:
JSON
.
stringify
(
searchSpace
)
});
});
...
@@ -147,8 +137,6 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
...
@@ -147,8 +137,6 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
parameters
:
{},
parameters
:
{},
intermediate
:
[]
intermediate
:
[]
};
};
let
acc
;
let
tableAcc
=
0
;
let
duration
=
0
;
let
duration
=
0
;
const
id
=
trialJobs
[
item
].
id
!==
undefined
const
id
=
trialJobs
[
item
].
id
!==
undefined
?
trialJobs
[
item
].
id
?
trialJobs
[
item
].
id
...
@@ -185,23 +173,14 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
...
@@ -185,23 +173,14 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
}
}
});
});
desc
.
intermediate
=
mediate
;
desc
.
intermediate
=
mediate
;
if
(
trialJobs
[
item
].
finalMetricData
!==
undefined
)
{
const
acc
=
getFinalResult
(
trialJobs
[
item
].
finalMetricData
);
acc
=
JSON
.
parse
(
trialJobs
[
item
].
finalMetricData
.
data
);
if
(
typeof
(
acc
)
===
'
object
'
)
{
if
(
acc
.
default
)
{
tableAcc
=
acc
.
default
;
}
}
else
{
tableAcc
=
acc
;
}
}
trialTable
.
push
({
trialTable
.
push
({
key
:
trialTable
.
length
,
key
:
trialTable
.
length
,
sequenceId
:
trialJobs
[
item
].
sequenceId
,
sequenceId
:
trialJobs
[
item
].
sequenceId
,
id
:
id
,
id
:
id
,
status
:
status
,
status
:
status
,
duration
:
duration
,
duration
:
duration
,
acc
:
tableA
cc
,
acc
:
a
cc
,
description
:
desc
description
:
desc
});
});
});
});
...
...
src/webui/src/components/overview/SuccessTable.tsx
View file @
8dc2a975
...
@@ -90,7 +90,7 @@ class SuccessTable extends React.Component<SuccessTableProps, {}> {
...
@@ -90,7 +90,7 @@ class SuccessTable extends React.Component<SuccessTableProps, {}> {
:
:
record
.
acc
record
.
acc
:
:
'
NaN
'
'
--
'
}
}
</
div
>
</
div
>
);
);
...
...
src/webui/src/components/trial-detail/Para.tsx
View file @
8dc2a975
...
@@ -4,6 +4,7 @@ import { MANAGER_IP } from '../../static/const';
...
@@ -4,6 +4,7 @@ import { MANAGER_IP } from '../../static/const';
import
ReactEcharts
from
'
echarts-for-react
'
;
import
ReactEcharts
from
'
echarts-for-react
'
;
import
{
Row
,
Col
,
Select
,
Button
,
message
}
from
'
antd
'
;
import
{
Row
,
Col
,
Select
,
Button
,
message
}
from
'
antd
'
;
import
{
ParaObj
,
VisualMapValue
,
Dimobj
}
from
'
../../static/interface
'
;
import
{
ParaObj
,
VisualMapValue
,
Dimobj
}
from
'
../../static/interface
'
;
import
{
getFinalResult
}
from
'
../../static/function
'
;
const
Option
=
Select
.
Option
;
const
Option
=
Select
.
Option
;
require
(
'
echarts/lib/chart/parallel
'
);
require
(
'
echarts/lib/chart/parallel
'
);
require
(
'
echarts/lib/component/tooltip
'
);
require
(
'
echarts/lib/component/tooltip
'
);
...
@@ -156,19 +157,10 @@ class Para extends React.Component<{}, ParaState> {
...
@@ -156,19 +157,10 @@ class Para extends React.Component<{}, ParaState> {
// trial-jobs interface list
// trial-jobs interface list
Object
.
keys
(
accParaData
).
map
(
item
=>
{
Object
.
keys
(
accParaData
).
map
(
item
=>
{
if
(
accParaData
[
item
].
status
===
'
SUCCEEDED
'
)
{
if
(
accParaData
[
item
].
status
===
'
SUCCEEDED
'
)
{
if
(
accParaData
[
item
].
finalMetricData
&&
accParaData
[
item
].
hyperParameters
)
{
const
finalData
=
accParaData
[
item
].
finalMetricData
;
// get acc array
if
(
finalData
&&
accParaData
[
item
].
hyperParameters
)
{
let
acc
;
const
result
=
getFinalResult
(
finalData
);
let
accReal
;
accPara
.
push
(
result
);
acc
=
JSON
.
parse
(
accParaData
[
item
].
finalMetricData
.
data
);
if
(
typeof
(
acc
)
===
'
object
'
)
{
if
(
acc
.
default
)
{
accReal
=
acc
.
default
;
}
}
else
{
accReal
=
acc
;
}
accPara
.
push
(
accReal
);
// get dim and every line specific number
// get dim and every line specific number
const
temp
=
JSON
.
parse
(
accParaData
[
item
].
hyperParameters
).
parameters
;
const
temp
=
JSON
.
parse
(
accParaData
[
item
].
hyperParameters
).
parameters
;
eachTrialParams
.
push
(
temp
);
eachTrialParams
.
push
(
temp
);
...
...
src/webui/src/components/trial-detail/TableList.tsx
View file @
8dc2a975
...
@@ -237,7 +237,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
...
@@ -237,7 +237,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
:
:
record
.
acc
record
.
acc
:
:
'
NaN
'
'
--
'
}
}
</
div
>
</
div
>
);
);
...
...
src/webui/src/static/function.ts
View file @
8dc2a975
import
{
FinalResult
}
from
'
./interface
'
;
export
const
convertTime
=
(
num
:
number
)
=>
{
export
const
convertTime
=
(
num
:
number
)
=>
{
if
(
num
%
3600
===
0
)
{
if
(
num
%
3600
===
0
)
{
return
num
/
3600
+
'
h
'
;
return
num
/
3600
+
'
h
'
;
...
@@ -23,4 +25,23 @@ export const convertDuration = (num: number) => {
...
@@ -23,4 +25,23 @@ export const convertDuration = (num: number) => {
}
else
{
}
else
{
return
result
;
return
result
;
}
}
};
};
\ No newline at end of file
// get final result value
export
const
getFinalResult
=
(
final
:
FinalResult
)
=>
{
let
acc
;
let
showDefault
=
0
;
if
(
final
)
{
acc
=
JSON
.
parse
(
final
[
0
].
data
);
if
(
typeof
(
acc
)
===
'
object
'
)
{
if
(
acc
.
default
)
{
showDefault
=
acc
.
default
;
}
}
else
{
showDefault
=
acc
;
}
return
showDefault
;
}
else
{
return
0
;
}
};
src/webui/src/static/interface.ts
View file @
8dc2a975
...
@@ -87,9 +87,13 @@ interface VisualMapValue {
...
@@ -87,9 +87,13 @@ interface VisualMapValue {
minAccuracy
:
number
;
minAccuracy
:
number
;
}
}
interface
FinalResult
{
data
:
string
;
}
export
{
export
{
TableObj
,
Parameters
,
Experiment
,
TableObj
,
Parameters
,
Experiment
,
AccurPoint
,
TrialNumber
,
TrialJob
,
AccurPoint
,
TrialNumber
,
TrialJob
,
DetailAccurPoint
,
TooltipForAccuracy
,
DetailAccurPoint
,
TooltipForAccuracy
,
ParaObj
,
VisualMapValue
,
Dimobj
ParaObj
,
VisualMapValue
,
Dimobj
,
FinalResult
};
};
\ No newline at end of file
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