Skip to content

Conversation

@m-dilorenzi
Copy link
Collaborator

@m-dilorenzi m-dilorenzi commented Jan 26, 2026

This pull request introduces new features and usability improvements to the OpenVPN tunnel management UI, including two new modals for certificate regeneration and tunnel details, as well as enhancements to existing components. The changes also extend the tunnel data model to support new fields and improve button visibility and labeling for a more consistent user experience.

New modals and feature integration:

  • Added RegenerateCertsModal.vue and integrated it into TunnelManager.vue to allow users to regenerate certificates for tunnels, with error handling and feedback.

  • Added TunnelInfoModal.vue and integrated it into TunnelManager.vue to display detailed information about a selected tunnel, including new fields like certificate expiry, bytes sent/received, and connection status.

Tunnel data model extension:

  • Extended ServerTunnel and ClientTunnel types in TunnelManager.vue to include optional fields: cert_expiry_ts, bytes_received, bytes_sent, and since, enabling richer tunnel information display

UI and usability improvements:

  • Changed button kinds for adding tunnels and importing configurations from secondary to primary for better visibility in TunnelManager.vue

  • Added helper text for tunnel name input in CreateOrEditTunnelDrawer.vue and a cancel label for the delete modal in DeleteTunnelModal.vue to improve form clarity and consistency

Copyright updates:

  • Updated copyright years to 2026 in all modified and new components.

These changes collectively improve the tunnel management experience by adding new capabilities, enhancing the UI, and ensuring the codebase remains up-to-date.

Refs: NethServer/nethsecurity#1481

@m-dilorenzi m-dilorenzi requested a review from Tbaile January 26, 2026 13:49
@m-dilorenzi m-dilorenzi self-assigned this Jan 26, 2026
@m-dilorenzi m-dilorenzi force-pushed the openvpn_certs_management branch from f701321 to b006289 Compare January 26, 2026 15:59
Comment on lines 45 to 68
const fieldLabels = computed(() => {
const isTunnelClient = _itemToShow.value ? isClientTunnel(_itemToShow.value) : false

return {
bytes_received: t('standalone.openvpn_tunnel.bytes_received'),
bytes_sent: t('standalone.openvpn_tunnel.bytes_sent'),
cert_expiry_ts: isTunnelClient
? t('standalone.openvpn_tunnel.client_cert_expiry')
: t('standalone.openvpn_tunnel.cert_expiry'),
connected: t('standalone.openvpn_tunnel.connection'),
enabled: t('standalone.openvpn_tunnel.status'),
id: 'Tunnel ID',
local_network: t('standalone.openvpn_tunnel.local_networks'),
ns_name: t('standalone.openvpn_tunnel.name'),
port: t('standalone.openvpn_tunnel.port'),
real_address: t('standalone.openvpn_tunnel.real_address'),
remote_network: t('standalone.openvpn_tunnel.remote_networks'),
since: t('standalone.openvpn_tunnel.since'),
topology: t('standalone.openvpn_tunnel.topology'),
virtual_address: t('standalone.openvpn_tunnel.virtual_address'),
vpn_network: t('standalone.openvpn_tunnel.vpn_network'),
remote_host: t('standalone.openvpn_tunnel.remote_host')
}
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not liking this approach, since you're not re-using this, you can just replace every fieldLabels['X'] with the proper t('standalone.openvpn_tunnel.bytes_received')

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, replaced the function usage with the proper label directly in the template

Comment on lines 70 to 103
function formatFieldValue(key: string, value: any): string {
if (value === null || value === undefined || value === '') return ''

// Handle timestamps
if ((key === 'cert_expiry_ts' || key === 'since') && typeof value === 'number') {
const date = new Date(value * 1000)
return date.toLocaleString(locale.value)
}

// Handle boolean-like fields
if (key === 'connected') {
return value
? t('standalone.openvpn_tunnel.connected')
: t('standalone.openvpn_tunnel.not_connected')
}

if (key === 'enabled') {
return value ? t('standalone.openvpn_tunnel.enabled') : t('standalone.openvpn_tunnel.disabled')
}

// Handle arrays
if (Array.isArray(value)) {
return value.join(', ')
}

return String(value)
}

function isFieldVisible(key: string, value: any): boolean {
// Check if field has a meaningful value
if (value === null || value === undefined || value === '') return false
if (Array.isArray(value) && value.length === 0) return false
return true
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These too, we are not cycling through an unknown object, we know all values, you can remove this and add this logic directly in the template below

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, replaced the function usage with the correct logic for each field directly in the template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenVPN tunnel: Increase server and client certificate duration

3 participants