Skip to content

Commit 431be5e

Browse files
committed
πŸ› fix(ui): top-align vulnerability rows in detail panels (#217)
1 parent 05c023f commit 431be5e

File tree

6 files changed

+33
-13
lines changed

6 files changed

+33
-13
lines changed

β€Žui/src/components/containers/ContainerFullPageTabContent.vueβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,12 +466,12 @@ function isActionInProgress(container: { id?: unknown; name?: unknown }) {
466466
</div>
467467
<div v-if="vulnerabilityPreview.length > 0" class="space-y-1.5">
468468
<div v-for="vulnerability in vulnerabilityPreview" :key="vulnerability.id"
469-
class="flex items-center gap-2 px-3 py-2 dd-rounded text-2xs-plus"
469+
class="flex items-start gap-2 px-3 py-2 dd-rounded text-2xs-plus"
470470
:style="{ backgroundColor: 'var(--dd-bg-inset)' }">
471-
<AppBadge size="xs" :custom="severityStyle(normalizeSeverity(vulnerability.severity))">
471+
<AppBadge size="xs" class="mt-0.5 shrink-0" :custom="severityStyle(normalizeSeverity(vulnerability.severity))">
472472
{{ normalizeSeverity(vulnerability.severity) }}
473473
</AppBadge>
474-
<span class="font-mono dd-text truncate">{{ vulnerability.id }}</span>
474+
<span class="min-w-0 font-mono dd-text truncate">{{ vulnerability.id }}</span>
475475
<span class="dd-text-muted truncate ml-auto">{{ getVulnerabilityPackage(vulnerability) }}</span>
476476
</div>
477477
</div>

β€Žui/src/components/containers/ContainerSideTabContent.vueβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,12 @@ function isActionInProgress(container: { id?: unknown; name?: unknown }) {
449449

450450
<div v-if="vulnerabilityPreview.length > 0" class="space-y-1">
451451
<div v-for="vulnerability in vulnerabilityPreview" :key="vulnerability.id"
452-
class="flex items-center gap-2 px-2.5 py-1.5 dd-rounded text-2xs"
452+
class="flex items-start gap-2 px-2.5 py-1.5 dd-rounded text-2xs"
453453
:style="{ backgroundColor: 'var(--dd-bg-inset)' }">
454-
<AppBadge size="xs" :custom="severityStyle(normalizeSeverity(vulnerability.severity))">
454+
<AppBadge size="xs" class="mt-0.5 shrink-0" :custom="severityStyle(normalizeSeverity(vulnerability.severity))">
455455
{{ normalizeSeverity(vulnerability.severity) }}
456456
</AppBadge>
457-
<span class="font-mono dd-text truncate">{{ vulnerability.id }}</span>
457+
<span class="min-w-0 font-mono dd-text truncate">{{ vulnerability.id }}</span>
458458
<span class="dd-text-muted truncate ml-auto">{{ getVulnerabilityPackage(vulnerability) }}</span>
459459
</div>
460460
</div>

β€Žui/src/views/SecurityView.vueβ€Ž

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -636,22 +636,23 @@ onUnmounted(() => {
636636
<div class="divide-y" :style="{ borderColor: 'var(--dd-border)' }">
637637
<div v-for="vuln in selectedImageVulnsWithSafeUrl" :key="vuln.id + vuln.package"
638638
class="px-4 py-3 hover:dd-bg-hover transition-colors">
639-
<div class="flex items-center gap-2 mb-1.5">
639+
<div class="flex items-start gap-2 mb-1.5">
640640
<AppIcon :name="severityIcon(vuln.severity)" :size="12"
641+
class="mt-0.5 shrink-0"
641642
:style="{ color: severityColor(vuln.severity).text }" />
642-
<AppBadge :custom="{ bg: severityColor(vuln.severity).bg, text: severityColor(vuln.severity).text }" size="xs" class="px-1.5 py-0">
643+
<AppBadge :custom="{ bg: severityColor(vuln.severity).bg, text: severityColor(vuln.severity).text }" size="xs" class="mt-0.5 shrink-0 px-1.5 py-0">
643644
{{ vuln.severity }}
644645
</AppBadge>
645-
<span class="font-mono text-2xs-plus font-semibold dd-text truncate">{{ vuln.id }}</span>
646+
<span class="min-w-0 font-mono text-2xs-plus font-semibold dd-text truncate">{{ vuln.id }}</span>
646647
</div>
647-
<div class="flex items-center gap-2 text-2xs-plus ml-5">
648+
<div class="flex items-start gap-2 text-2xs-plus ml-5 min-w-0">
648649
<span class="font-medium dd-text">{{ vuln.package }}</span>
649650
<span class="dd-text-muted">{{ vuln.version }}</span>
650-
<AppBadge v-if="vuln.fixedIn" tone="success" size="xs" class="ml-auto px-1.5 py-0">
651-
<AppIcon name="check" :size="9" class="mr-0.5" />
651+
<AppBadge v-if="vuln.fixedIn" tone="success" size="xs" class="ml-auto mt-0.5 shrink-0 px-1.5 py-0">
652+
<AppIcon name="check" :size="9" class="mr-0.5 shrink-0" />
652653
{{ vuln.fixedIn }}
653654
</AppBadge>
654-
<span v-else class="ml-auto text-2xs dd-text-muted">No fix</span>
655+
<span v-else class="ml-auto mt-0.5 shrink-0 text-2xs dd-text-muted">No fix</span>
655656
</div>
656657
<div
657658
v-if="vuln.title || vuln.target || vuln.safePrimaryUrl"

β€Žui/tests/components/ContainerSideTabContent.spec.tsβ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,12 @@ describe('ContainerSideTabContent - Environment Variables', () => {
717717
await sbomButton?.trigger('click');
718718

719719
expect(wrapper.text()).toContain('CVE-2026-0001');
720+
const vulnerabilityLabel = wrapper
721+
.findAll('.font-mono')
722+
.find((node) => node.text().includes('CVE-2026-0001'));
723+
const vulnerabilityRow = vulnerabilityLabel?.element.parentElement;
724+
expect(vulnerabilityRow?.classList.contains('items-start')).toBe(true);
725+
expect(vulnerabilityRow?.classList.contains('items-center')).toBe(false);
720726
expect(selectedSbomFormat.value).toBe('cyclonedx-json');
721727
expect(loadDetailSecurityData).toHaveBeenCalledTimes(1);
722728
expect(loadDetailSbom).toHaveBeenCalledTimes(1);

β€Žui/tests/components/containers/ContainerFullPageTabContent.spec.tsβ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,12 @@ describe('ContainerFullPageTabContent', () => {
803803
expect(wrapper.text()).toContain('Abort on pre-update failure');
804804
expect(wrapper.text()).toContain('{{name}}');
805805
expect(wrapper.text()).toContain('CVE-2026-0001');
806+
const vulnerabilityLabel = wrapper
807+
.findAll('.font-mono')
808+
.find((node) => node.text().includes('CVE-2026-0001'));
809+
const vulnerabilityRow = vulnerabilityLabel?.element.parentElement;
810+
expect(vulnerabilityRow?.classList.contains('items-start')).toBe(true);
811+
expect(vulnerabilityRow?.classList.contains('items-center')).toBe(false);
806812
expect(wrapper.text()).toContain('components:');
807813
expect(wrapper.text()).toContain('generated:');
808814

β€Žui/tests/views/SecurityView.spec.tsβ€Ž

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,13 @@ describe('SecurityView', () => {
477477
expect(w.text()).toContain('OpenSSL buffer overflow');
478478
expect(w.text()).toContain('usr/lib/libcrypto.so');
479479
expect(w.find('a[href="https://avd.aquasec.com/nvd/cve-2026-9999"]').exists()).toBe(true);
480+
481+
const vulnerabilityRow = w.find('.divide-y > div');
482+
const detailLines = vulnerabilityRow.findAll('.flex');
483+
expect(detailLines[0].classes()).toContain('items-start');
484+
expect(detailLines[0].classes()).not.toContain('items-center');
485+
expect(detailLines[1].classes()).toContain('items-start');
486+
expect(detailLines[1].classes()).not.toContain('items-center');
480487
});
481488

482489
it('computes safe vulnerability URLs once per vulnerability instead of per binding', async () => {

0 commit comments

Comments
Β (0)