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 a message when we are showing only 20 plots #5008

Merged
merged 13 commits into from
Nov 30, 2023
Merged

Add a message when we are showing only 20 plots #5008

merged 13 commits into from
Nov 30, 2023

Conversation

sroy3
Copy link
Contributor

@sroy3 sroy3 commented Nov 17, 2023

1/ 2 main <- this <- #5020

Part of #4867

Screen.Recording.2023-11-17.at.9.58.10.AM.mov

I wanted the message to be easily seen (always shown) but at the same time dismissible. Let me know what you think. Should we use a VS Code toast instead?

@sroy3 sroy3 added the product PR that affects product label Nov 17, 2023
@sroy3 sroy3 self-assigned this Nov 17, 2023
@sroy3 sroy3 marked this pull request as ready for review November 20, 2023 19:54
import { MessageBand } from '../../shared/components/messageBand/MessageBand'
import { Info } from '../../shared/components/icons'

const PathHighlight: React.FC<PropsWithChildren> = ({ children }) => (
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 2 locations. Consider refactoring.

<MessageBand icon={Info} id="too-many-plots-message">
We are only showing 20 plots by default. To view other plots, you can
toggle their visibility in the sidebar. You can also group your plots by
adding a path prefix to their IDs (
Copy link
Contributor

Choose a reason for hiding this comment

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

[C] In the dvc.yaml the ID for the plot can be a file or a string. The following are all valid (from demo project):

  - Loss:
      x: step
      y:
        training/plots/metrics/train/loss.tsv: loss
        training/plots/metrics/test/loss.tsv: loss
      y_label: loss
      title: "Loss"
  - Confusion matrix:
      template: confusion
      x: actual
      y:
        training/plots/sklearn/confusion_matrix.json: predicted
  - hist.csv:
      x: preds
      y: digit
      template: bar_horizontal
      title: Histogram of Predictions
  - probs.json:
      x: actual
      y: prob
      template: scatter
      title: Predicted Probabilities
  - training/plots/images

This means the instructions to group need to be updated slightly. In the case of the key being a file the user would need to group the underlying data. If it is just a string then it can be done in the suggested way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the message. Does that look like complete instructions to you now @mattseddon ?

@sroy3
Copy link
Contributor Author

sroy3 commented Nov 22, 2023

Because this has already been reviewed and there were a lot of changes requested in the planning yesterday, I will leave this up and merge the changes back into this PR through another PR.

Changes requested:

  • 20 plots per section
  • Static message per section

const nodes = [{}]
for (let i = 0; i < 19; i++) {
nodes.push({})
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor! I think we can create nodes for this test and the next one in a single line:

const nodes = Array.from({ length: 20 }).fill({})

* Select 20 plots by default per section

* Self review

* Fix parent status

* Simplify custom selection

* Fix test
@sroy3 sroy3 enabled auto-merge (squash) November 28, 2023 20:45
@@ -65,6 +67,12 @@ export const comparisonTableSlice = createSlice({
...action.payload,
hasData: !!action.payload
}
},
updateShouldShowTooManyPlotsMessage: (
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 4 locations. Consider refactoring.

@@ -93,6 +95,12 @@ export const templatePlotsSlice = createSlice({
...state,
sections: action.payload
}
},
updateShouldShowTooManyPlotsMessage: (
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 4 locations. Consider refactoring.

const { revisions, plots, width } = useSelector(
(state: PlotsState) => state.comparison
)
const { revisions, plots, width, shouldShowTooManyPlotsMessage } =
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 4 locations. Consider refactoring.

const { nbItemsPerRow, sections, hasItems } = useSelector(
(state: PlotsState) => state.template
)
const { nbItemsPerRow, sections, hasItems, shouldShowTooManyPlotsMessage } =
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 4 locations. Consider refactoring.

Copy link

codeclimate bot commented Nov 30, 2023

Code Climate has analyzed commit 7389c79 and detected 10 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1
Duplication 9

The test coverage on the diff in this pull request is 99.0% (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.

@sroy3 sroy3 merged commit b3a08c4 into main Nov 30, 2023
@sroy3 sroy3 deleted the plots-message branch November 30, 2023 15:51
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