Remove some hallucinated garbage from the blueprint queue

This commit is contained in:
2026-01-12 19:23:49 +01:00
parent 672e881bce
commit 0ae2eb9e7a

View File

@@ -33,8 +33,8 @@ import { Trash2, Plus, RefreshCw, Check, Search } from 'lucide-react';
import { getTypeIconUrl, fetchTypeName, TypeInfo } from '@/lib/api';
const CLICKHOUSE_URL = "https://mclickhouse.site.quack-lab.dev";
const CLICKHOUSE_USER = "indy_jobs_ro_user";
const CLICKHOUSE_PASSWORD = "Q9Cd5Z3j72NypTdNwKV7E7H83mv35mRc";
const CLICKHOUSE_USER = "indy_jobs_rw_user";
const CLICKHOUSE_PASSWORD = "66e8LU69M3dvzi9YZSkaA6WHGRt6TGGz";
const TYPESENSE_URL = "https://eve-typesense.site.quack-lab.dev";
const TYPESENSE_KEY = "#L46&&8UeJGE675zRR3kqzd6K!k6an7w";
@@ -46,15 +46,13 @@ const CLICKHOUSE_WRITE_PASSWORD = CLICKHOUSE_PASSWORD;
export interface BlueprintQueueItem {
id: string;
type_id: number;
quantity: number | null;
added_by: string;
added_at: string;
completed: boolean;
}
async function fetchBlueprintQueue(): Promise<BlueprintQueueItem[]> {
const query = `
SELECT id, type_id, quantity, added_by, added_at, completed
SELECT id, type_id, added_at, completed
FROM default.blueprint_queue
WHERE completed = 0
ORDER BY added_at ASC
@@ -80,11 +78,10 @@ async function fetchBlueprintQueue(): Promise<BlueprintQueueItem[]> {
}));
}
async function addToQueue(typeId: number, quantity: number | null, addedBy: string): Promise<void> {
const quantityValue = quantity !== null ? quantity : 'NULL';
async function addToQueue(typeId: number): Promise<void> {
const query = `
INSERT INTO default.blueprint_queue (type_id, quantity, added_by)
VALUES (${typeId}, ${quantityValue}, '${addedBy.replace(/'/g, "''")}')
INSERT INTO default.blueprint_queue (type_id)
VALUES (${typeId})
`;
const response = await fetch(`${CLICKHOUSE_URL}/?query=${encodeURIComponent(query)}`, {
@@ -166,7 +163,7 @@ interface TypesenseHit {
async function searchTypes(query: string): Promise<TypesenseHit[]> {
if (!query || query.length < 2) return [];
const response = await fetch(
`${TYPESENSE_URL}/collections/invTypes/documents/search?q=${encodeURIComponent(query)}&query_by=typeName&per_page=10`,
{
@@ -189,8 +186,6 @@ export function BlueprintsQueue() {
const [searchResults, setSearchResults] = useState<TypesenseHit[]>([]);
const [selectedType, setSelectedType] = useState<TypesenseHit | null>(null);
const [showDropdown, setShowDropdown] = useState(false);
const [newQuantity, setNewQuantity] = useState('');
const [addedBy, setAddedBy] = useState(() => localStorage.getItem('blueprint-queue-user') || '');
const dropdownRef = useRef<HTMLDivElement>(null);
const searchInputRef = useRef<HTMLInputElement>(null);
@@ -230,13 +225,12 @@ export function BlueprintsQueue() {
}, []);
const addMutation = useMutation({
mutationFn: ({ typeId, quantity, by }: { typeId: number; quantity: number | null; by: string }) =>
addToQueue(typeId, quantity, by),
mutationFn: ({ typeId }: { typeId: number }) =>
addToQueue(typeId),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['blueprint-queue'] });
setSearchQuery('');
setSelectedType(null);
setNewQuantity('');
},
});
@@ -258,13 +252,9 @@ export function BlueprintsQueue() {
const handleAdd = useCallback(() => {
if (!selectedType) return;
const quantity = newQuantity ? parseInt(newQuantity, 10) : null;
const by = addedBy.trim() || 'Unknown';
localStorage.setItem('blueprint-queue-user', by);
addMutation.mutate({ typeId: selectedType.typeID, quantity, by });
}, [selectedType, newQuantity, addedBy, addMutation]);
addMutation.mutate({ typeId: selectedType.typeID });
}, [selectedType, addMutation]);
if (error) {
return (
@@ -317,25 +307,6 @@ export function BlueprintsQueue() {
</div>
)}
</div>
<div className="w-24">
<label className="text-xs text-muted-foreground mb-1 block">Qty (opt)</label>
<Input
type="number"
placeholder="Qty"
value={newQuantity}
onChange={(e) => setNewQuantity(e.target.value)}
className="h-9"
/>
</div>
<div className="flex-1 min-w-[100px]">
<label className="text-xs text-muted-foreground mb-1 block">Added By</label>
<Input
placeholder="Your name"
value={addedBy}
onChange={(e) => setAddedBy(e.target.value)}
className="h-9"
/>
</div>
<Button
onClick={handleAdd}
disabled={!selectedType || addMutation.isPending}
@@ -371,8 +342,6 @@ export function BlueprintsQueue() {
<TableRow>
<TableHead className="w-12"></TableHead>
<TableHead>Blueprint</TableHead>
<TableHead className="w-20">Qty</TableHead>
<TableHead>Added By</TableHead>
<TableHead className="w-24">Actions</TableHead>
</TableRow>
</TableHeader>
@@ -396,12 +365,6 @@ export function BlueprintsQueue() {
</div>
</div>
</TableCell>
<TableCell>
{item.quantity ?? '—'}
</TableCell>
<TableCell className="text-muted-foreground">
{item.added_by}
</TableCell>
<TableCell>
<div className="flex gap-1">
<Button