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

[Kedro-viz-890]/run-export-modal #898

Merged
merged 28 commits into from
Jun 15, 2022
Merged

Conversation

Huongg
Copy link
Contributor

@Huongg Huongg commented Jun 9, 2022

Description

Resolves #890: To create a modal to notify users when they download a run in the experiment tracking

Development notes

ezgif com-gif-maker

QA notes

There are tests to ensure both buttons work as expected

Checklist

  • Read the contributing guidelines
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added new entries to the RELEASE.md file
  • Added tests to cover my changes

import { configure, mount, shallow } from 'enzyme';
import { render, screen } from '@testing-library/react';

// to help find text which is made by multiple HTML elements
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a place I can put this util function? I think we can re-use it somewhere else later

Copy link
Contributor

Choose a reason for hiding this comment

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

i was thinking maybe in src/components/ui/button we could add a success button?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah i was thinking the same, what do you think of naming it button-success. It sounds weird but if we name it this way, all the button components display next to each other.
eg

- button
- button-success

what do you think @rashidakanchwala @tynandebold ?

Copy link
Member

Choose a reason for hiding this comment

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

We should probably generalize it more than that. At some point we'll probably need to supply a fail state, too. So maybe we do something like button-message or similar.

Also to your original question about the utility function: you could just export const findTextWithTags for now, because at the moment I don't think we need it anywhere else, so it may be premature to move it elsewhere. If you want to move it though, somewhere in one of the utils files would be best, but you'd probably want to create a new file, like test-utils.js, so maybe we hold off for now.

const [exportData, setExportData] = useState([]);
const [isExported, setIsExported] = useState(false);

const updateExportData = useCallback(() => {
Copy link
Contributor Author

@Huongg Huongg Jun 9, 2022

Choose a reason for hiding this comment

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

I decided to leave
this function here locally in the component itself, rather than in the parent component experiment-primary-toolbar, or experiment-wrapper, as it's easier to manage local state, rather than passing it down through props

@tynandebold
Copy link
Member

Congratulations on your first PR in Viz!!! 🎆

Just one observation before a full review: I believe the entire button background should turn green on the success state, as it does in this modal:

Screen Shot 2022-06-10 at 09 47 42

Signed-off-by: huongg <[email protected]>
@Huongg Huongg requested a review from rashidakanchwala June 13, 2022 16:41
Copy link
Contributor

@rashidakanchwala rashidakanchwala left a comment

Choose a reason for hiding this comment

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

thanks @Huongg -- LGTM :)

Copy link
Member

@tynandebold tynandebold left a comment

Choose a reason for hiding this comment

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

Great work here! It's nearly good to go.

I'm requesting changes and writing only one comment for now. This implementation changes the way to modals are animating in/out, and I don't think it should. We'll need to tweak the changes to somehow fix that.

Comment on lines 48 to 65
{showRunDetailsModal && (
<RunDetailsModal
runMetadataToEdit={runMetadataToEdit}
runs={runMetadata}
setShowRunDetailsModal={setShowRunDetailsModal}
theme={theme}
visible={showRunDetailsModal}
/>
)}
{showRunExportModal && (
<RunExportModal
theme={theme}
visible={showRunExportModal}
setShowRunExportModal={setShowRunExportModal}
runMetadata={runMetadata}
runTrackingData={runTrackingData}
/>
)}
Copy link
Member

Choose a reason for hiding this comment

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

I asked about this yesterday when you were getting a sense check on this approach, and now looking at this work locally it seems that this does change the behavior of the modals animating in and out.

If you look on the main branch you'll see that when they enter there's a fade in and up, and when they disappear it's down and out. We'll need to keep that UX here, too, which means we'll have to find a way not to do this showRunExportModal && or do that and still animate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hey @tynandebold such a good spot, you're right. We should not remove the animation, sorry i didnt realise it yesterday. Actually, i can just use the existing props visible to apply the context, rather than check with props to render a specific component

Let me know what you think about the latest changes? Happy to discuss further

@Huongg Huongg requested a review from tynandebold June 14, 2022 12:50
Copy link
Member

@tynandebold tynandebold left a comment

Choose a reason for hiding this comment

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

Excellent changes. The animations are back! Thank you for that. I'm approving now with some comments and a couple of thoughts:

  1. When I toggle through the RunExportModal with my keyboard and export the data the modal animation doesn't fire nor does the modal close. It does work on the RunDetailsModal though.
  2. I like the use of context, I just hope that if we need to react to a failed API request and then show a failed state in the button instead of the success we'll be able to. We will, right?

@Huongg
Copy link
Contributor Author

Huongg commented Jun 15, 2022

Excellent changes. The animations are back! Thank you for that. I'm approving now with some comments and a couple of thoughts:

  1. When I toggle through the RunExportModal with my keyboard and export the data the modal animation doesn't fire nor does the modal close. It does work on the RunDetailsModal though.
  2. I like the use of context, I just hope that if we need to react to a failed API request and then show a failed state in the button instead of the success we'll be able to. We will, right?

hey to answer your question as below

  1. yeah you're right it doesn't have the animation at the moment when using the keyboard. I guess because it was wrapped around by a CSV link. I'll think of a way to fix it but for now let's merge this ticket and I'll open a new bug for that?
  2. yeah definitely, we just need to introduce a new state in the context to handle the failed state

@tynandebold
Copy link
Member

Excellent changes. The animations are back! Thank you for that. I'm approving now with some comments and a couple of thoughts:

  1. When I toggle through the RunExportModal with my keyboard and export the data the modal animation doesn't fire nor does the modal close. It does work on the RunDetailsModal though.
  2. I like the use of context, I just hope that if we need to react to a failed API request and then show a failed state in the button instead of the success we'll be able to. We will, right?

hey to answer your question as below

  1. yeah you're right it doesn't have the animation at the moment when using the keyboard. I guess because it was wrapped around by a CSV link. I'll think of a way to fix it but for now let's merge this ticket and I'll open a new bug for that?
  2. yeah definitely, we just need to introduce a new state in the context to handle the failed state

Perfect ☺️

Yes, let's create a new ticket to track that keyboard bug. And good to know about the failed state. Thanks for confirming. Merge this whenever you can!

@Huongg Huongg merged commit cf05cb3 into main Jun 15, 2022
@Huongg Huongg deleted the kedro-viz-890/run-export-modal branch June 15, 2022 10:36
@tynandebold tynandebold mentioned this pull request Jun 16, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run Export shows no modal
3 participants