Skip to content

ui: add the missing label for the backup resource limit - #14163

Open
stag7824 wants to merge 1 commit into
apache:4.22from
stag7824:fix-ui-missing-maxbackup-label
Open

ui: add the missing label for the backup resource limit#14163
stag7824 wants to merge 1 commit into
apache:4.22from
stag7824:fix-ui-missing-maxbackup-label

Conversation

@stag7824

Copy link
Copy Markdown

Description

The Resource Limits tab (account, domain and project) shows the backup row labelled with the
raw translation key label.maxbackup instead of a readable name.

ResourceLimitTab.vue derives the label from the resource type name returned by
listResourceLimits:

:label="$t('label.max' + (item.resourcetypename ? item.resourcetypename.replace('_', '') : ''))"

ResourceLimitResponse.setResourceType fills resourcetypename from the enum name, and
Resource.ResourceType declares backup("backup", 12), so the key looked up for that row is
label.maxbackup. That key exists in no locale. en.json has only label.maxbackups, which
is a different string used by the backup schedule form for how many backups to retain
(FormSchedule.vue), and label.maxbackupstorage, which is resource type 13.

i18n is configured with fallbackLocale: 'en' and silentTranslationWarn: true, so the
missing key produces no warning and vue-i18n renders the key itself.

The same key is used for the validation message when a tagged limit exceeds its untagged
limit, so that error currently reads label.maxbackup too:

this.$t('message.update.resource.limit.max.untagged.error')
    .replace('%x', this.$t('label.max' + this.resourceTypeIdNames[resourcetype].replace('_', '')))

Adding the key is enough; nothing else changes. Backup is the only one of the 17
Resource.ResourceType values whose label was missing — the other 16 already resolve.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • Trivial

How Has This Been Tested?

Resolved every Resource.ResourceType through the same expression the template uses, against
the real en.json before and after the change ($t returns the key when it is missing):

type                before                     after
backup              label.maxbackup            Max. Backups   <-- fixed

unchanged types: 16 of 17

So the one row that was broken now resolves, and no other label moves. en.json still parses
(4177 keys).

Found while looking at #13944. That report attributes the problem to resource types 15
(object_storage) and 16 (gpu), but label.maxobjectstorage and label.maxgpu are both
present and resolve correctly, so I do not think this change closes that issue — I have left
a note there with what I found.

The Resource Limits tab derives each label from the resource type name
returned by listResourceLimits:

    $t('label.max' + item.resourcetypename.replace('_', ''))

Resource.ResourceType declares backup("backup", 12), so the key looked up
for that row is label.maxbackup, which exists in no locale. en.json has
label.maxbackups, a different string used by the backup schedule form for
how many backups to retain, and label.maxbackupstorage, which is resource
type 13. With fallbackLocale 'en' and silentTranslationWarn enabled, the
miss is silent and vue-i18n renders the key itself, so the row reads
"label.maxbackup".

The same key is used for the tagged-limit validation message, which shows
the raw key for the same reason.

Backup was the only one of the 17 ResourceType values without a label; the
other 16 already resolve.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant