fsanyoto commited on
Commit
95215b6
Β·
verified Β·
1 Parent(s): b53f364

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "current": "544f1b97",
3
  "releases": []
4
  }
 
1
  {
2
+ "current": "767305c0",
3
  "releases": []
4
  }
VERSION CHANGED
@@ -1 +1 @@
1
- 544f1b97
 
1
+ 767305c0
api/routes_sheet.py CHANGED
@@ -912,7 +912,9 @@ def _registry_mirror(session: Session, cur, table_key: str, metric_window, neede
912
  # `_filter_columns` picks the compiler's type; handing them two different lists is how a column
913
  # ends up stored as one thing and compared as another.
914
  spec_fields = sheet_mod.mirror_fields(kept)
915
- spec = rel.registry_grid_spec(cur, table_key, spec_fields, rows)
 
 
916
  # β›”β›” THE MATERIALISED TABLE IS GIVEN THE WINDOW'S OWN NAME, AND WITHOUT THIS THE MEMO ABOVE
917
  # SERVES ONE WINDOW'S ROWS UNDER ANOTHER WINDOW'S ANSWER (found by W53-T14, live).
918
  # `odoo_relational.registry_grid_spec` names its temp table `_registry_grid_<table_key>` and
 
912
  # `_filter_columns` picks the compiler's type; handing them two different lists is how a column
913
  # ends up stored as one thing and compared as another.
914
  spec_fields = sheet_mod.mirror_fields(kept)
915
+ # The related customer side can contain thousands of permitted rows. Insert its column
916
+ # arrays in one call; per-row execute round trips delayed the first drill page by seconds.
917
+ spec = rel.registry_grid_spec(cur, table_key, spec_fields, rows, bulk=True)
918
  # β›”β›” THE MATERIALISED TABLE IS GIVEN THE WINDOW'S OWN NAME, AND WITHOUT THIS THE MEMO ABOVE
919
  # SERVES ONE WINDOW'S ROWS UNDER ANOTHER WINDOW'S ANSWER (found by W53-T14, live).
920
  # `odoo_relational.registry_grid_spec` names its temp table `_registry_grid_<table_key>` and
web/public/AIOS_DEPLOY_RECEIPT CHANGED
@@ -1 +1 @@
1
- 0e5f92d9000e97b0a35aef40168aaf35273dc19f9bb6647688563db692551567
 
1
+ dcb680d1d275cccc50e9f6c9c899dbd8405f9e10932707e40eac1c78bb169bcb
web/src/account/TurnAuditTable.tsx CHANGED
@@ -61,9 +61,9 @@ export function TurnAuditView({ state, onMore, onRetry }: {
61
  <td><time dateTime={turn.ts} title={turn.ts}>{new Date(turn.ts).toLocaleString(undefined, {
62
  month: "short", day: "numeric", hour: "2-digit", minute: "2-digit", second: "2-digit",
63
  })}</time></td>
64
- <td>{turn.user}</td><td>{label(turn.door)}</td><td>{turn.model}</td>
65
- <td className="acct-turns-number">{fmt.int(turn.tokensIn)}</td>
66
- <td className="acct-turns-number">{fmt.int(turn.tokensOut)}</td>
67
  <td className="acct-turns-number">{turn.cost === null ? "No price on file" :
68
  turn.cost.toLocaleString(undefined, { style: "currency", currency: "USD",
69
  minimumFractionDigits: 2, maximumFractionDigits: 6 })}</td>
 
61
  <td><time dateTime={turn.ts} title={turn.ts}>{new Date(turn.ts).toLocaleString(undefined, {
62
  month: "short", day: "numeric", hour: "2-digit", minute: "2-digit", second: "2-digit",
63
  })}</time></td>
64
+ <td>{turn.user}</td><td>{label(turn.door)}</td><td>{turn.model ?? "No model"}</td>
65
+ <td className="acct-turns-number">{turn.tokensIn === null ? "Not reported" : fmt.int(turn.tokensIn)}</td>
66
+ <td className="acct-turns-number">{turn.tokensOut === null ? "Not reported" : fmt.int(turn.tokensOut)}</td>
67
  <td className="acct-turns-number">{turn.cost === null ? "No price on file" :
68
  turn.cost.toLocaleString(undefined, { style: "currency", currency: "USD",
69
  minimumFractionDigits: 2, maximumFractionDigits: 6 })}</td>
web/src/account/turnAuditApi.ts CHANGED
@@ -7,9 +7,9 @@ export interface TurnAuditRow {
7
  ts: string;
8
  user: string;
9
  door: string;
10
- model: string;
11
- tokensIn: number;
12
- tokensOut: number;
13
  cost: number | null;
14
  tools: string[];
15
  durationMs: number;
@@ -42,7 +42,7 @@ function number(value: unknown): number {
42
 
43
  export function parseTurnAudit(body: unknown, offset = 0): TurnAuditPage {
44
  const page = object(body);
45
- const rows = page.turns ?? page.rows;
46
  if (!Array.isArray(rows)) throw new Error("Invalid turn audit page.");
47
  const turns = rows.map((value): TurnAuditRow => {
48
  const row = object(value);
@@ -55,9 +55,9 @@ export function parseTurnAudit(body: unknown, offset = 0): TurnAuditPage {
55
  ts,
56
  user: text(row.user),
57
  door: text(row.door),
58
- model: text(row.model),
59
- tokensIn: number(row.tokensIn),
60
- tokensOut: number(row.tokensOut),
61
  cost: row.cost === null ? null : number(row.cost),
62
  tools: row.tools as string[],
63
  durationMs: number(row.durationMs),
 
7
  ts: string;
8
  user: string;
9
  door: string;
10
+ model: string | null;
11
+ tokensIn: number | null;
12
+ tokensOut: number | null;
13
  cost: number | null;
14
  tools: string[];
15
  durationMs: number;
 
42
 
43
  export function parseTurnAudit(body: unknown, offset = 0): TurnAuditPage {
44
  const page = object(body);
45
+ const rows = page.lines ?? page.turns ?? page.rows;
46
  if (!Array.isArray(rows)) throw new Error("Invalid turn audit page.");
47
  const turns = rows.map((value): TurnAuditRow => {
48
  const row = object(value);
 
55
  ts,
56
  user: text(row.user),
57
  door: text(row.door),
58
+ model: row.model === null ? null : text(row.model),
59
+ tokensIn: row.tokensIn === null ? null : number(row.tokensIn),
60
+ tokensOut: row.tokensOut === null ? null : number(row.tokensOut),
61
  cost: row.cost === null ? null : number(row.cost),
62
  tools: row.tools as string[],
63
  durationMs: number(row.durationMs),
web/src/automation/AutomationFind.tsx CHANGED
@@ -823,7 +823,7 @@ export default function AutomationFind({
823
  deployment cannot read its own balance, so presenting this as a billed figure
824
  would be inventing a measurement.
825
  */}
826
- <strong>This is an estimate</strong> β€” {estimate.note}.
827
  </p>
828
  ) : null}
829
 
 
823
  deployment cannot read its own balance, so presenting this as a billed figure
824
  would be inventing a measurement.
825
  */}
826
+ <strong>This is an estimate.</strong> {estimate.note}.
827
  </p>
828
  ) : null}
829
 
web/src/customer-grid/CustomerGrid.tsx CHANGED
@@ -4532,8 +4532,10 @@ function CustomerGridSurface({
4532
  // ⭐⭐ D-229 β€” `fieldByKey` rides this context so a condition naming a column this table no
4533
  // longer has is COUNTED. `evalNode` ignores such a leaf (correctly), which means the grid was
4534
  // showing MORE rows than the filter panel claimed with nothing on screen saying so.
4535
- () => unresolvedConditions(config.filters, { cohortSets, viewSets, fieldByKey, today }),
4536
- [config.filters, cohortSets, viewSets, fieldByKey, today]
 
 
4537
  );
4538
 
4539
  // Wave-2 item 2c β€” COHORT MODE (the Cohort page). The host serves the WHOLE pool (rows +
 
4532
  // ⭐⭐ D-229 β€” `fieldByKey` rides this context so a condition naming a column this table no
4533
  // longer has is COUNTED. `evalNode` ignores such a leaf (correctly), which means the grid was
4534
  // showing MORE rows than the filter panel claimed with nothing on screen saying so.
4535
+ () => unresolvedConditions(cellView && embeddedIds !== undefined
4536
+ ? withoutAppliedLeaves(config.filters) : config.filters,
4537
+ { cohortSets, viewSets, fieldByKey, today }),
4538
+ [config.filters, cohortSets, viewSets, fieldByKey, today, cellView, embeddedIds]
4539
  );
4540
 
4541
  // Wave-2 item 2c β€” COHORT MODE (the Cohort page). The host serves the WHOLE pool (rows +
web/src/customer-grid/FormInterface.tsx CHANGED
@@ -258,7 +258,7 @@ export function FormInterface({
258
  <p className="cg-form-warn">
259
  The server holds {link.stored?.fields} question
260
  {link.stored?.fields === 1 ? "" : "s"} for this view that this page is not carrying.
261
- Reload before editing β€” saving now would replace them.
262
  </p>
263
  )}
264
  {/* ⚠ The banner above needs a STORED spec to compare against, so it can only speak once a
 
258
  <p className="cg-form-warn">
259
  The server holds {link.stored?.fields} question
260
  {link.stored?.fields === 1 ? "" : "s"} for this view that this page is not carrying.
261
+ Reload before editing. Saving now would replace them.
262
  </p>
263
  )}
264
  {/* ⚠ The banner above needs a STORED spec to compare against, so it can only speak once a
web/src/filter-kit/SheetFilterPopup.tsx CHANGED
@@ -109,15 +109,17 @@ const MAX_SPOKEN_LEAVES = 3;
109
  /** One leaf, in the builder's own words. `fields` is a map so a nested walk stays linear. */
110
  function ruleSentence(rule: FilterRule, byKey: Map<string, Field>): string {
111
  const field = byKey.get(rule.colId);
112
- const name = field?.label || rule.colId;
113
  // A column whose type is no longer known reads as text, which is what `opsForType` offers a
114
  // missing column too: the op still has a label, so the rule still has a sentence.
115
  const phrase = opLabel(rule.op as FilterOp, field?.type ?? "text");
116
  const listed = rule.values?.length ? rule.values.join(", ") : "";
117
- const single = typeof rule.value === "string" ? rule.value.trim() : "";
 
118
  const operand = listed || single;
119
  // `value2` is the far end of a `between`, and the builder reads it as a pair.
120
- const both = rule.value2 ? `${operand} and ${String(rule.value2).trim()}` : operand;
 
121
  return both ? `${name} ${phrase} ${both}` : `${name} ${phrase}`;
122
  }
123
 
@@ -125,7 +127,7 @@ function ruleSentence(rule: FilterRule, byKey: Map<string, Field>): string {
125
  function nodeIsActive(node: FilterNode): boolean {
126
  return isFilterGroup(node)
127
  ? node.children.some(nodeIsActive)
128
- : isRuleActive(node as FilterRule);
129
  }
130
 
131
  function nodesSentence(nodes: FilterNode[], conj: Conjunction, byKey: Map<string, Field>): string {
 
109
  /** One leaf, in the builder's own words. `fields` is a map so a nested walk stays linear. */
110
  function ruleSentence(rule: FilterRule, byKey: Map<string, Field>): string {
111
  const field = byKey.get(rule.colId);
112
+ const name = field?.label || "Unavailable field";
113
  // A column whose type is no longer known reads as text, which is what `opsForType` offers a
114
  // missing column too: the op still has a label, so the rule still has a sentence.
115
  const phrase = opLabel(rule.op as FilterOp, field?.type ?? "text");
116
  const listed = rule.values?.length ? rule.values.join(", ") : "";
117
+ const single = rule.valueRef?.ref ? `cell ${rule.valueRef.ref}`
118
+ : typeof rule.value === "string" ? rule.value.trim() : "";
119
  const operand = listed || single;
120
  // `value2` is the far end of a `between`, and the builder reads it as a pair.
121
+ const upper = rule.value2Ref?.ref ? `cell ${rule.value2Ref.ref}` : String(rule.value2 ?? "").trim();
122
+ const both = upper ? `${operand} and ${upper}` : operand;
123
  return both ? `${name} ${phrase} ${both}` : `${name} ${phrase}`;
124
  }
125
 
 
127
  function nodeIsActive(node: FilterNode): boolean {
128
  return isFilterGroup(node)
129
  ? node.children.some(nodeIsActive)
130
+ : Boolean((node as FilterRule).valueRef?.ref) || isRuleActive(node as FilterRule);
131
  }
132
 
133
  function nodesSentence(nodes: FilterNode[], conj: Conjunction, byKey: Map<string, Field>): string {
web/src/sheet/DrillModal.tsx CHANGED
@@ -54,6 +54,7 @@
54
  // stylesheet is guaranteed present. Same file, opposite verdict, for one reason: WHEN it paints.
55
 
56
  import { Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState } from "react";
 
57
  import { fetchWorkspace } from "../customer-grid/apiBridge";
58
  import { dropAppliedFilterLimits } from "../customer-grid/drillLimits";
59
  import type { SurfaceScope } from "../customer-grid/apiBridge";
@@ -539,6 +540,24 @@ function DrillModal(
539
  const shownTreeRef = useRef<FilterTree | null>(shownTree);
540
  shownTreeRef.current = shownTree;
541
  const shownTreeKey = JSON.stringify(shownTree);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
542
  useEffect(() => {
543
  setCellFilterDraft((draft) => draft?.base === shownTreeKey ? draft : null);
544
  }, [shownTreeKey]);
@@ -805,7 +824,9 @@ function DrillModal(
805
  * at most three live leaves and stops, so a memo keyed on a `shown` the page rebuilds every
806
  * render would recompute exactly as often while costing an extra comparison.
807
  */
808
- const said = shown?.kind === "filter" ? filterSentence(shown.tree, fields) : "";
 
 
809
  const bandText = !shown
810
  ? ""
811
  : shown.kind === "view"
 
54
  // stylesheet is guaranteed present. Same file, opposite verdict, for one reason: WHEN it paints.
55
 
56
  import { Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState } from "react";
57
+ import { API_V1, CREDENTIALS } from "../apiContract";
58
  import { fetchWorkspace } from "../customer-grid/apiBridge";
59
  import { dropAppliedFilterLimits } from "../customer-grid/drillLimits";
60
  import type { SurfaceScope } from "../customer-grid/apiBridge";
 
540
  const shownTreeRef = useRef<FilterTree | null>(shownTree);
541
  shownTreeRef.current = shownTree;
542
  const shownTreeKey = JSON.stringify(shownTree);
543
+ const [relatedLabels, setRelatedLabels] = useState<{ database: string; fields: Field[] } | null>(null);
544
+ const relatedDatabase = shownTreeKey.includes('"related:') ? drill?.database : undefined;
545
+ useEffect(() => {
546
+ if (!relatedDatabase) return;
547
+ const controller = new AbortController();
548
+ void fetch(`${API_V1}/sheets/filter-fields/${encodeURIComponent(relatedDatabase)}`, {
549
+ credentials: CREDENTIALS, signal: controller.signal,
550
+ }).then(async response => {
551
+ if (!response.ok) return;
552
+ const body = await response.json();
553
+ if (!controller.signal.aborted && Array.isArray(body?.fields)) {
554
+ const labels = body.fields.flatMap((field: Field & { related?: { legacyKeys?: string[] } }) =>
555
+ [field, ...(field.related?.legacyKeys ?? []).map(key => ({ ...field, key }))]);
556
+ setRelatedLabels({ database: relatedDatabase, fields: labels });
557
+ }
558
+ }).catch(() => { /* The footer keeps its unnamed-field fallback if metadata is unavailable. */ });
559
+ return () => controller.abort();
560
+ }, [relatedDatabase]);
561
  useEffect(() => {
562
  setCellFilterDraft((draft) => draft?.base === shownTreeKey ? draft : null);
563
  }, [shownTreeKey]);
 
824
  * at most three live leaves and stops, so a memo keyed on a `shown` the page rebuilds every
825
  * render would recompute exactly as often while costing an extra comparison.
826
  */
827
+ const sentenceFields = relatedLabels && relatedLabels.database === drill?.database
828
+ ? [...fields, ...relatedLabels.fields] : fields;
829
+ const said = shown?.kind === "filter" ? filterSentence(shown.tree, sentenceFields) : "";
830
  const bandText = !shown
831
  ? ""
832
  : shown.kind === "view"