From 6233ad12aeaef6a026725a8bdf51a1a8ca24c734 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Sun, 14 Jan 2024 17:29:44 +0100 Subject: [PATCH 01/31] webapp: Prefix Country with CMT2300A --- webapp/src/locales/de.json | 2 +- webapp/src/locales/en.json | 2 +- webapp/src/locales/fr.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/src/locales/de.json b/webapp/src/locales/de.json index c7a707365..af36fdcaa 100644 --- a/webapp/src/locales/de.json +++ b/webapp/src/locales/de.json @@ -360,7 +360,7 @@ "CmtPaLevel": "CMT2300A Sendeleistung:", "NrfPaLevelHint": "Verwendet für HM-Wechselrichter. Stellen Sie sicher, dass Ihre Stromversorgung stabil genug ist, bevor Sie die Sendeleistung erhöhen.", "CmtPaLevelHint": "Verwendet für HMS/HMT-Wechselrichter. Stellen Sie sicher, dass Ihre Stromversorgung stabil genug ist, bevor Sie die Sendeleistung erhöhen.", - "CmtCountry": "Region/Land:", + "CmtCountry": "CMT2300A Region/Land:", "CmtCountryHint": "Jedes Land hat unterschiedliche Frequenzzuteilungen.", "country_0": "Europa ({min}MHz - {max}MHz)", "country_1": "Nordamerika ({min}MHz - {max}MHz)", diff --git a/webapp/src/locales/en.json b/webapp/src/locales/en.json index 0f5618e5c..007b9d0b9 100644 --- a/webapp/src/locales/en.json +++ b/webapp/src/locales/en.json @@ -360,7 +360,7 @@ "CmtPaLevel": "CMT2300A Transmitting power:", "NrfPaLevelHint": "Used for HM-Inverters. Make sure your power supply is stable enough before increasing the transmit power.", "CmtPaLevelHint": "Used for HMS/HMT-Inverters. Make sure your power supply is stable enough before increasing the transmit power.", - "CmtCountry": "Region/Country:", + "CmtCountry": "CMT2300A Region/Country:", "CmtCountryHint": "Each country has different frequency allocations.", "country_0": "Europe ({min}MHz - {max}MHz)", "country_1": "North America ({min}MHz - {max}MHz)", diff --git a/webapp/src/locales/fr.json b/webapp/src/locales/fr.json index cd968c5d2..9a2e6a930 100644 --- a/webapp/src/locales/fr.json +++ b/webapp/src/locales/fr.json @@ -360,7 +360,7 @@ "CmtPaLevel": "CMT2300A Niveau de puissance d'émission", "NrfPaLevelHint": "Used for HM-Inverters. Assurez-vous que votre alimentation est suffisamment stable avant d'augmenter la puissance d'émission.", "CmtPaLevelHint": "Used for HMS/HMT-Inverters. Assurez-vous que votre alimentation est suffisamment stable avant d'augmenter la puissance d'émission.", - "CmtCountry": "Region/Country:", + "CmtCountry": "CMT2300A Region/Country:", "CmtCountryHint": "Each country has different frequency allocations.", "country_0": "Europe ({min}MHz - {max}MHz)", "country_1": "North America ({min}MHz - {max}MHz)", From f26e82424781da8d78f08545170b84b2f8891b69 Mon Sep 17 00:00:00 2001 From: Nikolaj Kappler Date: Mon, 15 Jan 2024 22:40:23 +0100 Subject: [PATCH 02/31] fix #1649 one of the goals of my pull request, besides simplifying the code was to have localization. It's nice that the browser can handle this, but for consistency, we'll go with vue-i18n since it is already available --- webapp/src/components/EventLog.vue | 2 +- webapp/src/components/FirmwareInfo.vue | 5 +++-- webapp/src/locales/de.json | 3 ++- webapp/src/locales/en.json | 3 ++- webapp/src/locales/fr.json | 5 +++-- webapp/src/utils/time.ts | 10 +++++----- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/webapp/src/components/EventLog.vue b/webapp/src/components/EventLog.vue index db2b58382..93877536a 100644 --- a/webapp/src/components/EventLog.vue +++ b/webapp/src/components/EventLog.vue @@ -31,7 +31,7 @@ export default defineComponent({ computed: { timeInHours() { return (value: number) => { - return timestampToString(value); + return timestampToString(this.$i18n.locale, value)[0]; }; }, }, diff --git a/webapp/src/components/FirmwareInfo.vue b/webapp/src/components/FirmwareInfo.vue index 6dd69a14c..5687c1045 100644 --- a/webapp/src/components/FirmwareInfo.vue +++ b/webapp/src/components/FirmwareInfo.vue @@ -49,7 +49,7 @@ {{ $t('firmwareinfo.Uptime') }} - {{ timeInHours(systemStatus.uptime) }} + {{ $t('firmwareinfo.UptimeValue', timeInHours(systemStatus.uptime)) }} @@ -73,7 +73,8 @@ export default defineComponent({ computed: { timeInHours() { return (value: number) => { - return timestampToString(value, true); + const [count, time] = timestampToString(this.$i18n.locale, value, true); + return {count, time}; }; }, versionInfoUrl(): string { diff --git a/webapp/src/locales/de.json b/webapp/src/locales/de.json index af36fdcaa..9afd00140 100644 --- a/webapp/src/locales/de.json +++ b/webapp/src/locales/de.json @@ -188,7 +188,8 @@ "ResetReason0": "Reset Grund CPU 0", "ResetReason1": "Reset Grund CPU 1", "ConfigSaveCount": "Anzahl der Konfigurationsspeicherungen", - "Uptime": "Betriebszeit" + "Uptime": "Betriebszeit", + "UptimeValue": "0 Tage {time} | 1 Tag {time} | {count} Tage {time}" }, "hardwareinfo": { "HardwareInformation": "Hardwareinformationen", diff --git a/webapp/src/locales/en.json b/webapp/src/locales/en.json index 007b9d0b9..e23111610 100644 --- a/webapp/src/locales/en.json +++ b/webapp/src/locales/en.json @@ -188,7 +188,8 @@ "ResetReason0": "Reset Reason CPU 0", "ResetReason1": "Reset Reason CPU 1", "ConfigSaveCount": "Config save count", - "Uptime": "Uptime" + "Uptime": "Uptime", + "UptimeValue": "0 days {time} | 1 day {time} | {count} days {time}" }, "hardwareinfo": { "HardwareInformation": "Hardware Information", diff --git a/webapp/src/locales/fr.json b/webapp/src/locales/fr.json index 9a2e6a930..c7087c450 100644 --- a/webapp/src/locales/fr.json +++ b/webapp/src/locales/fr.json @@ -188,7 +188,8 @@ "ResetReason0": "Raison de la réinitialisation CPU 0", "ResetReason1": "Raison de la réinitialisation CPU 1", "ConfigSaveCount": "Nombre d'enregistrements de la configuration", - "Uptime": "Temps de fonctionnement" + "Uptime": "Durée de fonctionnement", + "UptimeValue": "0 jour {time} | 1 jour {time} | {count} jours {time}" }, "hardwareinfo": { "HardwareInformation": "Informations sur le matériel", @@ -616,4 +617,4 @@ "ValueSelected": "Sélectionné", "ValueActive": "Activé" } -} +} \ No newline at end of file diff --git a/webapp/src/utils/time.ts b/webapp/src/utils/time.ts index 6e0224038..afdb1fff9 100644 --- a/webapp/src/utils/time.ts +++ b/webapp/src/utils/time.ts @@ -1,8 +1,8 @@ -export const timestampToString = (timestampSeconds: number, includeDays = false): string => { - const timeString = new Date(timestampSeconds * 1000).toLocaleTimeString([], { timeZone: "UTC" }); - if (!includeDays) return timeString; +export const timestampToString = (locale: string, timestampSeconds: number, includeDays = false): string[] => { + const timeString = new Date(timestampSeconds * 1000).toLocaleTimeString(locale, { timeZone: "UTC", hour12: false }); + if (!includeDays) return [timeString]; const secondsPerDay = 60 * 60 * 24; - const days = Math.floor(timestampSeconds / secondsPerDay); - return new Intl.RelativeTimeFormat().format(-days, "day") + " " + timeString; + const days = Math.floor(timestampSeconds / secondsPerDay).toFixed(0); + return [days, timeString]; } \ No newline at end of file From caaa7b6347311aefeafa7f59f834ad1a957b80e3 Mon Sep 17 00:00:00 2001 From: Nikolaj Kappler Date: Mon, 15 Jan 2024 22:54:04 +0100 Subject: [PATCH 03/31] fix count being a string --- webapp/src/utils/time.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webapp/src/utils/time.ts b/webapp/src/utils/time.ts index afdb1fff9..45f7f3baa 100644 --- a/webapp/src/utils/time.ts +++ b/webapp/src/utils/time.ts @@ -1,8 +1,10 @@ -export const timestampToString = (locale: string, timestampSeconds: number, includeDays = false): string[] => { +export function timestampToString(locale: string, timestampSeconds: number, includeDays: true): [number, string]; +export function timestampToString(locale: string, timestampSeconds: number, includeDays?: false): [string]; +export function timestampToString(locale: string, timestampSeconds: number, includeDays = false): [number, string] | [string] { const timeString = new Date(timestampSeconds * 1000).toLocaleTimeString(locale, { timeZone: "UTC", hour12: false }); if (!includeDays) return [timeString]; const secondsPerDay = 60 * 60 * 24; - const days = Math.floor(timestampSeconds / secondsPerDay).toFixed(0); + const days = Math.floor(timestampSeconds / secondsPerDay); return [days, timeString]; } \ No newline at end of file From 72a2c58f1ee7f183676de28eb589494e595f546b Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Wed, 17 Jan 2024 22:52:22 +0100 Subject: [PATCH 04/31] Update bblanchon/ArduinoJson from 6.21.4 to 6.21.5 --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 54f39481a..ad8169a73 100644 --- a/platformio.ini +++ b/platformio.ini @@ -37,7 +37,7 @@ build_unflags = lib_deps = https://github.com/yubox-node-org/ESPAsyncWebServer - bblanchon/ArduinoJson @ ^6.21.4 + bblanchon/ArduinoJson @ ^6.21.5 https://github.com/bertmelis/espMqttClient.git#v1.5.0 nrf24/RF24 @ ^1.4.8 olikraus/U8g2 @ ^2.35.9 From bfeb852e230697f6fcdb542528c22ca15e98bd0b Mon Sep 17 00:00:00 2001 From: Nikolaj Kappler Date: Tue, 16 Jan 2024 21:08:22 +0100 Subject: [PATCH 05/31] webapp: Remove redundant main container --- webapp/src/App.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/webapp/src/App.vue b/webapp/src/App.vue index 8ace89a17..6fa6eeaa5 100644 --- a/webapp/src/App.vue +++ b/webapp/src/App.vue @@ -1,8 +1,6 @@ \ No newline at end of file + From 5d63f644118684e2991a50c1390b460a70be5661 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Fri, 19 Jan 2024 20:02:03 +0100 Subject: [PATCH 14/31] webapp: Fix typo --- webapp/src/components/GridProfile.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/src/components/GridProfile.vue b/webapp/src/components/GridProfile.vue index 6c93caece..3f2dbf10e 100644 --- a/webapp/src/components/GridProfile.vue +++ b/webapp/src/components/GridProfile.vue @@ -33,9 +33,9 @@ {{ value.n }} - + @@ -109,4 +109,4 @@ export default defineComponent({ }, }, }); - \ No newline at end of file + From 6b31a4d470ff4a7cf54544abc727bfcd058cfef6 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Fri, 19 Jan 2024 21:36:18 +0100 Subject: [PATCH 15/31] webapp: Introduce Modal component Less duplicated code --- webapp/src/components/Modal.vue | 52 +++ webapp/src/locales/de.json | 4 +- webapp/src/locales/en.json | 4 +- webapp/src/locales/fr.json | 4 +- webapp/src/views/ConfigAdminView.vue | 32 +- webapp/src/views/HomeView.vue | 356 +++++++-------------- webapp/src/views/InverterAdminView.vue | 271 +++++++--------- webapp/src/views/MaintenanceRebootView.vue | 26 +- 8 files changed, 310 insertions(+), 439 deletions(-) create mode 100644 webapp/src/components/Modal.vue diff --git a/webapp/src/components/Modal.vue b/webapp/src/components/Modal.vue new file mode 100644 index 000000000..25da81ac9 --- /dev/null +++ b/webapp/src/components/Modal.vue @@ -0,0 +1,52 @@ + + + diff --git a/webapp/src/locales/de.json b/webapp/src/locales/de.json index 149b2591e..6222a5906 100644 --- a/webapp/src/locales/de.json +++ b/webapp/src/locales/de.json @@ -29,7 +29,8 @@ "Save": "Speichern", "Refreshing": "Aktualisieren", "Pull": "Zum Aktualisieren nach unten ziehen", - "Release": "Loslassen zum Aktualisieren" + "Release": "Loslassen zum Aktualisieren", + "Close": "Schließen" }, "localeswitcher": { "Dark": "Dunkel", @@ -116,7 +117,6 @@ "UnreadMessages": "Ungelesene Meldungen", "Loading": "@:base.Loading", "EventLog": "Ereignisanzeige", - "Close": "Schließen", "InverterInfo": "Wechselrichter-Informationen", "LimitSettings": "Limit-Einstellungen", "LastLimitSetStatus": "Letzter Übertragungsstatus:", diff --git a/webapp/src/locales/en.json b/webapp/src/locales/en.json index 36c8d47f8..f46aa323f 100644 --- a/webapp/src/locales/en.json +++ b/webapp/src/locales/en.json @@ -29,7 +29,8 @@ "Save": "Save", "Refreshing": "Refreshing", "Pull": "Pull down to refresh", - "Release": "Release to refresh" + "Release": "Release to refresh", + "Close": "Close" }, "localeswitcher": { "Dark": "Dark", @@ -116,7 +117,6 @@ "UnreadMessages": "unread messages", "Loading": "@:base.Loading", "EventLog": "Event Log", - "Close": "Close", "InverterInfo": "Inverter Info", "LimitSettings": "Limit Settings", "LastLimitSetStatus": "Last Limit Set Status:", diff --git a/webapp/src/locales/fr.json b/webapp/src/locales/fr.json index b110d3a10..a0e0dbdb2 100644 --- a/webapp/src/locales/fr.json +++ b/webapp/src/locales/fr.json @@ -29,7 +29,8 @@ "Save": "Sauvegarder", "Refreshing": "Refreshing", "Pull": "Pull down to refresh", - "Release": "Release to refresh" + "Release": "Release to refresh", + "Close": "Fermer" }, "localeswitcher": { "Dark": "Sombre", @@ -116,7 +117,6 @@ "UnreadMessages": "messages non lus", "Loading": "@:base.Loading", "EventLog": "Journal des événements", - "Close": "Fermer", "InverterInfo": "Informations sur l'onduleur", "LimitSettings": "Paramètres de la limite", "LastLimitSetStatus": "Statut de la dernière limite fixée", diff --git a/webapp/src/views/ConfigAdminView.vue b/webapp/src/views/ConfigAdminView.vue index 942b82d52..01e352010 100644 --- a/webapp/src/views/ConfigAdminView.vue +++ b/webapp/src/views/ConfigAdminView.vue @@ -88,32 +88,21 @@ - + + {{ $t('configadmin.ResetMsg') }} + + \ No newline at end of file + diff --git a/webapp/src/views/HomeView.vue b/webapp/src/views/HomeView.vue index 7c9e9110b..12b5f8750 100644 --- a/webapp/src/views/HomeView.vue +++ b/webapp/src/views/HomeView.vue @@ -124,229 +124,122 @@ -