mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Move DB maint to settings/exp section
This commit is contained in:
parent
6020ea9ce9
commit
c0d65c3f9d
5 changed files with 29 additions and 11 deletions
|
@ -476,6 +476,11 @@ ipcMain.on("request-update-unread-messages-main", (event,arg) => {
|
||||||
//mainLog.info("Received reply from chat and ?new messages = " +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", () => {
|
ipcMain.on("request-open-tnc-log", () => {
|
||||||
logViewer.show();
|
logViewer.show();
|
||||||
});
|
});
|
||||||
|
|
|
@ -2681,6 +2681,10 @@ ipcRenderer.on("action-update-unread-messages", (event) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcRenderer.on("action-clean-db", (event) => {
|
||||||
|
dbClean();
|
||||||
|
});
|
||||||
|
|
||||||
// https://stackoverflow.com/a/18650828
|
// https://stackoverflow.com/a/18650828
|
||||||
function formatBytes(bytes, decimals = 2) {
|
function formatBytes(bytes, decimals = 2) {
|
||||||
if (!+bytes) return "0 Bytes";
|
if (!+bytes) return "0 Bytes";
|
||||||
|
@ -2915,5 +2919,5 @@ async function dbClean()
|
||||||
|
|
||||||
//Compact database
|
//Compact database
|
||||||
await db.compact();
|
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.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1606,6 +1606,11 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
daemon.stopTNC();
|
daemon.stopTNC();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// btnCleanDB button clicked
|
||||||
|
document.getElementById("btnCleanDB").addEventListener("click", () => {
|
||||||
|
ipcRenderer.send("request-clean-db");
|
||||||
|
});
|
||||||
|
|
||||||
// TEST HAMLIB
|
// TEST HAMLIB
|
||||||
document.getElementById("testHamlib").addEventListener("click", () => {
|
document.getElementById("testHamlib").addEventListener("click", () => {
|
||||||
var data_bits = document.getElementById("hamlib_data_bits").value;
|
var data_bits = document.getElementById("hamlib_data_bits").value;
|
||||||
|
@ -1627,6 +1632,8 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
var radiocontrol = "rigctld";
|
var radiocontrol = "rigctld";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
daemon.testHamlib(
|
daemon.testHamlib(
|
||||||
radiocontrol,
|
radiocontrol,
|
||||||
deviceid,
|
deviceid,
|
||||||
|
|
|
@ -261,9 +261,13 @@
|
||||||
class="dropdown-item bg-danger text-white"
|
class="dropdown-item bg-danger text-white"
|
||||||
id="delete_selected_chat"
|
id="delete_selected_chat"
|
||||||
href="#"
|
href="#"
|
||||||
>Delete chat</a
|
><i
|
||||||
>
|
class="bi bi-person-x"
|
||||||
|
style="font-size: 1rem"
|
||||||
|
></i>
|
||||||
|
Delete chat</a>
|
||||||
</li>
|
</li>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
<li>
|
<li>
|
||||||
<button
|
<button
|
||||||
class="dropdown-item"
|
class="dropdown-item"
|
||||||
|
@ -278,14 +282,6 @@
|
||||||
Help
|
Help
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<button
|
|
||||||
class="dropdown-item"
|
|
||||||
id="btndbClean"
|
|
||||||
>
|
|
||||||
Clean Database
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<span
|
<span
|
||||||
|
|
|
@ -3796,6 +3796,12 @@
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</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="center">
|
||||||
<div class="badge text-bg-danger">
|
<div class="badge text-bg-danger">
|
||||||
<i class="bi bi-shield-exclamation"></i> These options may
|
<i class="bi bi-shield-exclamation"></i> These options may
|
||||||
|
|
Loading…
Reference in a new issue