Skip to content

Commit

Permalink
fix: remove initial_value again as it was not useful outside of booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Oct 19, 2021
1 parent 287269c commit 0cc984b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 23 deletions.
17 changes: 4 additions & 13 deletions selfservice/strategy/lookup/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,22 @@ import (
)

func NewRevealLookupNode() *node.Node {
return node.NewInputField(node.LookupReveal, "true", node.LookupGroup, node.InputAttributeTypeSubmit,
node.WithInputAttributes(func(a *node.InputAttributes) {
a.InitialValue = "false"
})).
return node.NewInputField(node.LookupReveal, "true", node.LookupGroup, node.InputAttributeTypeSubmit).
WithMetaLabel(text.NewInfoSelfServiceSettingsRevealLookup())
}

func NewRegenerateLookupNode() *node.Node {
return node.NewInputField(
node.LookupRegenerate, "true", node.LookupGroup, node.InputAttributeTypeSubmit, node.WithInputAttributes(func(a *node.InputAttributes) {
a.InitialValue = "false"
})).
node.LookupRegenerate, "true", node.LookupGroup, node.InputAttributeTypeSubmit).
WithMetaLabel(text.NewInfoSelfServiceSettingsRegenerateLookup())
}

func NewDisableLookupNode() *node.Node {
return node.NewInputField(node.LookupDisable, "true", node.LookupGroup, node.InputAttributeTypeSubmit, node.WithInputAttributes(func(a *node.InputAttributes) {
a.InitialValue = "false"
})).
return node.NewInputField(node.LookupDisable, "true", node.LookupGroup, node.InputAttributeTypeSubmit).
WithMetaLabel(text.NewInfoSelfServiceSettingsDisableLookup())
}

func NewConfirmLookupNode() *node.Node {
return node.NewInputField(node.LookupConfirm, "true", node.LookupGroup, node.InputAttributeTypeSubmit, node.WithInputAttributes(func(a *node.InputAttributes) {
a.InitialValue = "false"
})).
return node.NewInputField(node.LookupConfirm, "true", node.LookupGroup, node.InputAttributeTypeSubmit).
WithMetaLabel(text.NewInfoSelfServiceSettingsLookupConfirm())
}
6 changes: 0 additions & 6 deletions ui/node/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ type InputAttributes struct {
// The input's value.
FieldValue interface{} `json:"value,omitempty" faker:"string"`

// The input's initial value. This is primarily used for fields
// which are e.g. checkboxes or buttons (active/inactive).
// If this field is set on a button, it implies that
// clicking the button should trigger the "value" to be set.
InitialValue interface{} `json:"initial_value,omitempty" faker:"string"`

// Mark this input field as required.
Required bool `json:"required,omitempty"`

Expand Down
4 changes: 0 additions & 4 deletions ui/node/attributes_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,6 @@ func NewInputFieldFromSchema(name string, group Group, p jsonschemax.Path, opts
meta.Label = text.NewInfoNodeLabelGenerated(p.Title)
}

if attr.Type == InputAttributeTypeCheckbox {
attr.InitialValue = false
}

return &Node{
Type: Input,
Attributes: applyInputAttributes(opts, attr),
Expand Down

0 comments on commit 0cc984b

Please sign in to comment.