From 563268558b0a00892219510376bdfa5065b03444 Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Mon, 14 Oct 2024 16:32:17 +0800 Subject: [PATCH] Finished selecting peers in bulk to delete and download --- src/dashboard.py | 26 +- .../editConfiguration.vue | 2 +- .../configurationComponents/peerList.vue | 19 +- .../configurationComponents/peerSearch.vue | 16 +- .../configurationComponents/selectPeers.vue | 266 ++++++++++++++++++ src/static/app/src/components/navbar.vue | 4 +- src/static/css/dashboard.css | 16 +- 7 files changed, 321 insertions(+), 28 deletions(-) rename src/static/app/src/components/configurationComponents/{peerScheduleJobsComponents => }/editConfiguration.vue (99%) create mode 100644 src/static/app/src/components/configurationComponents/selectPeers.vue diff --git a/src/dashboard.py b/src/dashboard.py index baf8de4..b2d5c67 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -135,17 +135,18 @@ class DashboardLogger: self.loggerdb.commit() def log(self, URL: str = "", IP: str = "", Status: str = "true", Message: str = "") -> bool: - try: - with self.loggerdb: - loggerdbCursor = self.loggerdb.cursor() - loggerdbCursor.execute( - "INSERT INTO DashboardLog (LogID, URL, IP, Status, Message) VALUES (?, ?, ?, ?, ?)", (str(uuid.uuid4()), URL, IP, Status, Message,)) - if self.loggerdb.in_transaction: - self.loggerdb.commit() - return True - except Exception as e: - print(f"[WGDashboard] Access Log Error: {str(e)}") - return False + pass + # try: + # with self.loggerdb: + # loggerdbCursor = self.loggerdb.cursor() + # loggerdbCursor.execute( + # "INSERT INTO DashboardLog (LogID, URL, IP, Status, Message) VALUES (?, ?, ?, ?, ?)", (str(uuid.uuid4()), URL, IP, Status, Message,)) + # if self.loggerdb.in_transaction: + # self.loggerdb.commit() + # return True + # except Exception as e: + # print(f"[WGDashboard] Access Log Error: {str(e)}") + # return False class PeerJobLogger: def __init__(self): @@ -1940,7 +1941,8 @@ def API_downloadPeer(configName): if len(data['id']) == 0 or not peerFound: return ResponseObject(False, "Peer does not exist") return ResponseObject(data=peer.downloadPeer()) - + + @app.get(f"{APP_PREFIX}/api/downloadAllPeers/") def API_downloadAllPeers(configName): diff --git a/src/static/app/src/components/configurationComponents/peerScheduleJobsComponents/editConfiguration.vue b/src/static/app/src/components/configurationComponents/editConfiguration.vue similarity index 99% rename from src/static/app/src/components/configurationComponents/peerScheduleJobsComponents/editConfiguration.vue rename to src/static/app/src/components/configurationComponents/editConfiguration.vue index 569028c..bc3f64c 100644 --- a/src/static/app/src/components/configurationComponents/peerScheduleJobsComponents/editConfiguration.vue +++ b/src/static/app/src/components/configurationComponents/editConfiguration.vue @@ -33,7 +33,7 @@ const resetForm = () => { dataChanged.value = false; Object.assign(data, JSON.parse(JSON.stringify(props.configurationInfo))) } -const emit = defineEmits(["changed"]) +const emit = defineEmits(["changed", "close"]) const saveForm = () => { saving.value = true fetchPost("/api/updateWireguardConfiguration", data, (res) => { diff --git a/src/static/app/src/components/configurationComponents/peerList.vue b/src/static/app/src/components/configurationComponents/peerList.vue index 3189e2f..b3523e4 100644 --- a/src/static/app/src/components/configurationComponents/peerList.vue +++ b/src/static/app/src/components/configurationComponents/peerList.vue @@ -42,7 +42,8 @@ import PeerJobsLogsModal from "@/components/configurationComponents/peerJobsLogs import {ref} from "vue"; import PeerShareLinkModal from "@/components/configurationComponents/peerShareLinkModal.vue"; import LocaleText from "@/components/text/localeText.vue"; -import EditConfiguration from "@/components/configurationComponents/peerScheduleJobsComponents/editConfiguration.vue"; +import EditConfiguration from "@/components/configurationComponents/editConfiguration.vue"; +import SelectPeers from "@/components/configurationComponents/selectPeers.vue"; Chart.register( ArcElement, @@ -73,6 +74,7 @@ Chart.register( export default { name: "peerList", components: { + SelectPeers, EditConfiguration, LocaleText, PeerShareLinkModal, @@ -144,6 +146,9 @@ export default { }, editConfiguration: { modalOpen: false + }, + selectPeers: { + modalOpen: true } } }, @@ -592,6 +597,7 @@ export default { @jobsAll="this.peerScheduleJobsAll.modalOpen = true" @jobLogs="this.peerScheduleJobsLogs.modalOpen = true" @editConfiguration="this.editConfiguration.modalOpen = true" + @selectPeers="this.selectPeers.modalOpen = true" :configuration="this.configurationInfo">
+ + + +
\ No newline at end of file diff --git a/src/static/app/src/components/navbar.vue b/src/static/app/src/components/navbar.vue index d419bf0..052184e 100644 --- a/src/static/app/src/components/navbar.vue +++ b/src/static/app/src/components/navbar.vue @@ -45,7 +45,7 @@ export default { >