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

Wire up plots webview with static plots data #999

Merged
merged 10 commits into from
Nov 5, 2021

Conversation

mattseddon
Copy link
Member

@mattseddon mattseddon commented Nov 4, 2021

We can't ship this because it is providing stubbed data to the user. You can however take a look at the storybook to see the placeholder data.

Edit: also code is poo

5/5 master <- #1001 <- #995 <- #996 <- #998 <- this

I have lifted a lot of code from #1000 to help with this change and get us started.

Check out the storybook for the different states that the webview can get into:

  1. Loading (undefined passed)
  2. No plots ({ live: [], static: {} }}
  3. Live plots only
  4. Static only
  5. All the plots

Demo:

Screen.Recording.2021-11-05.at.4.20.28.pm.mov

Note: this is concerning - https://github.com/iterative/vscode-dvc/runs/4113738638?check_suite_focus=true (plotsShowFixture blowing up the @testing-library/react portion of the CI).

Closes #991 (if it hasn't been closed already).

@mattseddon mattseddon self-assigned this Nov 4, 2021
@mattseddon mattseddon changed the base branch from master to update-types-for-new-data November 4, 2021 06:08
@mattseddon mattseddon force-pushed the update-types-for-new-data branch 2 times, most recently from 4d0b70a to 86e6918 Compare November 5, 2021 00:46
@mattseddon mattseddon changed the base branch from update-types-for-new-data to master November 5, 2021 01:17
@mattseddon mattseddon force-pushed the add-static-plot-components branch from 9b0a574 to b6001c3 Compare November 5, 2021 03:06
@@ -0,0 +1,25 @@
* {
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 is a full C + P, should it be standardised or we cam have separate ones because they need to diverge?

Copy link
Contributor

Choose a reason for hiding this comment

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

We can standardize/share the styles that are shared, and use individual stylesheets in the projects for things that need to diverge. I expect there will be many styles that will always need to be consistent between the two.

@mattseddon mattseddon changed the base branch from master to update-types-for-new-data November 5, 2021 03:41
@@ -184,7 +183,7 @@ export class CliReader extends Cli {
): Promise<T> {
// Stubbed until DVC ready
if (isEqual(args, ['plots', 'show', '--show-json'])) {
return Promise.resolve(formatter(JSON.stringify(plotsShowFixture)))
return Promise.resolve({} as T)
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] Removed test fixture from the stub so data no longer flows to the user

@@ -61,6 +61,7 @@
"fork-ts-checker-webpack-plugin": "^6.2.12",
"identity-obj-proxy": "^3.0.0",
"jest": "^27.0.5",
"jest-canvas-mock": "^2.3.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.

[F] Needed for use with vega in @testing-library/react

@@ -0,0 +1,84 @@
/**
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] Adapted from #1000

@@ -2,26 +2,24 @@ import React, { useEffect, useState } from 'react'
import { PlotsData } from 'dvc/src/plots/webview/contract'
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] Lifted from #1000

@@ -0,0 +1,7 @@
import { InternalVsCodeApi } from '../../shared/api'
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] Also from #1000, we should standardise to use this now that we no longer have hot-reload

@@ -1,7 +1,10 @@
import React from 'react'
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] The changes here just give us something to iterate from.

@mattseddon mattseddon added product PR that affects product and removed 🏠 housekeeping labels Nov 5, 2021
@mattseddon mattseddon changed the title Add placeholder static plots into webview Wire up plots webview with static plots data Nov 5, 2021
@mattseddon mattseddon marked this pull request as ready for review November 5, 2021 05:44
Base automatically changed from update-types-for-new-data to master November 5, 2021 20:25

const signalInitialized = () =>
vsCodeApi.postMessage({ type: MessageFromWebviewType.initialized })

const App = () => {
export const App = () => {
Copy link

Choose a reason for hiding this comment

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

Function App has 29 lines of code (exceeds 25 allowed). Consider refactoring.

@codeclimate
Copy link

codeclimate bot commented Nov 5, 2021

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

Here's the issue category breakdown:

Category Count
Complexity 1

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

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

View more on Code Climate.

@rogermparent rogermparent enabled auto-merge (squash) November 5, 2021 20:41
@rogermparent rogermparent merged commit 3e09cfa into master Nov 5, 2021
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.

Show something in the Plots webview when there are no Experiments
2 participants