diff --git a/ui/src/ui/views/config-form.node.ts b/ui/src/ui/views/config-form.node.ts
index f57fb834e1..cd567d5e66 100644
--- a/ui/src/ui/views/config-form.node.ts
+++ b/ui/src/ui/views/config-form.node.ts
@@ -500,35 +500,39 @@ function renderObject(params: {
const additional = schema.additionalProperties;
const allowExtra = Boolean(additional) && typeof additional === "object";
+ const fields = html`
+ ${sorted.map(([propKey, node]) =>
+ renderNode({
+ schema: node,
+ value: obj[propKey],
+ path: [...path, propKey],
+ hints,
+ unsupported,
+ disabled,
+ onPatch,
+ }),
+ )}
+ ${
+ allowExtra
+ ? renderMapField({
+ schema: additional,
+ value: obj,
+ path,
+ hints,
+ unsupported,
+ disabled,
+ reservedKeys: reserved,
+ onPatch,
+ })
+ : nothing
+ }
+ `;
+
// For top-level, don't wrap in collapsible
if (path.length === 1) {
return html`
- ${sorted.map(([propKey, node]) =>
- renderNode({
- schema: node,
- value: obj[propKey],
- path: [...path, propKey],
- hints,
- unsupported,
- disabled,
- onPatch,
- }),
- )}
- ${
- allowExtra
- ? renderMapField({
- schema: additional,
- value: obj,
- path,
- hints,
- unsupported,
- disabled,
- reservedKeys: reserved,
- onPatch,
- })
- : nothing
- }
+ ${fields}
`;
}
@@ -542,31 +546,7 @@ function renderObject(params: {
${help ? html`${help}
` : nothing}
- ${sorted.map(([propKey, node]) =>
- renderNode({
- schema: node,
- value: obj[propKey],
- path: [...path, propKey],
- hints,
- unsupported,
- disabled,
- onPatch,
- }),
- )}
- ${
- allowExtra
- ? renderMapField({
- schema: additional,
- value: obj,
- path,
- hints,
- unsupported,
- disabled,
- reservedKeys: reserved,
- onPatch,
- })
- : nothing
- }
+ ${fields}
`;
diff --git a/ui/src/ui/views/usage-render-overview.ts b/ui/src/ui/views/usage-render-overview.ts
index 8a65216e7b..41ed841349 100644
--- a/ui/src/ui/views/usage-render-overview.ts
+++ b/ui/src/ui/views/usage-render-overview.ts
@@ -649,6 +649,38 @@ function renderSessionsCard(
0,
);
+ const renderSessionBarRow = (s: UsageSessionEntry, isSelected: boolean) => {
+ const value = getSessionValue(s);
+ const displayLabel = formatSessionListLabel(s);
+ const meta = buildSessionMeta(s);
+ return html`
+ onSelectSession(s.key, e.shiftKey)}
+ title="${s.key}"
+ >
+
+
${displayLabel}
+ ${meta.length > 0 ? html`
${meta.join(" · ")}
` : nothing}
+
+
+
+
+
${isTokenMode ? formatTokens(value) : formatCost(value)}
+
+
+ `;
+ };
+
const selectedSet = new Set(selectedSessions);
const selectedEntries = sortedWithDir.filter((s) => selectedSet.has(s.key));
const selectedCount = selectedEntries.length;
@@ -720,83 +752,22 @@ function renderSessionsCard(
No recent sessions
`
: html`
-
- ${recentEntries.map((s) => {
- const value = getSessionValue(s);
- const isSelected = selectedSet.has(s.key);
- const displayLabel = formatSessionListLabel(s);
- const meta = buildSessionMeta(s);
- return html`
-
onSelectSession(s.key, e.shiftKey)}
- title="${s.key}"
- >
-
-
${displayLabel}
- ${meta.length > 0 ? html`
${meta.join(" · ")}
` : nothing}
-
-
-
-
-
${isTokenMode ? formatTokens(value) : formatCost(value)}
-
-
- `;
- })}
-
- `
+
+ ${recentEntries.map((s) => renderSessionBarRow(s, selectedSet.has(s.key)))}
+
+ `
: sessions.length === 0
? html`
No sessions in range
`
: html`
-
- ${sortedWithDir.slice(0, 50).map((s) => {
- const value = getSessionValue(s);
- const isSelected = selectedSessions.includes(s.key);
- const displayLabel = formatSessionListLabel(s);
- const meta = buildSessionMeta(s);
-
- return html`
-
onSelectSession(s.key, e.shiftKey)}
- title="${s.key}"
- >
-
-
${displayLabel}
- ${meta.length > 0 ? html`
${meta.join(" · ")}
` : nothing}
-
-
-
-
-
${isTokenMode ? formatTokens(value) : formatCost(value)}
-
-
- `;
- })}
- ${sessions.length > 50 ? html`
+${sessions.length - 50} more
` : nothing}
-
- `
+
+ ${sortedWithDir
+ .slice(0, 50)
+ .map((s) => renderSessionBarRow(s, selectedSet.has(s.key)))}
+ ${sessions.length > 50 ? html`
+${sessions.length - 50} more
` : nothing}
+
+ `
}
${
selectedCount > 1
@@ -804,37 +775,7 @@ function renderSessionsCard(
Selected (${selectedCount})
- ${selectedEntries.map((s) => {
- const value = getSessionValue(s);
- const displayLabel = formatSessionListLabel(s);
- const meta = buildSessionMeta(s);
- return html`
-
onSelectSession(s.key, e.shiftKey)}
- title="${s.key}"
- >
-
-
${displayLabel}
- ${meta.length > 0 ? html`
${meta.join(" · ")}
` : nothing}
-
-
-
-
-
${isTokenMode ? formatTokens(value) : formatCost(value)}
-
-
- `;
- })}
+ ${selectedEntries.map((s) => renderSessionBarRow(s, true))}
`