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
ef90e7d2
Unverified
Commit
ef90e7d2
authored
May 18, 2020
by
Lijiaoa
Committed by
GitHub
May 18, 2020
Browse files
update (#2440)
Co-authored-by:
Lijiao
<
15910218274@163.com
>
parent
1e2a2e29
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
8 deletions
+35
-8
src/webui/src/components/trial-detail/TableList.tsx
src/webui/src/components/trial-detail/TableList.tsx
+35
-8
No files found.
src/webui/src/components/trial-detail/TableList.tsx
View file @
ef90e7d2
...
@@ -39,6 +39,11 @@ interface TableListProps {
...
@@ -39,6 +39,11 @@ interface TableListProps {
trialsUpdateBroadcast
:
number
;
trialsUpdateBroadcast
:
number
;
}
}
interface
SortInfo
{
field
:
string
;
isDescend
?:
boolean
;
}
interface
TableListState
{
interface
TableListState
{
intermediateOption
:
object
;
intermediateOption
:
object
;
modalVisible
:
boolean
;
modalVisible
:
boolean
;
...
@@ -60,9 +65,9 @@ interface TableListState {
...
@@ -60,9 +65,9 @@ interface TableListState {
tableColumns
:
IColumn
[];
tableColumns
:
IColumn
[];
allColumnList
:
string
[];
allColumnList
:
string
[];
tableSourceForSort
:
Array
<
TableRecord
>
;
tableSourceForSort
:
Array
<
TableRecord
>
;
sortMessage
:
SortInfo
;
}
}
class
TableList
extends
React
.
Component
<
TableListProps
,
TableListState
>
{
class
TableList
extends
React
.
Component
<
TableListProps
,
TableListState
>
{
public
intervalTrialLog
=
10
;
public
intervalTrialLog
=
10
;
...
@@ -91,7 +96,8 @@ class TableList extends React.Component<TableListProps, TableListState> {
...
@@ -91,7 +96,8 @@ class TableList extends React.Component<TableListProps, TableListState> {
modalIntermediateHeight
:
window
.
innerHeight
,
modalIntermediateHeight
:
window
.
innerHeight
,
tableColumns
:
this
.
initTableColumnList
(
this
.
props
.
columnList
),
tableColumns
:
this
.
initTableColumnList
(
this
.
props
.
columnList
),
allColumnList
:
this
.
getAllColumnKeys
(),
allColumnList
:
this
.
getAllColumnKeys
(),
tableSourceForSort
:
this
.
props
.
tableSource
tableSourceForSort
:
this
.
props
.
tableSource
,
sortMessage
:
{
field
:
''
,
isDescend
:
false
}
};
};
}
}
...
@@ -114,19 +120,29 @@ class TableList extends React.Component<TableListProps, TableListState> {
...
@@ -114,19 +120,29 @@ class TableList extends React.Component<TableListProps, TableListState> {
const
newItems
=
this
.
copyAndSort
(
tableSource
,
currColumn
.
fieldName
!
,
currColumn
.
isSortedDescending
);
const
newItems
=
this
.
copyAndSort
(
tableSource
,
currColumn
.
fieldName
!
,
currColumn
.
isSortedDescending
);
this
.
setState
({
this
.
setState
({
tableColumns
:
newColumns
,
tableColumns
:
newColumns
,
tableSourceForSort
:
newItems
tableSourceForSort
:
newItems
,
sortMessage
:
{
field
:
getColumn
.
key
,
isDescend
:
currColumn
.
isSortedDescending
}
});
});
};
};
private
copyAndSort
<
T
>
(
items
:
T
[],
columnKey
:
string
,
isSortedDescending
?:
boolean
):
T
[]
{
private
copyAndSort
<
T
>
(
items
:
T
[],
columnKey
:
string
,
isSortedDescending
?:
boolean
):
any
{
const
key
=
columnKey
as
keyof
T
;
const
key
=
columnKey
as
keyof
T
;
return
items
.
slice
(
0
).
sort
((
a
:
T
,
b
:
T
)
=>
((
isSortedDescending
?
a
[
key
]
<
b
[
key
]
:
a
[
key
]
>
b
[
key
])
?
1
:
-
1
));
return
items
.
slice
(
0
).
sort
(
function
(
a
:
T
,
b
:
T
):
any
{
if
(
a
[
key
]
===
undefined
)
{
return
1
;
}
if
(
b
[
key
]
===
undefined
)
{
return
-
1
;
}
return
(
isSortedDescending
?
a
[
key
]
<
b
[
key
]
:
a
[
key
]
>
b
[
key
])
?
1
:
-
1
;
});
}
}
AccuracyColumnConfig
:
any
=
{
AccuracyColumnConfig
:
any
=
{
name
:
'
Default metric
'
,
name
:
'
Default metric
'
,
className
:
'
leftTitle
'
,
className
:
'
leftTitle
'
,
key
:
'
a
ccuracy
'
,
key
:
'
latestA
ccuracy
'
,
fieldName
:
'
latestAccuracy
'
,
fieldName
:
'
latestAccuracy
'
,
minWidth
:
200
,
minWidth
:
200
,
maxWidth
:
300
,
maxWidth
:
300
,
...
@@ -143,7 +159,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
...
@@ -143,7 +159,7 @@ class TableList extends React.Component<TableListProps, TableListState> {
minWidth
:
80
,
minWidth
:
80
,
maxWidth
:
240
,
maxWidth
:
240
,
className
:
'
tableHead
'
,
className
:
'
tableHead
'
,
data
:
'
string
'
,
data
:
'
number
'
,
onColumnClick
:
this
.
onColumnClick
,
onColumnClick
:
this
.
onColumnClick
,
};
};
...
@@ -566,10 +582,21 @@ class TableList extends React.Component<TableListProps, TableListState> {
...
@@ -566,10 +582,21 @@ class TableList extends React.Component<TableListProps, TableListState> {
const
{
intermediateKey
,
modalIntermediateWidth
,
modalIntermediateHeight
,
const
{
intermediateKey
,
modalIntermediateWidth
,
modalIntermediateHeight
,
tableColumns
,
allColumnList
,
isShowColumn
,
modalVisible
,
tableColumns
,
allColumnList
,
isShowColumn
,
modalVisible
,
selectRows
,
isShowCompareModal
,
intermediateOtherKeys
,
selectRows
,
isShowCompareModal
,
intermediateOtherKeys
,
isShowCustomizedModal
,
copyTrialId
,
intermediateOption
isShowCustomizedModal
,
copyTrialId
,
intermediateOption
,
sortMessage
}
=
this
.
state
;
}
=
this
.
state
;
const
{
columnList
}
=
this
.
props
;
const
{
columnList
}
=
this
.
props
;
const
tableSource
:
Array
<
TableRecord
>
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
state
.
tableSourceForSort
));
const
tableSource
:
Array
<
TableRecord
>
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
state
.
tableSourceForSort
));
if
(
sortMessage
.
field
!==
''
)
{
tableSource
.
sort
(
function
(
a
,
b
):
any
{
if
(
a
[
sortMessage
.
field
]
===
undefined
)
{
return
1
;
}
if
(
b
[
sortMessage
.
field
]
===
undefined
)
{
return
-
1
;
}
return
(
sortMessage
.
isDescend
?
a
[
sortMessage
.
field
]
<
b
[
sortMessage
.
field
]
:
a
[
sortMessage
.
field
]
>
b
[
sortMessage
.
field
])
?
1
:
-
1
;
});
}
return
(
return
(
<
Stack
>
<
Stack
>
<
div
id
=
"tableList"
>
<
div
id
=
"tableList"
>
...
...
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