From 637920a928599d1002b0eac71a67f5abafd043e4 Mon Sep 17 00:00:00 2001 From: charleswrayjr Date: Tue, 9 Sep 2025 09:56:02 -0500 Subject: [PATCH] Separating the create client functionality from the main vpn lists. --- src/app/views/VPN/CreateVPNClientDialog.jsx | 3 ++- src/app/views/VPN/VPN.jsx | 27 +++++++++++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/app/views/VPN/CreateVPNClientDialog.jsx b/src/app/views/VPN/CreateVPNClientDialog.jsx index 3806c93..30f1cf3 100644 --- a/src/app/views/VPN/CreateVPNClientDialog.jsx +++ b/src/app/views/VPN/CreateVPNClientDialog.jsx @@ -5,6 +5,7 @@ const CreateVPNClientDialog = ( { open, onClose, onCreate }) => { const [clientName, setClientName] = useState(''); const [staticIp, setStaticIp] = useState(''); const [useStaticIp, setUseStaticIp] = useState(false); + // noinspection JSValidateTypes return ( Create New Client @@ -22,7 +23,7 @@ const CreateVPNClientDialog = ( { open, onClose, onCreate }) => { value={useStaticIp} onChange={(e) => setUseStaticIp(e.target.value)} fullWidth - > + variant='standard'> Dynamic IP Static IP diff --git a/src/app/views/VPN/VPN.jsx b/src/app/views/VPN/VPN.jsx index 7bbc48a..8906f20 100644 --- a/src/app/views/VPN/VPN.jsx +++ b/src/app/views/VPN/VPN.jsx @@ -12,8 +12,8 @@ const VPN = () => { const [password, setPassword] = useState('');*/ /*const [clientName, setClientName] = useState(''); const [staticIp, setStaticIp] = useState(''); - const [useStaticIp, setUseStaticIp] = useState(false);*/ - const [revokeClientName, setRevokeClientName] = useState(''); + const [useStaticIp, setUseStaticIp] = useState(false); + const [revokeClientName, setRevokeClientName] = useState('');*/ const [clients, setClients] = useState([]); const [availableClients, setAvailableClients] = useState( [] ); const [message, setMessage] = useState(''); @@ -47,16 +47,15 @@ const VPN = () => { const { clientName, useStaticIp, staticIp } = data; e.preventDefault(); setMessage( await VPNService.createClient({ clientName, useStaticIp, staticIp }, fetchClients ) ); + fetchAvailableClients().catch( e => setMessage( e ) ); setCreateOpen( false ); }; - const handleRevokeClientSubmit = async (e) => { - e.preventDefault(); + const handleRevokeClientSubmit = async ( revokeClientName ) => { setMessage( await VPNService.revokeClient( { revokeClientName }, fetchClients ) ); + fetchAvailableClients().catch( e => setMessage( e ) ); }; - console.log(availableClients); - return ( @@ -89,7 +88,7 @@ const VPN = () => { */} - Revoke OpenVPN Client + {/*Revoke OpenVPN Client
{ fullWidth /> - + */} Available OpenVPN Clients { }, header: 'Active Certificate' }, { accessorFn: row => clients.find( c => c.name === row.clientName ) ? 'Yes' : 'No', header: 'Connected' }, { accessorFn: row => row.hasOvpn ? 'Yes' : 'No', header: 'Has Profile' }, + { + header: 'Actions', + Cell: ({ row }) => ( + + ), + }, ]} data={availableClients} /> -- 2.43.0