Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
VILLASframework
VILLASweb
Commits
29ffefae
Commit
29ffefae
authored
Nov 27, 2018
by
Steffen Vogel
🎅🏼
Browse files
improve sort algorithm in simulator view
parent
c40998cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/containers/simulators.js
View file @
29ffefae
...
...
@@ -44,9 +44,34 @@ class Simulators extends Component {
return
[
UserStore
,
SimulatorStore
];
}
static
statePrio
(
state
)
{
switch
(
state
)
{
case
'
running
'
:
case
'
starting
'
:
return
1
;
case
'
paused
'
:
case
'
pausing
'
:
case
'
resuming
'
:
return
2
;
case
'
idle
'
:
return
3
;
case
'
shutdown
'
:
return
4
;
case
'
error
'
:
return
10
;
default
:
return
99
;
}
}
static
calculateState
()
{
const
simulators
=
SimulatorStore
.
getState
().
sort
((
a
,
b
)
=>
{
return
a
.
stateUpdatedAt
<
b
.
stateUpdatedAt
;
if
(
a
.
state
!==
b
.
state
)
return
this
.
statePrio
(
a
.
state
)
>
this
.
statePrio
(
b
.
state
);
else
if
(
a
.
name
!==
b
.
name
)
return
a
.
name
<
b
.
name
;
else
return
a
.
stateUpdatedAt
<
b
.
stateUpdatedAt
;
});
return
{
...
...
Write
Preview
Supports
Markdown
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