From 416f83b1c317bd6d7591cfe2856ec001f9bae658 Mon Sep 17 00:00:00 2001 From: Jens Maus Date: Sun, 1 Nov 2026 19:00:09 +0000 Subject: [PATCH] webui: group the device firmware update dialog by device type and version --- .../js/lang/de/translate.lang.extension.js | 13 ++- .../js/lang/en/translate.lang.extension.js | 11 +- .../statusdisplaydialogacousticepaper.js | 12 +++ .../webui/js/pages/startpage/startpage.js | 102 +++++++++++++++--- 4 files changed, 119 insertions(+), 19 deletions(-) diff --git a/src/webui/www/webui/js/lang/de/translate.lang.extension.js b/src/webui/www/webui/js/lang/de/translate.lang.extension.js index b276e188d..592fd59b6 100644 --- a/src/webui/www/webui/js/lang/de/translate.lang.extension.js +++ b/src/webui/www/webui/js/lang/de/translate.lang.extension.js @@ -646,9 +646,14 @@ jQuery.extend(true,langJSON, { "dialogRenameVirtualGroupDeviceTitle" : "Umbenennung des virtuellen Ger%E4tes", "dialogVirtualGroupDeviceContent" : "M%F6chten Sie das virtuelle Ger%e4t der Gruppe sowie die entsprechenden Kan%E4le mit dem Gruppennamen %FCberschreiben?", "dialogShowDeviceFirmwareTitle" : "Es stehen Ger%E4te-Firmware-Updates zur Verf%FCgung", - "dialogShowDeviceFirmwareTHDevice": "Ger%E4t", - "dialogShowDeviceFirmwareTHCurFw": "Aktuell", - "dialogShowDeviceFirmwareTHNewFw": "Neu", + "dialogShowDeviceFirmwareTHDevice": "Ger%E4tetyp", + "dialogShowDeviceFirmwareTHSerials": "Seriennummern", + "dialogShowDeviceFirmwareTHCurFw": "Aktuelle Version", + "dialogShowDeviceFirmwareTHNewFw": "Empfohlene Version", + "dialogShowDeviceFirmwareDescription": "Ausf%FChrung", + "dialogShowDeviceFirmwareDownloadInfo1": "1. Empfohlene Firmwareversion herunterladen", + "dialogShowDeviceFirmwareDownloadInfo2": "2. Firmwaredatei unter", + "dialogShowDeviceFirmwareDownloadInfo3": "hochladen", "dialogShowDeviceFirmwareLinkDownload": "Zum Downloadbereich", "hintDevFwAlreadyUploaded" : "" + "Die aktuellste Firmware des Ger%E4tes befindet sich bereits auf der " + HMIdentifier.de.CCUShortName + ".\n"+ @@ -1099,4 +1104,4 @@ jQuery.extend(true,langJSON, { }); langJSON.de.hintActivateDetectorSelfTest += langJSON.de.checkSmokeDetectorSelfTest; -langJSON.de.hintReInclusionDetectorFailed += langJSON.de.checkSmokeDetectorSelfTest; \ No newline at end of file +langJSON.de.hintReInclusionDetectorFailed += langJSON.de.checkSmokeDetectorSelfTest; diff --git a/src/webui/www/webui/js/lang/en/translate.lang.extension.js b/src/webui/www/webui/js/lang/en/translate.lang.extension.js index 10ee4e390..b61976587 100644 --- a/src/webui/www/webui/js/lang/en/translate.lang.extension.js +++ b/src/webui/www/webui/js/lang/en/translate.lang.extension.js @@ -646,9 +646,14 @@ jQuery.extend(true, langJSON, { "dialogRenameVirtualGroupDeviceTitle" : "Rename the virtual device", "dialogVirtualGroupDeviceContent" : "Would you like to rename the virtual device of the group and its channels to the group name?", "dialogShowDeviceFirmwareTitle" : "There are new device firmware updates available", - "dialogShowDeviceFirmwareTHDevice": "Device", - "dialogShowDeviceFirmwareTHCurFw": "Current", - "dialogShowDeviceFirmwareTHNewFw": "New", + "dialogShowDeviceFirmwareTHDevice": "Device type", + "dialogShowDeviceFirmwareTHSerials": "Serial numbers", + "dialogShowDeviceFirmwareTHCurFw": "Current Version", + "dialogShowDeviceFirmwareTHNewFw": "Recommended Version", + "dialogShowDeviceFirmwareDescription": "Instruction", + "dialogShowDeviceFirmwareDownloadInfo1": "1. Download recommended version", + "dialogShowDeviceFirmwareDownloadInfo2": "2. Upload firmware file via", + "dialogShowDeviceFirmwareDownloadInfo3": "", "dialogShowDeviceFirmwareLinkDownload": "To download area", "hintDevFwAlreadyUploaded" : "" + "The latest firmware version of the device is alreay installed on the " + HMIdentifier.en.CCUShortName + ".\n"+ diff --git a/src/webui/www_source/webui/js/dialog/statusdisplaydialogacousticepaper.js b/src/webui/www_source/webui/js/dialog/statusdisplaydialogacousticepaper.js index c89c2910b..8b6d516e6 100644 --- a/src/webui/www_source/webui/js/dialog/statusdisplaydialogacousticepaper.js +++ b/src/webui/www_source/webui/js/dialog/statusdisplaydialogacousticepaper.js @@ -86,6 +86,18 @@ function showDisplayConfigTextHelp() { MessageBox.show(title, content,'', 475, 450); }; +function toggleSerialNumberDisplay() { + var tb = document.getElementById("fwUpdates"); + if (tb) { + var th = tb.getElementsByTagName("th")[2]; + // an empty value restores the default table-cell/table-column display + var display = (th.style.display === "none") ? "" : "none"; + th.style.display = display; + tb.getElementsByTagName("col")[2].style.display = display; + document.querySelectorAll('#fwUpdates tbody tr td:nth-child(3)').forEach(el=>el.style.display = display) + } +}; + StatusDisplayDialogAcousticEPaper = Class.create({ initialize: function(title, content, value, callback, contentType) { diff --git a/src/webui/www_source/webui/js/pages/startpage/startpage.js b/src/webui/www_source/webui/js/pages/startpage/startpage.js index 8bf67bdb9..83b61da9f 100644 --- a/src/webui/www_source/webui/js/pages/startpage/startpage.js +++ b/src/webui/www_source/webui/js/pages/startpage/startpage.js @@ -159,11 +159,28 @@ StartPage = Singleton.create(Page, { return false; },*/ + cmpVersion: function (aa, bb) { + // 0 Version equal + // >0 Version aa newer + // <0 Version bb newer + const aArr = aa.split("."); + const bArr = bb.split("."); + const max = Math.max(aArr.length, bArr.length); + for (let index = 0; index < max; index++) { + const a = Number(aArr[index] || 0); + const b = Number(bArr[index] || 0); + if (a != b) + return (a - b); + } + return 0; + }, + showAllDeviceFirmware: function() { var self = this; if (!this.fetchDeviceList) { this.fetchDeviceList = true; // prevents this to be called multiple times (when clicking the start page) this.messageBoxHTML = ""; + this.DeviceUpdateList = {}; this.newFwCounter = 0; this.devIndex = 0; if (this.devList.length == 0) { @@ -273,12 +290,23 @@ StartPage = Singleton.create(Page, { newFW = resultMajorMinor; } + // generate RefUpdateList with detailed Information per DeviceType for grouped list if (devIsUpdatable && fwVersion && (fwVersion != "n/a") && (newFW != curFw)) { + if (!this.DeviceUpdateList[deviceType]) { + this.DeviceUpdateList[deviceType] = {}; + } + var RefUpdateList = this.DeviceUpdateList[deviceType][curFw]; + if (!RefUpdateList) { + this.DeviceUpdateList[deviceType][curFw] = { DevCnt: 0, FWAvailable: 0, FWUpload: 0, Address: [], downloadURL: this.downloadURL, deviceTypeForUrl: deviceTypeForUrl, fwVersion: fwVersion, curVersion: curFw, availableFirmware: availableFW }; + RefUpdateList = this.DeviceUpdateList[deviceType][curFw]; + } + RefUpdateList.DevCnt++; + RefUpdateList.Address.push(self.devList[self.devIndex].address); // FW not yet available on the CCU if (availableFW != newFW) { - self.messageBoxHTML += "" + deviceType + "" + devAddress + "" + curFw + "" + fwVersion + ""; + RefUpdateList.FWUpload++; } else { - self.messageBoxHTML += "" + deviceType + "" + self.devList[self.devIndex].address + "" + curFw + "" + fwVersion + ""; + RefUpdateList.FWAvailable++; } self.newFwCounter++; } @@ -287,6 +315,40 @@ StartPage = Singleton.create(Page, { if (self.devIndex < self.devList.length) { self.fetchAndSetDeviceVersion(); } else { + for (const Typ of Object.keys(this.DeviceUpdateList).sort()) { + for (const curFw of Object.keys(this.DeviceUpdateList[Typ]).sort(this.cmpVersion)) { + let Obj = this.DeviceUpdateList[Typ][curFw]; + let curVersion = Obj.curVersion; + let color = "black"; + if (this.cmpVersion(Obj.curVersion, Obj.fwVersion) > 0) { + curVersion = "" + Obj.curVersion + ""; + color = "orange"; + } + this.messageBoxHTML += "" + + "" + + Typ + + "" + + "" + + Obj.DevCnt + + "" + + "" + + Obj.Address.join('
') + + "" + + "" + + curVersion + + "" + + " 0) ? + "onClick=\"window.location.href='" + + Obj.downloadURL + + "&serial=0&product=" + Obj.deviceTypeForUrl + "'\">" : + "onClick=\"alert(translateKey('hintDevFwAlreadyUploaded'));\">") + + Obj.fwVersion + + "" + + ""; + } + } self.fetchDeviceList = false; self.deleteScriptElements(); if (self.newFwCounter > 0) { @@ -313,26 +375,42 @@ StartPage = Singleton.create(Page, { }, showAvailableDeviceFirmware: function() { + var groupCounter = 0; + for (const Typ of Object.keys(this.DeviceUpdateList)) { + groupCounter += Object.keys(this.DeviceUpdateList[Typ]).length; + } + var quoteOpen = (getLang() == "de") ? "„" : "“", + quoteClose = (getLang() == "de") ? "“" : "”"; var contentHeight = jQuery("#content").innerHeight(), - maxMessageBoxHeight = (this.newFwCounter * 20) + 50, + maxMessageBoxHeight = (groupCounter + 5) * 20, msgBoxHeight = (maxMessageBoxHeight < contentHeight) ? maxMessageBoxHeight : contentHeight; MessageBox.show(translateKey("dialogShowDeviceFirmwareTitle"), - ""+ + "
"+ "" + - "" + - "" + - "" + + "" + + "" + + "" + + "" + + "" + "" + - ""+ - ""+ - ""+ - ""+ + ""+ + ""+ + ""+ + ""+ + ""+ this.messageBoxHTML + + "" + //"" + "
"+translateKey('dialogShowDeviceFirmwareTHDevice')+""+translateKey('thSerialNumber')+""+translateKey('dialogShowDeviceFirmwareTHCurFw')+""+translateKey('dialogShowDeviceFirmwareTHNewFw')+""+translateKey('dialogShowDeviceFirmwareTHDevice')+""+translateKey('lblQuantity')+""+translateKey('dialogShowDeviceFirmwareTHSerials')+""+translateKey('dialogShowDeviceFirmwareTHCurFw')+""+translateKey('dialogShowDeviceFirmwareTHNewFw')+"

"+translateKey('dialogShowDeviceFirmwareDescription')+":
" + + translateKey('dialogShowDeviceFirmwareDownloadInfo1') + "
" + + translateKey('dialogShowDeviceFirmwareDownloadInfo2') + " " + + quoteOpen + "" + + " => " + translateKey('footerBtnNew') + quoteClose + " " + + translateKey('dialogShowDeviceFirmwareDownloadInfo3') + + "
"+translateKey('dialogShowDeviceFirmwareLinkDownload')+"
", "", - 400, + 450, msgBoxHeight ); },