Implement an export button for debugging
This commit is contained in:
@@ -2,12 +2,13 @@ import { useQuery } from "@tanstack/react-query";
|
|||||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { RefreshCw, AlertCircle, Radar } from "lucide-react";
|
import { RefreshCw, AlertCircle, Radar, Download } from "lucide-react";
|
||||||
import { SignatureCategories } from "@/components/SignatureCategories";
|
import { SignatureCategories } from "@/components/SignatureCategories";
|
||||||
import { useSignatureCategories } from "@/hooks/useSignatureCategories";
|
import { useSignatureCategories } from "@/hooks/useSignatureCategories";
|
||||||
import { toast } from "@/hooks/use-toast";
|
import { toast } from "@/hooks/use-toast";
|
||||||
import { CleanModeToggle } from "@/components/CleanModeToggle";
|
import { CleanModeToggle } from "@/components/CleanModeToggle";
|
||||||
import pb from "@/lib/pocketbase";
|
import pb from "@/lib/pocketbase";
|
||||||
|
import { SigviewRecord as Signature } from "@/lib/pbtypes";
|
||||||
|
|
||||||
interface SystemTrackerProps {
|
interface SystemTrackerProps {
|
||||||
system: string;
|
system: string;
|
||||||
@@ -25,7 +26,7 @@ export const SystemTracker = ({ system, cleanMode, onCleanModeToggle }: SystemTr
|
|||||||
queryKey: ['signatures', system],
|
queryKey: ['signatures', system],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
if (!system) return null;
|
if (!system) return null;
|
||||||
return pb.collection('sigview').getFullList({ batch: 1000, filter: `(system='${system}')` });
|
return pb.collection('sigview').getFullList<Signature>({ batch: 1000, filter: `(system='${system}')` });
|
||||||
},
|
},
|
||||||
enabled: !!system,
|
enabled: !!system,
|
||||||
refetchInterval: 5000, // Poll every 5 seconds
|
refetchInterval: 5000, // Poll every 5 seconds
|
||||||
@@ -39,6 +40,31 @@ export const SystemTracker = ({ system, cleanMode, onCleanModeToggle }: SystemTr
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleExport = () => {
|
||||||
|
const exportText = signatures
|
||||||
|
.map(sig => [
|
||||||
|
sig.identifier,
|
||||||
|
'', // Empty field (part[1] in parseSignature)
|
||||||
|
sig.type || '',
|
||||||
|
sig.signame || '',
|
||||||
|
sig.scanned || ''
|
||||||
|
].join('\t'))
|
||||||
|
.join('\n');
|
||||||
|
|
||||||
|
navigator.clipboard.writeText(exportText).then(() => {
|
||||||
|
toast({
|
||||||
|
title: "Exported",
|
||||||
|
description: "Signatures copied to clipboard in EVE format",
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
toast({
|
||||||
|
title: "Export Failed",
|
||||||
|
description: "Failed to copy to clipboard",
|
||||||
|
variant: "destructive"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const signatures = signaturesData || [];
|
const signatures = signaturesData || [];
|
||||||
const isLoading = signaturesLoading;
|
const isLoading = signaturesLoading;
|
||||||
|
|
||||||
@@ -80,6 +106,14 @@ export const SystemTracker = ({ system, cleanMode, onCleanModeToggle }: SystemTr
|
|||||||
<Badge variant="outline" className="bg-slate-700/50 text-slate-300 border-slate-600">
|
<Badge variant="outline" className="bg-slate-700/50 text-slate-300 border-slate-600">
|
||||||
Total: {signatures.length}
|
Total: {signatures.length}
|
||||||
</Badge>
|
</Badge>
|
||||||
|
<Button
|
||||||
|
onClick={handleExport}
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
className="h-6 w-6 text-slate-400 hover:text-slate-200 hover:bg-slate-700/50"
|
||||||
|
>
|
||||||
|
<Download className="h-3 w-3" />
|
||||||
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={handleRefresh}
|
onClick={handleRefresh}
|
||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
|
Reference in New Issue
Block a user