feat: add links to security advisories for vulnerabilities page
This commit is contained in:
parent
7138b618e4
commit
092926523c
3 changed files with 63 additions and 27 deletions
|
@ -35,7 +35,10 @@ import {
|
||||||
interface VulnerabiltyEntry {
|
interface VulnerabiltyEntry {
|
||||||
_id: string;
|
_id: string;
|
||||||
version: string;
|
version: string;
|
||||||
bullets: { point: string }[];
|
bullets: {
|
||||||
|
point: string;
|
||||||
|
securityAdvisoryUrl: string;
|
||||||
|
}[];
|
||||||
}
|
}
|
||||||
|
|
||||||
type VulnerabiltiesForm = z.infer<typeof vulnerabilitiesSchema>;
|
type VulnerabiltiesForm = z.infer<typeof vulnerabilitiesSchema>;
|
||||||
|
@ -50,7 +53,7 @@ const AdminLogPage = () => {
|
||||||
resolver: zodResolver(vulnerabilitiesSchema),
|
resolver: zodResolver(vulnerabilitiesSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
version: "",
|
version: "",
|
||||||
bullets: [{ point: "" }]
|
bullets: [{ point: "", securityAdvisoryUrl: "" }]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -136,35 +139,53 @@ const AdminLogPage = () => {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{fields.map((field, index) => (
|
{fields.map((field, index) => (
|
||||||
<FormField
|
<>
|
||||||
key={field.id}
|
<FormField
|
||||||
control={form.control}
|
key={field.id}
|
||||||
name={`bullets.${index}.point`}
|
control={form.control}
|
||||||
render={({ field }) => (
|
name={`bullets.${index}.point`}
|
||||||
<FormItem>
|
render={({ field }) => (
|
||||||
<FormLabel>Key Point {index + 1}</FormLabel>
|
<FormItem>
|
||||||
<FormControl>
|
<FormLabel>Key Point {index + 1}</FormLabel>
|
||||||
<Input {...field} />
|
<FormControl>
|
||||||
</FormControl>
|
<Input {...field} />
|
||||||
<FormMessage />
|
</FormControl>
|
||||||
<Button
|
<FormMessage />
|
||||||
type="button"
|
</FormItem>
|
||||||
className="mt-2"
|
)}
|
||||||
variant={"secondary"}
|
/>
|
||||||
onClick={() => remove(index)}
|
<FormField
|
||||||
>
|
key={field.id + "-securityAdvisory"}
|
||||||
Remove
|
control={form.control}
|
||||||
</Button>
|
name={`bullets.${index}.securityAdvisoryUrl`}
|
||||||
</FormItem>
|
render={({ field }) => (
|
||||||
)}
|
<FormItem>
|
||||||
/>
|
<FormLabel>
|
||||||
|
Security Advisory URL for Key Point {index + 1}
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input {...field} />
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
className="mt-2"
|
||||||
|
variant={"secondary"}
|
||||||
|
onClick={() => remove(index)}
|
||||||
|
>
|
||||||
|
Remove
|
||||||
|
</Button>
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
))}
|
))}
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
className="mb-4"
|
className="mb-4"
|
||||||
size={"icon"}
|
size={"icon"}
|
||||||
variant={"outline"}
|
variant={"outline"}
|
||||||
onClick={() => append({ point: "" })}
|
onClick={() => append({ point: "", securityAdvisoryUrl: "" })}
|
||||||
>
|
>
|
||||||
+
|
+
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -3,9 +3,11 @@ import { VULNERABILITY } from "@/constants/guidelines";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import clientPromise from "@/lib/db";
|
import clientPromise from "@/lib/db";
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
interface Bullet {
|
interface Bullet {
|
||||||
point: string;
|
point: string;
|
||||||
|
securityAdvisoryUrl: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Vulnerabilities {
|
interface Vulnerabilities {
|
||||||
|
@ -80,7 +82,19 @@ const Vulnerabilities = async () => {
|
||||||
<h2 className="font-semibold text-3xl -mb-2">{download.version}</h2>
|
<h2 className="font-semibold text-3xl -mb-2">{download.version}</h2>
|
||||||
<ul className="list-disc pl-5">
|
<ul className="list-disc pl-5">
|
||||||
{(download.bullets ?? []).map((bullet, index) => (
|
{(download.bullets ?? []).map((bullet, index) => (
|
||||||
<li key={index}>{bullet.point}</li>
|
<li key={index}>
|
||||||
|
{bullet.point}
|
||||||
|
{bullet.securityAdvisoryUrl ? (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
<Link href={bullet.securityAdvisoryUrl}>
|
||||||
|
View security advisory
|
||||||
|
</Link>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -28,7 +28,8 @@ export const vulnerabilitiesSchema = z.object({
|
||||||
version: z.string(),
|
version: z.string(),
|
||||||
bullets: z.array(
|
bullets: z.array(
|
||||||
z.object({
|
z.object({
|
||||||
point: z.string()
|
point: z.string(),
|
||||||
|
securityAdvisoryUrl: z.string()
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue