-
Notifications
You must be signed in to change notification settings - Fork 113
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
[KED-2996] Feature/toggle bookmark behavior #689
Conversation
…ature/toggle-bookmark-behavior#ked-2996
…ature/toggle-bookmark-behavior#ked-2996
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 Tynan!!!
…ature/toggle-bookmark-behavior#ked-2996
src/components/experiment-tracking/experiment-primary-toolbar/experiment-primary-toolbar.js
Outdated
Show resolved
Hide resolved
src/components/experiment-tracking/run-metadata/run-metadata.js
Outdated
Show resolved
Hide resolved
// Remove for now. | ||
// it('enables the pin button when show changes is enabled ', () => { | ||
// const wrapper = mount( | ||
// <RunMetadata | ||
// enableShowChanges={true} | ||
// isSingleRun={false} | ||
// runs={twoRuns} | ||
// /> | ||
// ); | ||
|
||
// expect(wrapper.find('.pipeline-menu-button__pin').length).toEqual(4); | ||
// }); |
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.
This test can be put back in once the useMutation
hook is moved up to the wrapper level.
On another note, please add relevant tests to cover the introduction of the new kebab menu and the bookmark icon.
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 wish this was true. The test still fails even if the mutation hook is moved. The hook itself still fires in this file, so it doesn't make a difference.
I won't be able to write any tests either. As soon as the details-metadata__buttons
markup becomes available with two runs in comparison view, we get that Apollo client
error I wrote about in the PR description.
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 this problem with useMutation
would be something we need to resolve within this PR as this seems to restrict our ability to write tests, which I highly doubt it would be designed this way given how many users there are within the react community.
Throwing a thought here - looking at the error it looks like the test was not able to locate the client, which you might need to wrap the wrapper with an ApolloProvider in the test?
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.
Also, it also does seem weird that this problem surfaces in this PR and not in the previous one when we introduced the mutation hook for the first time - I wonder what is the reason behind that?
it might either suggest that there might be a different setup, or perhaps there wasn't the right tests set up to properly test that 😆
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.
Haha, agreed! I'm looking into this now: https://www.apollographql.com/docs/react/development-testing/testing/
Will report back.
const humanReadableTime = toHumanReadableTime(timestamp); | ||
|
||
const onClick = (id) => { | ||
const onClick = (id, e) => { |
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.
please rename this to something more description such as onToggleBookmarkButton
, etc.
Please also add a test to cover the dead zone scenerio too - it can be just set up to test that updateRunDetails
function gets called
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.
This function can either toggle the bookmark or fire the onRunSelection
function, so it isn't strictly about the bookmark.
I can change it to onRunsListCardClick
. Is that ok?
I added a test but it also fails because of the Apollo bug. Uncomment the code and then try it here:
npm run test src/components/experiment-tracking/runs-list-card/runs-list-card.test.js
src/components/experiment-tracking/runs-list-card/runs-list-card.js
Outdated
Show resolved
Hide resolved
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.
Thanks for setting this up, the bookmark journey works well in general.
One thing I noticed. - on toggling 'show changes' off the entire burger menu, including the toggle bookmark buttons, etc, also gets toggled off, while instead they should still exist and only the 'pin run' button should be toggled off.
I'll continue to go through some of the code and leave further single comments if I see anything.
…ature/toggle-bookmark-behavior#ked-2996
Updated everything you asked for. Lmk if there's anything else :) |
…ithub.com/kedro-org/kedro-viz into feature/toggle-bookmark-behavior#ked-2996
…ature/toggle-bookmark-behavior#ked-2996
src/apollo/mutations.js
Outdated
@@ -22,10 +21,8 @@ export const UPDATE_RUN_DETAILS = gql` | |||
`; | |||
|
|||
export const useUpdateRunDetails = () => { | |||
const [_updateRunDetails, { error, loading, reset }] = useMutation( | |||
UPDATE_RUN_DETAILS, | |||
{ client } |
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 this the object the one that was causing the problems for the test?
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.
No it wasn't that. It's just we were't actually mocking the useUpdateRunDetails
mutation.
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.
indeed. I've always wondered why we need to pass in the client here as it's passed on from the ApolloProvider
anyways, good to delete this 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.
I haven't tested the functionality but the code LGTM!
src/components/experiment-tracking/run-details-modal/run-details-modal.test.js
Show resolved
Hide resolved
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 for getting through with the fix to the tests!
I've left a few comments which I'll let you fix them before merging it in. For the tests for run-details-modal
, I'll let you decide on whether to tackle it in this PR or as a separate PR.
Description
Resolves KED-2996.
Development notes
This PR enables all the bookmark functionality. There are three places where you can bookmark a run from:
Each area is wired up to now be able to toggle bookmarks.
I also wired up the close icon next to the kebab menu. That was a quick win and easy to do.
QA notes
I chose not to include the bookmark help text on hover in the runs list. Here's a design screenshot:
I did this for two reasons:
Separately, I also ordered the icons like this:
And not like this:
Isn't the close icon always on an end? I didn't feel right when it was in the middle.
Checklist
RELEASE.md
file