renew commit snapshot

This commit is contained in:
taDuc
2026-05-03 19:33:33 +07:00
parent fca188f0be
commit 34a5c3d041
18 changed files with 381 additions and 371 deletions
+2 -1
View File
@@ -16,6 +16,7 @@ import "yet-another-react-lightbox/styles.css";
import "yet-another-react-lightbox/plugins/captions.css";
import { createHistorianCV } from "@/service/historianService";
import { toast } from "sonner";
import { newId } from "@/uhm/lib/id";
import Swal from "sweetalert2";
import { PresignedUrlResponse } from "@/interface/media";
@@ -94,7 +95,7 @@ export default function RoleUpgrade() {
const presigned = await getPresignedUrl(file);
return {
id: Math.random().toString(36).substring(7),
id: newId(),
file: file,
previewUrl: isImage ? URL.createObjectURL(file) : "",
name: file.name,
+3 -4
View File
@@ -13,6 +13,7 @@ import Map from "@/uhm/components/Map";
import { DEFAULT_BACKGROUND_LAYER_VISIBILITY } from "@/uhm/lib/backgroundLayers";
import { EMPTY_FEATURE_COLLECTION } from "@/uhm/lib/geo/constants";
import { fetchSectionCommits } from "@/uhm/api/sections";
import { normalizeEditorSnapshot } from "@/uhm/lib/editor/snapshot/editorSnapshot";
import type { EditorSnapshot, SectionCommit } from "@/uhm/types/sections";
import type { EntitySnapshot } from "@/uhm/types/entities";
@@ -89,7 +90,7 @@ export default function SubmissionDetailPage() {
setCommits(commitRows || []);
const commit = (commitRows || []).find((c) => c.id === row.commit_id) || null;
const snap = (commit?.snapshot_json || null) as EditorSnapshot | null;
const snap = normalizeEditorSnapshot(commit?.snapshot_json || null);
setSnapshot(snap);
setSnapshotEntities((snap?.entities || []) as EntitySnapshot[]);
} catch (err) {
@@ -197,9 +198,7 @@ export default function SubmissionDetailPage() {
{isLoadingExtras ? (
<div className="mt-3 text-xs text-gray-500 dark:text-gray-400">Dang tai snapshot/commits...</div>
) : snapshot ? (
<div className="mt-3 text-xs text-gray-500 dark:text-gray-400">
Snapshot schema_version: {snapshot.schema_version}
</div>
<div className="mt-3 text-xs text-gray-500 dark:text-gray-400">Da tai snapshot.</div>
) : (
<div className="mt-3 text-xs text-gray-500 dark:text-gray-400">
Khong tim thay snapshot cho commit nay.