Skip to content

Function to prefill promote modal w/ query params#434

Merged
d1wilko merged 2 commits into
drone:mainfrom
kgwebsites:new-promote-queryparam-triggerable
Apr 19, 2023
Merged

Function to prefill promote modal w/ query params#434
d1wilko merged 2 commits into
drone:mainfrom
kgwebsites:new-promote-queryparam-triggerable

Conversation

@kgwebsites

Copy link
Copy Markdown
Contributor

Previously I added the abillity to prefill a custom build via query params. Duplicating that functionality over to build promotions as well.

@praxist

praxist commented Apr 17, 2023

Copy link
Copy Markdown

related: #432

@d1wilko d1wilko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hey @kgwebsites small question on this one :)

const cx = classNames.bind(css);

const DeploymentForm = ({ handleSubmit, handleCancel }) => {
const DeploymentForm = ({ handleSubmit, handleCancel, action, target, commit, parameters }) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the commit prop ever used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah good catch. This was copied over from the repo.jsx. I removed it from both, since it is not a used query param in either of the build/promote modals

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sounds good - thank you :)

@kgwebsites kgwebsites requested a review from d1wilko April 18, 2023 17:22

@d1wilko d1wilko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@d1wilko d1wilko merged commit c89ac05 into drone:main Apr 19, 2023
@tonglil

tonglil commented Mar 25, 2024

Copy link
Copy Markdown
@kgwebsites what's the URL format for filling the query parameters for the `parameters` field?

It's not the typical promote?target=target&key=value and trying json target=target&parameters={"key":"value"} does not seem to work either.

Can't find any documentation on this, would appreciate guidance here!

Nevermind, after iterating I found out to pre-fill the promotion form through URL parameters looks like this (a json array of kv objects:

/promote?target=target&parameters=[{"key":"k","value":"v"}]

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.

4 participants