diff --git a/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetails.vue b/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetails.vue index e69745d..e0cebf2 100644 --- a/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetails.vue +++ b/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetails.vue @@ -5,7 +5,7 @@
- {{ t('imageScanner.registries.title') }}: + {{ t('imageScanner.registries.title') }}: {{ $route.params.id }} @@ -27,7 +27,15 @@
- + Recent scans + @@ -38,7 +46,6 @@ import RancherMeta from './common/RancherMeta.vue'; import RegisterStatusBadge from './common/RegisterStatusBadge.vue'; import { REGISTRY_SCAN_HISTORY_TABLE } from '@sbombastic-image-vulnerability-scanner/config/table-headers'; - import RegistryDetailScanTable from './RegistryDetailScanTable.vue'; export default { name: 'registryDetails', @@ -47,15 +54,15 @@ ResourceTable, RancherMeta, RegisterStatusBadge, - RegistryDetailScanTable }, data() { return { PRODUCT_NAME, RESOURCE, - registry: null, registryStatus: null, registryMetadata: [], + scanHistory: [], + headers: REGISTRY_SCAN_HISTORY_TABLE } }, async fetch() { @@ -63,6 +70,15 @@ await this.$store.dispatch('cluster/find', { type: RESOURCE.REGISTRY, id: `${this.$route.params.ns}/${this.$route.params.id}` }); let registry = this.$store.getters['cluster/byId'](RESOURCE.REGISTRY, `${this.$route.params.ns}/${this.$route.params.id}`); + + await this.$store.dispatch('cluster/findAll', { type: RESOURCE.SCAN_JOB }); + let scanJobs = this.$store.getters['cluster/all'](RESOURCE.SCAN_JOB); + + // filter scan jobs for the current registry + scanJobs = scanJobs.filter((job) => { + return job.spec.registry === registry.metadata.name; + }); + this.registryStatus = this.getRegistryStatus(registry); this.registryMetadata = [ { @@ -73,7 +89,7 @@ { type: 'text', label: this.t('imageScanner.registries.configuration.meta.repositories'), - value: registry.spec.repositories?.length || 0 + value: registry.spec.repositories.length }, { type: 'text', @@ -94,7 +110,19 @@ } ]; - this.registry = registry; + this.scanHistory = scanJobs.map((rec) => { + rec.status.statusResult = rec.status.conditions.filter(condition => { + return condition.status === "True"; + })[0] || { + type: "Pending", + lastTransitionTime: null, + }; + rec.status['scannedImagesCount'] = this.$route.params.id === 'kw-controller' ? 1000 : 500; + rec.status['imagesCount'] = 2000; + return rec; + }); + + console.log("Scan history:", this.scanHistory); }, methods: { getRegistryStatus(registry) { @@ -122,6 +150,10 @@ gap: 24px; flex: 1 0 0; align-self: stretch; + + .table { + width: 100%; + } } .about { @@ -170,7 +202,7 @@ .resource-header-description { /* layout */ display: flex; - max-width: 900px; + width: 900px; height: 21px; flex-direction: column; justify-content: center; diff --git a/pkg/sbombastic-image-vulnerability-scanner/components/common/RegisterStatusBadge.vue b/pkg/sbombastic-image-vulnerability-scanner/components/common/RegisterStatusBadge.vue index e8cfc6a..0e12036 100644 --- a/pkg/sbombastic-image-vulnerability-scanner/components/common/RegisterStatusBadge.vue +++ b/pkg/sbombastic-image-vulnerability-scanner/components/common/RegisterStatusBadge.vue @@ -1,6 +1,6 @@ @@ -29,7 +29,7 @@ case REGISTRY_STATUS.FAILED: return "failed"; default: - return ""; + return "none"; } } } @@ -82,6 +82,9 @@ font-style: normal; font-weight: 400; line-height: 19px; + &.none { + color: var(--muted); + } } } \ No newline at end of file diff --git a/pkg/sbombastic-image-vulnerability-scanner/components/common/RegistryStatusUpdate.vue b/pkg/sbombastic-image-vulnerability-scanner/components/common/RegistryStatusUpdate.vue index cf19398..fd6e9d7 100644 --- a/pkg/sbombastic-image-vulnerability-scanner/components/common/RegistryStatusUpdate.vue +++ b/pkg/sbombastic-image-vulnerability-scanner/components/common/RegistryStatusUpdate.vue @@ -1,11 +1,11 @@