mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 00:07:26 +00:00
Services: Kea DHCP: Kea DHCPv4 - allow manual configuration for advanced scenarios, closes https://github.com/opnsense/core/issues/7822
This commit adds a toggle which skips config file generation for kea-dhcp4.conf and lets the user handle it manuallt, service startup and control stays in place while manually configured. When manual mode is selected, all other options will be hidden in the form, which should help people understand (and read) what the purpose of this toggle is (advanced mode).
This commit is contained in:
parent
4de4bd2774
commit
b55023315c
@ -115,7 +115,10 @@ function kea_configure_do($verbose = false)
|
||||
$keaDhcpv4 = new \OPNsense\Kea\KeaDhcpv4();
|
||||
if ($keaDhcpv4->isEnabled()) {
|
||||
service_log('Sync KEA DHCP config...', $verbose);
|
||||
$keaDhcpv4->generateConfig();
|
||||
if ($keaDhcpv4->general->manual_config->isEmpty()) {
|
||||
/* skip kea-dhcp4.conf when configured manually */
|
||||
$keaDhcpv4->generateConfig();
|
||||
}
|
||||
(new \OPNsense\Kea\KeaCtrlAgent())->generateConfig();
|
||||
service_log("done.\n", $verbose);
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<form>
|
||||
<field>
|
||||
<type>header</type>
|
||||
<label>General settings</label>
|
||||
<label>Service</label>
|
||||
</field>
|
||||
<field>
|
||||
<id>dhcpv4.general.enabled</id>
|
||||
@ -9,6 +9,17 @@
|
||||
<type>checkbox</type>
|
||||
<help>Enable DHCPv4 server.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>dhcpv4.general.manual_config</id>
|
||||
<label>Manual config</label>
|
||||
<type>checkbox</type>
|
||||
<advanced>true</advanced>
|
||||
<help>Disable configuration file generation and manage the file (/usr/local/etc/kea/kea-dhcp4.conf) manually.</help>
|
||||
</field>
|
||||
<field>
|
||||
<type>header</type>
|
||||
<label>General settings</label>
|
||||
</field>
|
||||
<field>
|
||||
<id>dhcpv4.general.interfaces</id>
|
||||
<label>Interfaces</label>
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
<Default>0</Default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<manual_config type="BooleanField"/>
|
||||
<interfaces type="InterfaceField">
|
||||
<Multiple>Y</Multiple>
|
||||
</interfaces>
|
||||
|
||||
@ -130,14 +130,36 @@
|
||||
}
|
||||
});
|
||||
|
||||
/* Manual configuration, hide all config elements except the service section*/
|
||||
$("#dhcpv4\\.general\\.manual_config").change(function(){
|
||||
let manual_config = $(this).is(':checked');
|
||||
if (manual_config) {
|
||||
if (!$("#show_advanced_frm_generalsettings").hasClass('fa-toggle-on')) {
|
||||
/* enforce advanced mode so the user notices the checkbox */
|
||||
$("#show_advanced_frm_generalsettings").click();
|
||||
}
|
||||
$(".is_managed").hide();
|
||||
} else {
|
||||
$(".is_managed").show();
|
||||
}
|
||||
$("#settings").find('table').each(function(){
|
||||
if (manual_config && $(this).find('#dhcpv4\\.general\\.manual_config').length == 0) {
|
||||
$(this).hide();
|
||||
} else {
|
||||
$(this).show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
|
||||
<li class="active"><a data-toggle="tab" href="#settings" id="tab_settings">{{ lang._('Settings') }}</a></li>
|
||||
<li><a data-toggle="tab" href="#subnets" id="tab_pools"> {{ lang._('Subnets') }} </a></li>
|
||||
<li><a data-toggle="tab" href="#reservations" id="tab_reservations"> {{ lang._('Reservations') }} </a></li>
|
||||
<li><a data-toggle="tab" href="#ha-peers" id="tab_ha-peers"> {{ lang._('HA Peers') }} </a></li>
|
||||
<li><a data-toggle="tab" href="#subnets" id="tab_pools" class="is_managed"> {{ lang._('Subnets') }} </a></li>
|
||||
<li><a data-toggle="tab" href="#reservations" id="tab_reservations" class="is_managed"> {{ lang._('Reservations') }} </a></li>
|
||||
<li><a data-toggle="tab" href="#ha-peers" id="tab_ha-peers" class="is_managed"> {{ lang._('HA Peers') }} </a></li>
|
||||
</ul>
|
||||
<div class="tab-content content-box">
|
||||
<!-- general settings -->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user