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

[UI] Auto refresh/redirect experiment list/detail page when user selects a different namespace #3297

Merged
merged 3 commits into from
Mar 19, 2020

Conversation

Bobgy
Copy link
Contributor

@Bobgy Bobgy commented Mar 17, 2020

Fixes #3296
/area frontend
/cc @chensun

Built image for preview:

gcr.io/gongyuan-pipeline-test/dev/frontend@sha256:60e2ee94c910f04a86e499a08ef73a9fc3dcbdba8160f5b03f8e2db1eed7a8f9

This change is Reviewable

@Bobgy
Copy link
Contributor Author

Bobgy commented Mar 17, 2020

/retest

Copy link
Member

@chensun chensun left a comment

Choose a reason for hiding this comment

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

Tested in my cluster, worked like a charm!
/lgtm

'',
10,
'created_at desc',
'',
Copy link
Member

Choose a reason for hiding this comment

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

nit: not sure if this is just a common UI practice, feels a bit unreadable to me. Does it make sense to have a wrapper function with a more meaningful name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what confused you. Do you mean this expect(xxxSpy).toHaveBeenLastCalledWith(...some arguments)?

This is fairly common, but previous implementation has been listing arguments (even though they are just default values).
I think if we change signature of listExperiment api method to let it accept an object of arguments, then the verifications here will include argument names, it will be a lot more readable.
e.g. proposed change will look like

expect(listExperimentsSpy).toHaveBeenLastCalledWith({
  page_token: xxx,
  page_size: xxx,
  sort_by: xxx,
  filter: xxx,
  resource_reference_key_type: xxx,
  resource_reference_key_id: xxx,
})

Above is a little more than what we need to do in this PR, so I will leave that to future. What do you think?

Copy link
Member

@chensun chensun Mar 18, 2020

Choose a reason for hiding this comment

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

Sorry, somehow my comment was placed right above the line that I wanted to comment on.
I meant ...LIST_EXPERIMENT_DEFAULTS.slice(0, 4) wasn't very clear to me what it's trying to get with the slice part. I was thinking maybe have a helper function to hide it away, something like:

function getTestExperimentWithoutNamespace() {
  return [...LIST_EXPERIMENT_DEFAULTS.slice(0, 4)]
}

or maybe even better as:

function getTestExperiment(namespace='test-ns') {
  return [...LIST_EXPERIMENT_DEFAULTS.slice(0, 4), 'NAMESPACE', namespace]
}

Does it make sense? Just a nitpick. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the explanation!
I don't quite like introducing another function, to keep it simple, I will just add another constant. please take a look what I changed

Copy link
Member

Choose a reason for hiding this comment

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

Yes, this looks good :)

frontend/src/pages/ExperimentList.test.tsx Show resolved Hide resolved
Copy link
Contributor Author

@Bobgy Bobgy left a comment

Choose a reason for hiding this comment

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

@chensun Thanks for the review!
I've updated accordingly.

PTAL

'',
10,
'created_at desc',
'',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what confused you. Do you mean this expect(xxxSpy).toHaveBeenLastCalledWith(...some arguments)?

This is fairly common, but previous implementation has been listing arguments (even though they are just default values).
I think if we change signature of listExperiment api method to let it accept an object of arguments, then the verifications here will include argument names, it will be a lot more readable.
e.g. proposed change will look like

expect(listExperimentsSpy).toHaveBeenLastCalledWith({
  page_token: xxx,
  page_size: xxx,
  sort_by: xxx,
  filter: xxx,
  resource_reference_key_type: xxx,
  resource_reference_key_id: xxx,
})

Above is a little more than what we need to do in this PR, so I will leave that to future. What do you think?

frontend/src/pages/ExperimentList.test.tsx Show resolved Hide resolved
frontend/src/pages/ExperimentList.test.tsx Show resolved Hide resolved
Copy link
Member

@chensun chensun left a comment

Choose a reason for hiding this comment

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

/lgtm

'',
10,
'created_at desc',
'',
Copy link
Member

@chensun chensun Mar 18, 2020

Choose a reason for hiding this comment

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

Sorry, somehow my comment was placed right above the line that I wanted to comment on.
I meant ...LIST_EXPERIMENT_DEFAULTS.slice(0, 4) wasn't very clear to me what it's trying to get with the slice part. I was thinking maybe have a helper function to hide it away, something like:

function getTestExperimentWithoutNamespace() {
  return [...LIST_EXPERIMENT_DEFAULTS.slice(0, 4)]
}

or maybe even better as:

function getTestExperiment(namespace='test-ns') {
  return [...LIST_EXPERIMENT_DEFAULTS.slice(0, 4), 'NAMESPACE', namespace]
}

Does it make sense? Just a nitpick. :)

@k8s-ci-robot k8s-ci-robot removed the lgtm label Mar 18, 2020
Copy link
Member

@chensun chensun left a comment

Choose a reason for hiding this comment

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

/lgtm

'',
10,
'created_at desc',
'',
Copy link
Member

Choose a reason for hiding this comment

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

Yes, this looks good :)

@Bobgy
Copy link
Contributor Author

Bobgy commented Mar 18, 2020

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Bobgy

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

@Bobgy
Copy link
Contributor Author

Bobgy commented Mar 19, 2020

/retest

@k8s-ci-robot k8s-ci-robot merged commit 47940d6 into kubeflow:master Mar 19, 2020
@Bobgy Bobgy deleted the fe_autorefresh_exp_list branch March 19, 2020 02:43
Jeffwan pushed a commit to Jeffwan/pipelines that referenced this pull request Dec 9, 2020
…cts a different namespace (kubeflow#3297)

* [UI] Auto refresh/redirect experiment list/detail page when namespace changes

* Add comments

* Address CR comment
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.

[Multi User] UI should react when user changes namespace
3 participants