-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
added better default labels to form components #1040
Conversation
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.
This is all working fine, the three interactive
cases (explicit true
/false
and implicit autodetection) are working perfectly and the default values look great!
Yay thanks @pngwn! |
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.
LGTM, Good work!
@@ -4,7 +4,7 @@ | |||
export let value: boolean = false; | |||
export let default_value: boolean = false; | |||
export let style: string = ""; | |||
export let label: string; |
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.
Question: How does the label is realized when the user provides one?
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.
What do you mean , sorry?
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.
@pngwn the default label is assigned like this:
export let label: string = "Checkbox";
I was wondering how do we assign the label given by the user
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.
These export let
statement essentially marks the interface for the component. They are passed in from above : <Checkbox label="some_label" />
. Same way arguments are marked on a function and passed in by the caller.
@@ -164,5 +165,24 @@ def test_format_ner_list_empty(self): | |||
self.assertEqual(format_ner_list(string, groups), result) | |||
|
|||
|
|||
class TestDeleteNone(unittest.TestCase): |
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.
Good practice to write a test for it, great!
@@ -2371,7 +2369,11 @@ def get_template_context(self): | |||
return {"default_value": self.default_value, **super().get_template_context()} | |||
|
|||
|
|||
############################ |
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.
Better borders 👍
This PR adds better default labels to form components. Instead of "null", the label now shows the name of the component. For example, the default label for a slider is "Slider":
Of course, these labels can be overridden by the user to say whatever they want. In the
Interface
class, the labels continue to be based off of the parameter names (for the input components) and are "output" or "output X" for the output components.As part of this work, I also removed any prop whose value is "null" from the config. This could potentially lead to some problems, so it would be great if you could review this @pngwn. For example, I noticed that the
interactive
prop could taketrue
,false
, ornull
, and so I adapted the logic to not depend onnull
.Also I included some other minor cleanups that I noticed going through the components.py file.
Closes: #669 #982