@@ -15,64 +15,74 @@ import plotsDiffFixture from '../../test/fixtures/plotsDiff/output'
1515import { Shape , StrokeDash } from '../multiSource/constants'
1616import { EXPERIMENT_WORKSPACE_ID , PlotsOutput } from '../../cli/dvc/contract'
1717import { REVISIONS } from '../../test/fixtures/plotsDiff'
18+ import { FIELD_SEPARATOR } from '../../cli/dvc/constants'
1819
1920const plotsDiffFixturePaths : PlotPath [ ] = [
2021 {
2122 hasChildren : false ,
23+ label : 'acc.png' ,
2224 parentPath : 'plots' ,
2325 path : join ( 'plots' , 'acc.png' ) ,
2426 revisions : new Set ( REVISIONS ) ,
2527 type : new Set < PathType > ( [ PathType . COMPARISON ] )
2628 } ,
2729 {
2830 hasChildren : true ,
31+ label : 'plots' ,
2932 parentPath : undefined ,
3033 path : 'plots' ,
3134 revisions : new Set ( REVISIONS )
3235 } ,
3336 {
3437 hasChildren : false ,
38+ label : 'heatmap.png' ,
3539 parentPath : 'plots' ,
3640 path : join ( 'plots' , 'heatmap.png' ) ,
3741 revisions : new Set ( REVISIONS ) ,
3842 type : new Set < PathType > ( [ PathType . COMPARISON ] )
3943 } ,
4044 {
4145 hasChildren : false ,
46+ label : 'loss.png' ,
4247 parentPath : 'plots' ,
4348 path : join ( 'plots' , 'loss.png' ) ,
4449 revisions : new Set ( REVISIONS ) ,
4550 type : new Set < PathType > ( [ PathType . COMPARISON ] )
4651 } ,
4752 {
4853 hasChildren : false ,
54+ label : 'image' ,
4955 parentPath : 'plots' ,
5056 path : join ( 'plots' , 'image' ) ,
5157 revisions : new Set ( REVISIONS ) ,
5258 type : new Set < PathType > ( [ PathType . COMPARISON ] )
5359 } ,
5460 {
5561 hasChildren : false ,
62+ label : 'loss.tsv' ,
5663 parentPath : 'logs' ,
5764 path : join ( 'logs' , 'loss.tsv' ) ,
5865 revisions : new Set ( REVISIONS ) ,
5966 type : new Set < PathType > ( [ PathType . TEMPLATE_SINGLE ] )
6067 } ,
6168 {
6269 hasChildren : true ,
70+ label : 'logs' ,
6371 parentPath : undefined ,
6472 path : 'logs' ,
6573 revisions : new Set ( REVISIONS )
6674 } ,
6775 {
6876 hasChildren : false ,
77+ label : 'acc.tsv' ,
6978 parentPath : 'logs' ,
7079 path : join ( 'logs' , 'acc.tsv' ) ,
7180 revisions : new Set ( REVISIONS ) ,
7281 type : new Set < PathType > ( [ PathType . TEMPLATE_SINGLE ] )
7382 } ,
7483 {
7584 hasChildren : false ,
85+ label : 'predictions.json' ,
7686 parentPath : undefined ,
7787 path : 'predictions.json' ,
7888 revisions : new Set ( REVISIONS ) ,
@@ -164,6 +174,7 @@ describe('collectPaths', () => {
164174 const pathsWithNoTypes : PlotPath [ ] = plotsDiffFixturePaths . map (
165175 plotPath => ( {
166176 hasChildren : plotPath . hasChildren ,
177+ label : plotPath . label ,
167178 parentPath : plotPath . parentPath ,
168179 path : plotPath . path ,
169180 revisions : new Set ( [ 'workspace' ] )
@@ -183,6 +194,7 @@ describe('collectPaths', () => {
183194 const mockPath = 'completely:madeup:path'
184195 const mockPlotPath = {
185196 hasChildren : false ,
197+ label : mockPath ,
186198 parentPath : undefined ,
187199 path : mockPath ,
188200 revisions : new Set ( [ 'bfc7f64' ] ) ,
@@ -230,56 +242,133 @@ describe('collectPaths', () => {
230242 revisions,
231243 type : PlotsType . VEGA
232244 }
245+ ] ,
246+ [ join ( `dvc.yaml${ FIELD_SEPARATOR } logs` , 'acc.tsv' ) ] : [
247+ {
248+ content : { } ,
249+ datapoints : { [ EXPERIMENT_WORKSPACE_ID ] : [ { } ] } ,
250+ revisions,
251+ type : PlotsType . VEGA
252+ }
253+ ] ,
254+ [ join (
255+ 'nested' ,
256+ 'dvclive' ,
257+ `dvc.yaml${ FIELD_SEPARATOR } logs` ,
258+ 'acc.tsv'
259+ ) ] : [
260+ {
261+ content : { } ,
262+ datapoints : { [ EXPERIMENT_WORKSPACE_ID ] : [ { } ] } ,
263+ revisions,
264+ type : PlotsType . VEGA
265+ }
233266 ]
234267 }
235268 }
236269
237270 expect ( collectPaths ( [ ] , mockPlotsDiff , revisions ) ) . toStrictEqual ( [
238271 {
239272 hasChildren : false ,
273+ label : 'acc.tsv' ,
240274 parentPath : join ( 'logs' , 'scalars' ) ,
241275 path : join ( 'logs' , 'scalars' , 'acc.tsv' ) ,
242276 revisions : new Set ( revisions ) ,
243277 type : new Set ( [ 'template-single' ] )
244278 } ,
245279 {
246280 hasChildren : true ,
281+ label : 'scalars' ,
247282 parentPath : 'logs' ,
248283 path : join ( 'logs' , 'scalars' ) ,
249284 revisions : new Set ( revisions )
250285 } ,
251286 {
252287 hasChildren : true ,
288+ label : 'logs' ,
253289 parentPath : undefined ,
254290 path : 'logs' ,
255291 revisions : new Set ( revisions )
256292 } ,
257293 {
258294 hasChildren : false ,
295+ label : 'loss.tsv' ,
259296 parentPath : join ( 'logs' , 'scalars' ) ,
260297 path : join ( 'logs' , 'scalars' , 'loss.tsv' ) ,
261298 revisions : new Set ( revisions ) ,
262299 type : new Set ( [ 'template-single' ] )
263300 } ,
264301 {
265302 hasChildren : false ,
303+ label : 'heatmap.png' ,
266304 parentPath : 'plots' ,
267305 path : join ( 'plots' , 'heatmap.png' ) ,
268306 revisions : new Set ( revisions ) ,
269307 type : new Set ( [ 'comparison' ] )
270308 } ,
271309 {
272310 hasChildren : true ,
311+ label : 'plots' ,
273312 parentPath : undefined ,
274313 path : 'plots' ,
275314 revisions : new Set ( revisions )
276315 } ,
277316 {
278317 hasChildren : false ,
318+ label : 'predictions.json' ,
279319 parentPath : undefined ,
280320 path : 'predictions.json' ,
281321 revisions : new Set ( revisions ) ,
282322 type : new Set ( [ 'template-multi' ] )
323+ } ,
324+ {
325+ hasChildren : false ,
326+ label : 'acc.tsv' ,
327+ parentPath : join ( `dvc.yaml${ FIELD_SEPARATOR } logs` ) ,
328+ path : join ( `dvc.yaml${ FIELD_SEPARATOR } logs` , 'acc.tsv' ) ,
329+ revisions : new Set ( revisions ) ,
330+ type : new Set ( [ 'template-single' ] )
331+ } ,
332+ {
333+ hasChildren : true ,
334+ label : 'logs' ,
335+ parentPath : join ( 'dvc.yaml' ) ,
336+ path : join ( `dvc.yaml${ FIELD_SEPARATOR } logs` ) ,
337+ revisions : new Set ( revisions )
338+ } ,
339+ {
340+ hasChildren : true ,
341+ label : 'dvc.yaml' ,
342+ parentPath : undefined ,
343+ path : 'dvc.yaml' ,
344+ revisions : new Set ( revisions )
345+ } ,
346+ {
347+ hasChildren : false ,
348+ label : 'acc.tsv' ,
349+ parentPath : join ( 'nested' , 'dvclive' , `dvc.yaml${ FIELD_SEPARATOR } logs` ) ,
350+ path : join (
351+ 'nested' ,
352+ 'dvclive' ,
353+ `dvc.yaml${ FIELD_SEPARATOR } logs` ,
354+ 'acc.tsv'
355+ ) ,
356+ revisions : new Set ( revisions ) ,
357+ type : new Set ( [ 'template-single' ] )
358+ } ,
359+ {
360+ hasChildren : true ,
361+ label : 'logs' ,
362+ parentPath : join ( 'nested' , 'dvclive' , 'dvc.yaml' ) ,
363+ path : join ( 'nested' , 'dvclive' , `dvc.yaml${ FIELD_SEPARATOR } logs` ) ,
364+ revisions : new Set ( revisions )
365+ } ,
366+ {
367+ hasChildren : true ,
368+ label : join ( 'nested' , 'dvclive' , 'dvc.yaml' ) ,
369+ parentPath : undefined ,
370+ path : join ( 'nested' , 'dvclive' , 'dvc.yaml' ) ,
371+ revisions : new Set ( revisions )
283372 }
284373 ] )
285374 } )
@@ -308,24 +397,28 @@ describe('collectPaths', () => {
308397 expect ( paths ) . toStrictEqual ( [
309398 {
310399 hasChildren : false ,
400+ label : 'mip.jpg' ,
311401 parentPath : join ( 'training' , 'plots' , 'images' ) ,
312402 path : misspeltJpg ,
313403 revisions
314404 } ,
315405 {
316406 hasChildren : true ,
407+ label : 'images' ,
317408 parentPath : join ( 'training' , 'plots' ) ,
318409 path : join ( 'training' , 'plots' , 'images' ) ,
319410 revisions
320411 } ,
321412 {
322413 hasChildren : true ,
414+ label : 'plots' ,
323415 parentPath : 'training' ,
324416 path : join ( 'training' , 'plots' ) ,
325417 revisions
326418 } ,
327419 {
328420 hasChildren : true ,
421+ label : 'training' ,
329422 parentPath : undefined ,
330423 path : 'training' ,
331424 revisions
0 commit comments