Skip to content

Commit d937183

Browse files
Merge branch 'develop'
2 parents 5d1874c + 2e6e13e commit d937183

File tree

11 files changed

+75
-80
lines changed

11 files changed

+75
-80
lines changed

packages/app/src/components/commands/AddCommandUsagePage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const AddCommandUsagePage = () => {
1919
ev.preventDefault();
2020

2121
requestCommandUsagePost(commandId, commandUsage).then(() => {
22-
queryClient.invalidateQueries({ queryKey: ["commands", commandId, "usages"] });
22+
queryClient.invalidateQueries({ queryKey: ["commands", parseInt(commandId), "usages"] });
2323
setCommandUsage(defaultCommmandUsage);
2424
navigate(`/commands/${commandId}`);
2525
});

packages/app/src/components/commands/CommandDetailsPage.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useQueryClient } from "@tanstack/react-query";
12
import { useCommandDeleteMutation, useCommandQuery, useCommandUsagesQuery } from "api/commands.js";
23
import { requestCommandUsageDelete } from "api/requests/commands.js";
34
import NativeButtonGroup from "components/form/NativeButtonGroup";
@@ -25,6 +26,7 @@ const CommandDetailsPage = () => {
2526
const [t] = useTranslation();
2627

2728
const { commandId } = useParams();
29+
const queryClient = useQueryClient();
2830
const navigate = useNavigate();
2931

3032
const [tabIndex, tabIndexSetter] = useState(0);
@@ -40,6 +42,7 @@ const CommandDetailsPage = () => {
4042

4143
const deleteUsage = (usage) => {
4244
requestCommandUsageDelete(usage.commandId, usage.id).finally(() => {
45+
queryClient.invalidateQueries(["commands", parseInt(commandId), "usages"]);
4346
refetchCommandUsages();
4447
});
4548
};

packages/app/src/components/layout/dashboard/widgets/ActiveProjectsWidget.jsx

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useProjectsQuery } from "api/projects.js";
22
import ProjectBadge from "components/projects/ProjectBadge";
33
import Loading from "components/ui/Loading";
4+
import NativeTable from "components/ui/tables/NativeTable.jsx";
45
import DashboardWidget from "./Widget";
56

67
const ActiveProjectsWidget = () => {
@@ -12,28 +13,17 @@ const ActiveProjectsWidget = () => {
1213

1314
return (
1415
<DashboardWidget title="Active projects">
15-
{projects.data.length === 0 ? (
16-
<p>No projects to show.</p>
17-
) : (
18-
<table className="table is-fullwidth">
19-
<thead>
20-
<tr>
21-
<th>Name</th>
22-
<th>Client</th>
23-
</tr>
24-
</thead>
25-
<tbody>
26-
{projects.data.map((project) => (
27-
<tr key={project.id}>
28-
<td>
29-
<ProjectBadge key={project.id} project={project} />
30-
</td>
31-
<td>{project.client_name ?? "-"}</td>
32-
</tr>
33-
))}
34-
</tbody>
35-
</table>
36-
)}
16+
<NativeTable rows={projects.data} rowId={(project) => project.id} columns={[
17+
{
18+
header: "Name",
19+
cell: (project) => <ProjectBadge key={project.id} project={project} />,
20+
},
21+
{
22+
header: "Client",
23+
cell: (project) => project.client?.name ?? "-",
24+
},
25+
]}>
26+
</NativeTable>
3727
</DashboardWidget>
3828
);
3929
};

packages/app/src/components/notifications/NotificationsBadge.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useNotificationsQuery } from "api/notifications.js";
22
import { requestNotificationPut } from "api/requests/notifications.js";
33
import NativeButton from "components/form/NativeButton";
44
import CssIcon from "components/ui/CssIcon";
5+
import Tag from "components/ui/Tag.jsx";
56
import { useWebsocketMessage } from "contexts/WebsocketContext";
67
import useToggle from "hooks/useToggle";
78
import { Link } from "react-router-dom";

packages/app/src/components/projects/Form.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const ProjectForm = ({ isEdit = false, project, projectSetter: setProject, onFor
5656
id="categoryId"
5757
name="categoryId"
5858
onChange={handleFormChange}
59-
value={project.category_id || ""}
59+
value={project.categoryId || ""}
6060
>
6161
<option value="">(none)</option>
6262
{categories.map((category) => (
@@ -181,7 +181,7 @@ const ProjectForm = ({ isEdit = false, project, projectSetter: setProject, onFor
181181
<NativeSelect
182182
id="vulnerabilityMetrics"
183183
name="vulnerabilityMetrics"
184-
value={notEmpty(project.vulnerability_metrics) ? project.vulnerability_metrics : "(null)"}
184+
value={notEmpty(project.vulnerabilityMetrics) ? project.vulnerabilityMetrics : "(null)"}
185185
onChange={handleFormChange}
186186
>
187187
<option value="(null)">(undefined)</option>
@@ -193,7 +193,7 @@ const ProjectForm = ({ isEdit = false, project, projectSetter: setProject, onFor
193193
</NativeSelect>
194194
}
195195
/>
196-
{!project.is_template && (
196+
{!project.isTemplate && (
197197
<>
198198
<HorizontalLabelledField
199199
label="Start date"

packages/app/src/components/projects/Table.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ const ProjectsTable = ({ projects, showClientColumn = true }) => {
1919
enabled: showClientColumn,
2020
cell: (project) => (
2121
<>
22-
{project.is_template ? (
22+
{project.isTemplate ? (
2323
<span title="Not applicable">(n/a)</span>
2424
) : (
25-
<ClientLink clientId={project.client_id}>{project.client_name}</ClientLink>
25+
<ClientLink clientId={project.clientId}>{project.client?.name}</ClientLink>
2626
)}
2727
</>
2828
),
2929
},
3030
{ header: "Description", className: "only-desktop", cell: (project) => project.description },
3131
{
3232
header: "Category",
33-
cell: (project) => (project.category_id !== null ? project.category_name : "(undefined)"),
33+
cell: (project) => (project.categoryId !== null ? project.category?.name : "(undefined)"),
3434
},
3535
{
3636
header: "Vulnerability metrics",
37-
cell: (project) => (project.vulnerability_metrics ? project.vulnerability_metrics : "(undefined)"),
37+
cell: (project) => (project.vulnerabilityMetrics ? project.vulnerabilityMetrics : "(undefined)"),
3838
},
3939
{ header: "Status", cell: (project) => (project.archived ? "Archived" : "Active") },
4040
{

packages/app/src/components/vulnerabilities/Details.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ const VulnerabilityDetails = () => {
9494
<Title
9595
type="Vulnerability"
9696
title={
97-
vulnerability.external_id ? (
97+
vulnerability.externalId ? (
9898
<>
99-
<strong>{vulnerability.external_id.toUpperCase()}</strong>
99+
<strong>{vulnerability.externalId.toUpperCase()}</strong>
100100
&nbsp;{vulnerability.summary}
101101
</>
102102
) : (

packages/app/src/components/vulnerabilities/StatusBadge.jsx

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1+
const STATUSES = {
2+
open: {
3+
label: "Open",
4+
color: "yellow",
5+
},
6+
confirmed: {
7+
label: "Confirmed",
8+
color: "orange",
9+
},
10+
resolved: {
11+
label: "Resolved",
12+
color: "blue",
13+
},
14+
closed: {
15+
label: "Closed",
16+
color: "green",
17+
},
18+
};
19+
120
const VulnerabilityStatusBadge = ({ vulnerability }) => {
2-
const STATUSES = {
3-
open: {
4-
label: "Open",
5-
color: "yellow",
6-
},
7-
confirmed: {
8-
label: "Confirmed",
9-
color: "orange",
10-
},
11-
resolved: {
12-
label: "Resolved",
13-
color: "blue",
14-
},
15-
closed: {
16-
label: "Closed",
17-
color: "green",
18-
},
19-
};
2021
const styles = {
2122
badge: {
2223
color: `var(--${STATUSES[vulnerability.status].color})`,

packages/app/src/components/vulnerabilities/VulnerabilitiesTable.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,13 @@ const VulnerabilitiesTable = ({
145145
</td>
146146
{showProjectColumn && (
147147
<td>
148-
{vulnerability.is_template ? (
148+
{vulnerability.isTemplate ? (
149149
<span title="Not applicable">(n/a)</span>
150150
) : (
151151
<ProjectBadge
152152
project={{
153-
id: vulnerability.project_id,
154-
name: vulnerability.project_name,
153+
id: vulnerability.projectId,
154+
name: vulnerability.project?.name,
155155
}}
156156
/>
157157
)}
@@ -164,11 +164,11 @@ const VulnerabilitiesTable = ({
164164
<RiskBadge risk={vulnerability.risk} />
165165
</td>
166166
<td>
167-
<CvssScore score={vulnerability.cvss_score} />
167+
<CvssScore score={vulnerability.cvssScore} />
168168
</td>
169169
<td className="only-desktop">
170170
<VulnerabilityCategorySpan
171-
name={vulnerability.category_name}
171+
name={vulnerability.category?.name}
172172
parentName={vulnerability.parent_category_name}
173173
/>
174174
</td>

packages/app/src/components/vulnerabilities/VulnerabilityDescriptionPanel.jsx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ const VulnerabilityDescriptionPanel = ({ vulnerability }) => {
3737
)}
3838

3939
<h4>Proof of concept</h4>
40-
{vulnerability.proof_of_concept ? (
41-
<ReactMarkdown>{vulnerability.proof_of_concept}</ReactMarkdown>
40+
{vulnerability.proofOfConcept ? (
41+
<ReactMarkdown>{vulnerability.proofOfConcept}</ReactMarkdown>
4242
) : (
4343
<EmptyField />
4444
)}
@@ -49,7 +49,7 @@ const VulnerabilityDescriptionPanel = ({ vulnerability }) => {
4949
<h4>Category</h4>
5050
<p>
5151
<VulnerabilityCategorySpan
52-
name={vulnerability.category_name}
52+
name={vulnerability.category?.name}
5353
parentName={vulnerability.parent_category_name}
5454
/>
5555
</p>
@@ -66,52 +66,52 @@ const VulnerabilityDescriptionPanel = ({ vulnerability }) => {
6666
<RiskBadge risk={vulnerability.risk} />
6767
</dd>
6868

69-
{vulnerability.cvss_score && (
69+
{vulnerability.cvssScore && (
7070
<>
7171
<dt>
7272
<CvssAbbr /> score
7373
</dt>
7474
<dd>
75-
<CvssScore score={vulnerability.cvss_score} />
75+
<CvssScore score={vulnerability.cvssScore} />
7676
</dd>
7777
</>
7878
)}
7979

80-
{vulnerability.cvss_vector && (
80+
{vulnerability.cvssVector && (
8181
<>
8282
<dt>CVSS vector</dt>
8383
<dd>
8484
<ExternalLink
85-
href={`https://www.first.org/cvss/calculator/3.0#${vulnerability.cvss_vector}`}
85+
href={`https://www.first.org/cvss/calculator/3.0#${vulnerability.cvssVector}`}
8686
>
87-
{vulnerability.cvss_vector}
87+
{vulnerability.cvssVector}
8888
</ExternalLink>
8989
</dd>
9090
</>
9191
)}
9292

93-
{vulnerability.owasp_vector && (
93+
{vulnerability.owaspVector && (
9494
<>
9595
<dt>OWASP vector</dt>
96-
<dd>{vulnerability.owasp_vector}</dd>
96+
<dd>{vulnerability.owaspVector}</dd>
9797
</>
9898
)}
99-
{vulnerability.owasp_overall && (
99+
{vulnerability.owaspOverall && (
100100
<>
101101
<dt>OWASP overall score</dt>
102-
<dd>{vulnerability.owasp_overall}</dd>
102+
<dd>{vulnerability.owaspOverall}</dd>
103103
</>
104104
)}
105-
{vulnerability.owasp_likehood && (
105+
{vulnerability.owaspLikelihood && (
106106
<>
107107
<dt>OWASP likehood score</dt>
108-
<dd>{vulnerability.owasp_likehood}</dd>
108+
<dd>{vulnerability.owaspLikelihood}</dd>
109109
</>
110110
)}
111-
{vulnerability.owasp_impact && (
111+
{vulnerability.owaspImpact && (
112112
<>
113113
<dt>OWASP impact score</dt>
114-
<dd>{vulnerability.owasp_impact}</dd>
114+
<dd>{vulnerability.owaspImpact}</dd>
115115
</>
116116
)}
117117
</dl>
@@ -139,9 +139,9 @@ const VulnerabilityDescriptionPanel = ({ vulnerability }) => {
139139
<>
140140
<dt>Project</dt>
141141
<dd>
142-
{vulnerability.project_id ? (
142+
{vulnerability.projectId ? (
143143
<ProjectBadge
144-
project={{ id: vulnerability.project_id, name: vulnerability.project_name }}
144+
project={{ id: vulnerability.projectId, name: vulnerability.project?.name }}
145145
/>
146146
) : (
147147
"-"
@@ -150,14 +150,14 @@ const VulnerabilityDescriptionPanel = ({ vulnerability }) => {
150150
</>
151151
)}
152152

153-
{vulnerability.target_id !== null && vulnerability.target_id !== 0 && (
153+
{vulnerability.targetId !== null && vulnerability.targetId !== 0 && (
154154
<>
155155
<dt>Affected target</dt>
156156
<dd>
157-
<Link to={`/targets/${vulnerability.target_id}`}>
158-
<TargetBadge name={vulnerability.target_name}>
159-
{vulnerability.target_id
160-
? `${vulnerability.target_name} (${vulnerability.target_kind})`
157+
<Link to={`/targets/${vulnerability.targetId}`}>
158+
<TargetBadge name={vulnerability.asset?.name}>
159+
{vulnerability.targetId
160+
? `${vulnerability.asset?.name} (${vulnerability.asset?.kind})`
161161
: "-"}
162162
</TargetBadge>
163163
</Link>

0 commit comments

Comments
 (0)