diff --git a/gui/main.js b/gui/main.js index 0a699244..1901a5ac 100644 --- a/gui/main.js +++ b/gui/main.js @@ -476,6 +476,11 @@ ipcMain.on("request-update-unread-messages-main", (event,arg) => { //mainLog.info("Received reply from chat and ?new messages = " +arg); }); +//Called by main to notify chat we should clean the DB +ipcMain.on("request-clean-db", (event,arg) => { + chat.webContents.send("action-clean-db"); +}); + ipcMain.on("request-open-tnc-log", () => { logViewer.show(); }); diff --git a/gui/preload-chat.js b/gui/preload-chat.js index ad70f9b1..7e1693b3 100644 --- a/gui/preload-chat.js +++ b/gui/preload-chat.js @@ -2681,6 +2681,10 @@ ipcRenderer.on("action-update-unread-messages", (event) => { }); }); +ipcRenderer.on("action-clean-db", (event) => { + dbClean(); +}); + // https://stackoverflow.com/a/18650828 function formatBytes(bytes, decimals = 2) { if (!+bytes) return "0 Bytes"; @@ -2915,5 +2919,5 @@ async function dbClean() //Compact database await db.compact(); - window.alert("Database maintenance is complete. " + itemCount + " items removed from database."); + window.alert("Database maintenance is complete. " + itemCount + " items removed from database. It's recommended you now restart the GUI."); } diff --git a/gui/preload-main.js b/gui/preload-main.js index df277654..38d73a2f 100644 --- a/gui/preload-main.js +++ b/gui/preload-main.js @@ -1606,6 +1606,11 @@ window.addEventListener("DOMContentLoaded", () => { daemon.stopTNC(); }); +// btnCleanDB button clicked +document.getElementById("btnCleanDB").addEventListener("click", () => { + ipcRenderer.send("request-clean-db"); +}); + // TEST HAMLIB document.getElementById("testHamlib").addEventListener("click", () => { var data_bits = document.getElementById("hamlib_data_bits").value; @@ -1627,6 +1632,8 @@ window.addEventListener("DOMContentLoaded", () => { var radiocontrol = "rigctld"; } + + daemon.testHamlib( radiocontrol, deviceid, diff --git a/gui/src/chat-module.html b/gui/src/chat-module.html index b30c5bfa..ba116fcb 100644 --- a/gui/src/chat-module.html +++ b/gui/src/chat-module.html @@ -261,9 +261,13 @@ class="dropdown-item bg-danger text-white" id="delete_selected_chat" href="#" - >Delete chat + > +Delete chat +