Path: blob/main/src/vs/workbench/contrib/issue/browser/issueReporterService.ts
5243 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);3839// eslint-disable-next-line no-restricted-syntax40const target = this.window.document.querySelector<HTMLElement>('.block-system .block-info');4142const webInfo = this.window.navigator.userAgent;43if (webInfo) {44target?.appendChild(this.window.document.createTextNode(webInfo));45this.receivedSystemInfo = true;46this.issueReporterModel.update({ systemInfoWeb: webInfo });47}4849this.setEventHandlers();50}5152public override setEventHandlers(): void {53super.setEventHandlers();5455this.addEventListener('issue-type', 'change', (event: Event) => {56const issueType = parseInt((<HTMLInputElement>event.target).value);57this.issueReporterModel.update({ issueType: issueType });5859// Resets placeholder60// eslint-disable-next-line no-restricted-syntax61const descriptionTextArea = <HTMLInputElement>this.getElementById('issue-title');62if (descriptionTextArea) {63descriptionTextArea.placeholder = localize('undefinedPlaceholder', "Please enter a title");64}6566this.updateButtonStates();67this.setSourceOptions();68this.render();69});70}71}727374