未验证 提交 dd85f62e 编写于 作者: B Benjamin Pasero 提交者: GitHub

Process explorer: use icon font instead of SVG (fix #102560) (#105411)

上级 555808e9
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#646465" d="M6 4v8l4-4-4-4zm1 2.414L8.586 8 7 9.586V6.414z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#646465" d="M11 10H5.344L11 4.414V10z"/></svg>
\ No newline at end of file
...@@ -58,6 +58,7 @@ table { ...@@ -58,6 +58,7 @@ table {
width: 100%; width: 100%;
table-layout: fixed; table-layout: fixed;
} }
th[scope='col'] { th[scope='col'] {
vertical-align: bottom; vertical-align: bottom;
border-bottom: 1px solid #cccccc; border-bottom: 1px solid #cccccc;
...@@ -65,6 +66,7 @@ th[scope='col'] { ...@@ -65,6 +66,7 @@ th[scope='col'] {
border-top: 1px solid #cccccc; border-top: 1px solid #cccccc;
cursor: default; cursor: default;
} }
td { td {
padding: .25rem; padding: .25rem;
vertical-align: top; vertical-align: top;
...@@ -100,7 +102,6 @@ tbody > tr:hover { ...@@ -100,7 +102,6 @@ tbody > tr:hover {
display: none; display: none;
} }
img { .header {
width: 16px; display: flex;
margin-right: 4px;
} }
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/processExplorer'; import 'vs/css!./media/processExplorer';
import 'vs/base/browser/ui/codicons/codiconStyles'; // make sure codicon css is loaded
import { ElectronService, IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; import { ElectronService, IElectronService } from 'vs/platform/electron/electron-sandbox/electron';
import { ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals'; import { ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals';
import { localize } from 'vs/nls'; import { localize } from 'vs/nls';
...@@ -16,6 +17,7 @@ import { addDisposableListener, addClass } from 'vs/base/browser/dom'; ...@@ -16,6 +17,7 @@ import { addDisposableListener, addClass } from 'vs/base/browser/dom';
import { DisposableStore } from 'vs/base/common/lifecycle'; import { DisposableStore } from 'vs/base/common/lifecycle';
import { isRemoteDiagnosticError, IRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics'; import { isRemoteDiagnosticError, IRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics';
import { MainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService'; import { MainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService';
import { CodiconLabel } from 'vs/base/browser/ui/codicons/codiconLabel';
const DEBUG_FLAGS_PATTERN = /\s--(inspect|debug)(-brk|port)?=(\d+)?/; const DEBUG_FLAGS_PATTERN = /\s--(inspect|debug)(-brk|port)?=(\d+)?/;
const DEBUG_PORT_PATTERN = /\s--(inspect|debug)-port=(\d+)/; const DEBUG_PORT_PATTERN = /\s--(inspect|debug)-port=(\d+)/;
...@@ -156,15 +158,15 @@ class ProcessExplorer { ...@@ -156,15 +158,15 @@ class ProcessExplorer {
return maxProcessId; return maxProcessId;
} }
private updateSectionCollapsedState(shouldExpand: boolean, body: HTMLElement, twistie: HTMLImageElement, sectionName: string) { private updateSectionCollapsedState(shouldExpand: boolean, body: HTMLElement, twistie: CodiconLabel, sectionName: string) {
if (shouldExpand) { if (shouldExpand) {
body.classList.remove('hidden'); body.classList.remove('hidden');
this.collapsedStateCache.set(sectionName, false); this.collapsedStateCache.set(sectionName, false);
twistie.src = './media/expanded.svg'; twistie.text = '$(chevron-down)';
} else { } else {
body.classList.add('hidden'); body.classList.add('hidden');
this.collapsedStateCache.set(sectionName, true); this.collapsedStateCache.set(sectionName, true);
twistie.src = './media/collapsed.svg'; twistie.text = '$(chevron-right)';
} }
} }
...@@ -191,18 +193,27 @@ class ProcessExplorer { ...@@ -191,18 +193,27 @@ class ProcessExplorer {
private renderProcessGroupHeader(sectionName: string, body: HTMLElement, container: HTMLElement) { private renderProcessGroupHeader(sectionName: string, body: HTMLElement, container: HTMLElement) {
const headerRow = document.createElement('tr'); const headerRow = document.createElement('tr');
const data = document.createElement('td');
data.textContent = sectionName;
data.colSpan = 4;
headerRow.appendChild(data);
const twistie = document.createElement('img'); const headerData = document.createElement('td');
this.updateSectionCollapsedState(!this.collapsedStateCache.get(sectionName), body, twistie, sectionName); headerData.colSpan = 4;
data.prepend(twistie); headerRow.appendChild(headerData);
const headerContainer = document.createElement('div');
headerContainer.className = 'header';
headerData.appendChild(headerContainer);
const twistieContainer = document.createElement('div');
const twistieCodicon = new CodiconLabel(twistieContainer);
this.updateSectionCollapsedState(!this.collapsedStateCache.get(sectionName), body, twistieCodicon, sectionName);
headerContainer.appendChild(twistieContainer);
const headerLabel = document.createElement('span');
headerLabel.textContent = sectionName;
headerContainer.appendChild(headerLabel);
this.listeners.add(addDisposableListener(data, 'click', (e) => { this.listeners.add(addDisposableListener(headerData, 'click', (e) => {
const isHidden = body.classList.contains('hidden'); const isHidden = body.classList.contains('hidden');
this.updateSectionCollapsedState(isHidden, body, twistie, sectionName); this.updateSectionCollapsedState(isHidden, body, twistieCodicon, sectionName);
})); }));
container.appendChild(headerRow); container.appendChild(headerRow);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册