mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-07 16:18:47 +00:00
Hide verify button
This commit is contained in:
@@ -167,6 +167,10 @@ export default function GeneralPage() {
|
|||||||
const [isCheckingCache, setIsCheckingCache] = useState(false);
|
const [isCheckingCache, setIsCheckingCache] = useState(false);
|
||||||
const [isRebuildingCache, setIsRebuildingCache] = useState(false);
|
const [isRebuildingCache, setIsRebuildingCache] = useState(false);
|
||||||
|
|
||||||
|
// get "imp" from local storage to determine if we should show the verify button (imp = "1" means show)
|
||||||
|
const showVerifyButton =
|
||||||
|
typeof window !== "undefined" && localStorage.getItem("imp") === "1";
|
||||||
|
|
||||||
const handleRebuildCache = async () => {
|
const handleRebuildCache = async () => {
|
||||||
if (!client.clientId) return;
|
if (!client.clientId) return;
|
||||||
setIsRebuildingCache(true);
|
setIsRebuildingCache(true);
|
||||||
@@ -904,74 +908,77 @@ export default function GeneralPage() {
|
|||||||
</SettingsSection>
|
</SettingsSection>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Hidden cache verification — subtle button, dev/admin diagnostic */}
|
{showVerifyButton && (
|
||||||
<div className="mt-8 flex flex-col gap-2 items-start opacity-30 hover:opacity-100 transition-opacity">
|
<div className="mt-8 flex flex-col gap-2 items-start opacity-30 hover:opacity-100 transition-opacity">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={handleVerifyCache}
|
onClick={handleVerifyCache}
|
||||||
disabled={isCheckingCache}
|
disabled={isCheckingCache}
|
||||||
className="text-xs text-muted-foreground underline disabled:opacity-50"
|
className="text-xs text-muted-foreground underline disabled:opacity-50"
|
||||||
title="Verify the client's site association cache against current permissions (read-only)"
|
title="Verify the client's site association cache against current permissions (read-only)"
|
||||||
>
|
|
||||||
{isCheckingCache
|
|
||||||
? "Checking cache…"
|
|
||||||
: "Verify association cache"}
|
|
||||||
</button>
|
|
||||||
{cacheCheck && (
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
"text-xs rounded border px-2 py-1 " +
|
|
||||||
(cacheCheck.consistent
|
|
||||||
? "border-green-600 text-green-700"
|
|
||||||
: "border-red-600 text-red-700")
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{cacheCheck.consistent ? (
|
{isCheckingCache
|
||||||
<span className="flex items-center gap-1">
|
? "Checking cache…"
|
||||||
<CheckCircle2 className="h-3 w-3" />
|
: "Verify association cache"}
|
||||||
Cache is consistent
|
</button>
|
||||||
</span>
|
{cacheCheck && (
|
||||||
) : (
|
<div
|
||||||
<div className="space-y-2">
|
className={
|
||||||
<div className="flex items-center gap-1 font-semibold">
|
"text-xs rounded border px-2 py-1 " +
|
||||||
<XCircle className="h-3 w-3" />
|
(cacheCheck.consistent
|
||||||
Cache is INCONSISTENT
|
? "border-green-600 text-green-700"
|
||||||
|
: "border-red-600 text-red-700")
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{cacheCheck.consistent ? (
|
||||||
|
<span className="flex items-center gap-1">
|
||||||
|
<CheckCircle2 className="h-3 w-3" />
|
||||||
|
Cache is consistent
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<div className="space-y-2">
|
||||||
|
<div className="flex items-center gap-1 font-semibold">
|
||||||
|
<XCircle className="h-3 w-3" />
|
||||||
|
Cache is INCONSISTENT
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Missing site resources: [
|
||||||
|
{cacheCheck.missingSiteResourceIds.join(
|
||||||
|
", "
|
||||||
|
)}
|
||||||
|
]
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Extra site resources: [
|
||||||
|
{cacheCheck.extraSiteResourceIds.join(
|
||||||
|
", "
|
||||||
|
)}
|
||||||
|
]
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Missing sites: [
|
||||||
|
{cacheCheck.missingSiteIds.join(", ")}]
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Extra sites: [
|
||||||
|
{cacheCheck.extraSiteIds.join(", ")}]
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={handleRebuildCache}
|
||||||
|
disabled={isRebuildingCache}
|
||||||
|
className="mt-1 text-xs underline font-semibold disabled:opacity-50"
|
||||||
|
>
|
||||||
|
{isRebuildingCache
|
||||||
|
? "Rebuilding…"
|
||||||
|
: "Rebuild cache now"}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
)}
|
||||||
Missing site resources: [
|
</div>
|
||||||
{cacheCheck.missingSiteResourceIds.join(
|
)}
|
||||||
", "
|
</div>
|
||||||
)}
|
)}
|
||||||
]
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Extra site resources: [
|
|
||||||
{cacheCheck.extraSiteResourceIds.join(", ")}
|
|
||||||
]
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Missing sites: [
|
|
||||||
{cacheCheck.missingSiteIds.join(", ")}]
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Extra sites: [
|
|
||||||
{cacheCheck.extraSiteIds.join(", ")}]
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={handleRebuildCache}
|
|
||||||
disabled={isRebuildingCache}
|
|
||||||
className="mt-1 text-xs underline font-semibold disabled:opacity-50"
|
|
||||||
>
|
|
||||||
{isRebuildingCache
|
|
||||||
? "Rebuilding…"
|
|
||||||
: "Rebuild cache now"}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</SettingsContainer>
|
</SettingsContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user