feat: 更新进程表排序功能,添加命令列排序支持并调整样式

This commit is contained in:
cmliu committed 2026-07-29 22:26:16 +08:00
1 parent 6c848094d0
commit fc98a4ae70
3 files changed
+5 -4

No files matched your search

+1 -1
View File
@@ -463,7 +463,7 @@
<th scope="col" aria-sort="descending"><button class="process-sort" type="button" data-process-sort="cpuPercent" data-i18n-zh="CPU%" data-i18n-en="CPU%">CPU%</button></th>
<th scope="col" aria-sort="none"><button class="process-sort" type="button" data-process-sort="state" data-i18n-zh="状态" data-i18n-en="State">状态</button></th>
<th scope="col" aria-sort="none"><button class="process-sort" type="button" data-process-sort="time" data-i18n-zh="时间" data-i18n-en="Time">时间</button></th>
<th scope="col" data-i18n-zh="名称/命令行" data-i18n-en="Name / command">名称/命令行</th>
<th scope="col" aria-sort="none"><button class="process-sort" type="button" data-process-sort="command" data-i18n-zh="名称/命令行" data-i18n-en="Name / command">名称/命令行</button></th>
</tr>
</thead>
<tbody id="process-table-body"></tbody>
+2 -2
View File
@@ -33,7 +33,7 @@ interface ProcessEntry {
command: string;
}
type ProcessSortKey = 'pid' | 'user' | 'memoryBytes' | 'memoryPercent' | 'cpuPercent' | 'state' | 'time';
type ProcessSortKey = 'pid' | 'user' | 'memoryBytes' | 'memoryPercent' | 'cpuPercent' | 'state' | 'time' | 'command';
type SortDirection = 'ascending' | 'descending';
interface ProcessSnapshot {
@@ -202,7 +202,7 @@ export class ProcessManager {
this.sortDirection = this.sortDirection === 'ascending' ? 'descending' : 'ascending';
} else {
this.sortKey = key;
this.sortDirection = key === 'user' || key === 'state' ? 'ascending' : 'descending';
this.sortDirection = key === 'user' || key === 'state' || key === 'command' ? 'ascending' : 'descending';
}
this.updateSortHeaders();
this.render();
+2 -1
View File
@@ -1395,7 +1395,8 @@ button:disabled {
.process-table th:nth-child(5) { width: 7%; }
.process-table th:nth-child(6) { width: 6%; }
.process-table th:nth-child(7) { width: 9%; }
.process-table th:nth-child(8) { width: 47%; text-align: left; }
.process-table th:nth-child(8) { width: 47%; text-align: center; }
.process-table th:nth-child(8) .process-sort { text-align: center; }
.process-sort {
position: relative;