fix(vulnerabilities): hide unselected browser headings

This commit is contained in:
Sycun 2026-11-13 17:32:42 +08:00
parent 478858d36d
commit b71e6e79bb
3 changed files with 23 additions and 13 deletions

View File

@ -31,12 +31,6 @@
.vulnerability-page-footer:has(> #vulnerability-pagination:empty) { display: none; }
@media (width > 900px) {
#page-vulnerabilities:has(#vulnerability-view-switch :is([data-vuln-view="host"], [data-vuln-view="task"])[aria-pressed="true"]) > .vulnerability-page-footer {
padding-inline-start: calc(var(--vuln-page-gutter) + var(--vuln-tree-width) + var(--vuln-tree-gap));
}
}
#page-vulnerabilities .vulnerability-header-start { gap: 20px; }
#page-vulnerabilities .vulnerability-view-switch { border: 0; padding: 4px; }
#page-vulnerabilities .vulnerability-view-switch button { padding: 7px 13px; }
@ -92,8 +86,6 @@
#page-vulnerabilities .vulnerability-host-sidebar {
display: flex;
flex-direction: column;
height: min(660px, 70vh);
min-height: 300px;
border-radius: 12px;
padding: 12px;
}
@ -123,7 +115,7 @@
cursor: pointer;
}
.vulnerability-domain-label[aria-pressed="true"] { color: var(--accent-color); font-weight: 600; }
.vulnerability-host-heading-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.vulnerability-host-heading-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-inline-start: auto; }
.vulnerability-host-heading-actions [hidden] { display: none; }
#page-vulnerabilities .vulnerability-host-results-heading { align-items: start; }
#vulnerability-host-selection {
@ -134,6 +126,7 @@
-webkit-line-clamp: 2;
overflow: hidden;
}
#vulnerability-host-selection[hidden] { display: none; }
.vulnerability-table-name {
flex: 1;
min-width: 0;
@ -257,6 +250,22 @@
#page-vulnerabilities .dashboard-stats { grid-template-columns: repeat(3,minmax(0,1fr)); }
#page-vulnerabilities .stat-card-total { grid-column: auto; }
}
@media (width > 900px) {
#page-vulnerabilities > .page-content:has(.vulnerability-host-browser) {
container-type: size;
padding-block-end: 0;
margin-block-end: 8px;
}
#page-vulnerabilities .vulnerability-host-sidebar {
position: sticky;
inset-block-start: var(--vuln-page-padding-block);
align-self: stretch;
/* Let the results size the grid row, capped by the visible scroll area. */
contain: size;
max-block-size: 100cqh;
}
}
@media (max-width: 900px) {
#page-vulnerabilities .vulnerability-host-browser { grid-template-columns: minmax(0,1fr); }
#page-vulnerabilities .vulnerability-host-sidebar { height: min(300px, 45vh); min-height: 220px; }

View File

@ -1560,9 +1560,10 @@ function renderVulnerabilityBrowserTable() {
});
const selectedOption = Array.from(document.querySelectorAll('#vulnerabilities-list [data-host-key]')).find(option => option.dataset.hostKey === selection);
const label = selection ? (selectedOption?.querySelector('[title]')?.title || selectedOption?.title || selection.slice(selection.indexOf(':') + 1))
: vulnT(vulnerabilityView === 'task' ? 'vulnerabilityPage.allTasks' : 'vulnerabilityPage.allHosts');
: '';
const heading = document.getElementById('vulnerability-host-selection');
heading.textContent = label || vulnT('vulnerabilityPage.unknownHost');
heading.hidden = !selection;
heading.textContent = selection ? label || vulnT('vulnerabilityPage.unknownHost') : '';
heading.title = heading.textContent;
document.getElementById('vulnerability-host-clear').hidden = !selection;
document.getElementById('vulnerability-host-selection-count').textContent =

View File

@ -48,7 +48,7 @@
<link rel="stylesheet" href="/static/vendor/xterm.css">
<!-- 移动端样式层:全部规则限定在 767.98px 以下,桌面端零影响 -->
<link rel="stylesheet" href="/static/css/mobile.css?v=20261015-project-table-3">
<link rel="stylesheet" href="/static/css/vulnerability-workspace.css?v=20261113-fixed-pagination">
<link rel="stylesheet" href="/static/css/vulnerability-workspace.css?v=20261113-selection-heading">
<link rel="stylesheet" href="/static/css/vulnerability-list.css?v=20261113-compact-rows">
<script src="/static/js/router.js?v=20261011-token-settings"></script>
</head>
@ -7132,7 +7132,7 @@
<script src="/static/js/skills.js?v=20261103-personal-integration"></script>
<script src="/static/js/fact-graph.js"></script>
<script src="/static/js/projects.js?v=20260819-1-pagination-20261027"></script>
<script src="/static/js/vulnerability.js?v=20261113-compact-rows"></script>
<script src="/static/js/vulnerability.js?v=20261113-selection-heading"></script>
<script src="/static/js/vulnerability-workspace.js?v=20261113-compact-rows"></script>
<script src="/static/js/vulnerability-download.js?v=20261030-2"></script>
<script src="/static/js/webshell.js?v=20261011-token-usage-tool-title"></script>