diff --git a/.agent/workflows/ai-instructions.md b/.agent/workflows/ai-instructions.md new file mode 100644 index 0000000..ea4e3fc --- /dev/null +++ b/.agent/workflows/ai-instructions.md @@ -0,0 +1,12 @@ +--- +description: Referensi Aturan AI TrustLab-Web +--- + +# ⚠️ BACA ATURAN UTAMA SEBELUM BEKERJA + +Semua aturan untuk proyek ini telah dipusatkan di root folder untuk menghindari miskomunikasi. + +**WAJIB BACA:** +[Master AI Instructions (Root)](file:///D:/Lab/HomeLab/Github/dyzulk/trustlab/.agent/workflows/ai-instructions.md) + +Pahami bagian **PART 5: FRONTEND (TRUSTLAB-WEB)** secara mendalam sebelum melakukan perubahan. diff --git a/src/app/dashboard/admin/root-ca/RootCaManagementClient.tsx b/src/app/dashboard/admin/root-ca/RootCaManagementClient.tsx index 02f781a..81c0e8f 100644 --- a/src/app/dashboard/admin/root-ca/RootCaManagementClient.tsx +++ b/src/app/dashboard/admin/root-ca/RootCaManagementClient.tsx @@ -22,6 +22,7 @@ export default function RootCaManagementClient() { const { addToast } = useToast(); const { data, error, mutate, isLoading } = useSWR("/api/admin/ca-certificates", fetcher); const [isRenewing, setIsRenewing] = useState(false); + const [isSyncing, setIsSyncing] = useState(false); const [confirmRenewUuid, setConfirmRenewUuid] = useState(null); // Redirect if not admin or owner (double security, backend also checks) @@ -49,13 +50,47 @@ export default function RootCaManagementClient() { } }; + const handleSyncCdn = async () => { + setIsSyncing(true); + try { + const response = await axios.post("/api/admin/ca-certificates/sync-cdn"); + addToast(response.data.message || "Sync to CDN successful", "success"); + mutate(); + } catch (err: any) { + console.error(err); + addToast(err.response?.data?.message || "Sync to CDN failed", "error"); + } finally { + setIsSyncing(false); + } + }; + if (error) return
{t("load_failed")}
; const certificates = data?.data || []; return (
- +
+ + + +