Skip to content
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

Merged
merged 28 commits into from
Feb 2, 2024

Conversation

srikant-ch5
Copy link
Contributor

Fixes : #1674

Developer's Certificate of Origin 1.1

   By making a contribution to this project, I certify that:

   (a) The contribution was created in whole or in part by me and I
       have the right to submit it under the Apache License 2.0; or

   (b) The contribution is based upon previous work that, to the best
       of my knowledge, is covered under an appropriate open source
       license and I have the right under that license to submit that
       work with modifications, whether created in whole or in part
       by me, under the same open source license (unless I am
       permitted to submit under a different license), as indicated
       in the file; or

   (c) The contribution was provided directly to me by some other
       person who certified (a), (b) or (c) and I have not modified
       it.

   (d) I understand and agree that this project and the contribution
       are public and that a record of the contribution (including all
       personal information I submit with it, including my sign-off) is
       maintained indefinitely and may be redistributed consistent with
       this project or the open source license(s) involved.

Copy link
Member

@matthoward366 matthoward366 left a 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": {
Copy link
Member

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": {
Copy link
Member

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": {
Copy link
Member

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.

@srikant-ch5 srikant-ch5 marked this pull request as draft January 25, 2024 05:27
@srikant-ch5
Copy link
Contributor Author

srikant-ch5 commented Jan 25, 2024

Hi @matthoward366 Please review the schema changes and slider component with changes related to above feedback.

Copy link
Member

@matthoward366 matthoward366 left a 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,
Copy link
Member

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}
Copy link
Member

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}
Copy link
Member

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={
Copy link
Member

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?

Copy link
Member

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"),
Copy link
Member

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"
},
Copy link
Member

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",
Copy link
Member

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

Copy link
Member

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",
Copy link
Member

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.

@srikant-ch5
Copy link
Contributor Author

Hi @matthoward366 Please review these changes and also I have included test cases.

min-width: 8.6rem;
}
.bx--slider-text-input {
background-color: #F4F4F4;
Copy link
Member

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;
Copy link
Member

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={
Copy link
Member

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": [
{
Copy link
Member

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",
Copy link
Member

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"
Copy link
Member

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"
Copy link
Member

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?

}
}
&.error {
input {
Copy link
Member

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?

@srikant-ch5 srikant-ch5 marked this pull request as ready for review February 2, 2024 15:08
"default": "slider with parameter value set to 'null'"
},
"control": "slider",
"min_value": null,
Copy link
Member

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.

Copy link
Member

@matthoward366 matthoward366 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@matthoward366 matthoward366 merged commit e71a2b4 into elyra-ai:main Feb 2, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add New Slider in Common Properties
2 participants