fsanyoto commited on
Commit
ecd617f
·
verified ·
1 Parent(s): a707d3c

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "current": "5aef04c1e",
3
  "releases": []
4
  }
 
1
  {
2
+ "current": "97257dacca6",
3
  "releases": []
4
  }
VERSION CHANGED
@@ -1 +1 @@
1
- 5aef04c1e
 
1
+ 97257dacca6
web/public/AIOS_DEPLOY_RECEIPT CHANGED
@@ -1 +1 @@
1
- 08671e431eaa33f78cc1b9904f90ff1e94907c8adec08d6b7403ddbe628c55e4
 
1
+ 28f494a1bff26c1441ab680e4e8d4b823c63741879de814769878c4e69caf407
web/src/apps/catalog/useCatalogData.ts CHANGED
@@ -1,6 +1,6 @@
1
  import { useCallback, useEffect, useState } from "react";
2
- import { TypedRefusal, typedOpenApi, typedQuery } from "../../typed/client";
3
- import type { QueryRequest, QueryResponse, TypedOpenApi } from "../../typed/client";
4
  import { FILTER_OPS, isFilterGroup } from "../../customer-grid/types";
5
  import type { Field, FilterNode, FilterOp, Row, ViewConfig } from "../../customer-grid/types";
6
 
@@ -245,35 +245,128 @@ export function useCatalogRecords(database: string, scope: CatalogReadScope, sea
245
  return { fields: live.fields, rows: live.rows, loading: live.loading, error: live.error, retry, search, setSearch };
246
  }
247
 
248
- /** Resolve only saved product codes, independently of the visible search and filters. */
249
- export async function loadCatalogPlacements(database: string, key: string, codes: string[], signal: AbortSignal): Promise<Row[]> {
250
- const rows: Row[] = [];
251
- for (const code of new Set(codes)) {
252
- const scope: CatalogReadScope = { filters: [{ id: "placement", colId: key, op: "eq", value: code }], filterConj: "and", sorts: [] };
253
- const page = await loadCatalogData(database, scope, signal);
254
- if (page.nextCursor || page.rows.length !== 1 || String(page.rows[0][key]) !== code) throw new Error(key === "pid"
255
- ? "A selected customer could not be confirmed." : `The saved product ${code} could not be confirmed.`);
256
- rows.push(page.rows[0]);
257
  }
258
- return rows;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  }
260
 
261
- export function useCatalogPlacements(database: string, key: string, codes: string[]) {
262
  const codesJson = JSON.stringify([...new Set(codes)].sort());
263
- const requestKey = `${database}::${key}::${codesJson}`;
264
  const [attempt, setAttempt] = useState(0);
265
- const [state, setState] = useState({ key: "", rows: [] as Row[], loading: true, error: "" });
266
  useEffect(() => {
267
  const controller = new AbortController();
268
- setState({ key: requestKey, rows: [], loading: true, error: "" });
269
- void loadCatalogPlacements(database, key, JSON.parse(codesJson), controller.signal).then((rows) => {
270
- if (!controller.signal.aborted) setState({ key: requestKey, rows, loading: false, error: "" });
 
 
271
  }).catch((error: unknown) => {
272
- if (!controller.signal.aborted) setState({ key: requestKey, rows: [], loading: false,
273
- error: error instanceof Error ? error.message : "Saved products could not be loaded." });
 
 
 
274
  });
275
  return () => controller.abort();
276
- }, [database, key, codesJson, requestKey, attempt]);
277
- return { ...(state.key === requestKey ? state : { rows: [], loading: true, error: "" }),
278
  retry: () => setAttempt((value) => value + 1) };
279
  }
 
1
  import { useCallback, useEffect, useState } from "react";
2
+ import { TypedRefusal, typedOpenApi, typedQuery, typedSchema } from "../../typed/client";
3
+ import type { DatabaseSchema, QueryRequest, QueryResponse, TypedOpenApi } from "../../typed/client";
4
  import { FILTER_OPS, isFilterGroup } from "../../customer-grid/types";
5
  import type { Field, FilterNode, FilterOp, Row, ViewConfig } from "../../customer-grid/types";
6
 
 
245
  return { fields: live.fields, rows: live.rows, loading: live.loading, error: live.error, retry, search, setSearch };
246
  }
247
 
248
+ function placementProperties(schema: DatabaseSchema, database: string): Properties {
249
+ if (schema.database !== database || !Array.isArray(schema.fields) || schema.fields.some((field) =>
250
+ !field || typeof field.key !== "string" || !field.key || typeof field.type !== "string")) {
251
+ throw new Error("The Catalog database is unavailable.");
 
 
 
 
 
252
  }
253
+ return Object.fromEntries(schema.fields.map((field) => {
254
+ const numeric = ["number", "int", "rating", "currency", "pct", "metric", "formula", "rollup"].includes(field.type);
255
+ const boolean = field.type === "checkbox" && ["mirror_user_table", "runtime_cache"].includes(String(schema.source_kind));
256
+ return [field.key, { type: field.type === "multiselect" ? ["string", "array", "null"]
257
+ : numeric ? ["number", "string", "null"] : [boolean ? "boolean" : "string", "null"] }];
258
+ }));
259
+ }
260
+
261
+ type PlacementProgress = { rows: Row[]; errors: Record<string, string> };
262
+
263
+ /** Resolve saved codes in order. A progress callback opts into independent results. */
264
+ export async function loadCatalogPlacements(database: string, key: string, codes: string[], signal: AbortSignal,
265
+ onProgress?: (data: PlacementProgress) => void): Promise<Row[]> {
266
+ signal.throwIfAborted();
267
+ const unique = [...new Set(codes)];
268
+ if (!unique.length) return [];
269
+ const schema = await typedSchema(database, signal);
270
+ const properties = placementProperties(schema, database);
271
+ signal.throwIfAborted();
272
+ const rows: (Row | undefined)[] = new Array(unique.length);
273
+ const errors: Record<string, string> = {};
274
+ const resolved = () => rows.filter((row): row is Row => row !== undefined);
275
+ const batchIdentities = database === "customer_data" && key === "pid" && schema.fields.some((field) =>
276
+ field.key === "partner_id" && field.source === "odoo" && ["int", "number"].includes(field.type)) &&
277
+ unique.every((code) => /^[1-9]\d*$/.test(code) && Number.isSafeInteger(Number(code)));
278
+ if (batchIdentities) {
279
+ for (let offset = 0; offset < unique.length; offset += 100) {
280
+ signal.throwIfAborted();
281
+ const batch = unique.slice(offset, offset + 100);
282
+ try {
283
+ const requested = new Set(batch);
284
+ const found = new Map<string, Row>();
285
+ const cursors: (string | null)[] = [null];
286
+ let limit = 100;
287
+ const scope: CatalogReadScope = { filters: [{ id: "placement", colId: "partner_id", op: "isAnyOf", value: "", values: batch }],
288
+ filterConj: "and", sorts: [] };
289
+ for (;;) {
290
+ const page = await loadCatalogData(database, scope, signal,
291
+ { cursor: cursors[cursors.length - 1], limit, priorCursors: [...cursors] }, properties);
292
+ limit = page.limit;
293
+ for (const row of page.rows) {
294
+ const code = String(row.pid);
295
+ if (!requested.has(code) || String(row.partner_id) !== code || found.has(code)) {
296
+ throw new Error("A selected customer batch could not be confirmed.");
297
+ }
298
+ found.set(code, row);
299
+ }
300
+ if (!page.nextCursor) break;
301
+ cursors.push(page.nextCursor);
302
+ }
303
+ for (const [index, code] of batch.entries()) {
304
+ const row = found.get(code);
305
+ if (row) rows[offset + index] = row;
306
+ else {
307
+ const message = "A selected customer could not be confirmed.";
308
+ if (!onProgress) throw new Error(message);
309
+ errors[code] = message;
310
+ }
311
+ }
312
+ } catch (error: unknown) {
313
+ signal.throwIfAborted();
314
+ if (!onProgress) throw error;
315
+ for (const code of batch) errors[code] = error instanceof Error ? error.message : "The selected record could not be loaded.";
316
+ }
317
+ signal.throwIfAborted();
318
+ onProgress?.({ rows: resolved(), errors: { ...errors } });
319
+ }
320
+ signal.throwIfAborted();
321
+ return resolved();
322
+ }
323
+ let next = 0;
324
+ let rejected = false;
325
+ await Promise.all(Array.from({ length: Math.min(6, unique.length) }, async () => {
326
+ while (next < unique.length && !rejected) {
327
+ signal.throwIfAborted();
328
+ const index = next++;
329
+ const code = unique[index];
330
+ try {
331
+ const scope: CatalogReadScope = { filters: [{ id: "placement", colId: key, op: "eq", value: code }], filterConj: "and", sorts: [] };
332
+ const page = await loadCatalogData(database, scope, signal, {}, properties);
333
+ if (page.nextCursor || page.rows.length !== 1 || String(page.rows[0][key]) !== code) throw new Error(key === "pid"
334
+ ? "A selected customer could not be confirmed." : `The saved product ${code} could not be confirmed.`);
335
+ rows[index] = page.rows[0];
336
+ } catch (error: unknown) {
337
+ signal.throwIfAborted();
338
+ if (!onProgress) { rejected = true; throw error; }
339
+ errors[code] = error instanceof Error ? error.message : "The selected record could not be loaded.";
340
+ }
341
+ signal.throwIfAborted();
342
+ onProgress?.({ rows: resolved(), errors: { ...errors } });
343
+ }
344
+ }));
345
+ signal.throwIfAborted();
346
+ return resolved();
347
  }
348
 
349
+ export function useCatalogPlacements(database: string, key: string, codes: string[], partial = false) {
350
  const codesJson = JSON.stringify([...new Set(codes)].sort());
351
+ const requestKey = `${database}::${key}::${codesJson}::${partial}`;
352
  const [attempt, setAttempt] = useState(0);
353
+ const [state, setState] = useState({ key: "", rows: [] as Row[], loading: true, error: "", errors: {} as Record<string, string> });
354
  useEffect(() => {
355
  const controller = new AbortController();
356
+ setState({ key: requestKey, rows: [], loading: true, error: "", errors: {} });
357
+ void loadCatalogPlacements(database, key, JSON.parse(codesJson), controller.signal, partial ? (data) => {
358
+ if (!controller.signal.aborted) setState({ ...data, key: requestKey, loading: true, error: "" });
359
+ } : undefined).then((rows) => {
360
+ if (!controller.signal.aborted) setState((live) => ({ ...live, key: requestKey, rows, loading: false, error: "" }));
361
  }).catch((error: unknown) => {
362
+ if (!controller.signal.aborted) setState((live) => {
363
+ const message = error instanceof Error ? error.message : "Saved products could not be loaded.";
364
+ return { key: requestKey, rows: partial ? live.rows : [], loading: false, error: message,
365
+ errors: partial ? Object.fromEntries((JSON.parse(codesJson) as string[]).map((code) => [code, message])) : {} };
366
+ });
367
  });
368
  return () => controller.abort();
369
+ }, [database, key, codesJson, requestKey, partial, attempt]);
370
+ return { ...(state.key === requestKey ? state : { rows: [], loading: true, error: "", errors: {} }),
371
  retry: () => setAttempt((value) => value + 1) };
372
  }
web/src/customer-grid/MapView.tsx CHANGED
@@ -64,6 +64,7 @@ import { AppFrame } from "./AppFrame";
64
  import { AppFrameMarks } from "../apps/templateMarks";
65
  import { CatalogApp } from "../apps/catalog/CatalogApp";
66
  import { useCatalogPlacements, useCatalogRecords } from "../apps/catalog/useCatalogData";
 
67
  import type { CatalogApplicationDefinition, CatalogViewSpec } from "./CatalogView";
68
  import { applicationTemplateSurface } from "./viewModes";
69
  import { LAND_PATH, LAKE_PATHS } from "./mapGeometry";
@@ -5124,7 +5125,7 @@ function RouteApplicationMapView({ props, titleKey, applicationId }: {
5124
  sorts: props.activeView?.config.sorts ?? [],
5125
  }, [titleKey]);
5126
  const [search, setSearch] = useState("");
5127
- const selected = useCatalogPlacements(props.tableKey, "pid", Array.from(props.selectedPids, String));
5128
  const selectedPending = selected.loading && props.selectedPids.size > 0;
5129
  const allRows = selected.rows.length
5130
  ? [...new Map([...data.rows, ...selected.rows].map((row) => [row.pid, row])).values()] : data.rows;
@@ -5155,7 +5156,8 @@ function RouteApplicationMapView({ props, titleKey, applicationId }: {
5155
  if (allRows.some((candidate) => candidate.pid === pid))
5156
  setCustomerPid(pid);
5157
  };
5158
- return <MapViewSurface {...props} rows={data.rows} allRows={allRows}
 
5159
  recordsPending={data.loading || selected.loading || !!selected.error}
5160
  applicationId={applicationId} onOpen={openCustomer} customerDetail={customerDetail}
5161
  onCustomerBack={() => setCustomerPid(null)} routingFilters={<>
@@ -5173,9 +5175,10 @@ function RouteApplicationMapView({ props, titleKey, applicationId }: {
5173
  </form>
5174
  {data.error && <div className="cg-catalog-library-error" role="alert"><span>{data.error}</span>
5175
  <button className="cg-btn" type="button" disabled={data.loading} onClick={data.retry}>Retry</button></div>}
5176
- {selected.error && <div className="cg-catalog-library-error" role="alert"><span>{selected.error}</span>
 
5177
  <button className="cg-btn" type="button" disabled={selected.loading} onClick={selected.retry}>Retry selected</button></div>}
5178
- </>} />;
5179
  }
5180
 
5181
  /** Resolve an Application deep link from the registry before selecting a specialized renderer.
 
64
  import { AppFrameMarks } from "../apps/templateMarks";
65
  import { CatalogApp } from "../apps/catalog/CatalogApp";
66
  import { useCatalogPlacements, useCatalogRecords } from "../apps/catalog/useCatalogData";
67
+ import { RoutingStopLabelErrors } from "./routeZoneApi";
68
  import type { CatalogApplicationDefinition, CatalogViewSpec } from "./CatalogView";
69
  import { applicationTemplateSurface } from "./viewModes";
70
  import { LAND_PATH, LAKE_PATHS } from "./mapGeometry";
 
5125
  sorts: props.activeView?.config.sorts ?? [],
5126
  }, [titleKey]);
5127
  const [search, setSearch] = useState("");
5128
+ const selected = useCatalogPlacements(props.tableKey, "pid", Array.from(props.selectedPids, String), true);
5129
  const selectedPending = selected.loading && props.selectedPids.size > 0;
5130
  const allRows = selected.rows.length
5131
  ? [...new Map([...data.rows, ...selected.rows].map((row) => [row.pid, row])).values()] : data.rows;
 
5156
  if (allRows.some((candidate) => candidate.pid === pid))
5157
  setCustomerPid(pid);
5158
  };
5159
+ return <RoutingStopLabelErrors.Provider value={selected.errors}>
5160
+ <MapViewSurface {...props} rows={data.rows} allRows={allRows}
5161
  recordsPending={data.loading || selected.loading || !!selected.error}
5162
  applicationId={applicationId} onOpen={openCustomer} customerDetail={customerDetail}
5163
  onCustomerBack={() => setCustomerPid(null)} routingFilters={<>
 
5175
  </form>
5176
  {data.error && <div className="cg-catalog-library-error" role="alert"><span>{data.error}</span>
5177
  <button className="cg-btn" type="button" disabled={data.loading} onClick={data.retry}>Retry</button></div>}
5178
+ {(selected.error || Object.keys(selected.errors).length > 0) && <div className="cg-catalog-library-error" role="alert">
5179
+ <span>{selected.error || "Some stops could not be loaded."}</span>
5180
  <button className="cg-btn" type="button" disabled={selected.loading} onClick={selected.retry}>Retry selected</button></div>}
5181
+ </>} /></RoutingStopLabelErrors.Provider>;
5182
  }
5183
 
5184
  /** Resolve an Application deep link from the registry before selecting a specialized renderer.
web/src/customer-grid/RouteNav.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
2
  import type { ReactElement } from "react";
3
  import { createPortal } from "react-dom";
4
  import { FolderMark } from "./icons";
@@ -19,6 +19,7 @@ import {
19
  routeLocationPartition,
20
  routeApplicationPath,
21
  routeStopIdentity,
 
22
  } from "./routeZoneApi";
23
  // W51-T28 / R6 + C8 — the wave-51 base kit's ONE confirm dialog. Consumed, never re-implemented.
24
  import { TruncatedName } from "../home/TruncatedName";
@@ -296,6 +297,7 @@ function RouteNavContent({ routes, folders, selectedIds, activeRouteId, sources,
296
  /** False until the first saved-Route read answers, so an empty list is not read as "none". */
297
  routesLoaded?: boolean;
298
  }) {
 
299
  /* ⭐⭐ OWNER 2026-08-31 item 3 - THE ROUTES RAIL IS THE VIEWS RAIL, NOT A COUSIN OF IT.
300
  Owner: *"I need the routes LIST navigation and the routes itself to have the exact same
301
  interface just like how we have it with view, where you can just click it and drag it AND
@@ -1127,7 +1129,8 @@ function RouteNavContent({ routes, folders, selectedIds, activeRouteId, sources,
1127
  // the name on paper is the same function as the name on screen, and every stop is on the
1128
  // page whether or not it has a coordinate.
1129
  const printStops = routePrintStops(
1130
- stopIds, stopLabels, stopCoords, routeStopIdentity, reversePrintLabels,
 
1131
  );
1132
  // ⚠ THE NAME HAS EXACTLY ONE WRITER NOW. `Save` below sends only the Maps URL, so an
1133
  // abandoned draft in the title can never be committed by a control that says nothing about
@@ -1216,9 +1219,9 @@ function RouteNavContent({ routes, folders, selectedIds, activeRouteId, sources,
1216
  onChange={(e) => onRouteStartChange?.(e.target.value ? Number(e.target.value) : null)}>
1217
  <option value="">Automatic</option>
1218
  {startUnavailable && <option value={routeStartPid!} disabled>
1219
- {routeStopIdentity(stopLabels[routeStartPid!], routeStartPid!)} (no map location)
1220
  </option>}
1221
- {locatedPids.map((pid) => <option key={pid} value={pid}>{routeStopIdentity(stopLabels[pid], pid)}</option>)}
1222
  </select>
1223
  </label>
1224
  <label>End
@@ -1228,9 +1231,9 @@ function RouteNavContent({ routes, folders, selectedIds, activeRouteId, sources,
1228
  onChange={(e) => onRouteEndChange?.(e.target.value ? Number(e.target.value) : null)}>
1229
  <option value="">Automatic</option>
1230
  {endUnavailable && <option value={routeEndPid!} disabled>
1231
- {routeStopIdentity(stopLabels[routeEndPid!], routeEndPid!)} (no map location)
1232
  </option>}
1233
- {locatedPids.filter((pid) => pid !== routeStartPid).map((pid) => <option key={pid} value={pid}>{routeStopIdentity(stopLabels[pid], pid)}</option>)}
1234
  </select>
1235
  </label>
1236
  </div>
@@ -1375,8 +1378,8 @@ function RouteNavContent({ routes, folders, selectedIds, activeRouteId, sources,
1375
  hover and focus. The id moves to the wrapper because TruncatedName takes none. */}
1376
  <span className="cg-view-text" id={`cg-route-stop-name-${pid}`}>
1377
  {/* Keyed by seat: a reorder remounts the tip, so it never paints at a stale row. */}
1378
- <TruncatedName key={index} className="cg-view-name">
1379
- {routeStopIdentity(stopLabels[pid], pid)}
1380
  </TruncatedName>
1381
  </span>
1382
  </button>
@@ -1412,7 +1415,7 @@ function RouteNavContent({ routes, folders, selectedIds, activeRouteId, sources,
1412
  <div role="list" aria-label="Route stops without a map location">
1413
  {unlocated.map((stop) => (
1414
  <p className="cg-w46-timer-note" role="listitem" key={stop.pid}>
1415
- <strong>{stop.label}</strong>: {stop.reason}
1416
  </p>
1417
  ))}
1418
  </div>
 
1
+ import { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
2
  import type { ReactElement } from "react";
3
  import { createPortal } from "react-dom";
4
  import { FolderMark } from "./icons";
 
19
  routeLocationPartition,
20
  routeApplicationPath,
21
  routeStopIdentity,
22
+ RoutingStopLabelErrors,
23
  } from "./routeZoneApi";
24
  // W51-T28 / R6 + C8 — the wave-51 base kit's ONE confirm dialog. Consumed, never re-implemented.
25
  import { TruncatedName } from "../home/TruncatedName";
 
297
  /** False until the first saved-Route read answers, so an empty list is not read as "none". */
298
  routesLoaded?: boolean;
299
  }) {
300
+ const stopLabelErrors = useContext(RoutingStopLabelErrors);
301
  /* ⭐⭐ OWNER 2026-08-31 item 3 - THE ROUTES RAIL IS THE VIEWS RAIL, NOT A COUSIN OF IT.
302
  Owner: *"I need the routes LIST navigation and the routes itself to have the exact same
303
  interface just like how we have it with view, where you can just click it and drag it AND
 
1129
  // the name on paper is the same function as the name on screen, and every stop is on the
1130
  // page whether or not it has a coordinate.
1131
  const printStops = routePrintStops(
1132
+ stopIds, stopLabels, stopCoords,
1133
+ (label, pid) => routeStopIdentity(label, pid, stopLabelErrors[pid]), reversePrintLabels,
1134
  );
1135
  // ⚠ THE NAME HAS EXACTLY ONE WRITER NOW. `Save` below sends only the Maps URL, so an
1136
  // abandoned draft in the title can never be committed by a control that says nothing about
 
1219
  onChange={(e) => onRouteStartChange?.(e.target.value ? Number(e.target.value) : null)}>
1220
  <option value="">Automatic</option>
1221
  {startUnavailable && <option value={routeStartPid!} disabled>
1222
+ {routeStopIdentity(stopLabels[routeStartPid!], routeStartPid!, stopLabelErrors[routeStartPid!])} (no map location)
1223
  </option>}
1224
+ {locatedPids.map((pid) => <option key={pid} value={pid}>{routeStopIdentity(stopLabels[pid], pid, stopLabelErrors[pid])}</option>)}
1225
  </select>
1226
  </label>
1227
  <label>End
 
1231
  onChange={(e) => onRouteEndChange?.(e.target.value ? Number(e.target.value) : null)}>
1232
  <option value="">Automatic</option>
1233
  {endUnavailable && <option value={routeEndPid!} disabled>
1234
+ {routeStopIdentity(stopLabels[routeEndPid!], routeEndPid!, stopLabelErrors[routeEndPid!])} (no map location)
1235
  </option>}
1236
+ {locatedPids.filter((pid) => pid !== routeStartPid).map((pid) => <option key={pid} value={pid}>{routeStopIdentity(stopLabels[pid], pid, stopLabelErrors[pid])}</option>)}
1237
  </select>
1238
  </label>
1239
  </div>
 
1378
  hover and focus. The id moves to the wrapper because TruncatedName takes none. */}
1379
  <span className="cg-view-text" id={`cg-route-stop-name-${pid}`}>
1380
  {/* Keyed by seat: a reorder remounts the tip, so it never paints at a stale row. */}
1381
+ <TruncatedName key={index} className={"cg-view-name" + (!stopLabels[pid] && stopLabelErrors[pid] ? " cg-w44-route-order-error" : "")}>
1382
+ {routeStopIdentity(stopLabels[pid], pid, stopLabelErrors[pid])}
1383
  </TruncatedName>
1384
  </span>
1385
  </button>
 
1415
  <div role="list" aria-label="Route stops without a map location">
1416
  {unlocated.map((stop) => (
1417
  <p className="cg-w46-timer-note" role="listitem" key={stop.pid}>
1418
+ <strong>{routeStopIdentity(stopLabels[stop.pid], stop.pid, stopLabelErrors[stop.pid])}</strong>: {stop.reason}
1419
  </p>
1420
  ))}
1421
  </div>
web/src/customer-grid/routeZoneApi.ts CHANGED
@@ -1,3 +1,4 @@
 
1
  import type {
2
  RouteDeliveryRecipientDirectory,
3
  RouteDeliveryDto,
@@ -11,6 +12,8 @@ export const ROUTE_INVENTORY_PATH = "/api/v1/customers/routes";
11
  export type RouteStopLabels = Record<number, { name: string; address: string }>;
12
  export type RouteStopCoords = Record<number, { lat: number; lon: number }>;
13
 
 
 
14
  export type UnlocatedRouteStop = {
15
  pid: number;
16
  label: string;
@@ -27,7 +30,9 @@ export type RouteLocationPartition = {
27
  export function routeStopIdentity(
28
  label: { name: string; address: string } | undefined,
29
  pid: number,
 
30
  ): string {
 
31
  const name = (label?.name || "").trim();
32
  if (name) return name;
33
  const address = (label?.address || "").trim();
 
1
+ import { createContext } from "react";
2
  import type {
3
  RouteDeliveryRecipientDirectory,
4
  RouteDeliveryDto,
 
12
  export type RouteStopLabels = Record<number, { name: string; address: string }>;
13
  export type RouteStopCoords = Record<number, { lat: number; lon: number }>;
14
 
15
+ export const RoutingStopLabelErrors = createContext<Readonly<Record<string, string>>>({});
16
+
17
  export type UnlocatedRouteStop = {
18
  pid: number;
19
  label: string;
 
30
  export function routeStopIdentity(
31
  label: { name: string; address: string } | undefined,
32
  pid: number,
33
+ error?: string,
34
  ): string {
35
+ if (!label) return error ? `Stop ${pid}: ${error}` : "Loading stop";
36
  const name = (label?.name || "").trim();
37
  if (name) return name;
38
  const address = (label?.address || "").trim();