form: New property to hide a given field in interface
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
1bcc5253cf
commit
56e56ed75b
@ -155,6 +155,8 @@ func getSpecs(svcType reflect.Type) viewServiceSpec {
|
|||||||
f.Required = true
|
f.Required = true
|
||||||
case "secret":
|
case "secret":
|
||||||
f.Secret = true
|
f.Secret = true
|
||||||
|
case "hidden":
|
||||||
|
f.Hide = true
|
||||||
default:
|
default:
|
||||||
f.Label = kv[0]
|
f.Label = kv[0]
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,9 @@ type Field struct {
|
|||||||
// the field when not needed. When typing, it doesn't hide characters like in password input.
|
// the field when not needed. When typing, it doesn't hide characters like in password input.
|
||||||
Secret bool `json:"secret,omitempty"`
|
Secret bool `json:"secret,omitempty"`
|
||||||
|
|
||||||
|
// Hide indicates if the field should be hidden to the user.
|
||||||
|
Hide bool `json:"hide,omitempty"`
|
||||||
|
|
||||||
// Description stores an helpfull sentence describing the field.
|
// Description stores an helpfull sentence describing the field.
|
||||||
Description string `json:"description,omitempty"`
|
Description string `json:"description,omitempty"`
|
||||||
}
|
}
|
||||||
@ -102,6 +105,8 @@ func GenField(field reflect.StructField) (f *Field) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch strings.ToLower(kv[0]) {
|
switch strings.ToLower(kv[0]) {
|
||||||
|
case "hidden":
|
||||||
|
f.Hide = true
|
||||||
case "required":
|
case "required":
|
||||||
f.Required = true
|
f.Required = true
|
||||||
case "secret":
|
case "secret":
|
||||||
|
@ -27,7 +27,9 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if type.substring(0, 2) === '[]' && type !== '[]byte' && type !== '[]uint8'}
|
{#if specs && specs.hide}
|
||||||
|
<!-- hidden input -->
|
||||||
|
{:else if type.substring(0, 2) === '[]' && type !== '[]byte' && type !== '[]uint8'}
|
||||||
<TableInput
|
<TableInput
|
||||||
edit={edit || editToolbar}
|
edit={edit || editToolbar}
|
||||||
{index}
|
{index}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user