-
Notifications
You must be signed in to change notification settings - Fork 4
Salt form data #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Salt form data #22
Conversation
5aba712
to
a67591a
Compare
d3a67d8
to
f24f262
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a first batch of comments before I run it and try to break it
# This method propagates the values to the underlying widgets. | ||
# | ||
# @example Setting values for included widgets | ||
# form.values = { "name" => "John", "surname" => "Doe" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# form.values = { "name" => "John", "surname" => "Doe" } | |
# form.value = { "name" => "John", "surname" => "Doe" } |
VBox(*children) | ||
end | ||
|
||
# Sets the value for the form |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this is copied from Form, I wonder if the code can be shared.
# version. | ||
def next_handler | ||
return false unless Yast::Popup.YesNo("Do you want to exit?") | ||
puts data.to_h.inspect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
puts data.to_h.inspect | |
require "yaml" # at the top of the file | |
puts data.to_h.to_yaml |
In the current state, when I change the Name field and press Next, the data still contains the old value. |
* For debugging purposes only.
we should extract the common parts to a mixin
778514d
to
68e29df
Compare
This PR adds support to store the data from the form so it can be exported later to be used as part of a Pillar.
Basically, a new
FormData
class has been added which offers an API to add, update and remove information (including collections). The data is referred using a regular path (eg..root.person
) and it is stored in a hash.To avoid coupling the widgets with the form data, a new
Form
widget has been introduced. To populate the form with the initial values, the#value=
method is used (values are then propagated to internal widgets). The#result
method offers a way to get the final values.In scope
Out of scope
test_formula
client dumps the result to the standard output.