Skip to content

Commit c9edb39

Browse files
xingzhang-suserushk014
authored andcommitted
Github #276: Bug: Minor display issues before 0.3.0 test
1 parent 3e0d2fc commit c9edb39

File tree

6 files changed

+20
-16
lines changed

6 files changed

+20
-16
lines changed

pkg/sbomscanner-ui-ext/components/ImageDetails.vue

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@
119119
<div class="vulnerabilities-section">
120120
<div class="summary-title">
121121
{{ t('imageScanner.imageDetails.mostSevereVulnerabilities.title') }}
122-
<InfoTooltip :tooltip="t('imageScanner.imageDetails.mostSevereVulnerabilities.tooltip')" />
122+
<InfoTooltip
123+
style="margin-left: 8px;"
124+
:tooltip="t('imageScanner.imageDetails.mostSevereVulnerabilities.tooltip')"
125+
/>
123126
</div>
124127
<div class="vulnerabilities-list">
125128
<div
@@ -262,7 +265,6 @@
262265

263266
<!-- Vulnerability Table -->
264267
<SortableTable
265-
v-if="safeTableData && safeTableData.length > 0"
266268
:key="`table-${isGrouped ? 'grouped' : 'ungrouped'}`"
267269
:rows="isGrouped ? layerData : safeTableData"
268270
:headers="isGrouped ? LAYER_BASED_TABLE : VULNERABILITY_DETAILS_TABLE"
@@ -324,12 +326,6 @@
324326
<!-- Disable search -->
325327
</template>
326328
</SortableTable>
327-
<div
328-
v-else
329-
class="no-data-message"
330-
>
331-
<p>No vulnerability data available</p>
332-
</div>
333329
</div>
334330
</template>
335331

@@ -548,7 +544,7 @@ export default {
548544
score: vuln.cvss?.nvd?.v3score ? `${ vuln.cvss.nvd.v3score } (CVSS v3)` : vuln.cvss?.redhat?.v3score ? `${ vuln.cvss.redhat.v3score } (CVSS v3)` : vuln.cvss?.ghsa?.v3score ? `${ vuln.cvss.ghsa.v3score } (CVSS v3)` : '',
549545
package: vuln.packageName,
550546
packageVersion: vuln.installedVersion,
551-
packagePath: vuln.purl || vuln.diffID, // Use purl if available, fallback to diffID
547+
packagePath: this.getPackagePath(vuln.purl),
552548
fixAvailable: vuln.fixedVersions && vuln.fixedVersions.length > 0,
553549
fixVersion: vuln.fixedVersions ? vuln.fixedVersions.join(', ') : '',
554550
severity: vuln.severity?.toLowerCase() || this.t('imageScanner.general.unknown'),
@@ -1375,6 +1371,11 @@ export default {
13751371
return [];
13761372
}
13771373
},
1374+
getPackagePath(purl) {
1375+
const packagePaths = typeof purl === 'string' ? purl.match(/(?<=:)([^@]+?)(?=@)/) : [];
1376+
1377+
return packagePaths && Array.isArray(packagePaths) ? packagePaths[0] : '';
1378+
},
13781379
},
13791380
};
13801381
</script>

pkg/sbomscanner-ui-ext/components/__tests__/CveDetails.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { jest } from '@jest/globals';
22
import { shallowMount, flushPromises } from '@vue/test-utils';
33
import CveDetails from '../CveDetails.vue';
44
import { BadgeState } from '@components/BadgeState';
5-
import { PRODUCT_NAME, RESOURCE, PAGE } from '@pkg/types';
5+
import { RESOURCE } from '@pkg/types';
66
import { NVD_BASE_URL, CVSS_VECTOR_BASE_URL } from '@pkg/constants';
77

88
jest.mock('@pkg/types', () => ({

pkg/sbomscanner-ui-ext/components/common/__tests__/AmountBarBySeverity.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ const StackedPercentageBar = {
1010
const factory = (propsData) => {
1111
return shallowMount(AmountBarBySeverity, {
1212
propsData,
13-
global: {
14-
stubs: { StackedPercentageBar, // Stub the child component
15-
},
16-
},
13+
global: { stubs: { StackedPercentageBar } }, // Stub the child component
1714
});
1815
};
1916

pkg/sbomscanner-ui-ext/components/common/__tests__/BarChart.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { shallowMount } from '@vue/test-utils';
2+
import { jest } from '@jest/globals';
23
import BarChart from '../BarChart.vue';
34

45
const PercentageBar = {

pkg/sbomscanner-ui-ext/components/common/__tests__/BlockPercentageBar.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

2-
import { jest } from '@jest/globals';
2+
import {
3+
jest, afterAll, beforeAll, beforeEach, afterEach, describe, it, expect
4+
} from '@jest/globals';
35
import { mount } from '@vue/test-utils';
46
import BlockPercentageBar from '../BlockPercentageBar.vue';
57

pkg/sbomscanner-ui-ext/pages/c/_cluster/sbomscanner/Dashboard.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@
5353
<div class="panel-header">
5454
<div class="header-left">
5555
<h3>{{ t('imageScanner.dashboard.scanningStatus.title') }}</h3>
56-
<InfoTooltip :tooltip="tooltip" />
56+
<InfoTooltip
57+
style="margin-left: 8px;"
58+
:tooltip="tooltip"
59+
/>
5760
</div>
5861
<div class="header-right">
5962
<span class="total-count">{{ displayedTotalScannedImageCnt }} {{ t('imageScanner.dashboard.scanningStatus.totalImages') }}</span>

0 commit comments

Comments
 (0)