Skip to content

Commit 8f81edd

Browse files
committed
fix: Fix errors, vex overview layout, and customize action label
1 parent 03a6f04 commit 8f81edd

File tree

7 files changed

+48
-205
lines changed

7 files changed

+48
-205
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,10 @@
241241
import SortableTable from "@shell/components/SortableTable";
242242
import { BadgeState } from '@components/BadgeState';
243243
import Checkbox from '@components/Form/Checkbox';
244-
import ScoreBadge from '@sbombastic-image-vulnerability-scanner/components/common/ScoreBadge';
245-
import BarChart from '@sbombastic-image-vulnerability-scanner/components/common/BarChart';
246-
import { VULNERABILITY_DETAILS_TABLE } from "@sbombastic-image-vulnerability-scanner/config/table-headers";
247-
import { images } from "@sbombastic-image-vulnerability-scanner/data/sbombastic.rancher.io.image";
244+
import ScoreBadge from '@pkg/components/common/ScoreBadge';
245+
import BarChart from '@pkg/components/common/BarChart';
246+
import { VULNERABILITY_DETAILS_TABLE } from "@pkg/config/table-headers";
247+
import { images } from "@pkg/data/sbombastic.rancher.io.image";
248248
249249
export default {
250250
name: 'ImageDetails',

pkg/sbombastic-image-vulnerability-scanner/config/sbombastic-image-vulnerability-scanner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,6 @@ export function init($plugin: IPlugin, store: any) {
9898
//"demo"
9999
]);
100100
// Prepend spaces on group name, as Rancher 2.12 render group name algin with sidemenu
101-
basicType([PAGE.REGISTRIES, PAGE.VEX_MANAGEMENT, RESOURCE.VEX_HUB], '    Advanced');
101+
basicType([PAGE.REGISTRIES, PAGE.VEX_MANAGEMENT], '    Advanced');
102102

103103
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ imageScanner:
196196
enable: Enable
197197
disable: Disable
198198
delete: Delete
199+
editConfiguration: Edit configuration
199200
actions:
200201
clone: Clone
201202
editConfig: Edit configuration
Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<template>
22
<div>
3-
4-
<Banner color="info">
5-
{{t('imageScanner.vexManagement.description')}}
6-
</Banner>
7-
83
<ResourceTable
94
ref="rt"
105
:schema="schema"
@@ -23,7 +18,6 @@
2318
<script>
2419
import { RESOURCE } from "@pkg/types";
2520
import ResourceTable from "@shell/components/ResourceTable";
26-
import Banner from '@components/Banner/Banner.vue';
2721
import RegisterStatusBadge from "@pkg/components/common/RegisterStatusBadge";
2822
import { VEX_MANAGEMENT_TABLE } from "@pkg/config/table-headers";
2923
import {
@@ -33,7 +27,6 @@ import {
3327
export default {
3428
name: 'VexManagement',
3529
components: {
36-
Banner,
3730
ResourceTable,
3831
RegisterStatusBadge,
3932
},
@@ -63,123 +56,15 @@ export default {
6356
await m.save();
6457
}));
6558
await this.$fetch();
66-
},
67-
createVexHub() {
68-
this.$router.push({
69-
name: `${ PRODUCT_NAME }-c-cluster-resource-create`,
70-
params: {
71-
resource: RESOURCE.VEX_HUB,
72-
cluster: this.$route.params.cluster,
73-
product: PRODUCT_NAME
74-
}
75-
});
7659
}
7760
},
7861
computed: {
7962
schema() {
8063
return this.$store.getters['cluster/schemaFor']?.(RESOURCE.VEX_HUB);
81-
},
82-
showMasthead(){
83-
const showMasthead = getters[`type-map/optionsFor`](this.resource).showListMasthead;
84-
console.log("=====showMasthead", showMasthead, this.resource);
85-
return false;
8664
}
8765
}
8866
}
8967
</script>
9068
9169
<style lang="scss" scoped>
92-
93-
.header-section {
94-
display: flex;
95-
align-items: flex-start;
96-
gap: 24px;
97-
align-self: stretch;
98-
margin-bottom: 24px;
99-
100-
.header-left {
101-
display: flex;
102-
flex-direction: column;
103-
justify-content: center;
104-
align-items: flex-start;
105-
gap: 8px;
106-
flex: 1 0 0;
107-
}
108-
109-
.title-wrap {
110-
display: flex;
111-
align-items: center;
112-
gap: 12px;
113-
align-self: stretch;
114-
115-
.title {
116-
color: #141419;
117-
font-family: Lato;
118-
font-size: 24px;
119-
font-style: normal;
120-
font-weight: 600;
121-
line-height: 32px;
122-
}
123-
}
124-
125-
.description {
126-
max-width: 900px;
127-
align-self: stretch;
128-
color: #717179;
129-
font-family: Lato;
130-
font-size: 14px;
131-
font-style: normal;
132-
font-weight: 400;
133-
line-height: 21px;
134-
}
135-
136-
.header-right {
137-
display: flex;
138-
align-items: flex-end;
139-
justify-content: end;
140-
flex: 1 0 0;
141-
gap: 24px;
142-
}
143-
144-
.header-btn {
145-
height: 40px;
146-
}
147-
}
148-
149-
// Status cell centering
150-
.status-cell {
151-
display: flex;
152-
align-items: center;
153-
justify-content: flex-start;
154-
height: 100%;
155-
min-height: 48px;
156-
padding: 8px 0;
157-
158-
:deep(.badge) {
159-
margin: 0;
160-
vertical-align: middle;
161-
}
162-
}
163-
164-
.uri-link .icon-external-link {
165-
margin-left: 6px;
166-
opacity: 0.7;
167-
}
168-
169-
/* Bulk header action buttons - align icons and text */
170-
.bulk-actions {
171-
display: flex;
172-
align-items: center;
173-
gap: 12px;
174-
}
175-
176-
.bulk-actions .btn {
177-
display: inline-flex;
178-
align-items: center;
179-
}
180-
181-
.bulk-actions .btn i {
182-
margin-right: 6px;
183-
line-height: 1;
184-
}
18570
</style>

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ export default class SbombasticRancherIoVexhub extends SteveModel {
1919
]);
2020
out = out.filter((a) => !a?.action || !remove.has(a.action));
2121

22+
// Customize the edit action label
23+
out = out.map((action) => {
24+
// Check for various possible edit action names
25+
if (action?.action === 'edit' || action?.action === 'goToEdit' || action?.action === 'editConfig') {
26+
return {
27+
...action,
28+
label: this.t('imageScanner.vexManagement.buttons.editConfiguration') || 'Edit configuration'
29+
};
30+
}
31+
32+
return action;
33+
});
34+
2235
const isEnabled = !!this.spec?.enabled;
2336
const toggle = this.toggle;
2437

pkg/sbombastic-image-vulnerability-scanner/pages/c/_cluster/sbombastic-image-vulnerability-scanner/VexManagement.vue

Lines changed: 12 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -21,67 +21,32 @@
2121
</div>
2222
</div>
2323

24-
<ResourceTable
25-
ref="rt"
26-
:schema="schema"
27-
:rows="rows"
28-
:namespaced="false"
29-
:headers="headers"
30-
:key-field="'id'"
31-
:table-actions="true"
32-
:use-query-params-for-simple-filtering="true"
33-
:force-update-live-and-delayed="forceUpdateKey"
34-
>
35-
</ResourceTable>
24+
<VexHubList />
3625
</div>
3726
</template>
3827

3928
<script>
4029
import { RESOURCE } from "@pkg/types";
41-
import ResourceTable from "@shell/components/ResourceTable";
42-
import RegisterStatusBadge from "@pkg/components/common/RegisterStatusBadge";
43-
import { VEX_MANAGEMENT_TABLE } from "@pkg/config/table-headers";
30+
import VexHubList from "@pkg/list/sbombastic.rancher.io.vexhub.vue";
4431
import {
4532
PRODUCT_NAME,
4633
} from "@pkg/types";
4734
4835
export default {
4936
name: 'VexManagement',
5037
components: {
51-
ResourceTable,
52-
RegisterStatusBadge,
53-
},
54-
data() {
55-
return {
56-
PRODUCT_NAME: PRODUCT_NAME,
57-
headers: VEX_MANAGEMENT_TABLE,
58-
disabled: false,
59-
selectedRows: [],
60-
filterText: '',
61-
rows: [],
62-
forceUpdateKey: 0
63-
}
64-
},
65-
async fetch() {
66-
await this.$store.dispatch('cluster/findAll', { type: RESOURCE.VEX_HUB });
67-
const vexhubsCRD = this.$store.getters['cluster/all']?.(RESOURCE.VEX_HUB);
68-
this.rows = vexhubsCRD || [];
38+
VexHubList,
6939
},
7040
methods: {
71-
rowWithActions(r) { return r; },
72-
async switchStatus(desired, selected) {
73-
const resources = selected && selected.length ? selected : (this.selectedRows || []);
74-
if (!resources.length) return;
75-
await Promise.all(resources.map(async (m) => {
76-
m.spec = { ...(m.spec || {}), enabled: desired };
77-
await m.save();
78-
}));
79-
await this.$fetch();
80-
}
81-
},
82-
computed: {
83-
schema() {
84-
return this.$store.getters['cluster/schemaFor']?.(RESOURCE.VEX_HUB);
41+
createVexHub() {
42+
this.$router.push({
43+
name: `${ PRODUCT_NAME }-c-cluster-resource-create`,
44+
params: {
45+
resource: RESOURCE.VEX_HUB,
46+
cluster: this.$route.params.cluster,
47+
product: PRODUCT_NAME
48+
}
49+
});
8550
}
8651
}
8752
}
@@ -150,41 +115,4 @@ export default {
150115
height: 40px;
151116
}
152117
}
153-
154-
// Status cell centering
155-
.status-cell {
156-
display: flex;
157-
align-items: center;
158-
justify-content: flex-start;
159-
height: 100%;
160-
min-height: 48px;
161-
padding: 8px 0;
162-
163-
:deep(.badge) {
164-
margin: 0;
165-
vertical-align: middle;
166-
}
167-
}
168-
169-
.uri-link .icon-external-link {
170-
margin-left: 6px;
171-
opacity: 0.7;
172-
}
173-
174-
/* Bulk header action buttons - align icons and text */
175-
.bulk-actions {
176-
display: flex;
177-
align-items: center;
178-
gap: 12px;
179-
}
180-
181-
.bulk-actions .btn {
182-
display: inline-flex;
183-
align-items: center;
184-
}
185-
186-
.bulk-actions .btn i {
187-
margin-right: 6px;
188-
line-height: 1;
189-
}
190118
</style>

pkg/sbombastic-image-vulnerability-scanner/routes/sbombastic-image-vulnerability-scanner-routes.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ import RegistryDetails from "@pkg/components/RegistryDetails.vue";
22
import ComponentDemo from "@pkg/pages/c/_cluster/sbombastic-image-vulnerability-scanner/ComponentDemo.vue";
33
import Dashboard from "@pkg/pages/c/_cluster/sbombastic-image-vulnerability-scanner/Dashboard.vue";
44
import ImageOverview from "@pkg/pages/c/_cluster/sbombastic-image-vulnerability-scanner/ImageOverview.vue";
5-
import ImageDetails from "@sbombastic-image-vulnerability-scanner/components/ImageDetails.vue";
5+
import ImageDetails from "@pkg/components/ImageDetails.vue";
66
import RegistriesConfiguration from "@pkg/pages/c/_cluster/sbombastic-image-vulnerability-scanner/RegistriesConfiguration.vue";
77
import Vulnerabilities from "@pkg/pages/c/_cluster/sbombastic-image-vulnerability-scanner/Vulnerabilities.vue";
88
import CreateResource from "@pkg/pages/c/_cluster/sbombastic-image-vulnerability-scanner/_resource/create.vue";
99
import ListResource from "@pkg/pages/c/_cluster/sbombastic-image-vulnerability-scanner/_resource/index.vue";
10+
import VexManagement from "@pkg/pages/c/_cluster/sbombastic-image-vulnerability-scanner/VexManagement.vue";
1011
import {
1112
PRODUCT_NAME,
1213
PAGE,
14+
RESOURCE,
1315
} from "@pkg/types";
1416

1517
const routes = [
@@ -68,6 +70,20 @@ const routes = [
6870
meta: {
6971
product: PRODUCT_NAME,
7072
},
73+
beforeEnter: (to: any, from: any, next: any) => {
74+
// Redirect VexHub resource to custom VexManagement page
75+
if (to.params.resource === RESOURCE.VEX_HUB) {
76+
next({
77+
name: `c-cluster-${PRODUCT_NAME}-${PAGE.VEX_MANAGEMENT}`,
78+
params: {
79+
cluster: to.params.cluster,
80+
product: PRODUCT_NAME
81+
}
82+
});
83+
} else {
84+
next();
85+
}
86+
}
7187
},
7288
];
7389

0 commit comments

Comments
 (0)