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
9efdd2f1
Commit
9efdd2f1
authored
Nov 27, 2018
by
Steffen Vogel
🎅🏼
Browse files
improve styling over labels in simulator view
parent
29ffefae
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/components/table.js
View file @
9efdd2f1
...
...
@@ -89,7 +89,7 @@ class CustomTable extends Component {
labelContent
=
child
.
props
.
labelModifier
(
labelContent
,
data
);
}
cell
.
push
(
<
span
>&
nbsp
;
<
Label
bs
Style
=
{
child
.
props
.
labelStyle
(
data
[
labelKey
],
data
)}
>
{
labelContent
.
toString
()}
<
/Label></
span
>
);
cell
.
push
(
<
span
>&
nbsp
;
<
Label
bs
Class
=
{
child
.
props
.
labelStyle
(
data
[
labelKey
],
data
)}
>
{
labelContent
.
toString
()}
<
/Label></
span
>
);
}
if
(
child
.
props
.
dataIndex
)
{
...
...
src/containers/simulators.js
View file @
9efdd2f1
...
...
@@ -91,6 +91,7 @@ class Simulators extends Component {
});
}
closeNewModal
(
data
)
{
this
.
setState
({
newModal
:
false
});
...
...
@@ -200,32 +201,39 @@ class Simulators extends Component {
return
Date
.
now
()
-
new
Date
(
simulator
.
stateUpdatedAt
)
>
fiveMinutes
;
}
isSimulatorOnline
(
state
)
{
return
state
!==
''
&&
state
!==
'
shutdown
'
&&
state
!==
'
unknown
'
;
}
stateLabelStyle
=
(
state
,
simulator
)
=>
{
if
(
this
.
isSimulatorOutdated
(
simulator
))
{
return
'
default
'
;
}
var
style
=
[
'
label
'
];
if
(
this
.
isSimulatorO
nline
(
state
)
)
{
return
'
success
'
;
if
(
this
.
isSimulatorO
utdated
(
simulator
)
&&
state
!==
'
shutdown
'
)
{
style
.
push
(
'
label-outdated
'
)
;
}
return
'
danger
'
;
}
switch
(
state
)
{
case
'
running
'
:
style
.
push
(
'
label-success
'
);
break
;
stateLabelModifier
=
(
state
,
simulator
)
=>
{
if
(
this
.
isSimulatorOutdated
(
simulator
))
{
return
'
unknown
'
;
}
case
'
paused
'
:
style
.
push
(
'
label-info
'
);
break
;
case
'
idle
'
:
style
.
push
(
'
label-primary
'
);
break
;
case
'
error
'
:
style
.
push
(
'
label-danger
'
);
break
;
case
'
shutdown
'
:
style
.
push
(
'
label-warning
'
);
break
;
if
(
this
.
isSimulatorOnline
(
state
))
{
return
'
online
'
;
default
:
style
.
push
(
'
label-default
'
)
;
}
return
'
offline
'
;
return
style
.
join
(
'
'
)
;
}
stateUpdateModifier
=
updatedAt
=>
{
...
...
@@ -246,10 +254,11 @@ class Simulators extends Component {
<
Table
data
=
{
this
.
state
.
simulators
}
>
<
TableColumn
checkbox
onChecked
=
{(
index
,
event
)
=>
this
.
onSimulatorChecked
(
index
,
event
)}
width
=
'
30
'
/>
<
TableColumn
title
=
'
Name
'
dataKeys
=
{[
'
properties.name
'
,
'
rawProperties.name
'
]}
/
>
<
TableColumn
title
=
'
State
'
dataKey
=
'
state
'
labelKey
=
'
state
'
labelModifier
=
{
this
.
stateLabelModifier
}
labelStyle
=
{
this
.
stateLabelStyle
}
/
>
<
TableColumn
title
=
'
State
'
labelKey
=
'
state
'
tooltipKey
=
'
error
'
labelModifier
=
{
this
.
stateLabelModifier
}
labelStyle
=
{
this
.
stateLabelStyle
}
/
>
<
TableColumn
title
=
'
Category
'
dataKeys
=
{[
'
properties.category
'
,
'
rawProperties.category
'
]}
/
>
<
TableColumn
title
=
'
Type
'
dataKeys
=
{[
'
properties.type
'
,
'
rawProperties.type
'
]}
/
>
<
TableColumn
title
=
'
Location
'
dataKeys
=
{[
'
properties.location
'
,
'
rawProperties.location
'
]}
/
>
<
TableColumn
title
=
'
Realm
'
dataKeys
=
{[
'
properties.realm
'
,
'
rawProperties.realm
'
]}
/
>
{
/*
<TableColumn title='Realm' dataKeys={['properties.realm', 'rawProperties.realm']} />
*/
}
<
TableColumn
title
=
'
Host
'
dataKey
=
'
host
'
/>
<
TableColumn
title
=
'
Last Update
'
dataKey
=
'
stateUpdatedAt
'
modifier
=
{
this
.
stateUpdateModifier
}
/
>
<
TableColumn
...
...
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