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