Skip to content

Commit

Permalink
fix: make each issue deeplinked into snyk project page
Browse files Browse the repository at this point in the history
  • Loading branch information
aarlaud committed Oct 14, 2022
1 parent 61c7a1a commit d5177a3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { FC } from "react";
import { Table, TableColumn } from "@backstage/core-components";
import { Table, TableColumn, Link } from "@backstage/core-components";
import { Issue } from "../../../types/types";

type DenseTableProps = {
issues: Array<Issue>;
pageUrl: string;
};

export const IssuesTable: FC<DenseTableProps> = ({ issues }) => {
export const IssuesTable: FC<DenseTableProps> = ({ issues, pageUrl }) => {
const columns: TableColumn[] = [
{ title: "Severity", field: "severity" },
{ title: "ID", field: "id" },
Expand All @@ -17,9 +18,10 @@ export const IssuesTable: FC<DenseTableProps> = ({ issues }) => {
];

const data = issues.map((issue) => {
const deepLinkToIssue = <Link to={`${pageUrl}#issue-${issue.id}`}>{issue.id}</Link>
return {
severity: issue.issueData.severity,
id: issue.id,
id: deepLinkToIssue,
name: issue.pkgName,
versions: issue.pkgVersions,
description: issue.issueData.title,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { FC } from "react";
import { Table, TableColumn } from "@backstage/core-components";
import { Table, TableColumn, Link } from "@backstage/core-components";
import { Issue } from "../../../types/types";

type DenseTableProps = {
issues: Array<Issue>;
pageUrl: string;
};

export const LicenseIssuesTable: FC<DenseTableProps> = ({ issues }) => {
export const LicenseIssuesTable: FC<DenseTableProps> = ({ issues, pageUrl }) => {
const columns: TableColumn[] = [
{ title: "Severity", field: "severity" },
{ title: "ID", field: "id" },
Expand All @@ -16,9 +17,10 @@ export const LicenseIssuesTable: FC<DenseTableProps> = ({ issues }) => {
];
//@ts-ignore
const data = issues.map((issue) => {
const deepLinkToIssue = <Link to={`${pageUrl}#issue-${issue.id}`}>{issue.id}</Link>
return {
severity: issue.issueData.severity,
id: issue.id,
id: deepLinkToIssue,
name: issue.pkgName,
versions: issue.pkgVersions,
description: issue.issueData.title,
Expand Down
44 changes: 22 additions & 22 deletions src/components/SnykEntityComponent/snykTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,31 +111,31 @@ export const generateSnykTabForProject = (
</Grid>
</Grid>

<Grid container spacing={2} justify="space-between" direction="row">
<Grid item xs={12}>
<TabbedCard deepLink={linkInfo}>
<CardTab label="Issues">
<IssuesTable issues={value.vulnsIssues.issues} />
</CardTab>
<CardTab label="License Issues">
<LicenseIssuesTable issues={value.licenseIssues.issues} />
</CardTab>
<CardTab label="Dependencies">
<Grid container>
<DepGraphInfo depGraph={value.depGraph} />
</Grid>
</CardTab>
<CardTab label="Ignored">
<IgnoredIssuesTable issues={value.ignoredIssues.issues} />
</CardTab>
{/* <CardTab label="Trends">
<div style={cardContentStyle}>Some content 4</div>
</CardTab> */}
</TabbedCard>
</Grid>
<Grid container spacing={2} justify="space-between" direction="row">
<Grid item xs={12}>
<TabbedCard deepLink={linkInfo}>
<CardTab label="Issues">
<IssuesTable issues={value.vulnsIssues.issues} pageUrl={linkInfo.link} />
</CardTab>
<CardTab label="License Issues">
<LicenseIssuesTable issues={value.licenseIssues.issues} pageUrl={linkInfo.link} />
</CardTab>
<CardTab label="Dependencies">
<Grid container>
<DepGraphInfo depGraph={value.depGraph} />
</Grid>
</CardTab>
<CardTab label="Ignored">
<IgnoredIssuesTable issues={value.ignoredIssues.issues} />
</CardTab>
{/* <CardTab label="Trends">
<div style={cardContentStyle}>Some content 4</div>
</CardTab> */}
</TabbedCard>
</Grid>
</Grid>
</Grid>
</Grid>
);
};
};

0 comments on commit d5177a3

Please sign in to comment.