diff --git a/package.json b/package.json index 48c5a03..5d1297a 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "dependencies": { "@kubernetes/client-node": "^1.3.0", "@rancher/components": "^0.3.0-alpha.1", - "@rancher/shell": "^3.0.4", + "@rancher/shell": "3.0.5-rc.7", "vue": "^3.5.17", "vue-router": "^4.5.0", "vuex": "^4.1.0" diff --git a/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetailScanTable.vue b/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetailScanTable.vue new file mode 100644 index 0000000..1d2fb25 --- /dev/null +++ b/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetailScanTable.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetails.vue b/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetails.vue index bd15561..e69745d 100644 --- a/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetails.vue +++ b/pkg/sbombastic-image-vulnerability-scanner/components/RegistryDetails.vue @@ -27,15 +27,7 @@ - Recent scans - + @@ -46,6 +38,7 @@ 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', @@ -54,15 +47,15 @@ ResourceTable, RancherMeta, RegisterStatusBadge, + RegistryDetailScanTable }, data() { return { PRODUCT_NAME, RESOURCE, + registry: null, registryStatus: null, registryMetadata: [], - scanHistory: [], - headers: REGISTRY_SCAN_HISTORY_TABLE } }, async fetch() { @@ -70,15 +63,6 @@ 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 = [ { @@ -89,7 +73,7 @@ { type: 'text', label: this.t('imageScanner.registries.configuration.meta.repositories'), - value: registry.spec.repositories.length + value: registry.spec.repositories?.length || 0 }, { type: 'text', @@ -110,19 +94,7 @@ } ]; - 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); + this.registry = registry; }, methods: { getRegistryStatus(registry) { @@ -150,10 +122,6 @@ gap: 24px; flex: 1 0 0; align-self: stretch; - - .table { - width: 100%; - } } .about { @@ -202,7 +170,7 @@ .resource-header-description { /* layout */ display: flex; - width: 900px; + max-width: 900px; height: 21px; flex-direction: column; justify-content: center; diff --git a/pkg/sbombastic-image-vulnerability-scanner/components/common/RancherMetaProperty.vue b/pkg/sbombastic-image-vulnerability-scanner/components/common/RancherMetaProperty.vue index f5e35da..258d0d9 100644 --- a/pkg/sbombastic-image-vulnerability-scanner/components/common/RancherMetaProperty.vue +++ b/pkg/sbombastic-image-vulnerability-scanner/components/common/RancherMetaProperty.vue @@ -4,7 +4,7 @@
{{ property.label }}
-
+
{{ property.value }}
diff --git a/pkg/sbombastic-image-vulnerability-scanner/config/table-headers.ts b/pkg/sbombastic-image-vulnerability-scanner/config/table-headers.ts index a7f6874..bccfd58 100644 --- a/pkg/sbombastic-image-vulnerability-scanner/config/table-headers.ts +++ b/pkg/sbombastic-image-vulnerability-scanner/config/table-headers.ts @@ -104,45 +104,46 @@ export const REGISTRY_SCAN_HISTORY_TABLE = [ name: "errors", labelKey: "imageScanner.registries.configuration.scanTable.header.error", value: "status.statusResult.message", + formatter: "ScanErrorCell", sort: "errors", }, ]; export const VEX_MANAGEMENT_TABLE = [ - { - name: "_status", - labelKey: "imageScanner.vexManagement.table.headers.status", - value: "_status", - getValue: (row: any) => row._status, - formatter: "VexStatusCellBadge", - sort: "_status", - }, - { - name: "name", - labelKey: "imageScanner.vexManagement.table.headers.name", - value: "name", - formatter: "VexNameLink", - sort: "name", - }, - { - name: "uri", - labelKey: "imageScanner.vexManagement.table.headers.uri", - value: "uri", - formatter: "UriExternalLink", - sort: "uri", - }, - { - name: "createdBy", - labelKey: "imageScanner.vexManagement.table.headers.createdBy", - value: "createdBy", - sort: "createdBy", - }, - { - name: "updated", - labelKey: "imageScanner.vexManagement.table.headers.updated", - value: "updated", - getValue: (row: any) => row.updated, - formatter: "VexDateFormatter", - sort: "updated", - } + { + name: "_status", + labelKey: "imageScanner.vexManagement.table.headers.status", + value: "_status", + getValue: (row: any) => row._status, + formatter: "VexStatusCellBadge", + sort: "_status", + }, + { + name: "name", + labelKey: "imageScanner.vexManagement.table.headers.name", + value: "name", + formatter: "VexNameLink", + sort: "name", + }, + { + name: "uri", + labelKey: "imageScanner.vexManagement.table.headers.uri", + value: "uri", + formatter: "UriExternalLink", + sort: "uri", + }, + { + name: "createdBy", + labelKey: "imageScanner.vexManagement.table.headers.createdBy", + value: "createdBy", + sort: "createdBy", + }, + { + name: "updated", + labelKey: "imageScanner.vexManagement.table.headers.updated", + value: "updated", + getValue: (row: any) => row.updated, + formatter: "VexDateFormatter", + sort: "updated", + }, ]; diff --git a/pkg/sbombastic-image-vulnerability-scanner/detail/sbombastic.rancher.io.registry.vue b/pkg/sbombastic-image-vulnerability-scanner/detail/sbombastic.rancher.io.registry.vue index 1b37ad7..36b11a5 100644 --- a/pkg/sbombastic-image-vulnerability-scanner/detail/sbombastic.rancher.io.registry.vue +++ b/pkg/sbombastic-image-vulnerability-scanner/detail/sbombastic.rancher.io.registry.vue @@ -1,37 +1,29 @@ \ No newline at end of file diff --git a/pkg/sbombastic-image-vulnerability-scanner/formatters/ScanErrorCell.vue b/pkg/sbombastic-image-vulnerability-scanner/formatters/ScanErrorCell.vue new file mode 100644 index 0000000..fb3f4d7 --- /dev/null +++ b/pkg/sbombastic-image-vulnerability-scanner/formatters/ScanErrorCell.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/pkg/sbombastic-image-vulnerability-scanner/l10n/en-us.yaml b/pkg/sbombastic-image-vulnerability-scanner/l10n/en-us.yaml index a92c978..783a0cb 100644 --- a/pkg/sbombastic-image-vulnerability-scanner/l10n/en-us.yaml +++ b/pkg/sbombastic-image-vulnerability-scanner/l10n/en-us.yaml @@ -128,6 +128,7 @@ imageScanner: general: refresh: Refresh data ago: ago + none: none typeLabel: sbombastic.rancher.io.registry: Registries configuration diff --git a/yarn.lock b/yarn.lock index 64c8ff3..dd3a09c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3433,12 +3433,12 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@jsep-plugin/assignment@^1.2.1", "@jsep-plugin/assignment@^1.3.0": +"@jsep-plugin/assignment@^1.3.0": version "1.3.0" resolved "https://registry.yarnpkg.com/@jsep-plugin/assignment/-/assignment-1.3.0.tgz#fcfc5417a04933f7ceee786e8ab498aa3ce2b242" integrity sha512-VVgV+CXrhbMI3aSusQyclHkenWSAm95WaiKrMxRFam3JSUiIaQjoMIw2sEs/OX4XifnqeQUN4DYbJjlA8EfktQ== -"@jsep-plugin/regex@^1.0.3", "@jsep-plugin/regex@^1.0.4": +"@jsep-plugin/regex@^1.0.4": version "1.0.4" resolved "https://registry.yarnpkg.com/@jsep-plugin/regex/-/regex-1.0.4.tgz#cb2fc423220fa71c609323b9ba7f7d344a755fcc" integrity sha512-q7qL4Mgjs1vByCaTnDFcBnV9HS7GVPJX5vyVoCgZHNSC9rjwIlmbXG5sUuorR5ndfHAIlJ8pVStxvjXHbNvtUg== @@ -3465,6 +3465,11 @@ tar-fs "^3.0.8" ws "^8.18.2" +"@kurkle/color@^0.3.0": + version "0.3.4" + resolved "https://registry.yarnpkg.com/@kurkle/color/-/color-0.3.4.tgz#4d4ff677e1609214fc71c580125ddddd86abcabf" + integrity sha512-M5UknZPHRu3DEDWoipU6sE8PdkZ6Z/S+v4dD+Ke8IaNlpdSQah50lz1KtcFBa2vsdOnwbbnxJwVM4wty6udA5w== + "@leichtgewicht/ip-codec@^2.0.1": version "2.0.5" resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz#4fc56c15c580b9adb7dc3c333a134e540b44bfb1" @@ -3633,15 +3638,15 @@ dependencies: lodash.debounce "4.0.8" -"@rancher/icons@2.0.29": - version "2.0.29" - resolved "https://registry.yarnpkg.com/@rancher/icons/-/icons-2.0.29.tgz#6546d69768c706bebd66bfa73b36aef3d105987a" - integrity sha512-qBBqfazS9y5VjV7fJDPNXmxd9AP/2uiE05mKFWP41kpbO+tEb62RnUBXCm14XLeScDZQcOuiAKVHMmvCFzF0BA== +"@rancher/icons@2.0.37": + version "2.0.37" + resolved "https://registry.yarnpkg.com/@rancher/icons/-/icons-2.0.37.tgz#61dd947009a4a3d27b2e4dca630da05583925744" + integrity sha512-T2FqiZraz9yte9tNMCGqIDQVPwXKTAPUTE8eAaQjhOJEbwfk/ttXDIKGYZ9mHApJX6s8JYVXAbRPcgXgc4zKpA== -"@rancher/shell@^3.0.4": - version "3.0.4" - resolved "https://registry.yarnpkg.com/@rancher/shell/-/shell-3.0.4.tgz#63569e85166a778771b9e129f0c17cc4578daaa2" - integrity sha512-YaUUMdSg2C1sKlged9wNvCt+WCwkJtfOhjjX1PwcWPqbq/zL6nPUWAVDcxiD9Ah5KbLMBoMtNWL/K3DG5xpoyQ== +"@rancher/shell@3.0.5-rc.7": + version "3.0.5-rc.7" + resolved "https://registry.yarnpkg.com/@rancher/shell/-/shell-3.0.5-rc.7.tgz#a3c3f555c9459b312546fb577e9916cd48126fb2" + integrity sha512-YxiRteWwTnuCGEh2AqIyH6Vx/PJXSwugi7dpf2U+XnQLqQHYM8pFo38jG8Tmj95KqZsRMLXdesRow/Icq96D5w== dependencies: "@aws-sdk/client-ec2" "3.658.1" "@aws-sdk/client-eks" "3.1.0" @@ -3653,7 +3658,7 @@ "@babel/preset-typescript" "7.16.7" "@novnc/novnc" "1.2.0" "@popperjs/core" "2.11.8" - "@rancher/icons" "2.0.29" + "@rancher/icons" "2.0.37" "@types/is-url" "1.2.30" "@types/node" "20.10.8" "@types/semver" "^7.5.8" @@ -3672,6 +3677,7 @@ babel-plugin-module-resolver "4.0.0" babel-preset-vue "2.0.2" cache-loader "4.1.0" + chart.js "4.4.8" clipboard-polyfill "4.0.1" codemirror ">=5.64.0 <6" codemirror-editor-vue3 "2.8.0" @@ -3691,7 +3697,7 @@ dayjs "1.8.29" defu "5.0.1" diff2html "3.4.24" - dompurify "2.5.4" + dompurify "3.2.5" element-matches "^0.1.2" entities "4.5.0" eslint "7.32.0" @@ -3721,7 +3727,7 @@ js-yaml "4.1.0" js-yaml-loader "1.2.2" jsdiff "1.1.1" - jsonpath-plus "10.0.7" + jsonpath-plus "10.3.0" jsrsasign "11.0.0" jszip "3.8.0" lodash "4.17.21" @@ -4701,6 +4707,11 @@ resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304" integrity sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA== +"@types/trusted-types@^2.0.7": + version "2.0.7" + resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.7.tgz#baccb07a970b91707df3a3e8ba6896c57ead2d11" + integrity sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw== + "@types/vue-select@^3.16.8": version "3.16.8" resolved "https://registry.yarnpkg.com/@types/vue-select/-/vue-select-3.16.8.tgz#12810f89d529723005ad0ae673fed1b191a30b9d" @@ -6742,6 +6753,13 @@ char-regex@^2.0.0: resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-2.0.2.tgz#81385bb071af4df774bff8721d0ca15ef29ea0bb" integrity sha512-cbGOjAptfM2LVmWhwRFHEKTPkLwNddVmuqYZQt895yXwAsWsXObCG+YN4DGQ/JBtT4GP1a1lPPdio2z413LmTg== +chart.js@4.4.8: + version "4.4.8" + resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-4.4.8.tgz#54645b638e9d585099bc16b892947b5e6cd2a552" + integrity sha512-IkGZlVpXP+83QpMm4uxEiGqSI7jFizwVtF3+n5Pc3k7sMO+tkd0qxh2OzLhenM0K80xtmAONWGBn082EiBQSDA== + dependencies: + "@kurkle/color" "^0.3.0" + check-more-types@2.24.0, check-more-types@^2.24.0: version "2.24.0" resolved "https://registry.yarnpkg.com/check-more-types/-/check-more-types-2.24.0.tgz#1420ffb10fd444dcfc79b43891bbfffd32a84600" @@ -8126,10 +8144,12 @@ domhandler@^4.0.0, domhandler@^4.2.0, domhandler@^4.3.1: dependencies: domelementtype "^2.2.0" -dompurify@2.5.4: - version "2.5.4" - resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.5.4.tgz#347e91070963b22db31c7c8d0ce9a0a2c3c08746" - integrity sha512-l5NNozANzaLPPe0XaAwvg3uZcHtDBnziX/HjsY1UcDj1MxTK8Dd0Kv096jyPK5HRzs/XM5IMj20dW8Fk+HnbUA== +dompurify@3.2.5: + version "3.2.5" + resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.2.5.tgz#11b108656a5fb72b24d916df17a1421663d7129c" + integrity sha512-mLPd29uoRe9HpvwP2TxClGQBzGXeEC/we/q+bFlmPPmj2p2Ugl3r6ATu/UU1v77DXNcehiBg9zsr1dREyA/dJQ== + optionalDependencies: + "@types/trusted-types" "^2.0.7" domutils@^2.5.2, domutils@^2.8.0: version "2.8.0" @@ -11725,7 +11745,7 @@ jsdom@^26.1.0: ws "^8.18.0" xml-name-validator "^5.0.0" -jsep@^1.3.9, jsep@^1.4.0: +jsep@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/jsep/-/jsep-1.4.0.tgz#19feccbfa51d8a79f72480b4b8e40ce2e17152f0" integrity sha512-B7qPcEVE3NVkmSJbaYxvv4cHkVW7DQsZz13pUMrfS8z8Q/BuShN+gcTXrUlPiGqM2/t/EEaI030bpxMqY8gMlw== @@ -11801,16 +11821,7 @@ jsonfile@^6.0.1: optionalDependencies: graceful-fs "^4.1.6" -jsonpath-plus@10.0.7: - version "10.0.7" - resolved "https://registry.yarnpkg.com/jsonpath-plus/-/jsonpath-plus-10.0.7.tgz#90d080863006679113b76711995c84afd66c344f" - integrity sha512-GDA8d8fu9+s4QzAzo5LMGiLL/9YjecAX+ytlnqdeXYpU55qME57StDgaHt9R2pA7Dr8U31nwzxNJMJiHkrkRgw== - dependencies: - "@jsep-plugin/assignment" "^1.2.1" - "@jsep-plugin/regex" "^1.0.3" - jsep "^1.3.9" - -jsonpath-plus@^10.3.0: +jsonpath-plus@10.3.0, jsonpath-plus@^10.3.0: version "10.3.0" resolved "https://registry.yarnpkg.com/jsonpath-plus/-/jsonpath-plus-10.3.0.tgz#59e22e4fa2298c68dfcd70659bb47f0cad525238" integrity sha512-8TNmfeTCk2Le33A3vRRwtuworG/L5RrgMvdjhKZxvyShO+mBu2fP50OWUjRLNtvw344DdDarFh9buFAZs5ujeA== @@ -14830,7 +14841,7 @@ string-length@^5.0.1: char-regex "^2.0.0" strip-ansi "^7.0.1" -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -14847,6 +14858,15 @@ string-width@^2.1.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^5.0.1, string-width@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" @@ -14902,7 +14922,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -14916,6 +14936,13 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -16252,7 +16279,7 @@ worker-loader@3.0.8: loader-utils "^2.0.0" schema-utils "^3.0.0" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -16278,6 +16305,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"