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 query string to click-to-deploy app to support arbitrary version #2384

Merged
merged 6 commits into from Feb 6, 2019

Conversation

IronPan
Copy link
Member

@IronPan IronPan commented Feb 4, 2019

A legit URL would look like
http://localhost:3000/#/deploy?version=[commit-sha]


This change is Reviewable

@IronPan
Copy link
Member Author

IronPan commented Feb 4, 2019

/assign @kunmingg @yebrahim

Copy link
Contributor

@kunmingg kunmingg left a 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) => (
Copy link
Contributor

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

Copy link
Member Author

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?

Copy link
Member Author

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

Copy link
Contributor

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.

Copy link
Contributor

@yebrahim yebrahim left a 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);
Copy link
Contributor

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"

Suggested change
const values = queryString.parse(this.props.location.search);
const params = new URLSearchParams(this.props.location.search);
if (params.get('version')) {
...

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

@IronPan
Copy link
Member Author

IronPan commented Feb 5, 2019

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)
if we really see base64 is necessary we can always switch.

@IronPan
Copy link
Member Author

IronPan commented Feb 5, 2019

@yebrahim thanks for pointing it out. yes verified it wont drop the query string

@IronPan IronPan closed this Feb 5, 2019
@IronPan IronPan deleted the qs2 branch February 5, 2019 09:06
@IronPan IronPan restored the qs2 branch February 5, 2019 09:06
@IronPan IronPan reopened this Feb 5, 2019
@kunmingg
Copy link
Contributor

kunmingg commented Feb 5, 2019

/lgtm

/hold
for @yebrahim

@k8s-ci-robot k8s-ci-robot removed the lgtm label Feb 5, 2019
@@ -16,7 +16,8 @@
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true
"noUnusedLocals": true,
"allowSyntheticDefaultImports": true
Copy link
Contributor

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.

Copy link
Member Author

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');
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@yebrahim yebrahim left a comment

Choose a reason for hiding this comment

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

/lgtm
Thanks @IronPan!

@kunmingg
Copy link
Contributor

kunmingg commented Feb 6, 2019

/approve
/hold cancel

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit b993c72 into kubeflow:master Feb 6, 2019
saffaalvi pushed a commit to StatCan/kubeflow that referenced this pull request Feb 11, 2021
…ubeflow#2384)

* add query string

* address comments

* fix syntax error

* address comments

* address comments
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.

None yet

5 participants