diff --git a/src/frontend/src/components/details/Details.tsx b/src/frontend/src/components/details/Details.tsx index 1e9aceaad7..e1cc70e3d4 100644 --- a/src/frontend/src/components/details/Details.tsx +++ b/src/frontend/src/components/details/Details.tsx @@ -67,6 +67,7 @@ type InternalLinkField = { model: ModelType; model_field?: string; model_formatter?: (value: any) => string; + model_filters?: any; backup_value?: string; }; @@ -234,7 +235,9 @@ function TableAnchorValue(props: Readonly) { const url = apiUrl(modelDef.api_endpoint, props.field_value); return api - .get(url) + .get(url, { + params: props.field_data.model_filters ?? undefined + }) .then((response) => { switch (response.status) { case 200: diff --git a/src/frontend/src/pages/stock/StockDetail.tsx b/src/frontend/src/pages/stock/StockDetail.tsx index af474ccfe9..84e0449162 100644 --- a/src/frontend/src/pages/stock/StockDetail.tsx +++ b/src/frontend/src/pages/stock/StockDetail.tsx @@ -211,10 +211,13 @@ export default function StockDetail() { type: 'link', name: 'belongs_to', label: t`Installed In`, + model_filters: { + part_detail: true + }, model_formatter: (model: any) => { let text = model?.part_detail?.full_name ?? model?.name; if (model.serial && model.quantity == 1) { - text += `# ${model.serial}`; + text += ` # ${model.serial}`; } return text;