diff --git a/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetailScanTable.vue b/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetailScanTable.vue
index b4d57aa..655aae9 100644
--- a/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetailScanTable.vue
+++ b/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetailScanTable.vue
@@ -1,6 +1,5 @@
diff --git a/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetails.vue b/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetails.vue
index a97f3a9..b276ea4 100644
--- a/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetails.vue
+++ b/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetails.vue
@@ -15,19 +15,20 @@
-
+
@@ -37,8 +38,8 @@
import ResourceTable from "@shell/components/ResourceTable";
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';
+ import ScanButton from './common/ScanButton.vue';
export default {
name: 'registryDetails',
@@ -47,66 +48,75 @@
ResourceTable,
RancherMeta,
RegisterStatusBadge,
- RegistryDetailScanTable
+ RegistryDetailScanTable,
+ ScanButton
},
data() {
return {
PRODUCT_NAME,
RESOURCE,
PAGE,
- registry: null,
registryStatus: null,
registryMetadata: [],
+ scanHistory: [],
}
},
async fetch() {
-
- 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 = [
- {
- type: 'text',
- label: this.t('imageScanner.registries.configuration.meta.registry'),
- value: registry.spec.uri
- },
- {
- type: 'text',
- label: this.t('imageScanner.registries.configuration.meta.repositories'),
- value: registry.spec.repositories?.length || 0
- },
- {
- type: 'text',
- label: this.t('imageScanner.registries.configuration.meta.schedule')
- },
- {
- type: 'text',
- label: this.t('imageScanner.registries.configuration.meta.namespace'),
- value: registry.metadata.namespace
- },
- {
- type: 'tags',
- tags: registry.spec.repositories || []
- },
- {
- type: 'text',
- value: registry.metadata.schedule || '',
- }
- ];
-
- this.registry = registry;
+ await this.loadData();
},
methods: {
+ async loadData(isForceLoading = false) {
+ await this.$store.dispatch('cluster/find', { type: RESOURCE.REGISTRY, id: `${this.$route.params.ns}/${this.$route.params.id}`, opt: {force: isForceLoading} });
+ if (this.$store.getters['cluster/canList'](RESOURCE.SCAN_JOB)) {
+ await this.$store.dispatch('cluster/findAll', { type: RESOURCE.SCAN_JOB, opt: {force: isForceLoading} });
+ }
+
+ let registry = this.$store.getters['cluster/byId'](RESOURCE.REGISTRY, `${this.$route.params.ns}/${this.$route.params.id}`);
+ let scanJobs = this.$store.getters['cluster/all'](RESOURCE.SCAN_JOB).filter((rec) => {
+ return rec.spec.registry === registry.metadata.name;
+ });
+
+ this.registryStatus = this.getRegistryStatus(registry);
+ this.registryMetadata = [
+ {
+ type: 'text',
+ label: this.t('imageScanner.registries.configuration.meta.registry'),
+ value: registry.spec.uri
+ },
+ {
+ type: 'text',
+ label: this.t('imageScanner.registries.configuration.meta.repositories'),
+ value: registry.spec.repositories?.length || 0
+ },
+ {
+ type: 'text',
+ label: this.t('imageScanner.registries.configuration.meta.schedule')
+ },
+ {
+ type: 'text',
+ label: this.t('imageScanner.registries.configuration.meta.namespace'),
+ value: registry.metadata.namespace
+ },
+ {
+ type: 'tags',
+ tags: registry.spec.repositories || []
+ },
+ {
+ type: 'text',
+ value: registry.metadata.schedule || '',
+ }
+ ];
+
+ this.scanHistory = scanJobs.map((rec) => {
+ rec.status.statusResult = rec.status.conditions.filter(condition => {
+ return condition.status === "True";
+ })[0] || {
+ type: "Pending",
+ lastTransitionTime: null,
+ };
+ return rec;
+ });
+ },
getRegistryStatus(registry) {
if (!registry || !registry.status || !registry.status.conditions || !registry.status.conditions.length) {
return null;