-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add dummy stories for vuln details components (#210)
- Loading branch information
Showing
10 changed files
with
180 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
client/src/app/pages/vulnerability-details/advisories-by-vulnerability.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import React from "react"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
import { AdvisoriesByVulnerability } from "./advisories-by-vulnerability"; | ||
|
||
const meta = { | ||
title: "Components/vulnerability-details/advisories-by-vulnerability.tsx", | ||
component: AdvisoriesByVulnerability, | ||
parameters: { | ||
layout: "fullscreen", | ||
}, | ||
tags: ["autodocs"], | ||
decorators: [ | ||
(Story) => ( | ||
<BrowserRouter> | ||
<Story /> | ||
</BrowserRouter> | ||
), | ||
], | ||
} satisfies Meta<typeof AdvisoriesByVulnerability>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const EmptyState: Story = { | ||
args: { | ||
variant: "compact", | ||
advisories: [], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
client/src/app/pages/vulnerability-details/packages-by-vulnerability.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
|
||
import { PackagesByVulnerability } from "./packages-by-vulnerability"; | ||
import React from "react"; | ||
|
||
const meta = { | ||
title: "Components/vulnerability-details/packages-by-vulnerability.tsx", | ||
component: PackagesByVulnerability, | ||
parameters: { | ||
layout: "fullscreen", | ||
}, | ||
tags: ["autodocs"], | ||
} satisfies Meta<typeof PackagesByVulnerability>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const EmptyState: Story = { | ||
args: { | ||
variant: "compact", | ||
initialItemsPerPage: 10, | ||
advisories: [], | ||
}, | ||
decorators: [ | ||
(Story) => ( | ||
<BrowserRouter> | ||
<Story /> | ||
</BrowserRouter> | ||
), | ||
], | ||
}; |
45 changes: 45 additions & 0 deletions
45
client/src/app/pages/vulnerability-details/sboms-by-vulnerability.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React from "react"; | ||
|
||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
import { SbomsByVulnerability } from "./sboms-by-vulnerability"; | ||
|
||
const meta = { | ||
title: "Components/vulnerability-details/sboms-by-vulnerability.tsx", | ||
component: SbomsByVulnerability, | ||
parameters: { | ||
layout: "fullscreen", | ||
}, | ||
tags: ["autodocs"], | ||
} satisfies Meta<typeof SbomsByVulnerability>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Primary: Story = { | ||
args: { | ||
variant: "compact", | ||
advisories: [], | ||
}, | ||
decorators: [ | ||
(Story) => ( | ||
<BrowserRouter> | ||
<Story /> | ||
</BrowserRouter> | ||
), | ||
], | ||
}; | ||
|
||
export const EmptyState: Story = { | ||
args: { | ||
variant: "compact", | ||
advisories: [], | ||
}, | ||
decorators: [ | ||
(Story) => ( | ||
<BrowserRouter> | ||
<Story /> | ||
</BrowserRouter> | ||
), | ||
], | ||
}; |
21 changes: 18 additions & 3 deletions
21
client/src/app/pages/vulnerability-details/vulnerability-details.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,34 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { BrowserRouter } from "react-router-dom"; | ||
import React from "react"; | ||
import { CveDetails } from "./vulnerability-details"; | ||
|
||
const meta = { | ||
title: "Vulnerabilities/Vulnerability Details/Vulnerability Details", | ||
title: "Components/vulnerability-details/vulnerability-details.tsx", | ||
component: CveDetails, | ||
parameters: { | ||
layout: "fullscreen", | ||
query: { | ||
vulnerabilityId: "CVE-2023-1664", | ||
}, | ||
}, | ||
tags: ["autodocs"], | ||
decorators: [ | ||
(Story) => ( | ||
<BrowserRouter> | ||
<Story /> | ||
</BrowserRouter> | ||
), | ||
], | ||
} satisfies Meta<typeof CveDetails>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: {}, | ||
render: () => { | ||
const urlParams = new URLSearchParams(document.location.search); | ||
const mockedParam = urlParams.get("vulnerabilityId"); | ||
return <div>Mocked value: {mockedParam}</div>; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { Overview } from "../app/pages/vulnerability-details/overview"; | ||
|
||
const meta = { | ||
title: "v2/Vulnerability Details", | ||
component: Overview, | ||
parameters: { | ||
layout: "fullscreen", | ||
}, | ||
tags: ["autodocs"], | ||
} satisfies Meta<typeof Overview>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
vulnerability: { | ||
// type VulnerabilityHead | ||
cwes: [], | ||
description: "Some description here", | ||
discovered: "And here", | ||
identifier: "vulny-wulny", | ||
title: "Some Fun Vulnerability", | ||
modified: null, | ||
normative: false, | ||
published: null, | ||
released: null, | ||
withdrawn: null, | ||
average_score: null, | ||
average_severity: null, | ||
reserved: null, | ||
|
||
// advisories, if any | ||
advisories: [], | ||
}, | ||
}, | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters