Skip to content

Commit 1b156a7

Browse files
rushk014xingzhang-suse
authored andcommitted
fix(registries): Fix UX/UI bugs for Registries Configuration - Detail page #118
1 parent fcf7296 commit 1b156a7

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetailScanTable.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<script>
22
import { REGISTRY_SCAN_HISTORY_TABLE } from "@sbombastic-image-vulnerability-scanner/config/table-headers";
3-
import ResourceTable from "@shell/components/ResourceTable";
3+
import SortableTable from "@shell/components/SortableTable";
44
55
export default {
66
name: 'RegistryDetailScanTable',
77
components: {
8-
ResourceTable
8+
SortableTable
99
},
1010
props: {
1111
scanHistory: {
@@ -24,12 +24,15 @@
2424
<template>
2525
<div class="registry-detail-scan-table">
2626
Recent scans
27-
<ResourceTable
28-
:headers="headers"
29-
:rows="scanHistory"
27+
<SortableTable
28+
:has-advanced-filtering="false"
3029
:namespaced="false"
31-
:rowActions="false"
30+
:row-actions="false"
31+
:table-actions="false"
3232
:search="false"
33+
:headers="headers"
34+
:rows="scanHistory"
35+
:default-sort-by="'since'"
3336
/>
3437
</div>
3538
</template>

pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetails.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
if (this.$store.getters['cluster/canList'](RESOURCE.SCAN_JOB)) {
8181
await this.$store.dispatch('cluster/findAll', { type: RESOURCE.SCAN_JOB, opt: {force: isForceLoading} });
8282
}
83+
this.scanHistory = [];
8384
8485
let registry = this.$store.getters['cluster/byId'](RESOURCE.REGISTRY, `${this.$route.params.ns}/${this.$route.params.id}`);
8586
let scanJobs = this.$store.getters['cluster/all'](RESOURCE.SCAN_JOB).filter((rec) => {
@@ -90,8 +91,8 @@
9091
this.registryMetadata = [
9192
{
9293
type: 'text',
93-
label: this.t('imageScanner.registries.configuration.meta.registry'),
94-
value: registry.spec.uri
94+
label: this.t('imageScanner.registries.configuration.meta.namespace'),
95+
value: registry.metadata.namespace
9596
},
9697
{
9798
type: 'text',
@@ -104,16 +105,17 @@
104105
},
105106
{
106107
type: 'text',
107-
label: this.t('imageScanner.registries.configuration.meta.namespace'),
108-
value: registry.metadata.namespace
108+
label: this.t('imageScanner.registries.configuration.meta.uri'),
109+
value: registry.spec.uri
109110
},
110111
{
111112
type: 'tags',
112113
tags: registry.spec.repositories || []
113114
},
114115
{
115116
type: 'text',
116-
value: registry.spec.scanInterval || '',
117+
value: registry.spec.scanInterval ?
118+
this.t('imageScanner.general.schedule', { i: registry.spec.scanInterval }) : '',
117119
}
118120
];
119121
@@ -133,6 +135,8 @@
133135
})
134136
});
135137
this.registry = registry;
138+
this.scanHistory = this.scanHistory.sort((a, b) => new Date(b.status?.statusResult?.lastTransitionTime) - new Date(a.status?.statusResult?.lastTransitionTime));
139+
this.registryStatus = this.scanHistory[0]?.status?.statusResult?.type.toLowerCase();
136140
},
137141
getRegistryStatus(registry) {
138142
if (!registry || !registry.status || !registry.status.conditions || !registry.status.conditions.length) {

pkg/sbombastic-image-vulnerability-scanner/l10n/en-us.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ imageScanner:
5050
label: Scan Interval
5151
scan: Start Scan
5252
meta:
53-
registry: Registry
5453
namespace: Namespace
54+
uri: URI
5555
repositories: Repositories
5656
schedule: Schedule
5757
scanTable:
@@ -165,6 +165,7 @@ imageScanner:
165165
none: none
166166
error: Error
167167
at: at
168+
schedule: Every {i}
168169

169170
typeLabel:
170171
sbombastic.rancher.io.registry: Registries configuration

pkg/sbombastic-image-vulnerability-scanner/models/sbombastic.rancher.io.registry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { _CREATE } from '@shell/config/query-params';
55
export default class Registry extends SteveModel {
66
get _availableActions() {
77
console.log("Registry _availableActions");
8-
const out = super._availableActions.filter(action => !['download','downloadYaml'].includes(action.action));
8+
const out = super._availableActions.filter(action => !['showConfiguration','download','downloadYaml'].includes(action.action));
99

1010
// In details page, we don't want to show the scan action
1111
if (this.$rootState.targetRoute && 'id' in this.$rootState.targetRoute.params) {

0 commit comments

Comments
 (0)