Skip to content

Commit c9363e1

Browse files
authored
Merge pull request #46 from xingzhang-suse/main
Refactor code base for image scanner, added demo page for displaying CRD's registry list
2 parents e0954a7 + 1432586 commit c9363e1

File tree

20 files changed

+201
-116
lines changed

20 files changed

+201
-116
lines changed

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
'@': '.',
1111
'~': '.',
1212
'@benchmark-compliance': './pkg/benchmark-compliance',
13-
'@image-scan': './pkg/image-scan',
13+
'@sbombastic-image-vulnerability-scanner': './pkg/sbombastic-image-vulnerability-scanner',
1414
'@network': './pkg/network',
1515
'@runtime-process-profile': './pkg/runtime-process-profile',
1616
},

jest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const config: Config.InitialOptions = {
1414
'@components/(.*)':
1515
'<rootDir>/node_modules/@rancher/components/dist/@rancher/components.common.js',
1616
'@benchmark-compliance/(.*)': '<rootDir>/pkg/benchmark-compliance/$1',
17-
'@image-scan/(.*)': '<rootDir>/pkg/image-scan/$1',
17+
'@sbombastic-image-vulnerability-scanner/(.*)': '<rootDir>/pkg/sbombastic-image-vulnerability-scanner/$1',
1818
'@network/(.*)': '<rootDir>/pkg/network/$1',
1919
'@runtime-process-profile/(.*)': '<rootDir>/pkg/runtime-process-profile/$1',
2020
'@tests/(.*)': '<rootDir>/tests/$1',

pkg/image-scan/pages/__tests__/overview.spec.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

pkg/image-scan/pages/overview.vue

Lines changed: 0 additions & 31 deletions
This file was deleted.

pkg/image-scan/product.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

pkg/image-scan/routes/image-scan-routes.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.
File renamed without changes.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { IPlugin } from '@shell/core/types';
2+
import { PRODUCT_NAME, PAGE } from '@sbombastic-image-vulnerability-scanner/types';
3+
4+
export function init($plugin: IPlugin, store: any) {
5+
6+
const {
7+
product,
8+
virtualType,
9+
basicType
10+
} = $plugin.DSL(store, PRODUCT_NAME);
11+
12+
// registering a cluster-level product
13+
product({
14+
icon: 'pod_security',
15+
inStore: 'cluster',
16+
});
17+
18+
// => => => creating a custom page
19+
virtualType({
20+
label: store.getters['i18n/t']('image_scanner.registries.title'),
21+
name: PAGE.REGISTRIES,
22+
namespaced: false,
23+
route: {
24+
name: `c-cluster-${PRODUCT_NAME}-${PAGE.REGISTRIES}`,
25+
params: {
26+
product: PRODUCT_NAME
27+
},
28+
meta: { pkg: PRODUCT_NAME, product: PRODUCT_NAME }
29+
}
30+
});
31+
32+
basicType([
33+
PAGE.REGISTRIES
34+
]);
35+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
image_scanner:
2+
registries:
3+
title: Registries

pkg/image-scan/index.ts renamed to pkg/sbombastic-image-vulnerability-scanner/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { importTypes } from '@rancher/auto-import';
22
import { IPlugin } from '@shell/core/types';
3-
import imageScanRoutes from './routes/image-scan-routes';
3+
import imageScanRoutes from '@sbombastic-image-vulnerability-scanner/routes/sbombastic-image-vulnerability-scanner-routes';
44

55

66
// Init the package
@@ -12,7 +12,7 @@ export default function(plugin: IPlugin): void {
1212
plugin.metadata = require('./package.json');
1313

1414
// Load a product
15-
plugin.addProduct(require('./product'));
15+
plugin.addProduct(require('./config/sbombastic-image-vulnerability-scanner'));
1616

1717
// Add Vue Routes
1818
plugin.addRoutes(imageScanRoutes);

0 commit comments

Comments
 (0)