// components/admin/tabs/StorageTab.js import { useState } from "react"; import Link from "next/link"; import { bytesToSize } from "../../../components/utils"; import { deleteAwaitingSubmissionsFromBlob } from "../../../actions/services/documentService"; import { consoleLogger } from "../../../actions/core/logger"; import { formatBlobDates } from "../utils/adminHelper"; export default function StorageTab({ data, repCompleteCount }) { const [showRepJson, setShowRepJson] = useState(true); const [showTmpFile, setShowTmpFile] = useState(true); const [listData, setListData] = useState(data); const toggleAll = () => { const newState = !(showRepJson || showTmpFile); setShowRepJson(newState); setShowTmpFile(newState); }; const deleteRepItem = (containerID, caseID, repfile) => { fetch("/api/admin/deleteblobrep", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ container: containerID, casefolderID: caseID, repfile }) }) .then((response) => { if (!response.ok) { throw new Error("Unable to delete representation"); } return response.json(); }) .then((data) => { return data; }) .then(() => { fetch("/api/admin/getrepsblobproxy", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ container: containerID }) }) .then((response) => { if (!response.ok) { throw new Error( "Unable to refresh representations" ); } return response.json(); }) .then((data) => { setMyRepresentations(data); setMyRepresentationsDetails(data); }) .catch((error) => { consoleLogger(error); return null; }) .then(() => { setCurrentView({ "viewName": "My Representations", "viewKey": "myRepresentations" }); }); }) .catch((error) => { consoleLogger(error); }); }; return (

Storage Account Contents

{repCompleteCount > 0 && (

Number of Orphaned Reps: {repCompleteCount}

)} {/* Toggle buttons */}
{/* Render users & containers */} {listData.map((user) => (
{user.containers.map((c) => (

{c.container} -{" "} {user.email}

{/* folders */} {c.folders.map((folder) => (

{folder.folderPath || "Root"}

{/* Buttons for TMP + Rep actions go here (same logic as before) */} {folder.hasTmpFile && ( <> )} {folder.hasRepJson && (
{" "} {folder.repComplete && ( )} {folder.repComplete && ( )}
)}
    {folder.blobs.map((blob) => (
  • {blob.name} ( {bytesToSize( blob.contentLength || blob.size )} ) {" "} {blob.lastModified && ( {/* { blob.displayDate } */} {formatBlobDates( blob )} )}
  • ))}
))}
))}
))}
); }