Skip to content

Commit 1e9f80d

Browse files
authored
Update default export path for plots data (#4849)
1 parent 21979f0 commit 1e9f80d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

extension/src/plots/webview/messages.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ export class WebviewMessages {
427427
| typeof EventName.VIEWS_PLOTS_EXPORT_PLOT_DATA_AS_TSV,
428428
writeFile: (filePath: string, plotId: string) => void
429429
) {
430-
const file = await showSaveDialog(`data.${extName}`, extName)
430+
const file = await this.showSaveDialog('data', extName)
431431

432432
if (!file) {
433433
return
@@ -439,10 +439,7 @@ export class WebviewMessages {
439439
}
440440

441441
private async exportPlotAsSvg(svg: string) {
442-
const file = await showSaveDialog(
443-
join(this.dvcRoot, 'visualization.svg'),
444-
'svg'
445-
)
442+
const file = await this.showSaveDialog('visualization', 'svg')
446443
if (!file) {
447444
return
448445
}
@@ -486,4 +483,9 @@ export class WebviewMessages {
486483
this.plots.savePlotDataAsTsv(filePath, plotId)
487484
)
488485
}
486+
487+
private showSaveDialog(filename: string, extName: string) {
488+
const defaultPath = join(this.dvcRoot, [filename, extName].join('.'))
489+
return showSaveDialog(defaultPath, extName)
490+
}
489491
}

0 commit comments

Comments
 (0)