-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add Support for New Slider in Common Properties #1675
Conversation
Signed-off-by: srikant <[email protected]>
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.
I think you'll need to add schema support in uihints for min/max. step should already be support but it can't be part of the value.
"title": "Slider with Min Max" | ||
}, | ||
"current_parameters": { | ||
"slider": { |
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 can only be "slider: 10`. We don't support an object like this.
"id": "slider_error", | ||
"type": "object", | ||
"required": true, | ||
"default": { |
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.
We can't have a value like this. Should be default: 50
or something like that.
}, | ||
"control": "slider", | ||
"class_name": "slider", | ||
"slider": { |
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 doesn't follow any of our standards. I don't really even know how this works.
Signed-off-by: srikant <[email protected]>
Hi @matthoward366 Please review the schema changes and slider component with changes related to above feedback. |
Signed-off-by: srikant <[email protected]>
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.
Once the code changes are done we'll need unit tests.
this.id = ControlUtils.getControlId(props.propertyId, this.uuid); | ||
this.state = { | ||
value: props.value, | ||
min: props.control.min_value, |
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.
min, max, and step shouldn't be state values. These don't change. Does value also need to be in the state? We should be able to get this directly from the controller/redux.
data-id={ControlUtils.getDataId(this.props.propertyId)} | ||
> | ||
<Slider | ||
id={this.id} |
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.
Is id required? From the docs it's not. In that case we can remove the code for it.
<Slider | ||
id={this.id} | ||
value={this.state.value} | ||
min={this.state.min} |
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 happens in min, max, step aren't defined? Shouldn't we default them in the code?
labelText={this.props.controlItem} | ||
onChange={this.handleChange} | ||
disabled={this.props.state === STATES.DISABLED} | ||
formatLabel={ |
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.
Why does minLabel or maxLabel work?
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.
Can you answer this?
@@ -330,6 +336,8 @@ export class ParameterDef { | |||
"orientation": propertyOf(uihint)("orientation"), | |||
"width": propertyOf(uihint)("width"), | |||
"charLimit": propertyOf(uihint)("char_limit"), | |||
"min_value": propertyOf(uihint)("min_value"), |
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.
internally we usually use camalCase. So minValue and maxValue.
{ | ||
"id": "slider-disable", | ||
"type": "boolean" | ||
}, |
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.
Can you make sure to format the file?
}, | ||
{ | ||
"id": "slider_error", | ||
"type": "object", |
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 shouldn't be an object
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.
can we also test with double values. Something with 0 and 1 being the min/max with increments of 0.1
"min_value": 10, | ||
"max_value": 100, | ||
"increment": 10, | ||
"test": "test", |
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 looks wrong. I don't think test
is valid.
…ted to Slider component Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
Hi @matthoward366 Please review these changes and also I have included test cases. |
min-width: 8.6rem; | ||
} | ||
.bx--slider-text-input { | ||
background-color: #F4F4F4; |
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.
Why do you need to set this? This should be controlled by light
property on the control. It also needs to be set based on if it's in a tearsheet or right side flyout.
*/ | ||
.properties-slider { | ||
.bx--slider { | ||
min-width: 8.6rem; |
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.
Can you add a comment as to why this is needed?
labelText={this.props.controlItem} | ||
onChange={this.handleChange} | ||
disabled={this.props.state === STATES.DISABLED} | ||
formatLabel={ |
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.
Can you answer this?
"slider-disable": false | ||
}, | ||
"parameters": [ | ||
{ |
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.
Can you add more option? What happens if null or something undefined is passed in. We usually add these into the parameterDef to validate.
"min_value": 10, | ||
"max_value": 100, | ||
"increment": 10, | ||
"test": "test", |
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.
Why is this here? This isn't valid for the schema.
}, | ||
"type": "controls", | ||
"parameter_refs": [ | ||
"slider_error" |
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.
Can you add a test for warning?
"type": "controls", | ||
"parameter_refs": [ | ||
"slider-disable", | ||
"slider" |
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.
Can you add a hidden option?
Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
… Update Comment in scss Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
…verage Signed-off-by: srikant <[email protected]>
} | ||
} | ||
&.error { | ||
input { |
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.
Should this also have the disabled check?
Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
"default": "slider with parameter value set to 'null'" | ||
}, | ||
"control": "slider", | ||
"min_value": null, |
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 need to be removed. They aren't valid and cause schema validation errors.
Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
Signed-off-by: srikant <[email protected]>
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.
Looks good
Fixes : #1674
Developer's Certificate of Origin 1.1