From 6b4c98726d583c8cb2c083030e67d9d9c8a61a67 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 5 Mar 2025 17:20:36 +0100 Subject: [PATCH] system: tweak UX of tunables; closes #7440 Build a formatter for the empty default and hide the virtual fields from the default dialog by default. The cloning doesn't make a lot of sense here so remove it completely. Delete only if in config. --- .../controllers/OPNsense/Core/forms/tunable.xml | 5 ++++- .../mvc/app/views/OPNsense/Core/tunables.volt | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Core/forms/tunable.xml b/src/opnsense/mvc/app/controllers/OPNsense/Core/forms/tunable.xml index ee742a072..247e96417 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Core/forms/tunable.xml +++ b/src/opnsense/mvc/app/controllers/OPNsense/Core/forms/tunable.xml @@ -11,6 +11,7 @@ sysctl.type info + true 2 tunable_type @@ -18,8 +19,9 @@ sysctl.default_value - + info + true 4 @@ -30,6 +32,7 @@ text 3 + tunable_value diff --git a/src/opnsense/mvc/app/views/OPNsense/Core/tunables.volt b/src/opnsense/mvc/app/views/OPNsense/Core/tunables.volt index e19895104..a725aed09 100644 --- a/src/opnsense/mvc/app/views/OPNsense/Core/tunables.volt +++ b/src/opnsense/mvc/app/views/OPNsense/Core/tunables.volt @@ -34,9 +34,9 @@ del:'/api/core/tunables/del_item/', options: { formatters: { - "tunable_type": function (column, row) { + tunable_type: function (column, row) { let retval = "{{ lang._('environment')}}"; - switch (row[column.id]) { + switch (row.type) { case 'w': retval = "{{ lang._('runtime')}}"; break; @@ -48,6 +48,19 @@ break; } return retval; + }, + tunable_value: function (column, row) { + return row.value.length ? row.value : row.default_value; + }, + commands: function (column, row) { + if (row.uuid.includes('-') === true) { + /* real config items can be edited or removed */ + return ' ' + + ''; + } else { + /* allow edit, renders the value on save */ + return ''; + } } } }