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
|
||||
case "secret":
|
||||
f.Secret = true
|
||||
case "hidden":
|
||||
f.Hide = true
|
||||
default:
|
||||
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.
|
||||
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 string `json:"description,omitempty"`
|
||||
}
|
||||
@ -102,6 +105,8 @@ func GenField(field reflect.StructField) (f *Field) {
|
||||
}
|
||||
} else {
|
||||
switch strings.ToLower(kv[0]) {
|
||||
case "hidden":
|
||||
f.Hide = true
|
||||
case "required":
|
||||
f.Required = true
|
||||
case "secret":
|
||||
|
@ -27,7 +27,9 @@
|
||||
}
|
||||
</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
|
||||
edit={edit || editToolbar}
|
||||
{index}
|
||||
|
Loading…
x
Reference in New Issue
Block a user