ioBroker / ioBroker.admin

user interface for configuration and administration
https://iobroker.net
MIT License
271 stars 78 forks source link

[bug]: on update message.linkText is ignored and button always shows "More info" #2511

Closed Garfonso closed 1 week ago

Garfonso commented 1 week ago

No existing issues.

Describe the bug

Developers can add a message for certain updates to their io-package.json. It is possible to add link and linkText properties to that message containing more information. I'd expect to see the linkText as Button description and from looking at the code, it seems that this also is intended, but for some reason I do not understand (otherwise I'd do a PR :smile: ) it always falls back to 'More info'.

Additional information: 'More info' is not in the translation, hence it is logged in the console. Might that cause a side effect? Since that is the most visible difference between linkText and the other texts. (see https://github.com/ioBroker/ioBroker.admin/blob/master/packages/admin/src-admin/src/dialogs/AdapterUpdateDialog.tsx#L579 ). I'd recommend either adding "More info" to the translations or replace the fallback with "Show more info" which is already in the translations and there is ample space. :-)

To Reproduce

To reproduce add some messages object to an adapter, maybe by editiong system.repositories and downgrade one adapter to match the message condition and see the messge. It's always more info.

Example messages array to add (adjust versoin):

"messages": [
        {
            "condition": {
                "operand": "and",
                "rules": [
                    "oldVersion<2.0.0",
                    "newVersion>=2.0.0"
                ]
            },
            "title": {
                "en": "Some Breaking Change",
                "de": "Einige brechende Veränderungen",
                "ru": "Некоторые прорывные изменения",
                "pt": "Algumas mudanças quebrando",
                "nl": "Enige brekende verandering",
                "fr": "Quelques changements",
                "it": "Alcuni cambiamenti di rottura",
                "es": "Algunos cambios de ruptura",
                "pl": "Pewne łamanie zmian",
                "uk": "Деякі зміни",
                "zh-cn": "一些突破性改变"
            },
            "text": {
                "en": "Text, see link.",
                "de": "Text, see link.",
                "ru": "Text, see link.",
                "pt": "Text, see link.",
                "nl": "Text, see link.",
                "fr": "Text, see link.",
                "it": "Text, see link.",
                "es": "Text, see link.",
                "pl": "Text, see link.",
                "uk": "Text, see link.",
                "zh-cn": "Text, see link."
            },
            "link": "https://github.com/iobroker-community-adapters/ioBroker.rpi2/issues/192",
            "level": "warn",
            "linkText": {
                "en": "GPIO Button discussion.",
                "de": "GPIO Button Diskussion.",
                "ru": "GPIO Button discussion.",
                "pt": "Discussão do botão GPIO.",
                "nl": "GPIO Button discussie.",
                "fr": "Discussion sur le bouton GPIO.",
                "it": "GPIO Button discussione.",
                "es": "GPIO Button discussion.",
                "pl": "Dyskusja GPIO Button.",
                "uk": "Обговорення кнопки GPIO.",
                "zh-cn": "GPIO按钮讨论."
            },
            "buttons": [
                "agree",
                "cancel"
            ]
        }
    ]

Expected behavior

Button to more info should show linkText.

Screenshots & Logfiles

admin-issue-linktext-en admin-issue-linktext

(english and german)

It also fails, if linkText is just a string, not an object.

Adapter version

6.17.14

js-controller version

5.0.19

Node version

v18.20.2

Operating system

Linux Server 6.5.0-41-generic #41-Ubuntu SMP PREEMPT_DYNAMIC Mon May 20 15:55:15 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Additional context

No response