Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/routes_sheet.py +3 -1
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
- web/src/account/TurnAuditTable.tsx +3 -3
- web/src/account/turnAuditApi.ts +7 -7
- web/src/automation/AutomationFind.tsx +1 -1
- web/src/customer-grid/CustomerGrid.tsx +4 -2
- web/src/customer-grid/FormInterface.tsx +1 -1
- web/src/filter-kit/SheetFilterPopup.tsx +6 -4
- web/src/sheet/DrillModal.tsx +22 -1
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "767305c0",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 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 |
-
|
|
|
|
|
|
|
| 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 |
-
|
|
|
|
| 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>
|
| 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(
|
| 4536 |
-
|
|
|
|
|
|
|
| 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
|
| 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 ||
|
| 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 =
|
|
|
|
| 118 |
const operand = listed || single;
|
| 119 |
// `value2` is the far end of a `between`, and the builder reads it as a pair.
|
| 120 |
-
const
|
|
|
|
| 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
|
|
|
|
|
|
|
| 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"
|