дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-21 09:00:49 +02:00
Порівняти коміти
2
Коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
18bdd908ca | ||
|
|
a4ee6110e8 |
No files matched your search
@@ -94,3 +94,30 @@ test("a second click on a Git Log toolbar button closes its popup", async ({ wor
|
||||
await expect(row).toBeHidden();
|
||||
}
|
||||
});
|
||||
|
||||
test("Git Log keeps filters and actions inside the commit pane at the minimum window width", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 400, height: 500 });
|
||||
const toolbar = page.getByRole("toolbar", { name: "Log filters" });
|
||||
const clippedButtons = () =>
|
||||
toolbar.evaluate((el) => {
|
||||
const bar = el.getBoundingClientRect();
|
||||
return Array.from(el.querySelectorAll("button"))
|
||||
.filter((button) => {
|
||||
if (getComputedStyle(button).visibility === "hidden") return false;
|
||||
const box = button.getBoundingClientRect();
|
||||
return box.width > 0 && (box.right > bar.right + 1 || box.bottom > bar.bottom + 1);
|
||||
})
|
||||
.map((button) => button.getAttribute("aria-label"));
|
||||
});
|
||||
await expect.poll(clippedButtons).toEqual([]);
|
||||
const search = toolbar.getByRole("textbox", { name: "Filter by message" });
|
||||
await expect(search).toBeVisible();
|
||||
expect((await search.boundingBox())!.width).toBeGreaterThan(12);
|
||||
await toolbar.getByRole("button", { name: "View Options" }).click();
|
||||
await expect(page.getByRole("menuitemcheckbox", { name: "Tag Names" })).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
await toolbar.getByRole("button", { name: "More Filters" }).click();
|
||||
await expect(page.getByRole("menuitem", { name: "Paths" })).toBeVisible();
|
||||
});
|
||||
@@ -14,6 +14,7 @@
|
||||
min-height: 0;
|
||||
}
|
||||
.log {
|
||||
container: git-log / inline-size;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
@@ -75,14 +76,32 @@
|
||||
|
||||
/* filters */
|
||||
.filters {
|
||||
gap: var(--space-1);
|
||||
padding: 0 8px 0 6px;
|
||||
height: auto;
|
||||
min-height: 32px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
gap: var(--space-0-5) var(--space-1);
|
||||
padding: var(--space-0-5) 8px var(--space-0-5) 6px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.filterControls,
|
||||
.filterActions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
.filterControls {
|
||||
flex: 1 1 260px;
|
||||
min-width: 0;
|
||||
}
|
||||
.filterActions {
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
max-width: 100%;
|
||||
}
|
||||
.textFilter {
|
||||
flex: 0 1 260px;
|
||||
min-width: 100px;
|
||||
min-width: min(100px, 60%);
|
||||
}
|
||||
.filterGroup {
|
||||
position: relative;
|
||||
@@ -96,6 +115,20 @@
|
||||
.filterHidden {
|
||||
visibility: hidden;
|
||||
}
|
||||
@container git-log (max-width: 320px) {
|
||||
.filterControls,
|
||||
.filterActions {
|
||||
display: contents;
|
||||
}
|
||||
.textFilter {
|
||||
flex: 1 0 100%;
|
||||
}
|
||||
/* Keep the filters measurable for the overflow menu. */
|
||||
.filterGroup {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
}
|
||||
}
|
||||
.filterButton {
|
||||
flex: none;
|
||||
height: 24px;
|
||||
|
||||
@@ -293,55 +293,57 @@ export function FilterBar() {
|
||||
|
||||
return (
|
||||
<div className={styles.filters} role="toolbar" aria-label={tx("Log filters")}>
|
||||
{!showBranches && (
|
||||
<IconButton icon="chevron-right" title="Show Branches" size="small" action="vcs.log.showBranches" />
|
||||
)}
|
||||
<SearchField
|
||||
className={styles.textFilter}
|
||||
value={text}
|
||||
onChange={setText}
|
||||
placeholder="Text or hash"
|
||||
aria-label="Filter by message"
|
||||
toggles={[
|
||||
{
|
||||
id: "regex",
|
||||
icon: "regex",
|
||||
title: "Regex",
|
||||
pressed: filters.regex,
|
||||
onToggle: (regex) => setLogFilters({ regex }),
|
||||
},
|
||||
{
|
||||
id: "case",
|
||||
icon: "case",
|
||||
title: "Match Case",
|
||||
pressed: filters.matchCase,
|
||||
onToggle: (matchCase) => setLogFilters({ matchCase }),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<span ref={groupRef} className={styles.filterGroup}>
|
||||
{logFilters.map((f, i) => (
|
||||
<FilterButton key={f.label} {...f} hidden={i >= hiddenFrom} />
|
||||
))}
|
||||
</span>
|
||||
{hiddenFrom < logFilters.length && (
|
||||
<IconButton
|
||||
icon="chevron-right"
|
||||
title="More Filters"
|
||||
size="small"
|
||||
aria-haspopup="menu"
|
||||
onClick={(e) => {
|
||||
const anchor = e.currentTarget;
|
||||
menuBelow(
|
||||
anchor,
|
||||
logFilters.slice(hiddenFrom).map((f) => ({
|
||||
label: f.value ? `${tx(f.label)}: ${f.value}` : f.label,
|
||||
run: () => f.onOpen(anchor),
|
||||
})),
|
||||
);
|
||||
}}
|
||||
<div className={styles.filterControls}>
|
||||
{!showBranches && (
|
||||
<IconButton icon="chevron-right" title="Show Branches" size="small" action="vcs.log.showBranches" />
|
||||
)}
|
||||
<SearchField
|
||||
className={styles.textFilter}
|
||||
value={text}
|
||||
onChange={setText}
|
||||
placeholder="Text or hash"
|
||||
aria-label="Filter by message"
|
||||
toggles={[
|
||||
{
|
||||
id: "regex",
|
||||
icon: "regex",
|
||||
title: "Regex",
|
||||
pressed: filters.regex,
|
||||
onToggle: (regex) => setLogFilters({ regex }),
|
||||
},
|
||||
{
|
||||
id: "case",
|
||||
icon: "case",
|
||||
title: "Match Case",
|
||||
pressed: filters.matchCase,
|
||||
onToggle: (matchCase) => setLogFilters({ matchCase }),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
<span ref={groupRef} className={styles.filterGroup}>
|
||||
{logFilters.map((f, i) => (
|
||||
<FilterButton key={f.label} {...f} hidden={i >= hiddenFrom} />
|
||||
))}
|
||||
</span>
|
||||
{hiddenFrom < logFilters.length && (
|
||||
<IconButton
|
||||
icon="chevron-right"
|
||||
title="More Filters"
|
||||
size="small"
|
||||
aria-haspopup="menu"
|
||||
onClick={(e) => {
|
||||
const anchor = e.currentTarget;
|
||||
menuBelow(
|
||||
anchor,
|
||||
logFilters.slice(hiddenFrom).map((f) => ({
|
||||
label: f.value ? `${tx(f.label)}: ${f.value}` : f.label,
|
||||
run: () => f.onOpen(anchor),
|
||||
})),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{dropdown}
|
||||
{branchAnchor && (
|
||||
<BranchFilterPopup
|
||||
@@ -356,88 +358,89 @@ export function FilterBar() {
|
||||
onSelectMany={() => void selectBranches()}
|
||||
/>
|
||||
)}
|
||||
<span className={styles.grow} />
|
||||
<IconButton
|
||||
icon="bookmark"
|
||||
title="Bookmarked Commits"
|
||||
size="small"
|
||||
disabled={!Object.keys(bookmarks).length}
|
||||
onClick={(e) =>
|
||||
menuBelow(
|
||||
e,
|
||||
Object.entries(bookmarks).map(([key, summary]) => ({
|
||||
label: summary,
|
||||
run: () => {
|
||||
const split = key.lastIndexOf("\0");
|
||||
void goToRef(key.slice(split + 1), split >= 0 ? key.slice(0, split) : undefined);
|
||||
<div className={styles.filterActions}>
|
||||
<IconButton
|
||||
icon="bookmark"
|
||||
title="Bookmarked Commits"
|
||||
size="small"
|
||||
disabled={!Object.keys(bookmarks).length}
|
||||
onClick={(e) =>
|
||||
menuBelow(
|
||||
e,
|
||||
Object.entries(bookmarks).map(([key, summary]) => ({
|
||||
label: summary,
|
||||
run: () => {
|
||||
const split = key.lastIndexOf("\0");
|
||||
void goToRef(key.slice(split + 1), split >= 0 ? key.slice(0, split) : undefined);
|
||||
},
|
||||
})),
|
||||
)
|
||||
}
|
||||
/>
|
||||
<IconButton
|
||||
icon="plus"
|
||||
title="Open Another Log Tab"
|
||||
size="small"
|
||||
onClick={(e) =>
|
||||
menuBelow(e, [
|
||||
{
|
||||
label: "In Tool Window",
|
||||
run: () => {
|
||||
openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`);
|
||||
},
|
||||
},
|
||||
})),
|
||||
)
|
||||
}
|
||||
/>
|
||||
<IconButton
|
||||
icon="plus"
|
||||
title="Open Another Log Tab"
|
||||
size="small"
|
||||
onClick={(e) =>
|
||||
menuBelow(e, [
|
||||
{
|
||||
label: "In Tool Window",
|
||||
run: () => {
|
||||
openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`);
|
||||
{
|
||||
label: "In Editor",
|
||||
run: () => {
|
||||
openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`, "editor");
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "In Editor",
|
||||
run: () => {
|
||||
openLogTab("log", `Log ${useGitLog.getState().logTabs.length + 1}`, "editor");
|
||||
},
|
||||
},
|
||||
{ label: "External Repository…", run: openExternalLog },
|
||||
])
|
||||
}
|
||||
/>
|
||||
<IconButton
|
||||
icon="clock"
|
||||
title="Recent Filters"
|
||||
size="small"
|
||||
onClick={(e) =>
|
||||
menuBelow(
|
||||
e,
|
||||
recentLogFilters().map((filters) => ({
|
||||
label:
|
||||
[
|
||||
filters.range,
|
||||
filters.branches.join(", "),
|
||||
filters.authors.join(", "),
|
||||
filters.text,
|
||||
filters.path,
|
||||
filters.paths?.join(", "),
|
||||
filters.date?.label,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" · ") || tx("All commits"),
|
||||
run: () => setLogFilters(filters),
|
||||
})),
|
||||
)
|
||||
}
|
||||
/>
|
||||
<IconButton icon="refresh" title="Refresh" size="small" onClick={() => void reloadLog({ preserve: true })} />
|
||||
<IconButton
|
||||
icon="sort"
|
||||
title="Graph Options"
|
||||
size="small"
|
||||
aria-haspopup="menu"
|
||||
onClick={(e) => menuBelow(e, graphOptionsMenu(useLogOptions.getState()))}
|
||||
/>
|
||||
<IconButton
|
||||
icon="eye"
|
||||
title="View Options"
|
||||
size="small"
|
||||
aria-haspopup="menu"
|
||||
onClick={(e) => menuBelow(e, viewOptionsMenu(useLogOptions.getState()))}
|
||||
/>
|
||||
<IconButton icon="search" title="Go to Hash/Branch/Tag" size="small" action="vcs.log.goToRef" />
|
||||
{ label: "External Repository…", run: openExternalLog },
|
||||
])
|
||||
}
|
||||
/>
|
||||
<IconButton
|
||||
icon="clock"
|
||||
title="Recent Filters"
|
||||
size="small"
|
||||
onClick={(e) =>
|
||||
menuBelow(
|
||||
e,
|
||||
recentLogFilters().map((filters) => ({
|
||||
label:
|
||||
[
|
||||
filters.range,
|
||||
filters.branches.join(", "),
|
||||
filters.authors.join(", "),
|
||||
filters.text,
|
||||
filters.path,
|
||||
filters.paths?.join(", "),
|
||||
filters.date?.label,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" · ") || tx("All commits"),
|
||||
run: () => setLogFilters(filters),
|
||||
})),
|
||||
)
|
||||
}
|
||||
/>
|
||||
<IconButton icon="refresh" title="Refresh" size="small" onClick={() => void reloadLog({ preserve: true })} />
|
||||
<IconButton
|
||||
icon="sort"
|
||||
title="Graph Options"
|
||||
size="small"
|
||||
aria-haspopup="menu"
|
||||
onClick={(e) => menuBelow(e, graphOptionsMenu(useLogOptions.getState()))}
|
||||
/>
|
||||
<IconButton
|
||||
icon="eye"
|
||||
title="View Options"
|
||||
size="small"
|
||||
aria-haspopup="menu"
|
||||
onClick={(e) => menuBelow(e, viewOptionsMenu(useLogOptions.getState()))}
|
||||
/>
|
||||
<IconButton icon="search" title="Go to Hash/Branch/Tag" size="small" action="vcs.log.goToRef" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Заблокувати користувача