Move DB maint to settings/exp section

This commit is contained in:
Mashintime 2023-07-01 17:03:22 -04:00
parent 6020ea9ce9
commit c0d65c3f9d
5 changed files with 29 additions and 11 deletions

View file

@ -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();
});

View file

@ -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.");
}

View file

@ -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,

View file

@ -261,9 +261,13 @@
class="dropdown-item bg-danger text-white"
id="delete_selected_chat"
href="#"
>Delete chat</a
>
><i
class="bi bi-person-x"
style="font-size: 1rem"
></i>
Delete chat</a>
</li>
<div class="dropdown-divider"></div>
<li>
<button
class="dropdown-item"
@ -278,14 +282,6 @@
Help
</button>
</li>
<li>
<button
class="dropdown-item"
id="btndbClean"
>
Clean Database
</button>
</li>
</ul>
<span

View file

@ -3796,6 +3796,12 @@
</div>
</label>
</div>
<div class="input-group input-group-sm mb-1">
<label class="input-group-text w-50">Database maintenance</label>
<label class="input-group-text w-50">
<button class="btn btn-outline-secondary btn-sm w-50" id="btnCleanDB" type="button">Clean</button>
</label>
</div>
<div class="center">
<div class="badge text-bg-danger">
<i class="bi bi-shield-exclamation"></i> These options may