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 pipeline input parameters #3293

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

pnaik1
Copy link
Contributor

@pnaik1 pnaik1 commented Oct 3, 2024

https://issues.redhat.com/browse/RHOAIENG-9425

Description

Added back the input parameter tab which was removed previously
Both for runs and scheduled runs
Screenshot 2024-10-03 at 12 01 56 PM

Screenshot 2024-10-03 at 12 03 14 PM

How Has This Been Tested?

  1. Create a run with parameters
  2. Check if the input parameter tab is present
  3. Click on the input parameter and check for if parameters are correctly displayed

Test Impact

Updated cypress test

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change.

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

Copy link

codecov bot commented Oct 3, 2024

Codecov Report

Attention: Patch coverage is 70.73171% with 12 lines in your changes missing coverage. Please review.

Project coverage is 84.77%. Comparing base (85ce695) to head (48b4b93).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...esDetails/pipelineRun/PipelineRunTabParameters.tsx 70.00% 12 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3293      +/-   ##
==========================================
- Coverage   84.77%   84.77%   -0.01%     
==========================================
  Files        1308     1309       +1     
  Lines       29247    29283      +36     
  Branches     7936     7954      +18     
==========================================
+ Hits        24795    24824      +29     
- Misses       4452     4459       +7     
Files with missing lines Coverage Δ
...inesDetails/pipelineRun/PipelineRunDetailsTabs.tsx 100.00% <100.00%> (ø)
...esDetails/pipelineRun/PipelineRunTabParameters.tsx 70.00% <70.00%> (ø)

... and 15 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 85ce695...48b4b93. Read the comment docs.

Comment on lines 43 to 50
let value = initialValue;

if (typeof value === 'boolean') {
value = value ? 'True' : 'False';
}

if (typeof value === 'object') {
value = JSON.stringify(value);
Copy link
Member

@Gkrumbach07 Gkrumbach07 Oct 3, 2024

Choose a reason for hiding this comment

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

pipeline spec for the run has input definition types that can be used

  inputDefinitions:
    parameters:
      datastore:
        parameterType: STRUCT
      hyperparameters:
        parameterType: STRUCT

These should match up the the run runtime_config parameters, if not you can fall back to just a string, but if there is a match you can use the same type of parsing we do here:

switch (type) {
case InputDefinitionParameterType.DOUBLE:
return numberValue && Number.isInteger(numberValue)
? numberValue.toFixed(1)
: numberValue;
case InputDefinitionParameterType.INTEGER:
return numberValue;
case InputDefinitionParameterType.BOOLEAN:
return boolValue ? 'True' : 'False';
case InputDefinitionParameterType.STRING:
try {
const jsonStringValue = JSON.parse(stringValue ?? '');
if (parseFloat(jsonStringValue)) {
throw stringValue;
}
return (
<ExecutionDetailsPropertiesValueCode
code={JSON.stringify(jsonStringValue, null, 2)}
/>
);
} catch {
return stringValue || <NoValue />;
}
break;
case InputDefinitionParameterType.LIST:
return <ExecutionDetailsPropertiesValueCode code={JSON.stringify(listValue, null, 2)} />;
case InputDefinitionParameterType.STRUCT:
return (
<ExecutionDetailsPropertiesValueCode code={JSON.stringify(structValue, null, 2)} />
);
default:
return nullValue;
}

make sure to create a reusable util for this then to avoid duplicate code

Copy link
Member

@Gkrumbach07 Gkrumbach07 left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link
Contributor

openshift-ci bot commented Oct 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Gkrumbach07

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

@openshift-ci openshift-ci bot added the approved label Oct 7, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit d857dec into opendatahub-io:main Oct 7, 2024
8 checks passed
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