Add ModelViewEditorOpened event (#12597)

* Add ModelViewEditorOpened event

* fix

* Fix compile
This commit is contained in:
Charles Gagnon
2020-09-24 12:53:28 -07:00
committed by GitHub
parent 1ea33d83bf
commit bf9646ba98
14 changed files with 51 additions and 24 deletions

View File

@@ -17,6 +17,8 @@ import { ModelViewInput, ModelViewInputModel, ModeViewSaveHandler } from 'sql/wo
import * as vscode from 'vscode';
import * as azdata from 'azdata';
import { assign } from 'vs/base/common/objects';
import { TelemetryView, TelemetryAction } from 'sql/platform/telemetry/common/telemetryKeys';
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
@extHostNamedCustomer(SqlMainContext.MainThreadModelViewDialog)
export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape {
@@ -33,7 +35,8 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
constructor(
context: IExtHostContext,
@IInstantiationService private _instatiationService: IInstantiationService,
@IEditorService private _editorService: IEditorService
@IEditorService private _editorService: IEditorService,
@IAdsTelemetryService private _telemetryService: IAdsTelemetryService
) {
this._proxy = context.getProxy(SqlExtHostContext.ExtHostModelViewDialog);
this._dialogService = new CustomDialogService(_instatiationService);
@@ -43,7 +46,7 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
throw new Error('Method not implemented.');
}
public $openEditor(handle: number, modelViewId: string, title: string, options?: azdata.ModelViewEditorOptions, position?: vscode.ViewColumn): Thenable<void> {
public $openEditor(handle: number, modelViewId: string, title: string, name?: string, options?: azdata.ModelViewEditorOptions, position?: vscode.ViewColumn): Thenable<void> {
return new Promise<void>((resolve, reject) => {
let saveHandler: ModeViewSaveHandler = options && options.supportsSave ? (h) => this.handleSave(h) : undefined;
let model = new ModelViewInputModel(modelViewId, handle, saveHandler);
@@ -52,7 +55,9 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
preserveFocus: true,
pinned: true
};
this._telemetryService.createActionEvent(TelemetryView.Shell, TelemetryAction.ModelViewDashboardOpened)
.withAdditionalProperties({ name: name })
.send();
this._editorService.openEditor(input, editorOptions, position as any).then((editor) => {
this._editorInputModels.set(handle, model);
resolve();