mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-03 06:51:53 +01:00
This commit is contained in:
committed by
Ramya Rao
parent
e34fe5aae0
commit
f2bf5fc8de
@@ -54,6 +54,8 @@ export class IssueReporter extends Disposable {
|
||||
private telemetryService: ITelemetryService;
|
||||
private issueReporterModel: IssueReporterModel;
|
||||
private shouldQueueSearch = true;
|
||||
private receivedSystemInfo = false;
|
||||
private receivedPerformanceInfo = false;
|
||||
|
||||
constructor(configuration: IssueReporterConfiguration) {
|
||||
super();
|
||||
@@ -74,17 +76,26 @@ export class IssueReporter extends Disposable {
|
||||
reprosWithoutExtensions: false
|
||||
});
|
||||
|
||||
ipcRenderer.on('issueInfoResponse', (event, info) => {
|
||||
ipcRenderer.on('issuePerformanceInfoResponse', (event, info) => {
|
||||
this.issueReporterModel.update(info);
|
||||
this.receivedPerformanceInfo = true;
|
||||
|
||||
this.updateAllBlocks(this.issueReporterModel.getData());
|
||||
|
||||
const submitButton = <HTMLButtonElement>document.getElementById('github-submit-btn');
|
||||
submitButton.disabled = false;
|
||||
submitButton.textContent = localize('previewOnGitHub', "Preview on GitHub");
|
||||
const state = this.issueReporterModel.getData();
|
||||
this.updateProcessInfo(state);
|
||||
this.updateWorkspaceInfo(state);
|
||||
this.updatePreviewButtonState();
|
||||
});
|
||||
|
||||
ipcRenderer.send('issueInfoRequest');
|
||||
ipcRenderer.on('issueSystemInfoResponse', (event, info) => {
|
||||
this.issueReporterModel.update({ systemInfo: info });
|
||||
this.receivedSystemInfo = true;
|
||||
|
||||
this.updateSystemInfo(this.issueReporterModel.getData());
|
||||
this.updatePreviewButtonState();
|
||||
});
|
||||
|
||||
ipcRenderer.send('issueSystemInfoRequest');
|
||||
ipcRenderer.send('issuePerformanceInfoRequest');
|
||||
|
||||
if (window.document.documentElement.lang !== 'en') {
|
||||
show(document.getElementById('english'));
|
||||
@@ -211,6 +222,7 @@ export class IssueReporter extends Disposable {
|
||||
private setEventHandlers(): void {
|
||||
document.getElementById('issue-type').addEventListener('change', (event: Event) => {
|
||||
this.issueReporterModel.update({ issueType: parseInt((<HTMLInputElement>event.target).value) });
|
||||
this.updatePreviewButtonState();
|
||||
this.render();
|
||||
});
|
||||
|
||||
@@ -269,6 +281,34 @@ export class IssueReporter extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private updatePreviewButtonState() {
|
||||
const submitButton = <HTMLButtonElement>document.getElementById('github-submit-btn');
|
||||
if (this.isPreviewEnabled()) {
|
||||
submitButton.disabled = false;
|
||||
submitButton.textContent = localize('previewOnGitHub', "Preview on GitHub");
|
||||
} else {
|
||||
submitButton.disabled = true;
|
||||
submitButton.textContent = localize('loadingData', "Loading data...");
|
||||
}
|
||||
}
|
||||
|
||||
private isPreviewEnabled() {
|
||||
const issueType = this.issueReporterModel.getData().issueType;
|
||||
if (issueType === IssueType.Bug && this.receivedSystemInfo) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (issueType === IssueType.PerformanceIssue && this.receivedSystemInfo && this.receivedPerformanceInfo) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (issueType === IssueType.FeatureRequest) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@debounce(300)
|
||||
private searchGitHub(event: Event): void {
|
||||
const title = (<HTMLInputElement>event.target).value;
|
||||
@@ -449,16 +489,6 @@ export class IssueReporter extends Disposable {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update blocks
|
||||
*/
|
||||
|
||||
private updateAllBlocks(state) {
|
||||
this.updateSystemInfo(state);
|
||||
this.updateProcessInfo(state);
|
||||
this.updateWorkspaceInfo(state);
|
||||
}
|
||||
|
||||
private updateSystemInfo = (state) => {
|
||||
const target = document.querySelector('.block-system .block-info');
|
||||
let tableHtml = '';
|
||||
|
||||
Reference in New Issue
Block a user