дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-22 09:30:46 +02:00
Порівняти коміти
3
Коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
f78a374520 | ||
|
|
a1b7572c62 | ||
|
|
9dffb50323 |
No files matched your search
@@ -0,0 +1,62 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test("Plugin management keeps the selected details reachable when Settings narrows", async ({ workbench: page }) => {
|
||||
const name = "ReconciliationTimelineInspectorEnterprise";
|
||||
const notes = "SettlementTimeline".repeat(18);
|
||||
await page.evaluate(
|
||||
async ({ name, notes }) => {
|
||||
const path = "/src/features/plugins/backend.ts";
|
||||
const { createMemoryPluginsBackend, setPluginsBackend } = await import(/* @vite-ignore */ path);
|
||||
const { plugins } = await createMemoryPluginsBackend().list();
|
||||
const longPlugin = { ...plugins[0], id: "settlement-inspector", name, changeNotes: notes };
|
||||
setPluginsBackend(createMemoryPluginsBackend([longPlugin, ...plugins.slice(1)]));
|
||||
},
|
||||
{ name, notes },
|
||||
);
|
||||
|
||||
await page.setViewportSize({ width: 1080, height: 760 });
|
||||
await page.keyboard.press("Meta+,");
|
||||
const settings = page.getByRole("dialog", { name: "Settings", exact: true });
|
||||
await settings.getByRole("treeitem", { name: "Plugins", exact: true }).click();
|
||||
await settings.getByRole("tab", { name: "Installed", exact: true }).click();
|
||||
|
||||
const filter = settings.getByRole("textbox", { name: "Filter plugins" });
|
||||
const list = settings.getByRole("list", { name: "Installed plugins" });
|
||||
const details = settings.getByLabel(`${name} details`);
|
||||
const heading = details.getByRole("heading", { name, exact: true });
|
||||
await expect(heading).toBeVisible();
|
||||
|
||||
const filterBox = (await filter.boundingBox())!;
|
||||
const headingBox = (await heading.boundingBox())!;
|
||||
expect(headingBox.x).toBeGreaterThan(filterBox.x + filterBox.width);
|
||||
|
||||
await page.setViewportSize({ width: 520, height: 760 });
|
||||
const body = settings.locator("[class*='pageBody']");
|
||||
await expect.poll(() => body.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
|
||||
const divider = settings.getByRole("separator", { name: "Resize plugin panes" });
|
||||
await expect(divider).toHaveAttribute("aria-orientation", "horizontal");
|
||||
const sources = settings.getByRole("tablist", { name: "Plugin sources" });
|
||||
await expect(sources.getByRole("tab", { name: "Marketplace" })).toBeVisible();
|
||||
await expect(sources.getByRole("tab", { name: "Installed" })).toBeVisible();
|
||||
expect(await sources.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
|
||||
|
||||
const before = (await divider.boundingBox())!.y;
|
||||
await divider.focus();
|
||||
await page.keyboard.press("ArrowDown");
|
||||
await expect.poll(async () => (await divider.boundingBox())!.y).toBeGreaterThan(before);
|
||||
await expect(details.getByRole("button", { name: "Disable", exact: true })).toBeVisible();
|
||||
|
||||
await details.getByRole("tab", { name: "What's New" }).click();
|
||||
await expect(details.getByText(notes, { exact: true })).toBeVisible();
|
||||
expect(await details.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
|
||||
|
||||
await filter.click();
|
||||
await expect(filter).toBeFocused();
|
||||
await filter.pressSequentially("Harbor");
|
||||
await list.getByRole("button", { name: /Harbor Night Theme/ }).click();
|
||||
await expect(settings.getByRole("heading", { name: "Harbor Night Theme", exact: true })).toBeVisible();
|
||||
await page.setViewportSize({ width: 1080, height: 760 });
|
||||
await expect(divider).toHaveAttribute("aria-orientation", "vertical");
|
||||
await expect(filter).toHaveValue("Harbor");
|
||||
await expect(settings.getByRole("heading", { name: "Harbor Night Theme", exact: true })).toBeVisible();
|
||||
});
|
||||
@@ -3,23 +3,21 @@
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
height: 100%;
|
||||
min-height: 420px;
|
||||
min-height: 0;
|
||||
}
|
||||
.topBar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--space-1-5);
|
||||
min-width: 0;
|
||||
}
|
||||
.side {
|
||||
display: flex;
|
||||
.page > .topBar {
|
||||
flex: none;
|
||||
flex-direction: column;
|
||||
width: clamp(320px, 42%, 480px);
|
||||
min-height: 0;
|
||||
border-right: 1px solid var(--border);
|
||||
padding: 0 var(--space-2) var(--space-1);
|
||||
}
|
||||
.sourceTabs {
|
||||
flex: none;
|
||||
border-bottom: 0;
|
||||
}
|
||||
.tabCount {
|
||||
@@ -37,13 +35,14 @@
|
||||
.searchRow {
|
||||
display: flex;
|
||||
flex: none;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-1-5);
|
||||
padding: 8px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.searchField {
|
||||
flex: 1;
|
||||
flex: 1 1 132px;
|
||||
min-width: 0;
|
||||
}
|
||||
.spacer {
|
||||
@@ -58,8 +57,6 @@
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.body {
|
||||
display: flex;
|
||||
min-width: 640px;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
border-top: 1px solid var(--border);
|
||||
@@ -237,11 +234,14 @@
|
||||
.details {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 16px 20px 20px;
|
||||
min-height: 0;
|
||||
padding: var(--space-4);
|
||||
overflow: auto;
|
||||
}
|
||||
.detailsEmpty {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
/* Tags, name, vendor, then the actions with the version. */
|
||||
.header {
|
||||
@@ -258,6 +258,7 @@
|
||||
color: var(--fg);
|
||||
font: inherit;
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.titleLine {
|
||||
display: flex;
|
||||
@@ -273,15 +274,19 @@
|
||||
.title {
|
||||
margin: 0;
|
||||
color: var(--fg-strong);
|
||||
font-size: var(--fs-input-large);
|
||||
font-size: 1.375em;
|
||||
font-weight: 600;
|
||||
line-height: 1.3;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.version {
|
||||
color: var(--fg-muted);
|
||||
font-size: var(--fs-small);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.authors {
|
||||
color: var(--fg-secondary);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.headerActions {
|
||||
display: flex;
|
||||
@@ -298,6 +303,7 @@
|
||||
margin: 10px 0 0;
|
||||
max-width: 640px;
|
||||
color: var(--fg);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.details .error {
|
||||
margin-top: 10px;
|
||||
@@ -434,6 +440,7 @@
|
||||
|
||||
.consentNotice {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-3);
|
||||
justify-content: space-between;
|
||||
@@ -444,8 +451,7 @@
|
||||
}
|
||||
|
||||
.categorySelect {
|
||||
flex: none;
|
||||
width: 150px;
|
||||
flex: 0 1 150px;
|
||||
}
|
||||
.ownIcon {
|
||||
background: transparent;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* There is no network repository: Available lists the plugin packages
|
||||
* available locally (`plugin_catalog`) and installs them from disk.
|
||||
*/
|
||||
import { useEffect, useMemo, useState, type MouseEvent, type ReactNode } from "react";
|
||||
import { useEffect, useLayoutEffect, useMemo, useRef, useState, type MouseEvent, type ReactNode } from "react";
|
||||
import clsx from "clsx";
|
||||
import type {
|
||||
CapabilityInfo,
|
||||
@@ -27,6 +27,9 @@ import {
|
||||
SearchField,
|
||||
Select,
|
||||
Spinner,
|
||||
SplitGroup,
|
||||
SplitHandle,
|
||||
SplitPanel,
|
||||
Tabs,
|
||||
showContextMenu,
|
||||
type MenuItem,
|
||||
@@ -1309,6 +1312,19 @@ export function PluginsPage({ initialTab = "marketplace" }: { initialTab?: Tab }
|
||||
const [query, setQuery] = useState("");
|
||||
const [selectedId, setSelectedId] = useState<string | null>(null);
|
||||
const [selectedCatalogId, setSelectedCatalogId] = useState<string | null>(null);
|
||||
const pageRef = useRef<HTMLDivElement>(null);
|
||||
const [stacked, setStacked] = useState(false);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const page = pageRef.current;
|
||||
if (!page) return;
|
||||
const measure = () => setStacked(page.clientWidth < 600);
|
||||
measure();
|
||||
if (typeof ResizeObserver === "undefined") return;
|
||||
const observer = new ResizeObserver(measure);
|
||||
observer.observe(page);
|
||||
return () => observer.disconnect();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
void refreshPlugins();
|
||||
@@ -1403,7 +1419,7 @@ export function PluginsPage({ initialTab = "marketplace" }: { initialTab?: Tab }
|
||||
|
||||
const headerSlot = useSettingsHeaderSlot();
|
||||
const header = (
|
||||
<>
|
||||
<div className={styles.topBar}>
|
||||
<Tabs
|
||||
variant="compact"
|
||||
className={styles.sourceTabs}
|
||||
@@ -1421,12 +1437,12 @@ export function PluginsPage({ initialTab = "marketplace" }: { initialTab?: Tab }
|
||||
/>
|
||||
{(loading || installing) && <Spinner size={14} label={installing ? "Installing plugin" : "Loading plugins"} />}
|
||||
<IconButton icon="settings" title="Manage Plugins" aria-haspopup="menu" onClick={openGear} />
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={styles.page}>
|
||||
{headerSlot ? createPortal(header, headerSlot) : <div className={styles.topBar}>{header}</div>}
|
||||
<div ref={pageRef} className={styles.page}>
|
||||
{headerSlot && !stacked ? createPortal(header, headerSlot) : header}
|
||||
|
||||
{error && (
|
||||
<div className={styles.error} role="alert">
|
||||
@@ -1434,8 +1450,13 @@ export function PluginsPage({ initialTab = "marketplace" }: { initialTab?: Tab }
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className={styles.body}>
|
||||
<div className={styles.side}>
|
||||
<SplitGroup
|
||||
id="plugin-panes"
|
||||
className={styles.body}
|
||||
orientation={stacked ? "vertical" : "horizontal"}
|
||||
storageKey={`openidea.settings.plugins.layout.${stacked ? "stacked" : "sideBySide"}`}
|
||||
>
|
||||
<SplitPanel id="plugin-list" defaultSize="45%" minSize={stacked ? "28%" : "240px"}>
|
||||
<div className={styles.searchRow}>
|
||||
<SearchField
|
||||
className={styles.searchField}
|
||||
@@ -1527,39 +1548,41 @@ export function PluginsPage({ initialTab = "marketplace" }: { initialTab?: Tab }
|
||||
{catalogError && <li className={clsx(styles.listEmpty, styles.errorText)}>{catalogError}</li>}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{tab === "installed" ? (
|
||||
selected ? (
|
||||
<InstalledDetails key={selected.id} plugin={selected} />
|
||||
</SplitPanel>
|
||||
<SplitHandle aria-label={tx("Resize plugin panes")} />
|
||||
<SplitPanel id="plugin-details" defaultSize="55%" minSize={stacked ? "35%" : "320px"}>
|
||||
{tab === "installed" ? (
|
||||
selected ? (
|
||||
<InstalledDetails key={selected.id} plugin={selected} />
|
||||
) : (
|
||||
<EmptyState className={styles.detailsEmpty} title={loaded ? "No plugin selected" : "Loading…"}>
|
||||
<T>Plugins are folders with a</T> <code>plugin.toml</code>
|
||||
<T>. Use the gear menu to install one from disk, or put dev plugins in</T>{" "}
|
||||
<code>.openidea/plugins/</code> <T>inside your project.</T>
|
||||
</EmptyState>
|
||||
)
|
||||
) : selectedMarket ? (
|
||||
<MarketDetails
|
||||
key={`market:${selectedMarket.id}`}
|
||||
entry={selectedMarket}
|
||||
suggestedBy={suggestions.get(selectedMarket.id)}
|
||||
onInstalled={(id) => {
|
||||
setTab("installed");
|
||||
setSelectedId(id);
|
||||
}}
|
||||
/>
|
||||
) : selectedEntry ? (
|
||||
<CatalogDetails key={selectedEntry.id} entry={selectedEntry} />
|
||||
) : marketUrl ? (
|
||||
<EmptyState className={styles.detailsEmpty} title="No plugin selected" />
|
||||
) : (
|
||||
<EmptyState className={styles.detailsEmpty} title={loaded ? "No plugin selected" : "Loading…"}>
|
||||
<T>Plugins are folders with a</T> <code>plugin.toml</code>
|
||||
<T>. Use the gear menu to install one from disk, or put dev plugins in</T> <code>.openidea/plugins/</code>{" "}
|
||||
<T>inside your project.</T>
|
||||
<EmptyState className={styles.detailsEmpty} title={NO_REPOSITORY}>
|
||||
<T>Install a plugin folder with</T> <code>plugin.toml</code>{" "}
|
||||
<T>via the gear menu › Install Plugin from Disk….</T>
|
||||
</EmptyState>
|
||||
)
|
||||
) : selectedMarket ? (
|
||||
<MarketDetails
|
||||
key={`market:${selectedMarket.id}`}
|
||||
entry={selectedMarket}
|
||||
suggestedBy={suggestions.get(selectedMarket.id)}
|
||||
onInstalled={(id) => {
|
||||
setTab("installed");
|
||||
setSelectedId(id);
|
||||
}}
|
||||
/>
|
||||
) : selectedEntry ? (
|
||||
<CatalogDetails key={selectedEntry.id} entry={selectedEntry} />
|
||||
) : marketUrl ? (
|
||||
<EmptyState className={styles.detailsEmpty} title="No plugin selected" />
|
||||
) : (
|
||||
<EmptyState className={styles.detailsEmpty} title={NO_REPOSITORY}>
|
||||
<T>Install a plugin folder with</T> <code>plugin.toml</code>{" "}
|
||||
<T>via the gear menu › Install Plugin from Disk….</T>
|
||||
</EmptyState>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</SplitPanel>
|
||||
</SplitGroup>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -953,7 +953,8 @@ describe("PluginsPage", () => {
|
||||
await user.click(screen.getByRole("button", { name: "Apply theme Harbor Night" }));
|
||||
await waitFor(() => expect(screen.getByRole("button", { name: "Use Default Theme" })).toBeInTheDocument());
|
||||
|
||||
await user.type(screen.getByLabelText("Filter plugins"), "toy");
|
||||
screen.getByLabelText("Filter plugins").focus();
|
||||
await user.keyboard("toy");
|
||||
await waitFor(() => expect(within(list).getAllByRole("listitem")).toHaveLength(1));
|
||||
expect(screen.getByRole("heading", { level: 2 })).toHaveTextContent("Toy Language");
|
||||
expect(screen.getByText("Toy (.toy)")).toBeInTheDocument();
|
||||
|
||||
@@ -2510,6 +2510,7 @@
|
||||
"Load Maven Project": "Load Maven Project",
|
||||
"Skip": "Skip",
|
||||
"Resize Markdown preview": "Resize Markdown preview",
|
||||
"Resize plugin panes": "Resize plugin panes",
|
||||
"Run a Python script or module": "Run a Python script or module",
|
||||
"Replace every occurrence of '{pattern}' with '{replacement}' in the scope? The search hit its limit, so it runs again to find the occurrences not listed.": "Replace every occurrence of '{pattern}' with '{replacement}' in the scope? The search hit its limit, so it runs again to find the occurrences not listed.",
|
||||
"Server default": "Server default",
|
||||
|
||||
@@ -8890,6 +8890,7 @@
|
||||
"This Maven project is not loaded": "此 Maven 项目尚未加载",
|
||||
"Load Maven Project": "加载 Maven 项目",
|
||||
"Resize Markdown preview": "调整 Markdown 预览宽度",
|
||||
"Resize plugin panes": "调整插件列表与详情区域大小",
|
||||
"Server default": "服务器默认值",
|
||||
"New Database": "新建数据库",
|
||||
"Owner:": "所有者:",
|
||||
|
||||
Reference in new issue
Заблокувати користувача