chg: [instance:settings] UI improvements

pull/70/head
mokaddem 2021-07-23 14:51:48 +02:00
parent 22faffb170
commit cf793b6742
2 changed files with 13 additions and 8 deletions

View File

@ -216,31 +216,30 @@ class SettingsProviderTable extends AppTable
'Narud' => 'Narud',
];
},
'name' => 'Antagonist',
'severity' => 'warning',
'type' => 'select'
],
],
'floating-setting' => [
'description' => 'floaringSetting',
'errorMessage' => 'floaringSetting',
'default' => 'A default value',
// 'default' => 'A default value',
'name' => 'Uncategorized Setting',
'test' => 'testEmptyBecomesDefault',
'type' => 'string'
// 'severity' => 'critical',
'severity' => 'warning',
// 'severity' => 'info',
'type' => 'integer'
],
],
'Network' => [
'Proxy' => [
'proxy.host' => [
'description' => __('The hostname of an HTTP proxy for outgoing sync requests. Leave empty to not use a proxy.'),
'default' => '',
'name' => __('Host'),
'test' => 'testHostname',
'type' => 'string',
],
'proxy.port' => [
'description' => __('The TCP port for the HTTP proxy.'),
'default' => '',
'name' => __('Port'),
'test' => 'testForRangeXY',
'type' => 'integer',

View File

@ -474,6 +474,8 @@ function isLeaf($setting)
let oldValue = settingsFlattened[$input.data('setting-name')].value
if ($input.is('select')) {
oldValue = oldValue !== undefined ? oldValue : -1
} else {
oldValue = oldValue !== undefined ? oldValue : ''
}
$input.val(oldValue)
handleSettingValueChange($input)
@ -503,7 +505,7 @@ function isLeaf($setting)
function handleSettingValueChange($input) {
const oldValue = settingsFlattened[$input.data('setting-name')].value
const newValue = ($input.attr('type') == 'checkbox' ? $input.is(':checked') : $input.val())
if (newValue == oldValue) {
if (newValue == oldValue || (newValue == '' && oldValue == undefined)) {
restoreWarnings($input)
} else {
removeWarnings($input)
@ -664,4 +666,8 @@ function isLeaf($setting)
.custom-select ~ div > a.btn-reset-setting {
left: -2.5em;
}
.form-control ~ div > a.btn-reset-setting {
left: -3em;
}
</style>