mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-27 08:03:37 +00:00
fix(agents): show the changes scope as compact tool window tabs (#5393)
The Whole Task / Last Turn switch in the agent Changes pane was a full-width segmented pill. It now uses the compact Tabs strip that tool window sub-views use elsewhere.
This commit is contained in:
@@ -1274,7 +1274,7 @@
|
||||
}
|
||||
.changesScope {
|
||||
flex: none;
|
||||
padding: 6px 10px 2px;
|
||||
padding: 0 4px;
|
||||
}
|
||||
.changesSummary {
|
||||
flex: none;
|
||||
|
||||
@@ -4,14 +4,13 @@ import { repositoryPath } from "@/features/vcs/repositoryPaths";
|
||||
import { tx } from "@/platform/i18n";
|
||||
import { call, commands, onIdeEvent } from "@/platform/ipc";
|
||||
import { basename, dirname, relativeDir } from "@/platform/project";
|
||||
import { fileIconName, Icon, IconButton, showContextMenu, Spinner, T, Tree } from "@/ui";
|
||||
import { fileIconName, Icon, IconButton, showContextMenu, Spinner, T, Tabs, Tree } from "@/ui";
|
||||
import { notifications } from "@/workbench/contributions";
|
||||
import { confirm } from "@/workbench/messages";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { ChangesResizer } from "../ChangesResizer";
|
||||
import styles from "../Session.module.css";
|
||||
import { setChangesOptions, type ChangesScope } from "../changesOptions";
|
||||
import { SegmentedControl } from "../ConfigPickers";
|
||||
import { formatSentAt } from "../conversation";
|
||||
import { branchLabel } from "../model";
|
||||
import { acceptChanges, refreshChanges, rollbackChanges, useAgents } from "../store";
|
||||
@@ -386,20 +385,21 @@ export function ChangesPane({
|
||||
)}
|
||||
{!docked && <IconButton icon="chevron-right" title={tx("Hide changes")} size="small" onClick={onHide} />}
|
||||
</div>
|
||||
<div className={styles.changesScope}>
|
||||
<SegmentedControl
|
||||
ariaLabel={tx("Changes to show")}
|
||||
options={[
|
||||
{ value: "task", label: tx("Whole Task") },
|
||||
{ value: "turn", label: tx("Last Turn") },
|
||||
]}
|
||||
value={scope}
|
||||
onChange={(value) => {
|
||||
setChangesOptions({ scope: value === "turn" ? "turn" : "task" });
|
||||
void refreshChanges(task.id);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Tabs
|
||||
variant="compact"
|
||||
className={styles.changesScope}
|
||||
aria-label="Changes to show"
|
||||
activeId={scope}
|
||||
onSelect={(id) => {
|
||||
if (id === scope) return;
|
||||
setChangesOptions({ scope: id === "turn" ? "turn" : "task" });
|
||||
void refreshChanges(task.id);
|
||||
}}
|
||||
items={[
|
||||
{ id: "task", label: "Whole Task" },
|
||||
{ id: "turn", label: "Last Turn" },
|
||||
]}
|
||||
/>
|
||||
{(scope === "turn" || grouped || head || task.base) && (
|
||||
<div className={styles.changesSummary}>
|
||||
{scope === "turn" ? (
|
||||
|
||||
@@ -3046,7 +3046,7 @@ describe("last turn changes", () => {
|
||||
const pane = await screen.findByRole("complementary", { name: "Changes" });
|
||||
expect(await within(pane).findByText("a.ts")).toBeInTheDocument();
|
||||
|
||||
fireEvent.click(within(pane).getByRole("radio", { name: "Last Turn" }));
|
||||
fireEvent.click(within(pane).getByRole("tab", { name: "Last Turn" }));
|
||||
await waitFor(() => expect(within(pane).queryByText("a.ts")).toBeNull());
|
||||
expect(within(pane).getByText("b.ts")).toBeInTheDocument();
|
||||
expect(within(pane).getByText("Since the last turn started")).toBeInTheDocument();
|
||||
@@ -3059,7 +3059,7 @@ describe("last turn changes", () => {
|
||||
backend.turnChanges = [];
|
||||
fireEvent.click(within(pane).getByRole("button", { name: "Refresh" }));
|
||||
expect(await within(pane).findByText("The last turn changed no files")).toBeInTheDocument();
|
||||
fireEvent.click(within(pane).getByRole("radio", { name: "Whole Task" }));
|
||||
fireEvent.click(within(pane).getByRole("tab", { name: "Whole Task" }));
|
||||
expect(await within(pane).findByText("a.ts")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user