headplane/app/routes/dns/components/toggle-override-local-dns.tsx
Roberto Matias 908039464a feat: add local DNS override toggle component and action
Implements a user interface toggle component to control the override_local_dns
setting in Headscale. This allows administrators to force clients to use the
configured DNS servers instead of their local DNS configuration.

- Added ToggleOverrideLocalDns component
- Added corresponding action handler in dns-actions.ts
- Added section to the DNS overview panel
- Updated interface to reflect config changes immediately

Fixes #125
2025-03-26 15:45:19 +01:00

36 lines
1.3 KiB
TypeScript

import Dialog from '~/components/Dialog';
interface Props {
isEnabled: boolean;
isDisabled: boolean;
}
export default function Modal({ isEnabled, isDisabled }: Props) {
return (
<Dialog>
<Dialog.Button
isDisabled={isDisabled}
className={isEnabled ? "text-red-500 border-red-500" : ""}
>
{isEnabled ? 'Disable' : 'Enable'} Local DNS Override
</Dialog.Button>
<Dialog.Panel isDisabled={isDisabled}>
<Dialog.Title>
{isEnabled ? 'Disable' : 'Enable'} Local DNS Override
</Dialog.Title>
<Dialog.Text>
{isEnabled
? 'Devices will no longer have their local DNS settings overridden by Headscale.'
: 'Headscale will override local DNS settings on connected devices, forcing them to use the server\'s DNS configuration.'
}
</Dialog.Text>
<input type="hidden" name="action_id" value="toggle_override_local_dns" />
<input
type="hidden"
name="new_state"
value={isEnabled ? 'disabled' : 'enabled'}
/>
</Dialog.Panel>
</Dialog>
);
}