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

feat(frontend) Support LIST, STRUCT type in RuntimeConfig parameters #7991

Merged
merged 20 commits into from
Jul 8, 2022

Conversation

jlyaoyuli
Copy link
Contributor

convertInput function is able to support LIST and STRUCT type user input parameter. Also, the default values from IR can be displayed correctly.

@jlyaoyuli
Copy link
Contributor Author

jlyaoyuli commented Jul 7, 2022

Test for STRUCT type (with default value) input parameters change.

Screen.Recording.2022-07-06.at.5.34.04.PM.mov

@jlyaoyuli
Copy link
Contributor Author

Test for LIST type (without default value) input parameters change.

Screen.Recording.2022-07-06.at.5.40.06.PM.mov

frontend/src/components/NewRunParametersV2.test.tsx Outdated Show resolved Hide resolved
render(<NewRunParametersV2 {...props}></NewRunParametersV2>);

const listParam = screen.getByDisplayValue('[1,2,3]');
fireEvent.change(listParam, { target: { value: '[4,5,6]' } });
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we check the screen now has [4,5,6]?

screen.getByDisplayValue('[4,5,6]');

Copy link
Collaborator

Choose a reason for hiding this comment

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

Same for all cases below.

Added and modified unit tests.
@jlyaoyuli
Copy link
Contributor Author

Test for double type input. The printOp process wait for (30 + inputNum) seconds

Screen.Recording.2022-07-07.at.4.51.03.PM.mov

@@ -71,6 +71,11 @@ function convertInput(paramStr: string, paramType: ParameterType_ParameterTypeEn
return Number(paramStr);
}
return null;
case ParameterType_ParameterTypeEnum.NUMBER_DOUBLE:
if (!Number.isNaN(Number(paramStr))) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

NIT: Is it necessary to use Number()? Can we simplify it by using !Number.isNaN(paramStr)?

Copy link
Contributor Author

@jlyaoyuli jlyaoyuli Jul 8, 2022

Choose a reason for hiding this comment

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

Yes, I think so. The input of isNaN() should be number.

Copy link
Collaborator

Choose a reason for hiding this comment

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

How about !isNaN(paramStr)? If we can use the standard library to do conversion for us, it is preferred: https://www.w3schools.com/jsref/jsref_isnan.asp

@zijianjoy
Copy link
Collaborator

/assign @zijianjoy

expect(handleParameterChangeSpy).toHaveBeenCalledTimes(1);
expect(handleParameterChangeSpy).toHaveBeenLastCalledWith({
doubleParam: 4.56,
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

For new tests: Please also check for the existence of display value 4.56. Just like we mentioned in https://github.com/kubeflow/pipelines/pull/7991/files#r916159217

@zijianjoy
Copy link
Collaborator

/lgtm
/approve

Great work implementing LIST and STRUCT type parameter inputs!

@google-oss-prow google-oss-prow bot added the lgtm label Jul 8, 2022
@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zijianjoy

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jlyaoyuli
Copy link
Contributor Author

/test kubeflow-pipeline-frontend-test

@google-oss-prow google-oss-prow bot merged commit 2d81e7b into kubeflow:master Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants