@@ -13,7 +13,6 @@ import { Logger } from '../../common/logger'
1313import { Experiments } from '../../experiments'
1414import { sendTelemetryEvent } from '../../telemetry'
1515import { EventName } from '../../telemetry/constants'
16- import { Toast } from '../../vscode/toast'
1716import {
1817 MessageFromWebview ,
1918 MessageFromWebviewType ,
@@ -30,31 +29,31 @@ import { RegisteredCommands } from '../../commands/external'
3029import { ErrorsModel } from '../errors/model'
3130
3231export class WebviewMessages {
32+ private readonly dvcRoot : string
3333 private readonly paths : PathsModel
3434 private readonly plots : PlotsModel
3535 private readonly errors : ErrorsModel
3636 private readonly experiments : Experiments
3737
3838 private readonly getWebview : ( ) => BaseWebview < TPlotsData > | undefined
3939 private readonly selectPlots : ( ) => Promise < void >
40- private readonly updateData : ( ) => Promise < void >
4140
4241 constructor (
42+ dvcRoot : string ,
4343 paths : PathsModel ,
4444 plots : PlotsModel ,
4545 errors : ErrorsModel ,
4646 experiments : Experiments ,
4747 getWebview : ( ) => BaseWebview < TPlotsData > | undefined ,
48- selectPlots : ( ) => Promise < void > ,
49- updateData : ( ) => Promise < void >
48+ selectPlots : ( ) => Promise < void >
5049 ) {
50+ this . dvcRoot = dvcRoot
5151 this . paths = paths
5252 this . plots = plots
5353 this . errors = errors
5454 this . experiments = experiments
5555 this . getWebview = getWebview
5656 this . selectPlots = selectPlots
57- this . updateData = updateData
5857 }
5958
6059 public async sendWebviewMessage ( ) {
@@ -79,7 +78,10 @@ export class WebviewMessages {
7978 public handleMessageFromWebview ( message : MessageFromWebview ) {
8079 switch ( message . type ) {
8180 case MessageFromWebviewType . ADD_CUSTOM_PLOT :
82- return commands . executeCommand ( RegisteredCommands . PLOTS_CUSTOM_ADD )
81+ return commands . executeCommand (
82+ RegisteredCommands . PLOTS_CUSTOM_ADD ,
83+ this . dvcRoot
84+ )
8385 case MessageFromWebviewType . RESIZE_PLOTS :
8486 return this . setPlotSize (
8587 message . payload . section ,
@@ -101,9 +103,15 @@ export class WebviewMessages {
101103 case MessageFromWebviewType . SELECT_EXPERIMENTS :
102104 return this . selectExperimentsFromWebview ( )
103105 case MessageFromWebviewType . REMOVE_CUSTOM_PLOTS :
104- return commands . executeCommand ( RegisteredCommands . PLOTS_CUSTOM_REMOVE )
106+ return commands . executeCommand (
107+ RegisteredCommands . PLOTS_CUSTOM_REMOVE ,
108+ this . dvcRoot
109+ )
105110 case MessageFromWebviewType . REFRESH_REVISIONS :
106- return this . refreshData ( )
111+ return commands . executeCommand (
112+ RegisteredCommands . PLOTS_REFRESH ,
113+ this . dvcRoot
114+ )
107115 case MessageFromWebviewType . TOGGLE_EXPERIMENT :
108116 return this . setExperimentStatus ( message . payload )
109117 case MessageFromWebviewType . ZOOM_PLOT :
@@ -237,16 +245,6 @@ export class WebviewMessages {
237245 )
238246 }
239247
240- private refreshData ( ) {
241- void Toast . infoWithOptions ( 'Attempting to refresh visible plots data.' )
242- void this . updateData ( )
243- sendTelemetryEvent (
244- EventName . VIEWS_PLOTS_MANUAL_REFRESH ,
245- undefined ,
246- undefined
247- )
248- }
249-
250248 private sendSectionCollapsed ( ) {
251249 void this . getWebview ( ) ?. show ( {
252250 sectionCollapsed : this . plots . getSectionCollapsed ( )
0 commit comments