-
Notifications
You must be signed in to change notification settings - Fork 528
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
[FIX-JENKINS-38805_User_can_run_parametrised_pipeline] #692
[FIX-JENKINS-38805_User_can_run_parametrised_pipeline] #692
Conversation
…c version that works with input parameter, still have some real rough edges to fix
changeParameter(index, event) { | ||
// console.log('onChange', index, event); | ||
const originalParameters = this.state.parameters; | ||
originalParameters[index].defaultParameterValue.value = event; |
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.
Per discussion in Gitter, it looks like the value
property is observable here, so modifying it outside of @action
decorator or action()
function will throw this error when mobx useStrict(true)
has been set. I believe that is set globally in core-js right now.
This may seem annoying but in a way I think it's good because it makes it very explicit when state change happens. Observable / data binding can be a slippery slope whenever any code can modify the data when there are shared references.
If you refer to core-js ToastService
that's a very simple example where modification of an array is managed by two different @action
methods. I think this is a good practice so that we're explicit and consistent of where we do state mutations.
On the other hand, if I understand the code correctly, you are pulling metadata about the input parameters from a job, then rendering them dynamically for user modification when launching a run. To me, you don't want to modify the underlying job / pipeline data in the data model during this user interaction. So I think what you probably want to do is clone the data here that drives the input parameters. If you still need advantages of observability and UI data binding, I write a quick class which encapsulates the form state and is build from a clone of the pipeline data. That way this data can be modified freely without changing the underlying data model.
great to see this stuff kick off ! |
const cancelButton = (<a title={cancelCaption} onClick={() => this.cancelForm()} className="btn inputStepCancel run-button btn-secondary" > | ||
<span className="button-label">{cancelCaption}</span> | ||
</a>); | ||
return (<ModalView |
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.
@scherler is this the dialog component that @sophistifunk built or a new impl of the Modal? I believe we should be using the dialog not a new component (cc @brody) See https://issues.jenkins-ci.org/browse/JENKINS-39371
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.
@i386 that is Modal view from jdl. I was not aware about the dialog component. will use that instead.
* In case you want to register a new mapping you need to edit './parameter/index' to add a new mapping | ||
* and further in './parameter/commonProptypes' you need to include the new type in the oneOf array. | ||
*/ | ||
export default class InputParameters extends Component { |
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.
tiny thing, but I worry that the name "Input" may confuse people looking at code for input vs params (they are very similar). It says parameters so this is ok... perhaps "ParameterForm" or something? just a suggestion. Nice commentary ;)
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.
noted, the whole thing needs a second iteration to remove some code redundancies. I created the PR to get feedback from cliff.
Thanks Thor :) |
…rking version with Dialog component and mobx based ParameterService
…ake it more generic and reusable
… to use the ParameterService
onNavigation={onNavigation} | ||
innerButtonClasses="btn-secondary" | ||
/> | ||
<ParametersRunButton |
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.
So this contains the regular run button if I read it correctly.
This is maybe a little bit confusing name wise - it probably still should be "RunButton" but then it has components in it for normal and parametrised run button I think.
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.
@michaelneale yes it contains the regular RunButton
and shows it when no parameters
are detected.
Regarding naming ParametersAwareRunButton
had been to long but that would be the most specific name.
@@ -114,7 +85,7 @@ export default class InputStep extends Component { | |||
error.response = response; | |||
throw error; | |||
} | |||
return response; | |||
return response.json(); |
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.
curious about this change - how did it work before?
Few things here @scherler:
|
@scherler the design in zeplin is 464px wide. At least make it 450px wide and it'll be beautiful. |
I am using it as shown in the related story: https://github.com/jenkinsci/jenkins-design-language/blob/master/src/js/stories/DialogStories.jsx#L58 https://github.com/jenkinsci/blueocean-plugin/pull/692/files#diff-e999489b5e8809d41a4a6ba443345688R134 meaning as I understand I am using it in the standard way. |
I am starting now to make it more appealing. |
… API for submitting the forms
…ive more structure
… sure we start blank
…core and extract input parameter from runnable. exporting the parameterRunButton as RunButton so all current usage support parameters out of the box. Tweak design of favorites to support parameterized starts.
…re-js - published under tag thor
This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation. |
@scherler the "Build" button should be "Run" |
Getting some test failures @scherler - worth looking into |
}) | ||
} | ||
</Table> | ||
{ runs.length > 0 && |
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 there any real diff here? It looks like formatting only, but its a dozen odd lines so hard to see - is there some tool doing that as it is a bit annoying as git can't tell it apart from real refactoring.
<button disabled={this.pager.pending || !this.pager.hasMore} className="btn-show-more btn-secondary" onClick={() => this.pager.fetchNextPage()}> | ||
{this.pager.pending ? t('common.pager.loading', { defaultValue: 'Loading...' }) : t('common.pager.more', { defaultValue: 'Show more' })} | ||
</button> | ||
{ runs && runs.length > 0 && |
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.
ditto with whitespace only changes???
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.
yeah sorry about that.
very nice - working great so far @scherler! |
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.
French translation advices
@@ -3,6 +3,9 @@ login=Connexion | |||
logout=D\u00e9connexion | |||
Not.found.heading=Page non trouv\u00e9e (404) | |||
Not.found.message=Jenkins n'a pas pu trouver la page que vous recherchiez. V\u00e9rifiez l'URL pour des erreurs ou appuyez sur le bouton de retour. | |||
parametrised.pipeline.cancel=Annuler | |||
parametrised.pipeline.header=Input indispensable | |||
parametrised.pipeline.submit=Lancer |
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 would say "Démarrer"
@@ -3,6 +3,9 @@ login=Connexion | |||
logout=D\u00e9connexion | |||
Not.found.heading=Page non trouv\u00e9e (404) | |||
Not.found.message=Jenkins n'a pas pu trouver la page que vous recherchiez. V\u00e9rifiez l'URL pour des erreurs ou appuyez sur le bouton de retour. | |||
parametrised.pipeline.cancel=Annuler | |||
parametrised.pipeline.header=Input indispensable |
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 would say "Entrée(s) indispensable" as "Input" is not a true French word. But the job configuration use the terms "parameters" so we could say "Paramètre(s) indispensable", which would be better for the configuration -> usage understanding.
…tions from feedback from Adrien.
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 it's better this way.
@michaelneale IMO ready for prime time. see jenkinsci/blueocean-acceptance-test#100 and passing https://ci.blueocean.io/job/ATH-Jenkinsfile/job/master/919/ |
…ion of workflow to for the input parameters
…ix workflow dependency to be able to use parameterized inputs
Description
See JENKINS-38805.
state of the nation
The feature is ready to review and playing around.
ATH coverage
jenkinsci/blueocean-acceptance-test#100
Current master ATH run on the branch https://ci.blueocean.io/job/ATH-Jenkinsfile/job/master/894/
Current branch ATH https://ci.blueocean.io/job/ATH-Jenkinsfile/job/master/919/
Next steps
Submitter checklist
Reviewer checklist
@reviewbybees