Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/issue/browser/issueReporterService.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
import { IProductConfiguration } from '../../../../base/common/product.js';
6
import { localize } from '../../../../nls.js';
7
import { IContextMenuService } from '../../../../platform/contextview/browser/contextView.js';
8
import { IFileDialogService } from '../../../../platform/dialogs/common/dialogs.js';
9
import { IFileService } from '../../../../platform/files/common/files.js';
10
import { IOpenerService } from '../../../../platform/opener/common/opener.js';
11
import { IThemeService } from '../../../../platform/theme/common/themeService.js';
12
import { IAuthenticationService } from '../../../services/authentication/common/authentication.js';
13
import { IIssueFormService, IssueReporterData } from '../common/issue.js';
14
import { BaseIssueReporterService } from './baseIssueReporterService.js';
15
16
// GitHub has let us know that we could up our limit here to 8k. We chose 7500 to play it safe.
17
// ref https://github.com/microsoft/vscode/issues/159191
18
19
export class IssueWebReporter extends BaseIssueReporterService {
20
constructor(
21
disableExtensions: boolean,
22
data: IssueReporterData,
23
os: {
24
type: string;
25
arch: string;
26
release: string;
27
},
28
product: IProductConfiguration,
29
window: Window,
30
@IIssueFormService issueFormService: IIssueFormService,
31
@IThemeService themeService: IThemeService,
32
@IFileService fileService: IFileService,
33
@IFileDialogService fileDialogService: IFileDialogService,
34
@IContextMenuService contextMenuService: IContextMenuService,
35
@IAuthenticationService authenticationService: IAuthenticationService,
36
@IOpenerService openerService: IOpenerService
37
) {
38
super(disableExtensions, data, os, product, window, true, issueFormService, themeService, fileService, fileDialogService, contextMenuService, authenticationService, openerService);
39
40
const target = this.window.document.querySelector<HTMLElement>('.block-system .block-info');
41
42
const webInfo = this.window.navigator.userAgent;
43
if (webInfo) {
44
target?.appendChild(this.window.document.createTextNode(webInfo));
45
this.receivedSystemInfo = true;
46
this.issueReporterModel.update({ systemInfoWeb: webInfo });
47
}
48
49
this.setEventHandlers();
50
}
51
52
public override setEventHandlers(): void {
53
super.setEventHandlers();
54
55
this.addEventListener('issue-type', 'change', (event: Event) => {
56
const issueType = parseInt((<HTMLInputElement>event.target).value);
57
this.issueReporterModel.update({ issueType: issueType });
58
59
// Resets placeholder
60
const descriptionTextArea = <HTMLInputElement>this.getElementById('issue-title');
61
if (descriptionTextArea) {
62
descriptionTextArea.placeholder = localize('undefinedPlaceholder', "Please enter a title");
63
}
64
65
this.updateButtonStates();
66
this.setSourceOptions();
67
this.render();
68
});
69
}
70
}
71
72