Skip to content

Commit

Permalink
Merge pull request #1475 from TheThingsNetwork/fix/1473-exposed-root-…
Browse files Browse the repository at this point in the history
…keys

Fix device overview with no root keys
  • Loading branch information
Bogdans committed Oct 15, 2019
2 parents 58ac051 + 189121d commit 18e184f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
19 changes: 15 additions & 4 deletions pkg/webui/console/views/device-overview/index.js
Expand Up @@ -35,6 +35,7 @@ const m = defineMessages({
sessionInfo: 'Session Information',
latestData: 'Latest Data',
rootKeys: 'Root Keys',
keysNotExposed: 'Keys are not exposed',
})

@connect(function({ device }, props) {
Expand Down Expand Up @@ -105,12 +106,21 @@ class DeviceOverview extends React.Component {

// Add root keys, if available
if (Object.keys(root_keys).length > 0) {
activationInfoData.items.push({
const infoEntry = {
key: m.rootKeyId,
value: root_keys.root_key_id,
type: 'code',
sensitive: false,
subItems: [
}
if (!Boolean(root_keys.app_key) && !Boolean(root_keys.nwk_key)) {
infoEntry.subItems = [
{
key: m.rootKeys,
value: <Message content={m.keysNotExposed} />,
},
]
} else {
infoEntry.subItems = [
{
key: sharedMessages.appKey,
value: root_keys.app_key.key,
Expand All @@ -125,8 +135,9 @@ class DeviceOverview extends React.Component {
sensitive: true,
}
: { key: sharedMessages.nwkKey, value: undefined }),
],
})
]
}
activationInfoData.items.push(infoEntry)
} else {
activationInfoData.items.push({
key: m.rootKeys,
Expand Down
1 change: 1 addition & 0 deletions pkg/webui/locales/en.json
Expand Up @@ -194,6 +194,7 @@
"console.views.device-overview.index.sessionInfo": "Session Information",
"console.views.device-overview.index.latestData": "Latest Data",
"console.views.device-overview.index.rootKeys": "Root Keys",
"console.views.device-overview.index.keysNotExposed": "Keys are not exposed",
"console.views.gateway-add.index.createGateway": "Create Gateway",
"console.views.gateway-data.index.gtwData": "Gateway Data",
"console.views.gateway-general-settings.index.updateSuccess": "Successfully updated gateway",
Expand Down
1 change: 1 addition & 0 deletions pkg/webui/locales/xx.json
Expand Up @@ -194,6 +194,7 @@
"console.views.device-overview.index.sessionInfo": "Xxxxxxx Xxxxxxxxxxx",
"console.views.device-overview.index.latestData": "Xxxxxx Xxxx",
"console.views.device-overview.index.rootKeys": "Xxxx Xxxx",
"console.views.device-overview.index.keysNotExposed": "Xxxx xxx xxx xxxxxxx",
"console.views.gateway-add.index.createGateway": "Xxxxxx Xxxxxxx",
"console.views.gateway-data.index.gtwData": "Xxxxxxx Xxxx",
"console.views.gateway-general-settings.index.updateSuccess": "Xxxxxxxxxxxx xxxxxxx xxxxxxx",
Expand Down

0 comments on commit 18e184f

Please sign in to comment.