From c851b14d3532d74c3f00359fafc9d857bb883911 Mon Sep 17 00:00:00 2001 From: proddy Date: Mon, 25 Nov 2024 16:52:49 +0100 Subject: [PATCH] show download button instead of dialog --- interface/src/app/settings/Version.tsx | 163 ++++++++++-------- .../src/components/layout/LayoutAppBar.tsx | 2 +- interface/src/i18n/cz/index.ts | 5 +- interface/src/i18n/de/index.ts | 5 +- interface/src/i18n/en/index.ts | 5 +- interface/src/i18n/fr/index.ts | 5 +- interface/src/i18n/it/index.ts | 5 +- interface/src/i18n/nl/index.ts | 5 +- interface/src/i18n/no/index.ts | 5 +- interface/src/i18n/pl/index.ts | 5 +- interface/src/i18n/sk/index.ts | 5 +- interface/src/i18n/sv/index.ts | 5 +- interface/src/i18n/tr/index.ts | 5 +- mock-api/rest_server.ts | 8 +- 14 files changed, 132 insertions(+), 96 deletions(-) diff --git a/interface/src/app/settings/Version.tsx b/interface/src/app/settings/Version.tsx index d7beeaa1e..38380a348 100644 --- a/interface/src/app/settings/Version.tsx +++ b/interface/src/app/settings/Version.tsx @@ -109,73 +109,49 @@ const Version = () => { useLayoutTitle('EMS-ESP Firmware'); - // see if we have internet access - const internet_live = - latestDevVersion !== undefined && latestVersion !== undefined; - - // check for older boards where auto-upgrade is not supported - const download_only = data && !data.psram; - - const renderUploadDialog = () => { - if (!internet_live) { - return null; - } - - return ( - setOpenDialog(false)} - > - - {(download_only ? LL.DOWNLOAD(0) : LL.INSTALL('')) + ' ' + ' Firmware'} - - - - {LL.INSTALL_VERSION( - download_only ? LL.DOWNLOAD(1) : LL.INSTALL(''), - useDev ? latestDevVersion : latestVersion - )} - - - - - + - {!download_only && ( - - )} - - - ); - }; + {LL.DOWNLOAD(1)} + + + + + + ); const showFirmwareDialog = (useDevVersion: boolean) => { if (useDevVersion || data.emsesp_version.includes('dev')) { @@ -190,6 +166,17 @@ const Version = () => { } const isDev = data.emsesp_version.includes('dev'); + // const isDev = false; // for testing + // const isDev = true; // for testing + + // check for older versions where auto-upgrade is not supported. These are bbqkees boards with no psram. + const canUpload = upgradeAvailable && data && data.psram; + // const canUpload = true as boolean; // for testing + // const canUpload = false as boolean; // for testing + + // see if we have internet access + const internet_live = + latestDevVersion !== undefined && latestVersion !== undefined; return ( <> @@ -260,7 +247,7 @@ const Version = () => { (changelog) - {!isDev && upgradeAvailable && ( + {!isDev && canUpload && ( + )} + {!isDev && !canUpload && ( + )} @@ -277,7 +283,7 @@ const Version = () => { (changelog) - {isDev && upgradeAvailable && ( + {isDev && canUpload && ( + )} + {isDev && !canUpload && ( + )} diff --git a/interface/src/components/layout/LayoutAppBar.tsx b/interface/src/components/layout/LayoutAppBar.tsx index 377ab5c04..bc0e84f46 100644 --- a/interface/src/components/layout/LayoutAppBar.tsx +++ b/interface/src/components/layout/LayoutAppBar.tsx @@ -58,7 +58,7 @@ const LayoutAppBar = ({ title, onToggleDrawer }: LayoutAppBarProps) => { > {pathnames[0] === 'status' ? LL.STATUS_OF('') : LL.SETTINGS(0)} -  |  +   |   diff --git a/interface/src/i18n/cz/index.ts b/interface/src/i18n/cz/index.ts index 0de8a84e2..4cb5f9d8b 100644 --- a/interface/src/i18n/cz/index.ts +++ b/interface/src/i18n/cz/index.ts @@ -331,7 +331,7 @@ const cz: Translation = { ALLVALUES: 'Všechny hodnoty', SPECIAL_FUNCTIONS: 'Speciální funkce', WAIT_FIRMWARE: 'Firmware se nahrává a instaluje', - INSTALL_VERSION: 'Tímto se {0} verze {1}. Jste si jistí?', + INSTALL_VERSION: 'Tímto se instalovat verze {0}. Jste si jistí?', SWITCH_DEV: 'přepnout na vývojovou verzi', UPGRADE_AVAILABLE: 'Je k dispozici aktualizace firmwaru!', LATEST_VERSION: 'Používáte nejnovější verzi firmwaru.', @@ -342,7 +342,8 @@ const cz: Translation = { DASHBOARD: 'Dashboard', NO_DATA: 'Žádná data nejsou k dispozici', DASHBOARD_1: 'Přizpůsobte si dashboard označením EMS entit jako Oblíbené pomocí modulu Přizpůsobení', - DEVELOPER_MODE: 'Režim vývojáře' + DEVELOPER_MODE: 'Režim vývojáře', + UPGRADE: 'Upgrade' // TODO translate }; export default cz; diff --git a/interface/src/i18n/de/index.ts b/interface/src/i18n/de/index.ts index b468050fd..d109017ad 100644 --- a/interface/src/i18n/de/index.ts +++ b/interface/src/i18n/de/index.ts @@ -331,7 +331,7 @@ const de: Translation = { ALLVALUES: 'Alle Werte', SPECIAL_FUNCTIONS: 'Sonderfunktionen', WAIT_FIRMWARE: 'Die Firmware wird hochgeladen und installiert.', - INSTALL_VERSION: 'Dadurch wird die Version {1} heruntergeladen. Sind Sie sicher?', + INSTALL_VERSION: 'Dadurch wird die Version {0} heruntergeladen. Sind Sie sicher?', SWITCH_DEV: 'Wechseln Sie zur Entwicklungsversion!', UPGRADE_AVAILABLE: 'Es ist ein Firmware-Upgrade verfügbar.', LATEST_VERSION: 'Sie verwenden die neueste Firmware-Version.', @@ -342,7 +342,8 @@ const de: Translation = { DASHBOARD: 'Dashboard', NO_DATA: 'Keine Daten verfügbar', DASHBOARD_1: 'Passen Sie Ihr Dashboard an, indem Sie EMS-Entitäten mithilfe des Moduls „Anpassungen“ als Favorit markieren', - DEVELOPER_MODE: 'Entwicklermodus' + DEVELOPER_MODE: 'Entwicklermodus', + UPGRADE: 'Upgrade' // TODO translate }; export default de; diff --git a/interface/src/i18n/en/index.ts b/interface/src/i18n/en/index.ts index 0d1de15ad..77e0d58d9 100644 --- a/interface/src/i18n/en/index.ts +++ b/interface/src/i18n/en/index.ts @@ -331,7 +331,7 @@ const en: Translation = { ALLVALUES: 'All Values', SPECIAL_FUNCTIONS: 'Special Functions', WAIT_FIRMWARE: 'Firmware is uploading and installing', - INSTALL_VERSION: 'This will {0} version {1}. Are you sure?', + INSTALL_VERSION: 'This will install version {0}. Are you sure?', SWITCH_DEV: 'switch to the development version', UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', LATEST_VERSION: 'You are using the latest firmware version.', @@ -342,7 +342,8 @@ const en: Translation = { DASHBOARD: 'Dashboard', NO_DATA: 'No data available', DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module', - DEVELOPER_MODE: 'Developer Mode' + DEVELOPER_MODE: 'Developer Mode', + UPGRADE: 'Upgrade' }; export default en; diff --git a/interface/src/i18n/fr/index.ts b/interface/src/i18n/fr/index.ts index deda198bf..0b360cea3 100644 --- a/interface/src/i18n/fr/index.ts +++ b/interface/src/i18n/fr/index.ts @@ -331,7 +331,7 @@ const fr: Translation = { ALLVALUES: 'All Values', // TODO translate SPECIAL_FUNCTIONS: 'Special Functions', WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate - INSTALL_VERSION: 'This will {0} version {1}. Are you sure?', // TODO translate + INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate SWITCH_DEV: 'switch to the development version', // TODO translate UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate @@ -342,7 +342,8 @@ const fr: Translation = { DASHBOARD: 'Dashboard', // TODO translate NO_DATA: 'No data available', // TODO translate DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module', // TODO translate - DEVELOPER_MODE: 'Developer Mode' // TODO translate + DEVELOPER_MODE: 'Developer Mode', // TODO translate + UPGRADE: 'Upgrade' // TODO translate }; export default fr; diff --git a/interface/src/i18n/it/index.ts b/interface/src/i18n/it/index.ts index 6dc5f60b1..777d54071 100644 --- a/interface/src/i18n/it/index.ts +++ b/interface/src/i18n/it/index.ts @@ -331,7 +331,7 @@ const it: Translation = { ALLVALUES: 'All Values', // TODO translate SPECIAL_FUNCTIONS: 'Special Functions', // TODO translate WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate - INSTALL_VERSION: 'This will {0} version {1}. Are you sure?', // TODO translate + INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate SWITCH_DEV: 'switch to the development version', // TODO translate UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate @@ -342,7 +342,8 @@ const it: Translation = { DASHBOARD: 'Dashboard', // TODO translate NO_DATA: 'No data available', // TODO translate DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module', // TODO translate - DEVELOPER_MODE: 'Developer Mode' // TODO translate + DEVELOPER_MODE: 'Developer Mode', // TODO translate + UPGRADE: 'Upgrade' // TODO translate }; export default it; diff --git a/interface/src/i18n/nl/index.ts b/interface/src/i18n/nl/index.ts index de018a996..ec5b3754f 100644 --- a/interface/src/i18n/nl/index.ts +++ b/interface/src/i18n/nl/index.ts @@ -331,7 +331,7 @@ const nl: Translation = { ALLVALUES: 'All Values', // TODO translate SPECIAL_FUNCTIONS: 'Special Functions', // TODO translate WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate - INSTALL_VERSION: 'This will {0} version {1}. Are you sure?', // TODO translate + INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate SWITCH_DEV: 'switch to the development version', // TODO translate UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate @@ -342,7 +342,8 @@ const nl: Translation = { DASHBOARD: 'Dashboard', // TODO translate NO_DATA: 'No data available', // TODO translate DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module', // TODO translate - DEVELOPER_MODE: 'Developer Mode' // TODO translate + DEVELOPER_MODE: 'Developer Mode', // TODO translate + UPGRADE: 'Upgrade' // TODO translate }; export default nl; diff --git a/interface/src/i18n/no/index.ts b/interface/src/i18n/no/index.ts index a3284f304..80031ef4c 100644 --- a/interface/src/i18n/no/index.ts +++ b/interface/src/i18n/no/index.ts @@ -331,7 +331,7 @@ const no: Translation = { ALLVALUES: 'All Values', // TODO translate SPECIAL_FUNCTIONS: 'Special Functions', // TODO translate WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate - INSTALL_VERSION: 'This will {0} version {1}. Are you sure?', // TODO translate + INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate SWITCH_DEV: 'switch to the development version', // TODO translate UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate @@ -342,7 +342,8 @@ const no: Translation = { DASHBOARD: 'Dashboard', // TODO translate NO_DATA: 'No data available', // TODO translate DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module', // TODO translate - DEVELOPER_MODE: 'Developer Mode' // TODO translate + DEVELOPER_MODE: 'Developer Mode', // TODO translate + UPGRADE: 'Upgrade' // TODO translate }; export default no; diff --git a/interface/src/i18n/pl/index.ts b/interface/src/i18n/pl/index.ts index 2d6d8f7c4..4fe2d3b72 100644 --- a/interface/src/i18n/pl/index.ts +++ b/interface/src/i18n/pl/index.ts @@ -331,7 +331,7 @@ const pl: BaseTranslation = { ALLVALUES: 'All Values', // TODO translate SPECIAL_FUNCTIONS: 'Special Functions', // TODO translate WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate - INSTALL_VERSION: 'This will {0} version {1}. Are you sure?', // TODO translate + INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate SWITCH_DEV: 'switch to the development version', // TODO translate UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate @@ -342,7 +342,8 @@ const pl: BaseTranslation = { DASHBOARD: 'Dashboard', // TODO translate NO_DATA: 'No data available', // TODO translate DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module', // TODO translate - DEVELOPER_MODE: 'Developer Mode' // TODO translate + DEVELOPER_MODE: 'Developer Mode', // TODO translate + UPGRADE: 'Upgrade' // TODO translate }; export default pl; diff --git a/interface/src/i18n/sk/index.ts b/interface/src/i18n/sk/index.ts index bdf160c4a..8e0428ec1 100644 --- a/interface/src/i18n/sk/index.ts +++ b/interface/src/i18n/sk/index.ts @@ -331,7 +331,7 @@ const sk: Translation = { ALLVALUES: 'Všetky hodnoty', SPECIAL_FUNCTIONS: 'Špeciálne funkcie', WAIT_FIRMWARE: 'Firmvér sa nahráva a inštaluje', - INSTALL_VERSION: 'Týmto sa {0} verzia {1}. Si si istý?', + INSTALL_VERSION: 'Týmto sa inštalovať verzia {0}. Si si istý?', SWITCH_DEV: 'prejsť na vývojovú verziu', UPGRADE_AVAILABLE: 'K dispozícii je aktualizácia firmvéru!', LATEST_VERSION: 'Používate poslednú verziu firmvéru.', @@ -342,7 +342,8 @@ const sk: Translation = { DASHBOARD: 'Panel', NO_DATA: 'Nie sú k dispozícii žiadne údaje', DASHBOARD_1: 'Prispôsobte si svoj informačný panel tak, že označíte entity EMS ako Obľúbené pomocou modulu Prispôsobenia', - DEVELOPER_MODE: 'Developer Mode' // TODO translate + DEVELOPER_MODE: 'Developer Mode', // TODO translate + UPGRADE: 'Upgrade' // TODO translate }; export default sk; diff --git a/interface/src/i18n/sv/index.ts b/interface/src/i18n/sv/index.ts index 6e51169eb..e12a0b8f9 100644 --- a/interface/src/i18n/sv/index.ts +++ b/interface/src/i18n/sv/index.ts @@ -331,7 +331,7 @@ const sv: Translation = { ALLVALUES: 'All Values', // TODO translate SPECIAL_FUNCTIONS: 'Special Functions', // TODO translate WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate - INSTALL_VERSION: 'This will {0} version {1}. Are you sure?', // TODO translate + INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate SWITCH_DEV: 'switch to the development version', // TODO translate UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate @@ -342,7 +342,8 @@ const sv: Translation = { DASHBOARD: 'Dashboard', // TODO translate NO_DATA: 'No data available', // TODO translate DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module', // TODO translate - DEVELOPER_MODE: 'Developer Mode' // TODO translate + DEVELOPER_MODE: 'Developer Mode', // TODO translate + UPGRADE: 'Upgrade' // TODO translate }; export default sv; diff --git a/interface/src/i18n/tr/index.ts b/interface/src/i18n/tr/index.ts index 5fe2b97d6..f09148225 100644 --- a/interface/src/i18n/tr/index.ts +++ b/interface/src/i18n/tr/index.ts @@ -331,7 +331,7 @@ const tr: Translation = { ALLVALUES: 'All Values', // TODO translate SPECIAL_FUNCTIONS: 'Special Functions', // TODO translate WAIT_FIRMWARE: 'Firmware is uploading and installing', // TODO translate - INSTALL_VERSION: 'This will {0} version {1}. Are you sure?', // TODO translate + INSTALL_VERSION: 'This will install version {0}. Are you sure?', // TODO translate SWITCH_DEV: 'switch to the development version', // TODO translate UPGRADE_AVAILABLE: 'There is a firmware upgrade available!', // TODO translate LATEST_VERSION: 'You are using the latest firmware version.', // TODO translate @@ -342,7 +342,8 @@ const tr: Translation = { DASHBOARD: 'Dashboard', // TODO translate NO_DATA: 'No data available', // TODO translate DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module', // TODO translate - DEVELOPER_MODE: 'Developer Mode' // TODO translate + DEVELOPER_MODE: 'Developer Mode', // TODO translate + UPGRADE: 'Upgrade' // TODO translate }; export default tr; diff --git a/mock-api/rest_server.ts b/mock-api/rest_server.ts index 56a752281..f6bfa5e7b 100644 --- a/mock-api/rest_server.ts +++ b/mock-api/rest_server.ts @@ -30,14 +30,14 @@ const headers = { }; // Versions - all without the 'v' -let THIS_VERSION = '3.7.1'; +let THIS_VERSION = '3.7.0'; let LATEST_STABLE_VERSION = '3.7.0'; -let LATEST_DEV_VERSION = '3.7.1-dev.4'; +let LATEST_DEV_VERSION = '3.7.1-dev.1'; let VERSION_IS_UPGRADEABLE = false; // for testing - scenario 1 -// THIS_VERSION = '3.7.1-dev.1'; -// VERSION_IS_UPGRADEABLE = true; +THIS_VERSION = '3.7.1-dev.1'; +VERSION_IS_UPGRADEABLE = true; // for testing - scenario 2 // THIS_VERSION = '3.6.5';