From b8792200c62472f5f19a7755b897b5d227c52e73 Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Tue, 19 Aug 2025 00:40:01 +0800 Subject: [PATCH] Peer groups are done... ish? --- src/modules/WireguardConfiguration.py | 9 ++- .../configurationComponents/peer.vue | 16 ++-- .../configurationComponents/peerList.vue | 8 +- .../configurationComponents/peerSearch.vue | 13 ++- .../peerSettingsDropdown.vue | 18 ++++- .../peerTagSelectDropdown.vue | 50 ++++++++++++ .../configurationComponents/peerTag.vue | 79 ++++++++++++++++--- .../configurationComponents/peerTagBadge.vue | 28 +++---- .../peerTagComponents/peerTagColorPicker.vue | 56 +++++++++++++ .../peerTagComponents/peerTagIconPicker.vue | 67 ++++++++++++++++ .../peerTagComponents/peerTagSetting.vue | 68 ++++++++-------- src/static/app/src/css/dashboard.css | 11 +++ .../stores/WireguardConfigurationsStore.js | 12 ++- ...ashboardClientAssignmentStore-BYyUcIAE.js} | 2 +- ...rowser-CUNU5TeN.js => browser-B0i-0kw7.js} | 2 +- ...r-gfqQFqhJ.js => clientViewer-BXwkKMuY.js} | 2 +- ...lients-CS5yac06.js => clients-BP6uWXZk.js} | 2 +- ...-CZ-cEoML.js => configuration-wsKGWItz.js} | 2 +- ...IFb9l.js => configurationList-DboEuUoe.js} | 2 +- ....min-ByYLSMoK.js => dayjs.min-BL2FwcOQ.js} | 2 +- ...WnGFi.js => editConfiguration-DdhjykFG.js} | 2 +- .../{index-Bnws_7p3.js => index-BkgMs09Q.js} | 2 +- .../WGDashboardAdmin/assets/index-CEgxlFph.js | 44 ----------- .../{index-Y0T0n_39.js => index-CZPsF2U9.js} | 2 +- .../WGDashboardAdmin/assets/index-D8FEWvTd.js | 45 +++++++++++ ...{index-BDaHdMHs.css => index-DKdU-4Tq.css} | 2 +- ...ext-CZEqppbJ.js => localeText-HhSrtmDv.js} | 2 +- ...essage-lE8RM6So.js => message-B9XkgTpS.js} | 2 +- ...wXHmPW.js => newConfiguration-CtqO761Q.js} | 2 +- .../{osmap-DvBgnKxV.js => osmap-sVTiryWD.js} | 2 +- ...l-kocgDJ98.js => peerAddModal-6OXzV-kx.js} | 2 +- ...nNgnueo.js => peerAssignModal-4s9KIRRj.js} | 2 +- ...L.js => peerConfigurationFile-Bu8LrVnZ.js} | 2 +- ...rJobs-BlEaLTIc.js => peerJobs-DhwxSw4D.js} | 2 +- ...RbUaVr.js => peerJobsAllModal-B2LsoJtz.js} | 2 +- ...-6iZ9.js => peerJobsLogsModal-wJXHXIpR.js} | 2 +- .../assets/peerList-Ds7SMCG6.js | 2 - .../assets/peerList-e93tedO9.css | 1 + .../assets/peerList-oFmqVRiE.css | 1 - .../assets/peerList-z0ZlmZDE.js | 2 + ...ode-DCXZjwoZ.js => peerQRCode-DIdJYEUb.js} | 2 +- ...-5wueDjMu.js => peerSearchBar-CWk5LEJ2.js} | 2 +- ...s-CJDRDmgG.js => peerSettings-gxsOaWwD.js} | 2 +- ...IV5B.js => peerShareLinkModal-B_68Izsk.js} | 2 +- .../{ping-BXHbuuvy.js => ping-ItWrZCNU.js} | 2 +- ...-DXFPK0lu.js => protocolBadge-BRFqOgHs.js} | 2 +- ...Mt.js => restoreConfiguration-tlX57SI4.js} | 2 +- ...x1Rvtbi.js => schedulePeerJob-CiqFx77z.js} | 2 +- ...rs-qGFGZiNO.js => selectPeers-77wUrv7v.js} | 2 +- ...tings-DmXi_k9q.js => settings-BV_3l2Qx.js} | 2 +- .../{setup-Cb9lSjMP.js => setup-BhLp9vvb.js} | 2 +- .../{share-CjPHj-7c.js => share-BF3Czia1.js} | 2 +- ...{signin-BSejuUSW.js => signin-2FKPJiWx.js} | 2 +- ..._index_0_scoped_9509d7a0_lang-Bdd268vD.js} | 2 +- ...s-BXp77NfT.js => systemStatus-PnxvVks-.js} | 2 +- .../{totp-Ro36WANQ.js => totp-kEQihdzW.js} | 2 +- ...ute-Jl0HSSXg.js => traceroute-CZAMGJz9.js} | 2 +- ...BC4djgzJ.js => vue-datepicker-DeX7yt2g.js} | 2 +- src/static/dist/WGDashboardAdmin/index.html | 4 +- 59 files changed, 432 insertions(+), 180 deletions(-) create mode 100644 src/static/app/src/components/configurationComponents/peerSettingsDropdownComponents/peerTagSelectDropdown.vue create mode 100644 src/static/app/src/components/configurationComponents/peerTagComponents/peerTagColorPicker.vue create mode 100644 src/static/app/src/components/configurationComponents/peerTagComponents/peerTagIconPicker.vue rename src/static/dist/WGDashboardAdmin/assets/{DashboardClientAssignmentStore-DgJ8bz1S.js => DashboardClientAssignmentStore-BYyUcIAE.js} (95%) rename src/static/dist/WGDashboardAdmin/assets/{browser-CUNU5TeN.js => browser-B0i-0kw7.js} (99%) rename src/static/dist/WGDashboardAdmin/assets/{clientViewer-gfqQFqhJ.js => clientViewer-BXwkKMuY.js} (98%) rename src/static/dist/WGDashboardAdmin/assets/{clients-CS5yac06.js => clients-BP6uWXZk.js} (96%) rename src/static/dist/WGDashboardAdmin/assets/{configuration-CZ-cEoML.js => configuration-wsKGWItz.js} (86%) rename src/static/dist/WGDashboardAdmin/assets/{configurationList-QPyIFb9l.js => configurationList-DboEuUoe.js} (98%) rename src/static/dist/WGDashboardAdmin/assets/{dayjs.min-ByYLSMoK.js => dayjs.min-BL2FwcOQ.js} (99%) rename src/static/dist/WGDashboardAdmin/assets/{editConfiguration-C6VWnGFi.js => editConfiguration-DdhjykFG.js} (99%) rename src/static/dist/WGDashboardAdmin/assets/{index-Bnws_7p3.js => index-BkgMs09Q.js} (98%) delete mode 100644 src/static/dist/WGDashboardAdmin/assets/index-CEgxlFph.js rename src/static/dist/WGDashboardAdmin/assets/{index-Y0T0n_39.js => index-CZPsF2U9.js} (99%) create mode 100644 src/static/dist/WGDashboardAdmin/assets/index-D8FEWvTd.js rename src/static/dist/WGDashboardAdmin/assets/{index-BDaHdMHs.css => index-DKdU-4Tq.css} (99%) rename src/static/dist/WGDashboardAdmin/assets/{localeText-CZEqppbJ.js => localeText-HhSrtmDv.js} (76%) rename src/static/dist/WGDashboardAdmin/assets/{message-lE8RM6So.js => message-B9XkgTpS.js} (84%) rename src/static/dist/WGDashboardAdmin/assets/{newConfiguration-DpwXHmPW.js => newConfiguration-CtqO761Q.js} (99%) rename src/static/dist/WGDashboardAdmin/assets/{osmap-DvBgnKxV.js => osmap-sVTiryWD.js} (99%) rename src/static/dist/WGDashboardAdmin/assets/{peerAddModal-kocgDJ98.js => peerAddModal-6OXzV-kx.js} (99%) rename src/static/dist/WGDashboardAdmin/assets/{peerAssignModal-DnNgnueo.js => peerAssignModal-4s9KIRRj.js} (97%) rename src/static/dist/WGDashboardAdmin/assets/{peerConfigurationFile-qA9pFzkL.js => peerConfigurationFile-Bu8LrVnZ.js} (92%) rename src/static/dist/WGDashboardAdmin/assets/{peerJobs-BlEaLTIc.js => peerJobs-DhwxSw4D.js} (90%) rename src/static/dist/WGDashboardAdmin/assets/{peerJobsAllModal-88RbUaVr.js => peerJobsAllModal-B2LsoJtz.js} (90%) rename src/static/dist/WGDashboardAdmin/assets/{peerJobsLogsModal-D6i-6iZ9.js => peerJobsLogsModal-wJXHXIpR.js} (96%) delete mode 100644 src/static/dist/WGDashboardAdmin/assets/peerList-Ds7SMCG6.js create mode 100644 src/static/dist/WGDashboardAdmin/assets/peerList-e93tedO9.css delete mode 100644 src/static/dist/WGDashboardAdmin/assets/peerList-oFmqVRiE.css create mode 100644 src/static/dist/WGDashboardAdmin/assets/peerList-z0ZlmZDE.js rename src/static/dist/WGDashboardAdmin/assets/{peerQRCode-DCXZjwoZ.js => peerQRCode-DIdJYEUb.js} (90%) rename src/static/dist/WGDashboardAdmin/assets/{peerSearchBar-5wueDjMu.js => peerSearchBar-CWk5LEJ2.js} (96%) rename src/static/dist/WGDashboardAdmin/assets/{peerSettings-CJDRDmgG.js => peerSettings-gxsOaWwD.js} (98%) rename src/static/dist/WGDashboardAdmin/assets/{peerShareLinkModal-DOdxIV5B.js => peerShareLinkModal-B_68Izsk.js} (98%) rename src/static/dist/WGDashboardAdmin/assets/{ping-BXHbuuvy.js => ping-ItWrZCNU.js} (97%) rename src/static/dist/WGDashboardAdmin/assets/{protocolBadge-DXFPK0lu.js => protocolBadge-BRFqOgHs.js} (79%) rename src/static/dist/WGDashboardAdmin/assets/{restoreConfiguration-CQrtQ-Mt.js => restoreConfiguration-tlX57SI4.js} (98%) rename src/static/dist/WGDashboardAdmin/assets/{schedulePeerJob-Cx1Rvtbi.js => schedulePeerJob-CiqFx77z.js} (96%) rename src/static/dist/WGDashboardAdmin/assets/{selectPeers-qGFGZiNO.js => selectPeers-77wUrv7v.js} (97%) rename src/static/dist/WGDashboardAdmin/assets/{settings-DmXi_k9q.js => settings-BV_3l2Qx.js} (99%) rename src/static/dist/WGDashboardAdmin/assets/{setup-Cb9lSjMP.js => setup-BhLp9vvb.js} (96%) rename src/static/dist/WGDashboardAdmin/assets/{share-CjPHj-7c.js => share-BF3Czia1.js} (95%) rename src/static/dist/WGDashboardAdmin/assets/{signin-BSejuUSW.js => signin-2FKPJiWx.js} (98%) rename src/static/dist/WGDashboardAdmin/assets/{storageMount.vue_vue_type_style_index_0_scoped_9509d7a0_lang-BdvkPqzU.js => storageMount.vue_vue_type_style_index_0_scoped_9509d7a0_lang-Bdd268vD.js} (93%) rename src/static/dist/WGDashboardAdmin/assets/{systemStatus-BXp77NfT.js => systemStatus-PnxvVks-.js} (96%) rename src/static/dist/WGDashboardAdmin/assets/{totp-Ro36WANQ.js => totp-kEQihdzW.js} (94%) rename src/static/dist/WGDashboardAdmin/assets/{traceroute-Jl0HSSXg.js => traceroute-CZAMGJz9.js} (96%) rename src/static/dist/WGDashboardAdmin/assets/{vue-datepicker-BC4djgzJ.js => vue-datepicker-DeX7yt2g.js} (99%) diff --git a/src/modules/WireguardConfiguration.py b/src/modules/WireguardConfiguration.py index 3aa6df10..fd1ff080 100644 --- a/src/modules/WireguardConfiguration.py +++ b/src/modules/WireguardConfiguration.py @@ -16,7 +16,7 @@ from .PeerJobs import PeerJobs from .PeerShareLinks import PeerShareLinks from .Utilities import StringToBoolean, GenerateWireguardPublicKey, RegexMatch, ValidateDNSAddress, \ ValidateEndpointAllowedIPs -from .WireguardConfigurationInfo import WireguardConfigurationInfo +from .WireguardConfigurationInfo import WireguardConfigurationInfo, PeerGroupsClass class WireguardConfiguration: @@ -1110,7 +1110,7 @@ class WireguardConfiguration: except Exception as e: return False - def updateConfigurationInfo(self, key: str, value: str | dict[str, str]) -> tuple[bool, Any, str] | tuple[ + def updateConfigurationInfo(self, key: str, value: str | dict[str, str] | dict[str, dict]) -> tuple[bool, Any, str] | tuple[ bool, str, None] | tuple[bool, None, None]: if key == "Description": self.configurationInfo.Description = value @@ -1124,6 +1124,11 @@ class WireguardConfiguration: return False, str(e), None self.configurationInfo.OverridePeerSettings = ( self.configurationInfo.OverridePeerSettings.model_validate(value)) + elif key == "PeerGroups": + peerGroups = {} + for name, data in value.items(): + peerGroups[name] = PeerGroupsClass(**data) + self.configurationInfo.PeerGroups = peerGroups else: return False, "Key does not exist", None diff --git a/src/static/app/src/components/configurationComponents/peer.vue b/src/static/app/src/components/configurationComponents/peer.vue index 812eea34..a1daf330 100644 --- a/src/static/app/src/components/configurationComponents/peer.vue +++ b/src/static/app/src/components/configurationComponents/peer.vue @@ -15,7 +15,7 @@ export default { PeerTagBadge, LocaleText, PeerSettingsDropdown }, props: { - Peer: Object + Peer: Object, ConfigurationInfo: Object }, data(){ return { @@ -106,7 +106,9 @@ export default {
- +