Update frontend to use reportFile on Audit

Signed-off-by: Ludovic Vielle <ludovic@probo.com>
This commit is contained in:
Ludovic Vielle
2026-06-03 22:28:08 +02:00
parent 0e4d73bb0f
commit c1c351ff81
7 changed files with 50 additions and 52 deletions

View File

@@ -41,15 +41,14 @@ export const auditNodeQuery = graphql`
name
validFrom
validUntil
report {
reportFile {
id
filename
fileName
mimeType
size
downloadUrl
createdAt
}
reportUrl
state
framework {
id
@@ -82,9 +81,9 @@ export const createAuditMutation = graphql`
name
validFrom
validUntil
report {
reportFile {
id
filename
fileName
}
state
framework {
@@ -108,9 +107,9 @@ export const updateAuditMutation = graphql`
name
validFrom
validUntil
report {
reportFile {
id
filename
fileName
}
state
framework {
@@ -241,9 +240,9 @@ export const uploadAuditReportMutation = graphql`
uploadAuditReport(input: $input) {
audit {
id
report {
reportFile {
id
filename
fileName
downloadUrl
createdAt
}
@@ -286,9 +285,9 @@ export const deleteAuditReportMutation = graphql`
deleteAuditReport(input: $input) {
audit {
id
report {
reportFile {
id
filename
fileName
downloadUrl
createdAt
}

View File

@@ -141,7 +141,7 @@ export default function AuditDetailsPage(props: Props) {
});
const handleDeleteReport = () => {
if (!auditEntry.report || !auditEntry.id) return;
if (!auditEntry.reportFile || !auditEntry.id) return;
confirm(
async () => {
@@ -152,7 +152,7 @@ export default function AuditDetailsPage(props: Props) {
__(
"This will permanently delete the audit report \"%s\". This action cannot be undone.",
),
auditEntry.report.filename,
auditEntry.reportFile.fileName,
),
},
);
@@ -253,7 +253,7 @@ export default function AuditDetailsPage(props: Props) {
<div className="space-y-4">
<h3 className="text-lg font-medium">{__("Audit Report")}</h3>
{auditEntry.report
{auditEntry.reportFile
? (
<div className="space-y-4">
<div className="flex items-center justify-between p-4 bg-success-50 border border-success-200 rounded-lg">
@@ -261,14 +261,14 @@ export default function AuditDetailsPage(props: Props) {
<IconArrowInbox className="text-success-600" size={20} />
<div className="flex-1">
<p className="font-medium text-success-900">
{auditEntry.report.filename}
{auditEntry.reportFile.fileName}
</p>
<div className="flex items-center gap-4 text-sm text-success-700">
<span>{fileSize(__, auditEntry.report.size)}</span>
<span>{fileSize(__, auditEntry.reportFile.size)}</span>
<span>
{__("Uploaded")}
{" "}
{formatDate(auditEntry.report.createdAt)}
{formatDate(auditEntry.reportFile.createdAt)}
</span>
</div>
</div>
@@ -276,8 +276,8 @@ export default function AuditDetailsPage(props: Props) {
<ActionDropdown>
<DropdownItem
onClick={() => {
if (auditEntry.report?.downloadUrl) {
window.open(auditEntry.report.downloadUrl, "_blank");
if (auditEntry.reportFile?.downloadUrl) {
window.open(auditEntry.reportFile.downloadUrl, "_blank", "noopener,noreferrer");
}
}}
icon={IconArrowInbox}

View File

@@ -82,7 +82,7 @@ const paginatedAuditsFragment = graphql`
name
validFrom
validUntil
report {
reportFile {
id
}
state
@@ -293,7 +293,7 @@ function AuditRow({
<Td>{formatDate(entry.validFrom) || __("Not set")}</Td>
<Td>{formatDate(entry.validUntil) || __("Not set")}</Td>
<Td>
{entry.report
{entry.reportFile
? (
<div className="flex flex-col">
<Badge variant="success">{__("Uploaded")}</Badge>

View File

@@ -53,14 +53,13 @@ const documentAccessFragment = graphql`
}
}
}
report {
reportFile {
id
filename
audit {
id
framework {
name
}
fileName
}
audit {
framework {
name
}
}
trustCenterFile {
@@ -95,15 +94,15 @@ function toDocumentAccessInfo(
status: node.status,
};
}
if (node.report) {
if (node.reportFile) {
return {
persisted: node.id !== node.report.id,
persisted: node.id !== node.reportFile.id,
variant: "success",
name: node.report.filename,
name: node.reportFile.fileName,
type: "report",
typeLabel: __("Report"),
category: node.report.audit?.framework?.name ?? "",
id: node.report.id,
category: node.audit?.framework?.name ?? "",
id: node.reportFile.id,
status: node.status,
};
}