ui: Consider net.IP as strings
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
a56e59bf22
commit
145abc96a9
|
@ -1,9 +1,12 @@
|
|||
import type { Field } from '$lib/model/custom_form';
|
||||
|
||||
export function fillUndefinedValues(value: any, spec: Field) {
|
||||
if (value[spec.id] === undefined) {
|
||||
if (spec.type == "[]uint8") value[spec.id] = "";
|
||||
else if (spec.type.startsWith("[]")) value[spec.id] = [];
|
||||
else if (spec.type != "string" && !spec.type.startsWith("uint") && !spec.type.startsWith("int") && !spec.type.startsWith("time.Duration")) value[spec.id] = { };
|
||||
if (value[spec.id] === undefined && spec.type.length) {
|
||||
let vartype = spec.type;
|
||||
if (vartype[0] == "*") vartype = vartype.substring(1);
|
||||
|
||||
if (vartype == "[]uint8") value[spec.id] = "";
|
||||
else if (vartype.startsWith("[]")) value[spec.id] = [];
|
||||
else if (vartype != "string" && !vartype.startsWith("uint") && !vartype.startsWith("int") && vartype != "time.Duration" && vartype != "net.IP") value[spec.id] = { };
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue