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 query string to click-to-deploy app to support arbitrary version #2384
Conversation
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.
Maybe can base64 encode the parameter value as we might pass arbitrary tags in addition to commits?
@@ -192,7 +201,7 @@ export default class DeployForm extends React.Component<any, DeployFormState> { | |||
process.env.REACT_APP_VERSIONS.split(',').map((version, i) => ( | |||
<MenuItem key={i} value={version}>{version}</MenuItem> | |||
)) : | |||
versionList.map((version, i) => ( | |||
this._versions.map((version, i) => ( |
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.
Currently process.env.REACT_APP_VERSIONS
has higher priority to set version list.
You probably want to use new param as high priority one for version list
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.
when and how was it set? is it a config parameter in click-to-deploy application that's not exist in this repo?
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.
anyway always respect the query string as the first option. done
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.
REACT_APP_VERSIONS is set through configmap in k8s cluster.
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.
We need to make sure that the navigation from logged out view -> auth view -> deploy form doesn't throw away the querystring, so that we can easily direct users to a preset url that includes the version.
@@ -121,6 +124,13 @@ export default class DeployForm extends React.Component<any, DeployFormState> { | |||
// be able to click submit until the fetches have succeeded. How can we do | |||
// that? | |||
|
|||
const values = queryString.parse(this.props.location.search); |
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.
You can instead do something like"
const values = queryString.parse(this.props.location.search); | |
const params = new URLSearchParams(this.props.location.search); | |
if (params.get('version')) { | |
... |
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.
done.
to @kunmingg i would actually prefer use plain text to start with, and for pipeline we would likely use commit id instead tag name, so we don't need to create tag. this would allow people deploy arbitrary commit easily (without base64 encode manually) |
@yebrahim thanks for pointing it out. yes verified it wont drop the query string |
/lgtm /hold |
@@ -16,7 +16,8 @@ | |||
"noImplicitAny": true, | |||
"strictNullChecks": true, | |||
"suppressImplicitAnyIndexErrors": true, | |||
"noUnusedLocals": true | |||
"noUnusedLocals": true, | |||
"allowSyntheticDefaultImports": true |
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.
You don't need this anymore.
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.
done
@@ -121,6 +123,13 @@ export default class DeployForm extends React.Component<any, DeployFormState> { | |||
// be able to click submit until the fetches have succeeded. How can we do | |||
// that? | |||
|
|||
const params = new URLSearchParams(this.props.location.search); | |||
if (params.get('version')) { | |||
this._query_string_version = params.get('version'); |
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.
Why the extra variable? Why not just append/prepend to the versions array? Then the rest of the render logic can remain as is: render all items in the list, and auto-select the first/last one.
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.
kunming mentioned the REACT_APP_VERSIONS will take precedence. The code might get ugly without this extra variable.
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.
Suggestion: This logic should just be done at the beginning of the render function rather than here, it'd be cleaner to first compute the list then render the entire array here.
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.
done
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.
/lgtm
Thanks @IronPan!
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kunmingg 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 |
…ubeflow#2384) * add query string * address comments * fix syntax error * address comments * address comments
A legit URL would look like
http://localhost:3000/#/deploy?version=[commit-sha]
This change is