fsanyoto commited on
Commit
0aaeea7
·
verified ·
1 Parent(s): 8e64e37

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "current": "41b95315053a",
3
  "releases": []
4
  }
 
1
  {
2
+ "current": "4ccda8afb9",
3
  "releases": []
4
  }
VERSION CHANGED
@@ -1 +1 @@
1
- 41b95315053a
 
1
+ 4ccda8afb9
web/public/AIOS_DEPLOY_RECEIPT CHANGED
@@ -1 +1 @@
1
- 5e9dfac669a615c1db636d4f0b16c386492d66ad00c16e91c133a8b01c31a425
 
1
+ ebc449c401569610c681fa10eb76062a0df81056cf9655dad9c6fb1ccabe58a4
web/src/customer-grid/CatalogView.tsx CHANGED
@@ -668,7 +668,7 @@ export function CatalogRecordEditor({ record, definition, fieldByKey, priceField
668
  <button type="button" className="cg-btn" disabled={printing || !draft.pages.length || unavailable || !!registryError || placements.loading || !!placements.error}
669
  onClick={() => { setPrintError(""); setPrinting(true); }}><IconPrint /> {printing ? "Preparing print" : "Print"}</button>
670
  {canEdit && <button type="button" className="cg-btn cg-btn--primary" disabled={!dirty || saving}
671
- onClick={() => { void saveDraft(); }}>{saving ? "Saving" : "Save"}</button>}
672
  </div>
673
  {saveError && <div className="cg-catalog-library-error" role="alert"><span>{saveError}</span>
674
  <button type="button" className="cg-btn" disabled={saving} onClick={() => { void saveDraft(); }}>Retry</button></div>}
 
668
  <button type="button" className="cg-btn" disabled={printing || !draft.pages.length || unavailable || !!registryError || placements.loading || !!placements.error}
669
  onClick={() => { setPrintError(""); setPrinting(true); }}><IconPrint /> {printing ? "Preparing print" : "Print"}</button>
670
  {canEdit && <button type="button" className="cg-btn cg-btn--primary" disabled={!dirty || saving}
671
+ onClick={() => { void saveDraft(); }}>Save</button>}
672
  </div>
673
  {saveError && <div className="cg-catalog-library-error" role="alert"><span>{saveError}</span>
674
  <button type="button" className="cg-btn" disabled={saving} onClick={() => { void saveDraft(); }}>Retry</button></div>}
web/src/customer-grid/CustomerGrid.tsx CHANGED
@@ -88,6 +88,7 @@ import type { GroupRowPlaceholder } from "./useGetCellContent";
88
  import { useGridSelection } from "./useGridSelection";
89
  import Toolbar from "./Toolbar";
90
  import { useSaveState } from "./SaveState";
 
91
  import { cellNoteText, editOutbox, gridEditScope, patchCellNote, pendingCellEdits, pendingCellNotes } from "./apiBridge";
92
  import CellNoteMenu, { cellNoteRefusal, drawCellNoteMarker } from "./CellNoteMenu";
93
  import type { OutboxEdit } from "./editOutbox";
@@ -5925,6 +5926,10 @@ function CustomerGridSurface({
5925
  * `drawContent()` untouched. ⚠ A cell is DENSE: two short lines, one baseline above centre and
5926
  * one below, never a sentence.
5927
  */
 
 
 
 
5928
  const drawGridCell = useCallback<DrawCellCallback>((args, drawContent) => {
5929
  const { cell, ctx, rect, theme } = args;
5930
  const row = displayRows[args.row];
@@ -5932,6 +5937,8 @@ function CustomerGridSurface({
5932
  const markNote = () => {
5933
  if (row?.kind === "data" && noteAt(row.record, key))
5934
  drawCellNoteMarker(ctx, rect, LP_YELLOW_DEEP);
 
 
5935
  };
5936
  const text = cell.kind === GridCellKind.Number || cell.kind === GridCellKind.Text
5937
  ? cell.displayData : undefined;
@@ -5959,7 +5966,7 @@ function CustomerGridSurface({
5959
  ctx.fillText(share, x, mid + SHOW_AS_LINE_GAP);
5960
  ctx.restore();
5961
  markNote();
5962
- }, [displayRows, visibleCols, noteAt]);
5963
  // W40-T30 — the wrapper that sat here intercepted `cell[0] === visibleCols.length` (the one
5964
  // index past the real columns) to paint the virtual "Go" Uri cell. Owner instruction 27
5965
  // removed the feature, so every index glide asks for is a real column again and the hook's
@@ -7003,7 +7010,8 @@ function CustomerGridSurface({
7003
  const field = fieldByKey.get(cellCol.id!);
7004
  const text = field ? formatDisplay(field, vr.record[field.key]) : "";
7005
  const bounds = args.bounds;
7006
- const tip = field && noteAt(vr.record, field.key) ? null
 
7007
  : bounds ? cellTipText(text, measureCellText(text), bounds.width) : null;
7008
  if (tip && bounds) {
7009
  const x = tipLeft(bounds.x, window.innerWidth, measureCellText(tip) + 20);
@@ -7019,7 +7027,7 @@ function CustomerGridSurface({
7019
  }
7020
  setCellTip((prev) => (prev === null ? prev : null));
7021
  },
7022
- [visibleCols, fieldByKey, displayRows, noteAt, scope]
7023
  );
7024
  const rowHeight = useMemo(
7025
  () =>
@@ -7140,6 +7148,16 @@ function CustomerGridSurface({
7140
  ? { ...row.record, ...overlayEdits[row.record.pid] }
7141
  : row.record;
7142
  }, [detailIndex, detailRows, overlayEdits, mirrorDetailRecord, detailPid]);
 
 
 
 
 
 
 
 
 
 
7143
  const dataPosition = useMemo(() => {
7144
  if (detailIndex === undefined) return 0;
7145
  return detailRows
@@ -11428,6 +11446,7 @@ function CustomerGridSurface({
11428
  <Toolbar
11429
  toolbarKind={routeApplicationSurface ? "app" : "table"}
11430
  saveScope={embedded || routeApplicationSurface ? undefined : scope}
 
11431
  manager={true}
11432
  nouns={topic.nouns}
11433
  viewer={viewer}
@@ -13004,9 +13023,12 @@ function CustomerGridSurface({
13004
  {cellNoteHover && cellNoteHover.scope === scope && (() => {
13005
  const row = rowByPid.get(cellNoteHover.pid);
13006
  const note = row && noteAt(row, cellNoteHover.key);
13007
- return note ? <div className="cg-header-tip cg-cell-note-hover" role="tooltip"
 
 
13008
  style={{ left: cellNoteHover.x, top: cellNoteHover.y }}>
13009
- {note}
 
13010
  </div> : null;
13011
  })()}
13012
  {cellNoteMenu && cellNoteMenu.scope === scope && (() => {
@@ -14546,6 +14568,7 @@ function CustomerGridSurface({
14546
  fields={fields}
14547
  fieldProjection={{ order, visible }}
14548
  record={detailRecord}
 
14549
  titleKey={lockedKey}
14550
  // ⭐ W35-T29 — the SAME star state the row control uses, never a second client. An
14551
  // embedded grid has neither: `recordStars` is disabled there, so `ready` is false and
 
88
  import { useGridSelection } from "./useGridSelection";
89
  import Toolbar from "./Toolbar";
90
  import { useSaveState } from "./SaveState";
91
+ import { cellSaveRefusals } from "./cellSaveRefusals";
92
  import { cellNoteText, editOutbox, gridEditScope, patchCellNote, pendingCellEdits, pendingCellNotes } from "./apiBridge";
93
  import CellNoteMenu, { cellNoteRefusal, drawCellNoteMarker } from "./CellNoteMenu";
94
  import type { OutboxEdit } from "./editOutbox";
 
5926
  * `drawContent()` untouched. ⚠ A cell is DENSE: two short lines, one baseline above centre and
5927
  * one below, never a sentence.
5928
  */
5929
+ const cellSaveFailures = useMemo(() => cellSaveRefusals(scope, [...pendingCellEdits(scope),
5930
+ ...pendingCellNotes(scope).map((note) => ({ ...note, kind: "cell-note", scope, updates: { [note.field]: note.text } }))],
5931
+ embedded || routeApplicationSurface ? [] : displayRows.flatMap((row) => row.kind === "data" ? [row.record.pid] : []),
5932
+ fields.map((field) => field.key)), [scope, saveStatus, displayRows, fields, embedded, routeApplicationSurface]);
5933
  const drawGridCell = useCallback<DrawCellCallback>((args, drawContent) => {
5934
  const { cell, ctx, rect, theme } = args;
5935
  const row = displayRows[args.row];
 
5937
  const markNote = () => {
5938
  if (row?.kind === "data" && noteAt(row.record, key))
5939
  drawCellNoteMarker(ctx, rect, LP_YELLOW_DEEP);
5940
+ if (row?.kind === "data" && cellSaveFailures.has(JSON.stringify([row.record.pid, key])))
5941
+ drawCellNoteMarker(ctx, { ...rect, width: rect.width - (noteAt(row.record, key) ? 9 : 0) }, LP_RED_DEEP);
5942
  };
5943
  const text = cell.kind === GridCellKind.Number || cell.kind === GridCellKind.Text
5944
  ? cell.displayData : undefined;
 
5966
  ctx.fillText(share, x, mid + SHOW_AS_LINE_GAP);
5967
  ctx.restore();
5968
  markNote();
5969
+ }, [displayRows, visibleCols, noteAt, cellSaveFailures]);
5970
  // W40-T30 — the wrapper that sat here intercepted `cell[0] === visibleCols.length` (the one
5971
  // index past the real columns) to paint the virtual "Go" Uri cell. Owner instruction 27
5972
  // removed the feature, so every index glide asks for is a real column again and the hook's
 
7010
  const field = fieldByKey.get(cellCol.id!);
7011
  const text = field ? formatDisplay(field, vr.record[field.key]) : "";
7012
  const bounds = args.bounds;
7013
+ const tip = field && (noteAt(vr.record, field.key)
7014
+ || cellSaveFailures.has(JSON.stringify([vr.record.pid, field.key]))) ? null
7015
  : bounds ? cellTipText(text, measureCellText(text), bounds.width) : null;
7016
  if (tip && bounds) {
7017
  const x = tipLeft(bounds.x, window.innerWidth, measureCellText(tip) + 20);
 
7027
  }
7028
  setCellTip((prev) => (prev === null ? prev : null));
7029
  },
7030
+ [visibleCols, fieldByKey, displayRows, noteAt, scope, cellSaveFailures]
7031
  );
7032
  const rowHeight = useMemo(
7033
  () =>
 
7148
  ? { ...row.record, ...overlayEdits[row.record.pid] }
7149
  : row.record;
7150
  }, [detailIndex, detailRows, overlayEdits, mirrorDetailRecord, detailPid]);
7151
+ const detailSaveFailures = useMemo(() => cellSaveRefusals(scope, [...pendingCellEdits(scope),
7152
+ ...pendingCellNotes(scope).map((note) => ({ ...note, kind: "cell-note", scope, updates: { [note.field]: note.text } }))],
7153
+ !embedded && !routeApplicationSurface && detailRecord && detailRecord.pid === detailPid ? [detailRecord.pid] : [],
7154
+ fields.map((field) => field.key)), [scope, saveStatus, embedded, routeApplicationSurface, detailRecord, detailPid, fields]);
7155
+ const saveRefusals = useMemo(() => {
7156
+ const reasons = new Map<string, string>();
7157
+ for (const cell of new Map([...cellSaveFailures, ...detailSaveFailures]).values()) for (const id of cell.ids)
7158
+ reasons.set(id, [reasons.get(id), cell.reason].filter(Boolean).join("\n"));
7159
+ return reasons;
7160
+ }, [cellSaveFailures, detailSaveFailures]);
7161
  const dataPosition = useMemo(() => {
7162
  if (detailIndex === undefined) return 0;
7163
  return detailRows
 
11446
  <Toolbar
11447
  toolbarKind={routeApplicationSurface ? "app" : "table"}
11448
  saveScope={embedded || routeApplicationSurface ? undefined : scope}
11449
+ saveRefusals={saveRefusals}
11450
  manager={true}
11451
  nouns={topic.nouns}
11452
  viewer={viewer}
 
13023
  {cellNoteHover && cellNoteHover.scope === scope && (() => {
13024
  const row = rowByPid.get(cellNoteHover.pid);
13025
  const note = row && noteAt(row, cellNoteHover.key);
13026
+ const reason = row && cellSaveFailures.get(JSON.stringify([row.pid, cellNoteHover.key]))?.reason;
13027
+ return note || reason ? <div className="cg-header-tip cg-cell-note-hover" role="tooltip"
13028
+ data-cell-refused={reason ? true : undefined}
13029
  style={{ left: cellNoteHover.x, top: cellNoteHover.y }}>
13030
+ {reason && <div>{reason}</div>}
13031
+ {note && <div>{note}</div>}
13032
  </div> : null;
13033
  })()}
13034
  {cellNoteMenu && cellNoteMenu.scope === scope && (() => {
 
14568
  fields={fields}
14569
  fieldProjection={{ order, visible }}
14570
  record={detailRecord}
14571
+ saveFailures={{ scope, pid: detailPid, cells: detailSaveFailures }}
14572
  titleKey={lockedKey}
14573
  // ⭐ W35-T29 — the SAME star state the row control uses, never a second client. An
14574
  // embedded grid has neither: `recordStars` is disabled there, so `ready` is false and
web/src/customer-grid/DatePicker.tsx CHANGED
@@ -575,11 +575,11 @@ export function DatePicker({ anchor, field, fields, pid, scopeKey, value, today,
575
  the column can change and this row will not follow. Saying so beats letting somebody
576
  discover it a month later. */}
577
  {inherited && storedRecurrence?.rules?.length ? (
578
- <span className="w46-recur-word">Repeating from this column's rule. Saving makes it this record's own.</span>
579
  ) : null}
580
  {storedRecurrence?.rules?.length && !inherited ? <button type="button" className="w46-recur-quiet is-danger" disabled={saving} onClick={removeRepeat}>Remove repeat</button> : null}
581
  <button type="button" className="w46-recur-quiet" disabled={saving} onClick={cancelEditor}>Cancel</button>
582
- <button type="button" className="w46-recur-save" disabled={saving} onClick={saveEditor}>{saving ? "Saving" : "Save"}</button>
583
  </div>
584
  </div>}
585
  </AnchoredOverlay>;
 
575
  the column can change and this row will not follow. Saying so beats letting somebody
576
  discover it a month later. */}
577
  {inherited && storedRecurrence?.rules?.length ? (
578
+ <span className="w46-recur-word">Repeating from this column's rule. Save to use this record's own rule.</span>
579
  ) : null}
580
  {storedRecurrence?.rules?.length && !inherited ? <button type="button" className="w46-recur-quiet is-danger" disabled={saving} onClick={removeRepeat}>Remove repeat</button> : null}
581
  <button type="button" className="w46-recur-quiet" disabled={saving} onClick={cancelEditor}>Cancel</button>
582
+ <button type="button" className="w46-recur-save" disabled={saving} onClick={saveEditor}>Save</button>
583
  </div>
584
  </div>}
585
  </AnchoredOverlay>;
web/src/customer-grid/MapView.tsx CHANGED
@@ -5006,9 +5006,9 @@ function MapViewSurfaceContent({
5006
  }}
5007
  title={drawnZoneGeometry || zoneKeyboardDraft
5008
  ? (zoneEditor ? "Replace this Zone boundary with the drawn shape" : "Save the drawn Zone")
5009
- : zoneEditor ? "Save Zone details" : "Draw a boundary before saving"}
5010
  >
5011
- {zoneBusy ? "Saving Zone" : zoneEditor ? "Update Zone" : "Save Zone"}
5012
  </button>
5013
  {zoneEditor && (!normalizedCustomerZones || zoneEditor.permission?.canDelete) && (
5014
  <button type="button" className="cg-btn cg-btn--danger" disabled={zoneBusy}
 
5006
  }}
5007
  title={drawnZoneGeometry || zoneKeyboardDraft
5008
  ? (zoneEditor ? "Replace this Zone boundary with the drawn shape" : "Save the drawn Zone")
5009
+ : zoneEditor ? "Save Zone details" : "Draw a boundary first"}
5010
  >
5011
+ {zoneEditor ? "Update Zone" : "Save Zone"}
5012
  </button>
5013
  {zoneEditor && (!normalizedCustomerZones || zoneEditor.permission?.canDelete) && (
5014
  <button type="button" className="cg-btn cg-btn--danger" disabled={zoneBusy}
web/src/customer-grid/RecordDetail.css CHANGED
@@ -287,6 +287,16 @@
287
  line-height: 1.45;
288
  }
289
 
 
 
 
 
 
 
 
 
 
 
290
  .cg-record-main .cg-detail-value {
291
  min-height: 30px;
292
  padding: 5px 9px;
 
287
  line-height: 1.45;
288
  }
289
 
290
+ .cg-record-main .cg-detail-field[data-cell-refused="true"] .cg-detail-label::after {
291
+ content: "";
292
+ display: inline-block;
293
+ width: 0;
294
+ height: 0;
295
+ margin-left: 4px;
296
+ border-top: 6px solid var(--lp-red-deep);
297
+ border-left: 6px solid transparent;
298
+ }
299
+
300
  .cg-record-main .cg-detail-value {
301
  min-height: 30px;
302
  padding: 5px 9px;
web/src/customer-grid/RecordDetail.tsx CHANGED
@@ -216,6 +216,12 @@ export interface RecordDetailProps {
216
  visible: ReadonlySet<string>;
217
  };
218
  record: Row;
 
 
 
 
 
 
219
  titleKey: string;
220
  positionLabel: string;
221
  canPrev: boolean;
@@ -1058,6 +1064,7 @@ export default function RecordDetail({
1058
  fields: baseFields,
1059
  fieldProjection,
1060
  record: baseRecord,
 
1061
  titleKey,
1062
  positionLabel,
1063
  canPrev,
@@ -2257,6 +2264,10 @@ export default function RecordDetail({
2257
  /** One row of the interleaved list: the handle, the label, and the type's own value slot. */
2258
  const renderRow = (field: Field, index: number) => {
2259
  const inputId = `cg-ov-${field.key}`;
 
 
 
 
2260
  // ONE verdict, `types.mayEditField` — stratum + read-only-by-nature + permissions.
2261
  // No second permission test anywhere below: a `formula` or `created_time` field must stay
2262
  // read-only after item 9, and that is this function's answer, not a type check of mine.
@@ -2802,6 +2813,8 @@ export default function RecordDetail({
2802
  key={field.key}
2803
  data-field-key={field.key}
2804
  data-field-editable={editable ? "true" : "false"}
 
 
2805
  onDragOver={(event) => {
2806
  // Only OUR drag. Without the guard the whole list would advertise itself as a drop
2807
  // target for a dragged file or a selection from another tab.
 
216
  visible: ReadonlySet<string>;
217
  };
218
  record: Row;
219
+ /** Confirmed refusals for the admitted base record and its current readable fields. */
220
+ saveFailures?: {
221
+ scope: SurfaceScope;
222
+ pid: number;
223
+ cells: ReadonlyMap<string, { reason: string }>;
224
+ };
225
  titleKey: string;
226
  positionLabel: string;
227
  canPrev: boolean;
 
1064
  fields: baseFields,
1065
  fieldProjection,
1066
  record: baseRecord,
1067
+ saveFailures,
1068
  titleKey,
1069
  positionLabel,
1070
  canPrev,
 
2264
  /** One row of the interleaved list: the handle, the label, and the type's own value slot. */
2265
  const renderRow = (field: Field, index: number) => {
2266
  const inputId = `cg-ov-${field.key}`;
2267
+ const refusalReason = !frame && scope != null && saveFailures
2268
+ && topicForScope(saveFailures.scope).scope === topicForScope(scope).scope
2269
+ && saveFailures.pid === record.pid && fieldByKey.has(field.key)
2270
+ ? saveFailures.cells.get(JSON.stringify([record.pid, field.key]))?.reason : undefined;
2271
  // ONE verdict, `types.mayEditField` — stratum + read-only-by-nature + permissions.
2272
  // No second permission test anywhere below: a `formula` or `created_time` field must stay
2273
  // read-only after item 9, and that is this function's answer, not a type check of mine.
 
2813
  key={field.key}
2814
  data-field-key={field.key}
2815
  data-field-editable={editable ? "true" : "false"}
2816
+ data-cell-refused={refusalReason ? "true" : undefined}
2817
+ title={refusalReason}
2818
  onDragOver={(event) => {
2819
  // Only OUR drag. Without the guard the whole list would advertise itself as a drop
2820
  // target for a dragged file or a selection from another tab.
web/src/customer-grid/SaveState.tsx CHANGED
@@ -10,19 +10,25 @@ export function useSaveState(includes: (edit: OutboxEdit) => boolean) {
10
  return useMemo(() => outboxStatus(snapshot, includes), [snapshot, includes]);
11
  }
12
 
13
- export default function SaveState({ includes, showFailures = false }: {
14
  includes: (edit: OutboxEdit) => boolean;
15
  showFailures?: boolean;
 
16
  }) {
17
  useEffect(() => { void editOutbox.start(); }, []);
18
  const status = useSaveState(includes);
19
- const reason = showFailures ? [...new Set(Object.values(status.failures).map((failure) => failure.message))]
 
 
 
20
  .join("\n").replace(/[\u2013\u2014]/g, ",") : "";
 
 
21
  return (
22
- <div className="cg-save-state" data-state={status.state} title={reason || undefined}>
23
  <span role="status" aria-live="polite" aria-atomic="true"
24
- aria-label={reason ? `${status.state}. ${reason}` : undefined}>{status.state}</span>
25
- {showFailures && status.state === "Not saved" && status.pending.length > 0 && <button type="button"
26
  className="cg-save-retry" aria-label="Retry unsaved changes"
27
  onClick={() => void editOutbox.retryNow((edit) => includes(edit)
28
  && !!editOutbox.snapshot().failures[edit.id])}>Retry</button>}
 
10
  return useMemo(() => outboxStatus(snapshot, includes), [snapshot, includes]);
11
  }
12
 
13
+ export default function SaveState({ includes, showFailures = false, refusalReasons }: {
14
  includes: (edit: OutboxEdit) => boolean;
15
  showFailures?: boolean;
16
+ refusalReasons?: ReadonlyMap<string, string>;
17
  }) {
18
  useEffect(() => { void editOutbox.start(); }, []);
19
  const status = useSaveState(includes);
20
+ const refused = status.pending.filter((edit) => status.failures[edit.id]?.confirmedRefusal
21
+ && (!refusalReasons || refusalReasons.has(edit.id)));
22
+ const reason = showFailures ? [...new Set(refused.map((edit) =>
23
+ refusalReasons?.get(edit.id) ?? status.failures[edit.id].message))]
24
  .join("\n").replace(/[\u2013\u2014]/g, ",") : "";
25
+ if (showFailures && !reason) return null;
26
+ const state = showFailures ? "Not saved" : status.state;
27
  return (
28
+ <div className="cg-save-state" data-state={state} title={reason || undefined}>
29
  <span role="status" aria-live="polite" aria-atomic="true"
30
+ aria-label={reason ? `${state}. ${reason}` : undefined}>{state}</span>
31
+ {showFailures && refused.length > 0 && <button type="button"
32
  className="cg-save-retry" aria-label="Retry unsaved changes"
33
  onClick={() => void editOutbox.retryNow((edit) => includes(edit)
34
  && !!editOutbox.snapshot().failures[edit.id])}>Retry</button>}
web/src/customer-grid/Toolbar.tsx CHANGED
@@ -66,6 +66,7 @@ export interface ConnectionChoice {
66
  interface ToolbarBaseProps {
67
  toolbarKind?: "table" | "pivot" | "app";
68
  saveScope?: string;
 
69
  fields: Field[];
70
  /** Identity used only to classify shared fields into ownership sections. */
71
  viewer?: Viewer;
@@ -666,6 +667,7 @@ const ROW_OPTIONS: { mode: RowHeightMode; label: string }[] = [
666
  export default function Toolbar({
667
  toolbarKind = "table",
668
  saveScope,
 
669
  countDetail,
670
  savedValueCount = false,
671
  onRetryCount,
@@ -1262,7 +1264,7 @@ export default function Toolbar({
1262
  </div>
1263
  )}
1264
  </Popover>
1265
- {saveScope !== undefined && <SaveState includes={saveIncludes} showFailures />}
1266
  </div>
1267
 
1268
  {onFullscreen && (
 
66
  interface ToolbarBaseProps {
67
  toolbarKind?: "table" | "pivot" | "app";
68
  saveScope?: string;
69
+ saveRefusals?: ReadonlyMap<string, string>;
70
  fields: Field[];
71
  /** Identity used only to classify shared fields into ownership sections. */
72
  viewer?: Viewer;
 
667
  export default function Toolbar({
668
  toolbarKind = "table",
669
  saveScope,
670
+ saveRefusals,
671
  countDetail,
672
  savedValueCount = false,
673
  onRetryCount,
 
1264
  </div>
1265
  )}
1266
  </Popover>
1267
+ {saveScope !== undefined && <SaveState includes={saveIncludes} showFailures refusalReasons={saveRefusals} />}
1268
  </div>
1269
 
1270
  {onFullscreen && (
web/src/customer-grid/ViewSidebar.tsx CHANGED
@@ -1286,7 +1286,6 @@ export default function ViewSidebar({
1286
  views: suppliedViews,
1287
  loading = false,
1288
  activeViewId,
1289
- saveState,
1290
  onSelect: requestSelect,
1291
  onCreate,
1292
  onRename,
@@ -2841,9 +2840,6 @@ export default function ViewSidebar({
2841
  {/* I13 — the "Views / All changes saved" header block is GONE and everything moved up. */}
2842
  </div>
2843
 
2844
- <div className="cg-sr-only" aria-live="polite">
2845
- {saveState === "saving" ? "Saving changes…" : "All changes saved"}
2846
- </div>
2847
  </>
2848
  );
2849
 
 
1286
  views: suppliedViews,
1287
  loading = false,
1288
  activeViewId,
 
1289
  onSelect: requestSelect,
1290
  onCreate,
1291
  onRename,
 
2840
  {/* I13 — the "Views / All changes saved" header block is GONE and everything moved up. */}
2841
  </div>
2842
 
 
 
 
2843
  </>
2844
  );
2845
 
web/src/customer-grid/cellSaveRefusals.ts ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { PendingCellEdit } from "./apiBridge";
2
+ import { topicForScope } from "./types";
3
+
4
+ /** Refusal details belong only to admitted records and current readable fields in this database. */
5
+ export function cellSaveRefusals(scope: string, edits: readonly PendingCellEdit[],
6
+ pids: readonly number[], keys: readonly string[]) {
7
+ const records = new Set(pids), fields = new Set(keys);
8
+ const cells = new Map<string, { reason: string; ids: string[] }>();
9
+ for (const edit of edits) {
10
+ if (topicForScope(edit.scope).scope !== topicForScope(scope).scope
11
+ || !records.has(edit.pid) || !edit.failure?.confirmedRefusal) continue;
12
+ const updated = Object.keys(edit.updates);
13
+ for (const key of updated) {
14
+ if (!fields.has(key)) continue;
15
+ const message = edit.failure.cells ? edit.failure.cells[key]
16
+ : updated.every((field) => fields.has(field)) ? edit.failure.message : "The server refused this change.";
17
+ if (!message) continue;
18
+ const reason = message.replace(/[\u2013\u2014]/g, ", ");
19
+ const address = JSON.stringify([edit.pid, key]), previous = cells.get(address);
20
+ cells.set(address, { reason: previous && previous.reason !== reason ? `${previous.reason}\n${reason}` : reason,
21
+ ids: [...(previous?.ids ?? []), edit.id] });
22
+ }
23
+ }
24
+ return cells;
25
+ }