From 91bdeef3738e5c820f6b899c2eab2d3dc416b31a Mon Sep 17 00:00:00 2001 From: John Cowen Date: Thu, 16 Jun 2022 12:07:04 +0100 Subject: [PATCH] ui: Fix intl keys in order to render correct messages for empty states (#13409) * ui: Fix intl keys in order to render correct messages for empty states * Add a debug only debug log to warn about missing keys --- .changelog/13409.txt | 3 +++ .../app/templates/dc/acls/auth-methods/index.hbs | 4 ++-- .../templates/dc/services/show/intentions/index.hbs | 4 ++-- .../consul-ui/app/utils/intl/missing-message.js | 6 ++++++ ui/packages/consul-ui/translations/routes/en-us.yaml | 11 ++++++----- 5 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 .changelog/13409.txt diff --git a/.changelog/13409.txt b/.changelog/13409.txt new file mode 100644 index 000000000..b45b089ef --- /dev/null +++ b/.changelog/13409.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Fix incorrect text on certain page empty states +``` diff --git a/ui/packages/consul-ui/app/templates/dc/acls/auth-methods/index.hbs b/ui/packages/consul-ui/app/templates/dc/acls/auth-methods/index.hbs index f61a94347..687e63600 100644 --- a/ui/packages/consul-ui/app/templates/dc/acls/auth-methods/index.hbs +++ b/ui/packages/consul-ui/app/templates/dc/acls/auth-methods/index.hbs @@ -90,13 +90,13 @@ as |route|> >

- {{t 'routes.dc.auth-methods.index.empty.header' + {{t 'routes.dc.acls.auth-methods.index.empty.header' items=items.length }}

- {{t 'routes.dc.auth-methods.index.empty.body' + {{t 'routes.dc.acls.auth-methods.index.empty.body' items=items.length htmlSafe=true }} diff --git a/ui/packages/consul-ui/app/templates/dc/services/show/intentions/index.hbs b/ui/packages/consul-ui/app/templates/dc/services/show/intentions/index.hbs index 2b127daa3..776910103 100644 --- a/ui/packages/consul-ui/app/templates/dc/services/show/intentions/index.hbs +++ b/ui/packages/consul-ui/app/templates/dc/services/show/intentions/index.hbs @@ -94,13 +94,13 @@ as |route|> >

- {{t 'routes.dc.services.intentions.index.empty.header' + {{t 'routes.dc.services.show.intentions.index.empty.header' items=items.length }}

- {{t 'routes.dc.services.intentions.index.empty.body' + {{t 'routes.dc.services.show.intentions.index.empty.body' items=items.length htmlSafe=true }} diff --git a/ui/packages/consul-ui/app/utils/intl/missing-message.js b/ui/packages/consul-ui/app/utils/intl/missing-message.js index 7e9c3c945..a454243ca 100644 --- a/ui/packages/consul-ui/app/utils/intl/missing-message.js +++ b/ui/packages/consul-ui/app/utils/intl/missing-message.js @@ -1,6 +1,12 @@ +/* eslint no-console: ["error", { allow: ["debug"] }] */ +import { runInDebug } from '@ember/debug'; + // if we can't find the message, take the last part of the identifier and // ucfirst it so it looks human export default function missingMessage(key, locales) { + runInDebug( + _ => console.debug(`Translation key not found: ${key}`) + ); const last = key .split('.') .pop() diff --git a/ui/packages/consul-ui/translations/routes/en-us.yaml b/ui/packages/consul-ui/translations/routes/en-us.yaml index bbe2c9428..d0d904521 100644 --- a/ui/packages/consul-ui/translations/routes/en-us.yaml +++ b/ui/packages/consul-ui/translations/routes/en-us.yaml @@ -75,11 +75,12 @@ dc: title: Metadata sessions: title: Lock Sessions - header: Welcome to Lock Sessions - body: | -

- Consul provides a session mechanism which can be used to build distributed locks. Sessions act as a binding layer between Nodes, Health Checks, and Key/Value data. There are currently no Lock Sessions present, or you may not have key:read or session:read permissions. -

+ empty: + header: Welcome to Lock Sessions + body: | +

+ Consul provides a session mechanism which can be used to build distributed locks. Sessions act as a binding layer between Nodes, Health Checks, and Key/Value data. There are currently no Lock Sessions present, or you may not have key:read or session:read permissions. +

services: title: Service Instances empty: |