mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Select dynamic fixes (#13187)
* Fix select-dynamic changes require validation for select-dynamic allow 0 in config:set * fix zero_or_exists * validate, not validation :D
This commit is contained in:
@@ -72,7 +72,7 @@ class SetConfigCommand extends LnmsCommand
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $force && ! $value) {
|
if (! $force && $value === null) {
|
||||||
$message = $parent
|
$message = $parent
|
||||||
? trans('commands.config:set.forget_from', ['path' => $this->getChildPath($setting, $parent), 'parent' => $parent])
|
? trans('commands.config:set.forget_from', ['path' => $this->getChildPath($setting, $parent), 'parent' => $parent])
|
||||||
: trans('commands.config:set.confirm', ['setting' => $setting]);
|
: trans('commands.config:set.confirm', ['setting' => $setting]);
|
||||||
|
@@ -163,7 +163,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
});
|
});
|
||||||
|
|
||||||
Validator::extend('zero_or_exists', function ($attribute, $value, $parameters, $validator) {
|
Validator::extend('zero_or_exists', function ($attribute, $value, $parameters, $validator) {
|
||||||
if ($value === 0) {
|
if ($value === 0 || $value === '0') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"/js/app.js": "/js/app.js?id=a3b972f53d547c6c17ba",
|
"/js/app.js": "/js/app.js?id=14addcfe7f4fbe7a8495",
|
||||||
"/js/manifest.js": "/js/manifest.js?id=1514baaea419f38abb7d",
|
"/js/manifest.js": "/js/manifest.js?id=1514baaea419f38abb7d",
|
||||||
"/css/app.css": "/css/app.css?id=996b9e3da0c3ab98067e",
|
"/css/app.css": "/css/app.css?id=996b9e3da0c3ab98067e",
|
||||||
"/js/vendor.js": "/js/vendor.js?id=ccca9695062f1f68aaa8",
|
"/js/vendor.js": "/js/vendor.js?id=ccca9695062f1f68aaa8",
|
||||||
"/js/lang/de.js": "/js/lang/de.js?id=cc551d5a4aa98a6d7453",
|
"/js/lang/de.js": "/js/lang/de.js?id=cc551d5a4aa98a6d7453",
|
||||||
"/js/lang/en.js": "/js/lang/en.js?id=ed12053692c8faeb5c9f",
|
"/js/lang/en.js": "/js/lang/en.js?id=477413b4d5dc0ca3dcff",
|
||||||
"/js/lang/fr.js": "/js/lang/fr.js?id=aeac40fc3bd66cdfa69e",
|
"/js/lang/fr.js": "/js/lang/fr.js?id=aeac40fc3bd66cdfa69e",
|
||||||
"/js/lang/it.js": "/js/lang/it.js?id=ae198ed0b94351e4d950",
|
"/js/lang/it.js": "/js/lang/it.js?id=ae198ed0b94351e4d950",
|
||||||
"/js/lang/ru.js": "/js/lang/ru.js?id=f6b7c078755312a0907c",
|
"/js/lang/ru.js": "/js/lang/ru.js?id=f6b7c078755312a0907c",
|
||||||
|
@@ -64,7 +64,7 @@
|
|||||||
},
|
},
|
||||||
"required": ["type"],
|
"required": ["type"],
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"anyOf": [
|
"oneOf": [
|
||||||
{
|
{
|
||||||
"properties": {
|
"properties": {
|
||||||
"type": {"const": "select"},
|
"type": {"const": "select"},
|
||||||
@@ -89,9 +89,12 @@
|
|||||||
"minProperties": 1,
|
"minProperties": 1,
|
||||||
"required": ["target"],
|
"required": ["target"],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
"validate": {
|
||||||
|
"minProperties": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["options"]
|
"required": ["options", "validate"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@@ -79,7 +79,11 @@ export default {
|
|||||||
|
|
||||||
this.select2 = $(this.$el)
|
this.select2 = $(this.$el)
|
||||||
.find('select')
|
.find('select')
|
||||||
.select2(this.settings);
|
.select2(this.settings)
|
||||||
|
.on('select2:select select2:unselect', ev => {
|
||||||
|
this.$emit('change', this.select2.val());
|
||||||
|
this.$emit('select', ev['params']['data']);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.select2.select2('destroy');
|
this.select2.select2('destroy');
|
||||||
|
Reference in New Issue
Block a user