Skip to content

Commit 466aff4

Browse files
committed
fix(webapp): drag-drop index, length-key sample path, live-poll payload, formatting
- Insert a downward-dragged column before the hovered row (adjust the target index after removal) so it lands where the drop indicator showed. - Emit bracket notation for a sample key named 'length' so the column reads that property instead of a computed count. - Stop re-selecting the immutable payload on the 3s live poll; only metadata/output can change while a run is in flight, and the merge preserves the existing payload. - Apply oxfmt formatting.
1 parent dfe36b4 commit 466aff4

6 files changed

Lines changed: 24 additions & 24 deletions

File tree

apps/webapp/app/components/runs/v3/RunsDisplayOptions.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export function RunsDisplayOptions() {
105105
const to = arr.findIndex((o) => keyFor(o.col) === toKey);
106106
if (from < 0 || to < 0) return;
107107
const [moved] = arr.splice(from, 1);
108-
arr.splice(to, 0, moved);
108+
arr.splice(from < to ? to - 1 : to, 0, moved);
109109
applyLayout(arr);
110110
};
111111

@@ -260,9 +260,7 @@ function ColumnRow({
260260
{isOver && <div className="absolute inset-x-0 top-0 h-0.5 bg-blue-500" />}
261261
{locked ? <Checkbox checked disabled /> : <Checkbox checked={checked} onChange={onToggle} />}
262262
<span className="flex min-w-0 flex-1 items-center gap-1.5">
263-
<span
264-
className={cn("truncate text-sm", checked ? "text-text-bright" : "text-text-dimmed")}
265-
>
263+
<span className={cn("truncate text-sm", checked ? "text-text-bright" : "text-text-dimmed")}>
266264
{col.def.label}
267265
</span>
268266
{isSmart && <BoltIcon className="size-3.5 flex-none text-text-dimmed" />}

apps/webapp/app/components/runs/v3/SmartColumnSample.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function SmartColumnSample({
3434

3535
function childPath(parentPath: string, key: string | number): string {
3636
if (typeof key === "number") return `${parentPath}[${key}]`;
37-
if (/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key)) return `${parentPath}.${key}`;
37+
if (key !== "length" && /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key)) return `${parentPath}.${key}`;
3838
return `${parentPath}['${key.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}']`;
3939
}
4040

apps/webapp/app/components/runs/v3/smartColumnData.test.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import superjson from "superjson";
22
import { describe, expect, it } from "vitest";
3-
import {
4-
extractSmartValue,
5-
getAtPath,
6-
labelFromPath,
7-
parseSource,
8-
} from "./smartColumnData";
3+
import { extractSmartValue, getAtPath, labelFromPath, parseSource } from "./smartColumnData";
94

105
describe("parseSource", () => {
116
it("reports empty for missing data", () => {

apps/webapp/app/components/runs/v3/smartColumnData.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ export function getAtPath(root: unknown, path: string): unknown {
9595

9696
if (match[1] !== undefined) tokens.push({ kind: "dot", key: match[1] });
9797
else if (match[2] !== undefined) tokens.push({ kind: "index", index: Number(match[2]) });
98-
else if (match[3] !== undefined) tokens.push({ kind: "key", key: unescapeBracketKey(match[3]) });
99-
else if (match[4] !== undefined) tokens.push({ kind: "key", key: unescapeBracketKey(match[4]) });
98+
else if (match[3] !== undefined)
99+
tokens.push({ kind: "key", key: unescapeBracketKey(match[3]) });
100+
else if (match[4] !== undefined)
101+
tokens.push({ kind: "key", key: unescapeBracketKey(match[4]) });
100102
}
101103
if (lastIndex !== normalized.length) return undefined;
102104

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.live.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
4848
projectId: project.id,
4949
environmentId: environment.id,
5050
runId: runIds,
51-
runSelect: deriveRunSelect(columns.visibleStandardIds, columns.smartSources),
51+
runSelect: deriveRunSelect(
52+
columns.visibleStandardIds,
53+
columns.smartSources.filter((source) => source !== "payload")
54+
),
5255
page: { size: 100 },
5356
})
5457
.then(({ runs: listedRuns }) => listedRuns.map(mapRunToLiveFields))

apps/webapp/app/services/runsRepository/clickhouseRunsRepository.server.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -308,18 +308,20 @@ export class ClickHouseRunsRepository implements IRunsRepository {
308308
? { ...options.runSelect, id: true }
309309
: LIST_RUN_DEFAULT_SELECT;
310310

311-
let runs = await this.#hydrateRunsByIds<ListedRun>(runIds, (client, ids) =>
312-
store.findRuns(
313-
{
314-
where: {
315-
id: {
316-
in: boundedIn(ids),
311+
let runs = await this.#hydrateRunsByIds<ListedRun>(
312+
runIds,
313+
(client, ids) =>
314+
store.findRuns(
315+
{
316+
where: {
317+
id: {
318+
in: boundedIn(ids),
319+
},
317320
},
321+
select,
318322
},
319-
select,
320-
},
321-
client
322-
) as Promise<ListedRun[]>
323+
client
324+
) as Promise<ListedRun[]>
323325
);
324326

325327
// ClickHouse is slightly delayed, so we're going to do in-memory status filtering too

0 commit comments

Comments
 (0)