Get GPU information in issue reporter, #46960

This commit is contained in:
Rachel Macfarlane
2018-04-02 16:12:14 -07:00
parent 3bc2728340
commit 691c789ce3
4 changed files with 52 additions and 4 deletions

View File

@@ -771,10 +771,14 @@ export class IssueReporter extends Disposable {
const target = document.querySelector('.block-system .block-info');
let tableHtml = '';
Object.keys(state.systemInfo).forEach(k => {
const data = typeof state.systemInfo[k] === 'object'
? Object.keys(state.systemInfo[k]).map(key => `${key}: ${state.systemInfo[k][key]}`).join('<br>')
: state.systemInfo[k];
tableHtml += `
<tr>
<td>${k}</td>
<td>${state.systemInfo[k]}</td>
<td>${data}</td>
</tr>`;
});
target.innerHTML = `<table>${tableHtml}</table>`;

View File

@@ -142,7 +142,11 @@ ${this.getInfos()}
`;
Object.keys(this._data.systemInfo).forEach(k => {
md += `|${k}|${this._data.systemInfo[k]}|\n`;
const data = typeof this._data.systemInfo[k] === 'object'
? Object.keys(this._data.systemInfo[k]).map(key => `${key}: ${this._data.systemInfo[k][key]}`).join('<br>')
: this._data.systemInfo[k];
md += `|${k}|${data}|\n`;
});
md += '\n</details>';

View File

@@ -35,6 +35,36 @@ VS Code version: undefined
OS version: undefined
<!-- generated by issue reporter -->`);
});
test('serializes GPU information when data is provided', () => {
const issueReporterModel = new IssueReporterModel({
issueType: 0,
systemInfo: {
'GPU Status': {
'2d_canvas': 'enabled',
'checker_imaging': 'disabled_off'
}
}
});
assert.equal(issueReporterModel.serialize(),
`
Issue Type: <b>Bug</b>
undefined
VS Code version: undefined
OS version: undefined
<details>
<summary>System Info</summary>
|Item|Value|
|---|---|
|GPU Status|2d_canvas: enabled<br>checker_imaging: disabled_off|
</details>Extensions: none
<!-- generated by issue reporter -->`);
});