Schliesse das Notebook-Source-Mapping, damit Wizard und Taxonomie ohne leere Kategorie starten.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
b276758ee1
commit
d784248e28
13 files changed
+1505
-9
No files matched your search
+15
-2
@@ -45,7 +45,14 @@ export const api = {
|
||||
};
|
||||
|
||||
export type ProductCategory = { id: string; name: string; status: string };
|
||||
export type CategorySource = { source: string; source_category_id: string; display_name: string; status: string };
|
||||
export type CategorySource = {
|
||||
source: string;
|
||||
source_category_id: string;
|
||||
display_name: string;
|
||||
status: string;
|
||||
taxonomy_status?: string;
|
||||
external_category_key?: string;
|
||||
};
|
||||
export type BuyingTemplate = { id: string; version: number; name: string; product_category_id?: string; market?: string; currency?: string };
|
||||
export type ProjectSummary = {
|
||||
id: string;
|
||||
@@ -148,5 +155,11 @@ export type Observation = {
|
||||
dynamic_attributes?: { raw_name: string; normalized_value: unknown }[];
|
||||
};
|
||||
export type Source = { id: string; name: string };
|
||||
export type SourceCategory = { external_category_key: string; name: string; status: string };
|
||||
export type SourceCategory = {
|
||||
external_category_key: string;
|
||||
name: string;
|
||||
status: string;
|
||||
taxonomy_status?: string;
|
||||
product_category_id?: string | null;
|
||||
};
|
||||
export type SourceFilter = { label: string; external_filter_key: string; filter_type: string; status: string };
|
||||
@@ -18,21 +18,29 @@ export function AdminPage() {
|
||||
});
|
||||
const discover = useMutation({
|
||||
mutationFn: () => api.discoverTaxonomy(source, category),
|
||||
onSuccess: () => filters.refetch(),
|
||||
onSuccess: () => {
|
||||
categories.refetch();
|
||||
filters.refetch();
|
||||
},
|
||||
});
|
||||
if (sources.isLoading) return <LoadingState />;
|
||||
const selected = categories.data?.items.find((item) => item.external_category_key === category);
|
||||
return (
|
||||
<section className="grid">
|
||||
<h1>Quellen und Taxonomie</h1>
|
||||
<p className="muted">Technische IDs sind nur hier sichtbar.</p>
|
||||
<div className="card">
|
||||
<div className="card grid">
|
||||
<p>Source: {source || "–"}</p>
|
||||
<p>Kategorie: {category || "–"}</p>
|
||||
<button className="button" disabled={!source || !category} onClick={() => discover.mutate()}>
|
||||
<p>Status: {selected?.taxonomy_status || "NOT_LEARNED"}</p>
|
||||
{discover.isError ? <p className="danger">{(discover.error as Error).message}</p> : null}
|
||||
<button className="button" disabled={!source || !category || discover.isPending} onClick={() => discover.mutate()}>
|
||||
Taxonomie laden
|
||||
</button>
|
||||
</div>
|
||||
{!filters.data?.filters.length ? (
|
||||
{!category ? (
|
||||
<EmptyState>Keine Source-Kategorie hinterlegt.</EmptyState>
|
||||
) : !filters.data?.filters.length ? (
|
||||
<EmptyState>Taxonomie wurde noch nicht geladen.</EmptyState>
|
||||
) : (
|
||||
<div className="card">
|
||||
|
||||
@@ -60,6 +60,7 @@ export function WizardPage() {
|
||||
});
|
||||
|
||||
const sourceItems = sources.data?.items || [];
|
||||
const sourceRow = sourceItems.find((item) => item.source === source) || sourceItems[0];
|
||||
const needsPicker = sourceItems.filter((item) => item.status === "ACTIVE").length > 1;
|
||||
|
||||
const visible = useMemo(() => criteria.data?.criteria || [], [criteria.data]);
|
||||
@@ -113,6 +114,16 @@ export function WizardPage() {
|
||||
{categoryId && !sources.isLoading && sourceItems.length === 0 ? (
|
||||
<EmptyState>Keine Source für diese Produktkategorie verfügbar.</EmptyState>
|
||||
) : null}
|
||||
{sourceRow?.taxonomy_status === "NOT_LEARNED" && criteria.isLoading ? (
|
||||
<EmptyState>Kriterien für diese Produktkategorie werden gerade vorbereitet.</EmptyState>
|
||||
) : null}
|
||||
{sourceRow?.taxonomy_status === "LEARNING" ? <LoadingState /> : null}
|
||||
{sourceRow?.taxonomy_status === "BLOCKED" ? (
|
||||
<EmptyState>Quelle derzeit nicht automatisiert abfragbar.</EmptyState>
|
||||
) : null}
|
||||
{sourceRow?.taxonomy_status === "BROKEN" ? (
|
||||
<EmptyState>Die Quelle für diese Kategorie ist derzeit unbrauchbar.</EmptyState>
|
||||
) : null}
|
||||
{needsPicker ? (
|
||||
<label>
|
||||
Quelle
|
||||
@@ -128,6 +139,7 @@ export function WizardPage() {
|
||||
<p className="muted">Quelle: {source}</p>
|
||||
) : null}
|
||||
|
||||
{criteria.isError ? <ErrorState message={(criteria.error as Error).message} onRetry={() => criteria.refetch()} /> : null}
|
||||
{criteria.isLoading ? <LoadingState /> : null}
|
||||
{visible.length > 0 ? (
|
||||
<div className="card grid">
|
||||
|
||||
Reference in new issue
Block a user