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
5243 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
// eslint-disable-next-line no-restricted-syntax
41
const target = this.window.document.querySelector<HTMLElement>('.block-system .block-info');
42
43
const webInfo = this.window.navigator.userAgent;
44
if (webInfo) {
45
target?.appendChild(this.window.document.createTextNode(webInfo));
46
this.receivedSystemInfo = true;
47
this.issueReporterModel.update({ systemInfoWeb: webInfo });
48
}
49
50
this.setEventHandlers();
51
}
52
53
public override setEventHandlers(): void {
54
super.setEventHandlers();
55
56
this.addEventListener('issue-type', 'change', (event: Event) => {
57
const issueType = parseInt((<HTMLInputElement>event.target).value);
58
this.issueReporterModel.update({ issueType: issueType });
59
60
// Resets placeholder
61
// eslint-disable-next-line no-restricted-syntax
62
const descriptionTextArea = <HTMLInputElement>this.getElementById('issue-title');
63
if (descriptionTextArea) {
64
descriptionTextArea.placeholder = localize('undefinedPlaceholder', "Please enter a title");
65
}
66
67
this.updateButtonStates();
68
this.setSourceOptions();
69
this.render();
70
});
71
}
72
}
73
74