mirror of
https://github.com/lucaspalomodevelop/opnsense-core.git
synced 2026-03-13 00:07:27 +00:00
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.
This commit is contained in:
parent
85319e2501
commit
6b4c98726d
@ -11,6 +11,7 @@
|
||||
<id>sysctl.type</id>
|
||||
<label>Type</label>
|
||||
<type>info</type>
|
||||
<advanced>true</advanced>
|
||||
<grid_view>
|
||||
<sequence>2</sequence>
|
||||
<formatter>tunable_type</formatter>
|
||||
@ -18,8 +19,9 @@
|
||||
</field>
|
||||
<field>
|
||||
<id>sysctl.default_value</id>
|
||||
<label>Default value</label>
|
||||
<label>Default</label>
|
||||
<type>info</type>
|
||||
<advanced>true</advanced>
|
||||
<grid_view>
|
||||
<sequence>4</sequence>
|
||||
</grid_view>
|
||||
@ -30,6 +32,7 @@
|
||||
<type>text</type>
|
||||
<grid_view>
|
||||
<sequence>3</sequence>
|
||||
<formatter>tunable_value</formatter>
|
||||
</grid_view>
|
||||
</field>
|
||||
<field>
|
||||
|
||||
@ -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 '<button type="button" class="btn btn-xs btn-default command-edit bootgrid-tooltip" data-row-id="' + row.uuid + '"><span class="fa fa-fw fa-pencil"></span></button> ' +
|
||||
'<button type="button" class="btn btn-xs btn-default command-delete bootgrid-tooltip" data-row-id="' + row.uuid + '"><span class="fa fa-fw fa-trash-o"></span></button>';
|
||||
} else {
|
||||
/* allow edit, renders the value on save */
|
||||
return '<button type="button" class="btn btn-xs btn-default command-edit bootgrid-tooltip" data-row-id="' + row.uuid + '"><span class="fa fa-fw fa-pencil"></span></button>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user