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 Multiple X Field Selection to Plot Wizard #4797

Merged
merged 42 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
55a3172
first iteration
julieg18 Oct 2, 2023
68953fc
adjust filter
julieg18 Oct 2, 2023
e410b53
Add new tests
julieg18 Oct 2, 2023
1a86d95
Add missing test for dvc.yaml
julieg18 Oct 2, 2023
f81ef2f
resourcePicker adjustments
julieg18 Oct 2, 2023
a6b4a91
Adjust how we handle failed files
julieg18 Oct 3, 2023
3d405fb
Improve error handling
julieg18 Oct 3, 2023
76df14f
Fix broken pickFiles
julieg18 Oct 3, 2023
22c64c5
Use relative path instead of just filename in quick pick
julieg18 Oct 3, 2023
da06e65
Delete unneeded function
julieg18 Oct 3, 2023
b6af87c
Resolve some comments:
julieg18 Oct 4, 2023
bd3e211
Improve text
julieg18 Oct 4, 2023
52defff
wip solution
julieg18 Oct 4, 2023
ec182c3
fix broken tests
julieg18 Oct 5, 2023
54d675e
Merge branch 'main' into improve-plot-wizard-err-handling
julieg18 Oct 5, 2023
528ec62
Clean up and add more tests
julieg18 Oct 5, 2023
0d287a2
Create more solid split between single and multi files
julieg18 Oct 6, 2023
bb688f9
Change function to constant
julieg18 Oct 6, 2023
86556fc
Stop returning array in `validateFileNames`
julieg18 Oct 6, 2023
d850b22
Resolve review comments
julieg18 Oct 9, 2023
be782ee
Merge branch 'main' into improve-plot-wizard-err-handling
julieg18 Oct 9, 2023
cf57f3e
Add Title Option to Plot Wizard
julieg18 Oct 9, 2023
89fc205
Add Multiple Y Field Selection in Plot Wizard
julieg18 Oct 9, 2023
20f6ce7
Only format y values once in `quickPick.ts`
julieg18 Oct 9, 2023
8666917
Merge branch 'main' into add-title-opt-to-plot-wizard
julieg18 Oct 9, 2023
9a185b0
Fix typo
julieg18 Oct 9, 2023
861fe52
Update default title
julieg18 Oct 10, 2023
f067599
Merge branch 'add-title-opt-to-plot-wizard' into allow-plot-wizard-mu…
julieg18 Oct 10, 2023
29657e4
Keep x the same type as y
julieg18 Oct 10, 2023
3b5bc20
first iteration
julieg18 Oct 10, 2023
5933faa
Move error handling to chain pr
julieg18 Oct 10, 2023
135582a
update quick pick util
julieg18 Oct 10, 2023
6dbd3dd
Merge branch 'main' into allow-plot-wizard-multi-x-selection
julieg18 Oct 11, 2023
973e684
Improve types
julieg18 Oct 11, 2023
749c2f9
Add tests for new quick pick util
julieg18 Oct 11, 2023
880a6c0
Add check for empty x fields
julieg18 Oct 11, 2023
c6349bb
Minor refactor
julieg18 Oct 11, 2023
e5be873
Merge branch 'main' into allow-plot-wizard-multi-x-selection
julieg18 Oct 11, 2023
1d892f8
Resolve review comments
julieg18 Oct 12, 2023
9741260
Fix typo
julieg18 Oct 12, 2023
7033ec6
Add error handling for Plot Wizard plots with x fields (#4798)
julieg18 Oct 13, 2023
402d6a2
Merge branch 'main' into allow-plot-wizard-multi-x-selection
julieg18 Oct 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions extension/src/fileSystem/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ describe('addPlotToDvcYamlFile', () => {
' eval/prc/test.json: precision'
]
const mockNewPlotLines = [
' - simple_plot:',
' - Simple Plot:',
' template: simple',
' x: epochs',
' y:',
Expand All @@ -624,8 +624,9 @@ describe('addPlotToDvcYamlFile', () => {

addPlotToDvcYamlFile('/', {
template: 'simple',
x: { file: 'data.json', key: 'epochs' },
y: { file: 'data.json', key: 'accuracy' }
title: 'Simple Plot',
x: { 'data.json': 'epochs' },
y: { 'data.json': 'accuracy' }
})

expect(mockedWriteFileSync).toHaveBeenCalledWith(
Expand All @@ -652,8 +653,9 @@ describe('addPlotToDvcYamlFile', () => {

addPlotToDvcYamlFile('/', {
template: 'simple',
x: { file: 'data.json', key: 'epochs' },
y: { file: 'acc.json', key: 'accuracy' }
title: 'simple_plot',
x: { 'data.json': 'epochs' },
y: { 'acc.json': 'accuracy' }
})

expect(mockedWriteFileSync).toHaveBeenCalledWith(
Expand All @@ -670,8 +672,9 @@ describe('addPlotToDvcYamlFile', () => {

addPlotToDvcYamlFile('/', {
template: 'simple',
x: { file: 'data.json', key: 'epochs' },
y: { file: 'data.json', key: 'accuracy' }
title: 'Simple Plot',
x: { 'data.json': 'epochs' },
y: { 'data.json': 'accuracy' }
})

mockDvcYamlContent.splice(7, 0, ...mockPlotYamlContent)
Expand All @@ -692,8 +695,9 @@ describe('addPlotToDvcYamlFile', () => {

addPlotToDvcYamlFile('/', {
template: 'simple',
x: { file: 'data.json', key: 'epochs' },
y: { file: 'data.json', key: 'accuracy' }
title: 'Simple Plot',
x: { 'data.json': 'epochs' },
y: { 'data.json': 'accuracy' }
})

expect(mockedWriteFileSync).toHaveBeenCalledWith(
Expand Down Expand Up @@ -729,8 +733,9 @@ describe('addPlotToDvcYamlFile', () => {

addPlotToDvcYamlFile('/', {
template: 'simple',
x: { file: 'data.json', key: 'epochs' },
y: { file: 'data.json', key: 'accuracy' }
title: 'simple_plot',
x: { 'data.json': 'epochs' },
y: { 'data.json': 'accuracy' }
})

expect(mockedWriteFileSync).toHaveBeenCalledWith(
Expand Down
15 changes: 10 additions & 5 deletions extension/src/fileSystem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,18 @@ const loadYamlAsDoc = (
}

const getPlotYamlObj = (plot: PlotConfigData) => {
const { x, y, template } = plot
const plotName = `${template}_plot`
const { x, y, template, title } = plot

const yFiles = Object.keys(y)
const xFiles = Object.keys(x)
const oneFileUsed =
yFiles.length === 1 && xFiles.length === 1 && yFiles[0] === xFiles[0]

return {
[plotName]: {
[title]: {
template,
x: x.file === y.file ? x.key : { [x.file]: x.key },
y: { [y.file]: y.key }
x: oneFileUsed ? x[xFiles[0]] : x,
y
}
}
}
Expand Down
Loading
Loading