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

Bump min DVC version to 3.33.0 (standardise plots across products) #4734

Merged
merged 31 commits into from
Dec 6, 2023

Conversation

mattseddon
Copy link
Member

@mattseddon mattseddon commented Sep 28, 2023

Part of iterative/dvc#9940

This PR makes the changes required to accept the new templates provided by dvc-render in iterative/dvc-render#142. Made available through dvc in iterative/dvc#9931.

The main difference in the approach is that extra anchors have been added to the default templates. These anchors will all be filled in the webview so that the values can be manipulated depending on whether or not the plot is being shown in the zoom modal. We will no longer be overwriting information in templates that do not have the appropriate anchors.

I have consolidated our plot's test fixtures as part of the change. I have been able to drop a few files as the bulk of the complexity has been moved into dvc-render.

Demo

Screen.Recording.2023-11-27.at.12.14.35.pm.mov

@mattseddon mattseddon added the product PR that affects product label Sep 28, 2023
@mattseddon mattseddon self-assigned this Sep 28, 2023
@@ -1,5 +1,3 @@
import { Plot } from '../../plots/webview/contract'

export const MIN_CLI_VERSION = '2.58.1'
Copy link
Member Author

Choose a reason for hiding this comment

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

[I] Will need bumped

Copy link
Member Author

Choose a reason for hiding this comment

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

Don't forget to remove the code that checks the CLI version when running exp rename

Copy link
Contributor

Choose a reason for hiding this comment

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

Are these things that need to be done before merging?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep

>

export const mergeFields = (fields: string[]): string =>
Copy link
Member Author

Choose a reason for hiding this comment

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

[F] All of this logic has moved to dvc-render and the templates.

@@ -2798,172 +2777,6 @@ describe('App', () => {
expect(clickEvent.stopPropagation).toHaveBeenCalledTimes(1)
})

it('should have a tooltip on the plot if the title is cut', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

[F] See this

@@ -84,7 +69,9 @@ export const ZoomedInPlot: React.FC<ZoomedInPlotProps> = ({
ThemeProperty.FONT
])

const fullThemedSvg = preventSvgTruncation(themedSvg)
const fullThemedSvg = addExportBackgroundColor(
Copy link
Member Author

Choose a reason for hiding this comment

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

[F] This was broken

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 462453 lines exceeds the maximum allowed for the inline comments feature.

@@ -1,5 +1,3 @@
import { Plot } from '../../plots/webview/contract'

export const MIN_CLI_VERSION = '2.58.1'
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these things that need to be done before merging?

export const PLOT_ZOOM_AND_PAN_ANCHOR = '<DVC_METRIC_ZOOM_AND_PAN>' as const
export const PLOT_PARAM_TYPE_ANCHOR = '<DVC_PARAM_TYPE>' as const
export const PLOT_HEIGHT_ANCHOR = '<DVC_METRIC_PLOT_HEIGHT>' as const
export const PLOT_WIDTH_ANCHOR = '<DVC_METRIC_PLOT_WIDTH>' as const
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have these inside an enum / const? So we can have all tags while importing only one constant (autocompletion as well).

@@ -71,49 +47,45 @@ export const ZoomablePlot: React.FC<ZoomablePlotProps> = ({
}

return (
<ZoomablePlotWrapper spec={plotProps.spec as SpecWithTitles}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we getting rid of the tooltip?

Copy link
Contributor

Choose a reason for hiding this comment

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


table {
table-layout: auto !important;

Copy link
Contributor

Choose a reason for hiding this comment

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

Was this needed after all? (table-layout)

anchorDefinitions: AnchorDefinitions
// eslint-disable-next-line sonarjs/cognitive-complexity
): unknown => {
if (!value) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to return early if value === 0?

Copy link
Contributor

Choose a reason for hiding this comment

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

Since it is also tested on line 38 and value is returned in the end as well, we should remove that check and let isAnchor return false if there is no value.

webview/src/plots/components/vegaLite/util.ts Show resolved Hide resolved
const updatedAnchors: Record<string, unknown> = {}

const titleWidth = getMaxHorizontalTitleCharacters(nbItemsPerRow)
const titleHeight = getMaxVerticalTitleCharacters(
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are inside the webview, we can now calculate the available space and have it looking right all the time.

Copy link
Contributor

@julieg18 julieg18 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! Should we create a todo list of what needs to be done before this pr gets merged to ensure nothing gets missed?

webview/src/plots/components/vegaLite/util.ts Show resolved Hide resolved
type === 'number' ? 'quantitative' : 'nominal'

export const createSpec = (
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this function no longer takes arguments, should we turn it into an object instead?

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 462453 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 462456 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 462329 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 462329 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 462333 lines exceeds the maximum allowed for the inline comments feature.

Copy link

codeclimate bot commented Dec 6, 2023

Code Climate has analyzed commit 7bde398 and detected 3 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1
Duplication 2

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

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

View more on Code Climate.

@mattseddon mattseddon changed the title plots: standardise across DVC/Studio/VS Code Bump min DVC version to 3.33.0 (standardise plots across products) Dec 6, 2023
@mattseddon mattseddon merged commit 5d24dfb into main Dec 6, 2023
8 checks passed
@mattseddon mattseddon deleted the use-new-templates branch December 6, 2023 01:09
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