提交 a7e82b2d 编写于 作者: C Christof Marti

Add 'from' to telemetry events

上级 851ed825
...@@ -31,7 +31,7 @@ export class EditorWalkThroughAction extends Action { ...@@ -31,7 +31,7 @@ export class EditorWalkThroughAction extends Action {
public run(): TPromise<void> { public run(): TPromise<void> {
const uri = URI.parse(require.toUrl('./editorWalkThrough.md')) const uri = URI.parse(require.toUrl('./editorWalkThrough.md'))
.with({ scheme: WALK_THROUGH_SCHEME }); .with({ scheme: WALK_THROUGH_SCHEME });
const input = this.instantiationService.createInstance(WalkThroughInput, localize('editorWalkThrough.title', "Editor Walk-Through"), '', uri, null); const input = this.instantiationService.createInstance(WalkThroughInput, localize('editorWalkThrough.title', "Editor Walk-Through"), '', uri, /* telemetryFrom */ null, /* onReady */ null);
return this.editorService.openEditor(input, { pinned: true }, Position.ONE) return this.editorService.openEditor(input, { pinned: true }, Position.ONE)
.then(() => void (0)); .then(() => void (0));
} }
......
...@@ -81,18 +81,29 @@ export class WalkThroughPart extends BaseEditor { ...@@ -81,18 +81,29 @@ export class WalkThroughPart extends BaseEditor {
scrollTarget.scrollIntoView(); scrollTarget.scrollIntoView();
} }
} else { } else {
this.openerService.open(URI.parse(node.href)); const uri = this.addFrom(URI.parse(node.href));
this.openerService.open(uri);
} }
event.preventDefault(); event.preventDefault();
} else if (node instanceof HTMLButtonElement) { } else if (node instanceof HTMLButtonElement) {
const href = node.getAttribute('data-href'); const href = node.getAttribute('data-href');
if (href) { if (href) {
this.openerService.open(URI.parse(href)); const uri = this.addFrom(URI.parse(href));
this.openerService.open(uri);
} }
} }
}); });
} }
private addFrom(uri: URI) {
if (uri.scheme !== 'command') {
return uri;
}
const query = uri.query ? JSON.parse(uri.query) : {};
query.from = (<WalkThroughInput>this.input).getTelemetryFrom();
return uri.with({ query: JSON.stringify(query) });
}
layout({ width, height }: Dimension): void { layout({ width, height }: Dimension): void {
$(this.content).style({ height: `${height}px`, width: `${width}px` }); $(this.content).style({ height: `${height}px`, width: `${width}px` });
this.contentDisposables.forEach(disposable => { this.contentDisposables.forEach(disposable => {
......
...@@ -43,23 +43,16 @@ export class WalkThroughInput extends EditorInput { ...@@ -43,23 +43,16 @@ export class WalkThroughInput extends EditorInput {
static ID: string = 'workbench.editors.walkThroughInput'; static ID: string = 'workbench.editors.walkThroughInput';
private promise: TPromise<WalkThroughModel>; private promise: TPromise<WalkThroughModel>;
private resource: URI;
private name: string;
private description: string;
constructor( constructor(
name: string, private name: string,
description: string, private description: string,
resource: URI, private resource: URI,
private telemetryFrom: string,
public readonly onReady: (container: HTMLElement) => void, public readonly onReady: (container: HTMLElement) => void,
@ITextModelResolverService private textModelResolverService: ITextModelResolverService @ITextModelResolverService private textModelResolverService: ITextModelResolverService
) { ) {
super(); super();
this.name = name;
this.description = description;
this.resource = resource;
} }
getResource(): URI { getResource(): URI {
...@@ -78,6 +71,10 @@ export class WalkThroughInput extends EditorInput { ...@@ -78,6 +71,10 @@ export class WalkThroughInput extends EditorInput {
return this.description; return this.description;
} }
getTelemetryFrom(): string {
return this.telemetryFrom || 'walkThrough';
}
getTelemetryDescriptor(): { [key: string]: any; } { getTelemetryDescriptor(): { [key: string]: any; } {
const descriptor = super.getTelemetryDescriptor(); const descriptor = super.getTelemetryDescriptor();
descriptor['resource'] = telemetryURIDescriptor(this.resource); descriptor['resource'] = telemetryURIDescriptor(this.resource);
......
...@@ -86,7 +86,7 @@ class WelcomePage { ...@@ -86,7 +86,7 @@ class WelcomePage {
const recentlyOpened = this.windowService.getRecentlyOpen(); const recentlyOpened = this.windowService.getRecentlyOpen();
const uri = URI.parse(require.toUrl('./welcomePage.html')) const uri = URI.parse(require.toUrl('./welcomePage.html'))
.with({ scheme: WALK_THROUGH_SCHEME }); .with({ scheme: WALK_THROUGH_SCHEME });
const input = this.instantiationService.createInstance(WalkThroughInput, localize('welcome.title', "Welcome"), '', uri, container => this.onReady(container, recentlyOpened)); const input = this.instantiationService.createInstance(WalkThroughInput, localize('welcome.title', "Welcome"), '', uri, 'welcomePage', container => this.onReady(container, recentlyOpened));
this.editorService.openEditor(input, { pinned: true }, Position.ONE) this.editorService.openEditor(input, { pinned: true }, Position.ONE)
.then(null, onUnexpectedError); .then(null, onUnexpectedError);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册