Skip to content

Commit 6c1200a

Browse files
committed
Frontend: Remote CSV- added CSV error to audit screen
1 parent 559bcec commit 6c1200a

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

apps/frontend/src/routes/Audit.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import { StyledLabeledInput } from "#src/components/StyledLabeledInput.tsx";
4949
import { BlockersTableSummary } from "#src/components/BlockersTableSummary.tsx";
5050
import { FaTableList } from "react-icons/fa6";
5151
import { stringifyMessage } from "graphql-ws";
52+
import { MdError } from "react-icons/md";
5253

5354
export interface Page {
5455
url: string;
@@ -139,7 +140,7 @@ export const Audit = () => {
139140
queryFn: async () =>
140141
(
141142
await apiClient.graphql({
142-
query: `query($audit_id: uuid!){audits_by_pk(id:$audit_id) {id name email_notifications interval remote_csv_url}}`,
143+
query: `query($audit_id: uuid!){audits_by_pk(id:$audit_id) {id name email_notifications interval remote_csv_url remote_csv_error}}`,
143144
variables: { audit_id: auditId },
144145
})
145146
)?.data?.audits_by_pk,
@@ -327,11 +328,18 @@ export const Audit = () => {
327328
}).response);
328329
await queryClient.refetchQueries({ queryKey: ["urls", auditId] });
329330
const out = await resp.body.json() as any;
331+
if (out.message) {
332+
setAnnounceMessage(
333+
out.message,
334+
"success"
335+
)
336+
} else {
337+
setAnnounceMessage(
338+
"There was a problem updating the CSV URL!",
339+
"error"
340+
)
341+
}
330342

331-
setAnnounceMessage(
332-
out.message,
333-
"success"
334-
);
335343
}
336344

337345
const updateAuditRemoteCsv = async (newValue: string) => {
@@ -676,8 +684,11 @@ export const Audit = () => {
676684
variant="naked"
677685
/>
678686
</div>
679-
680-
<p className="font-small" style={{ marginBottom: 0}}>This audit will automatically update the list of URLs scanned from the CSV above.</p>
687+
{audit.remote_csv_error &&
688+
<Card variant="short-error">
689+
<MdError className="icon-small" /><div className="font-small"><b>There was a problem with your CSV.</b>{audit.remote_csv_error}</div></Card>
690+
}
691+
<p className="font-small" style={{ marginBottom: 0 }}>This audit will automatically update the list of URLs scanned from the CSV above.</p>
681692
</Card>
682693
) : (null)}
683694

0 commit comments

Comments
 (0)