Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add soil to the normalized message preview in the events view #6164

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

import React from 'react'

import { getDataRate, getSignalInformation } from '@console/components/events/utils'

import PropTypes from '@ttn-lw/lib/prop-types'
import sharedMessages from '@ttn-lw/lib/shared-messages'

Expand All @@ -27,12 +25,15 @@ import JSONPayload from './shared/json-payload'
const ApplicationUplinkNormalizedPreview = React.memo(({ event }) => {
const { data, identifiers } = event
const deviceIds = identifiers[0].device_ids
const { snr, rssi } = getSignalInformation(data)
const dataRate = getDataRate(data)

return (
<DescriptionList>
<DescriptionList.Byte title={messages.devAddr} data={deviceIds.dev_addr} />
{data.normalized_payload.soil && (
<DescriptionList.Item title={sharedMessages.normalizedPayloadSoil}>
<JSONPayload data={data.normalized_payload.soil} />
</DescriptionList.Item>
)}
{data.normalized_payload.air && (
<DescriptionList.Item title={sharedMessages.normalizedPayloadAir}>
<JSONPayload data={data.normalized_payload.air} />
Expand All @@ -43,10 +44,6 @@ const ApplicationUplinkNormalizedPreview = React.memo(({ event }) => {
<JSONPayload data={data.normalized_payload.wind} />
</DescriptionList.Item>
)}
<DescriptionList.Item title={messages.fPort} data={data.f_port} />
<DescriptionList.Item title={messages.dataRate} data={dataRate} />
<DescriptionList.Item title={messages.snr} data={snr} />
<DescriptionList.Item title={messages.rssi} data={rssi} />
</DescriptionList>
)
})
Expand Down
1 change: 1 addition & 0 deletions pkg/webui/lib/shared-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ export default defineMessages({
noLocation: 'No location information available',
noMatch: 'No items found',
none: 'None',
normalizedPayloadSoil: 'Soil',
normalizedPayloadAir: 'Air',
normalizedPayloadWind: 'Wind',
notAvailable: 'n/a',
Expand Down
1 change: 1 addition & 0 deletions pkg/webui/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,7 @@
"lib.shared-messages.noLocation": "No location information available",
"lib.shared-messages.noMatch": "No items found",
"lib.shared-messages.none": "None",
"lib.shared-messages.normalizedPayloadSoil": "Soil",
"lib.shared-messages.normalizedPayloadAir": "Air",
"lib.shared-messages.normalizedPayloadWind": "Wind",
"lib.shared-messages.notAvailable": "n/a",
Expand Down