优化错误报告更新响应
PATCH 更新直接返回元数据,避免重复下载归档 管理后台保留已加载详情并合并最新状态
This commit is contained in:
@@ -24,6 +24,7 @@ import type {
|
||||
AdminEditorShowcaseListResponse,
|
||||
AdminEditorShowcaseReviewRequest,
|
||||
AdminErrorReportDetail,
|
||||
AdminErrorReportEntry,
|
||||
AdminErrorReportListResponse,
|
||||
AdminFeatureGateConfigResponse,
|
||||
AdminLoginResponse,
|
||||
@@ -310,7 +311,7 @@ export function updateAdminErrorReport(
|
||||
batchId: string,
|
||||
payload: { status: string; note?: string },
|
||||
) {
|
||||
return request<AdminErrorReportDetail>(
|
||||
return request<AdminErrorReportEntry>(
|
||||
`/admin/api/error-reports/${encodeURIComponent(batchId)}`,
|
||||
{ method: 'PATCH', token, body: payload },
|
||||
);
|
||||
|
||||
@@ -87,12 +87,11 @@ export function AdminErrorReportsPage({ token, onUnauthorized }: Props) {
|
||||
setBusy(true);
|
||||
setStatus('');
|
||||
try {
|
||||
setSelected(
|
||||
await updateAdminErrorReport(token, selected.batchId, {
|
||||
const updated = await updateAdminErrorReport(token, selected.batchId, {
|
||||
status: nextStatus,
|
||||
note: selected.note,
|
||||
}),
|
||||
);
|
||||
});
|
||||
setSelected((current) => (current ? { ...current, ...updated } : current));
|
||||
await loadRef.current();
|
||||
} catch (error) {
|
||||
if (isAdminApiError(error) && error.status === 401) onUnauthorized();
|
||||
|
||||
@@ -339,7 +339,7 @@ pub async fn admin_update_error_report(
|
||||
{
|
||||
return Err(bad_request("处理备注不能超过 2000 个字符"));
|
||||
}
|
||||
state
|
||||
let updated = state
|
||||
.spacetime_client()
|
||||
.update_error_report(ErrorReportUpdateRecordInput {
|
||||
batch_id: batch_id.clone(),
|
||||
@@ -356,13 +356,27 @@ pub async fn admin_update_error_report(
|
||||
Some(&batch_id),
|
||||
)
|
||||
.await;
|
||||
admin_get_error_report(
|
||||
State(state),
|
||||
Extension(ctx),
|
||||
Extension(admin),
|
||||
AxumPath(batch_id),
|
||||
)
|
||||
.await
|
||||
Ok(json_success_body(
|
||||
Some(&ctx),
|
||||
AdminErrorReportEntry {
|
||||
batch_id: updated.batch_id,
|
||||
event_count: updated.event_count,
|
||||
log_count: updated.log_count,
|
||||
fingerprint: updated.first_fingerprint,
|
||||
source: updated.first_source,
|
||||
status: updated.review_status.clone(),
|
||||
user_id: updated.user_id,
|
||||
created_at: updated.created_at,
|
||||
updated_at: updated.updated_at,
|
||||
user_description: None,
|
||||
attachment_size_bytes: updated.archive_size_bytes,
|
||||
submission_id: Some(updated.submission_id),
|
||||
oss_object_key: Some(updated.object_key),
|
||||
archive_sha256: Some(updated.archive_sha256),
|
||||
upload_status: Some("ready".into()),
|
||||
review_status: Some(updated.review_status),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
pub async fn admin_download_error_report(
|
||||
|
||||
Reference in New Issue
Block a user