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 action buttons to empty plot sections #4694

Merged
merged 3 commits into from
Sep 21, 2023

Conversation

julieg18
Copy link
Contributor

@julieg18 julieg18 commented Sep 20, 2023

Demo

Custom

https://github.com/iterative/vscode-dvc/assets/43496356/23f4a1db-a22d-4adf-bf1e-90aa0725ab7a

Screen.Recording.2023-09-21.at.8.07.01.AM.mov

Template

Screen.Recording.2023-09-20.at.9.50.30.AM.mov

Followup to #4680

@julieg18 julieg18 added the product PR that affects product label Sep 20, 2023
@julieg18 julieg18 self-assigned this Sep 20, 2023
enablePlotCreation,
hasAddedPlots
} = useSelector((state: PlotsState) => state.custom)
const { plotsIds, nbItemsPerRow, isCollapsed, height, hasAddedPlots } =
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 3 locations. Consider refactoring.

@@ -52,24 +52,6 @@ export const getCustomPlotPathsFromColumns = (
return { metrics, params }
}

export const checkForCustomPlotOptions = (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently our "Add Plot" shows the custom plot option even if you can't create any more custom plots. We could technically add an extra check but then our choose plot quick pick would have only one item.

Copy link
Member

Choose a reason for hiding this comment

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

If the option fails under these conditions with a clear message then that is ok.

I think the chances of real users hitting this is low.

Copy link
Contributor Author

@julieg18 julieg18 Sep 21, 2023

Choose a reason for hiding this comment

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

If the option fails under these conditions with a clear message then that is ok.

Yes, the option fails with an error toast message.

@@ -100,7 +100,6 @@ export type CustomPlotData = CustomPlot & {
export type CustomPlotsData = {
plots: CustomPlotData[]
nbItemsPerRow: number
enablePlotCreation: boolean
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No longer needed since our "Add Custom Plot" action buttons will only appear in the case of there being no custom plots at all.

onClick={selectPlots}
text="Select Plots"
/>
<StartButton
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The custom section "Add Plot" button is a bit different than the template one since it can take you to right to custom plot creation, unlike the data series which needs that extra description for more context.

We could keep as is, but if we wanted them to function the same we could:

  1. Have the custom plot section open the "Select Plot Type" quick pick as well. Would mean an extra click for the user but would reduce some code.
  2. Update our "Add Data Series Plot" action to open a quick pick first instead of the file selector, allowing the user to get context and type in a relative file if preferred. Would get rid of the extra click a user needs to make, but would make data series plot creation a bit more complex.

Copy link
Member

@mattseddon mattseddon Sep 21, 2023

Choose a reason for hiding this comment

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

I vote for option 1. The only drawback that I see is that the plot may not necessarily appear in the section that the user is currently looking at. However, I think that is fine. "Add Data Series Plot" ends with the dvc.yaml being open anyway... right?

Copy link
Contributor Author

@julieg18 julieg18 Sep 21, 2023

Choose a reason for hiding this comment

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

Yes, "Add Data Series" ends with the dvc.yaml being opened. Makes sense! I'll update the code to use the add plot command instead.

@julieg18 julieg18 marked this pull request as ready for review September 20, 2023 15:06
@julieg18 julieg18 requested a review from shcheklein September 20, 2023 15:06
@shcheklein
Copy link
Member

Demo look perfect to me. Thanks!

@codeclimate
Copy link

codeclimate bot commented Sep 21, 2023

Code Climate has analyzed commit d62de15 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 1

The test coverage on the diff in this pull request is 100.0% (85% is the threshold).

This pull request will bring the total coverage in the repository to 95.0% (0.0% change).

View more on Code Climate.

@julieg18 julieg18 merged commit 0bd577e into main Sep 21, 2023
3 checks passed
@julieg18 julieg18 deleted the add-buttons-to-empty-plot-sections branch September 21, 2023 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR that affects product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants