|
| 1 | +import { Button, TableColumn } from "@backstage/core-components"; |
| 2 | +import React from "react"; |
| 3 | + |
| 4 | +export const columns: TableColumn[] = [ |
| 5 | + { |
| 6 | + title: "Tag title", |
| 7 | + field: "tag", |
| 8 | + type: "string", |
| 9 | + }, |
| 10 | + { |
| 11 | + title: "Size MB", |
| 12 | + field: "size", |
| 13 | + type: "numeric", |
| 14 | + }, |
| 15 | + { |
| 16 | + title: "Vulnerabilities severity", |
| 17 | + field: "vulnerabilities.severity", |
| 18 | + type: "string", |
| 19 | + cellStyle: (_, rowData: any & { tableData: { id: number } }) => { |
| 20 | + if (rowData.vulnerabilities.severity === "Low") { |
| 21 | + return { backgroundColor: "rgb(173, 226, 40)" }; |
| 22 | + } |
| 23 | + if (rowData?.vulnerabilities.severity === "Medium") { |
| 24 | + return { backgroundColor: "rgb(236, 219, 35)" }; |
| 25 | + } |
| 26 | + if (rowData?.vulnerabilities.severity === "High") { |
| 27 | + return { backgroundColor: "rgb(246, 150, 30)" }; |
| 28 | + } |
| 29 | + if (rowData?.vulnerabilities?.severity === "Critical") { |
| 30 | + return { backgroundColor: "rgb(255, 71, 26)" }; |
| 31 | + } |
| 32 | + return { backgroundColor: "rgb(106, 215, 45)" }; |
| 33 | + }, |
| 34 | + }, |
| 35 | + { |
| 36 | + title: "Total Vulnerabilities", |
| 37 | + field: "vulnerabilities.count", |
| 38 | + type: "numeric", |
| 39 | + }, |
| 40 | + |
| 41 | + { |
| 42 | + title: "Push Time", |
| 43 | + field: "pushTime", |
| 44 | + type: "datetime", |
| 45 | + defaultSort: "desc", |
| 46 | + }, |
| 47 | + { |
| 48 | + title: "Pull Time", |
| 49 | + field: "pullTime", |
| 50 | + type: "datetime", |
| 51 | + }, |
| 52 | + { |
| 53 | + title: "", |
| 54 | + field: "repoUrl", |
| 55 | + render: (rowData: any) => ( |
| 56 | + <Button |
| 57 | + to={`${rowData.repoUrl}/artifacts/${rowData.tag}`} |
| 58 | + color="primary" |
| 59 | + variant="contained" |
| 60 | + > |
| 61 | + Learn More |
| 62 | + </Button> |
| 63 | + ), |
| 64 | + }, |
| 65 | +]; |
0 commit comments