Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
code
data-on-a-map-app
Commits
fd02f179
Commit
fd02f179
authored
Dec 02, 2019
by
alain
🐙
Browse files
fix legend conditional
parent
bd8510c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/DeckLayers/StationTooltip.js
View file @
fd02f179
...
...
@@ -9,7 +9,6 @@ import { moment } from "../util/time.js"
const
SensorTooltip
=
props
=>
{
const
{
d
,
label
,
unit
}
=
props
//const dataAgeText = d.dataAge < 1 ? texts.lastHour : `${roundBy(d.dataAge, 0)} ${texts.hoursAgo}`
const
dataAgeText
=
`
${
moment
(
d
.
timestamp
).
format
(
"
HH
"
)
}
-
${
moment
(
d
.
timestamp
).
add
(
1
,
'
hours
'
).
format
(
"
HH
"
)
}${
texts
.
hourShort
}
`
return
(
...
...
src/Modal/StationInfo.js
View file @
fd02f179
...
...
@@ -286,7 +286,7 @@ class StationInfo extends React.Component {
<
footer
id
=
"
chart-footer
"
>
<
span
className
=
"
hint-time-selection
"
>
{
texts
.
timeSelectionHint
}
<
/span
>
{
Object
.
keys
(
dataStreams
).
length
>
1
&&
{
Object
.
keys
(
dataStreams
[
Object
.
keys
(
dataStreams
)[
0
]]
).
length
>
1
&&
<
ul
id
=
"
chart-data-selection
"
>
{
Object
.
keys
(
dataStreams
).
map
(
i
=>
<
li
key
=
{
i
}
className
=
"
data-stream
"
>
...
...
src/util/time.js
View file @
fd02f179
...
...
@@ -84,3 +84,27 @@ export const subtractOneHourISO = (datestring) => {
// + 'T' + pad(now.getUTCHours())
// + ':00:00.000Z'
// }
export
const
getDataAge
=
(
timestamp
,
granularity
,
timestamp_end
=
false
)
=>
{
const
diff
=
new
Date
()
-
new
Date
(
timestamp
)
let
unit
switch
(
granularity
)
{
case
"
minutely
"
:
unit
=
216000000
break
;
case
"
daily
"
:
unit
=
150000
break
;
// default is hourly
default
:
unit
=
3600000
break
;
}
let
inUnit
=
diff
/
unit
if
(
timestamp_end
)
inUnit
-=
unit
return
inUnit
}
\ No newline at end of file
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