Skip to content

Commit c99269b

Browse files
committed
fix(graph-ui): remove misleading 'Project name' field from index picker
The optional 'Project name' input was labelled 'Optional display name', but its value became the project's permanent identity (the <name>.db filename, projects.name primary key, and the project. prefix on every node's qualified_name) - not a cosmetic label. Since a project cannot be renamed after indexing and the name is always derivable from the folder path, the field was misleading. Remove the input, its state, and its submit payload; project names now always derive from the selected folder path. Drop the now-dead i18n strings and update the test. Signed-off-by: Zadak <rarepops@protonmail.com>
1 parent 9871e7e commit c99269b

3 files changed

Lines changed: 4 additions & 27 deletions

File tree

graph-ui/src/components/StatsTab.test.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe("StatsTab index modal", () => {
4646
vi.unstubAllGlobals();
4747
});
4848

49-
it("submits a custom path and project name", async () => {
49+
it("submits a custom path", async () => {
5050
let submitted: unknown = null;
5151
mockProjectsFetch((url, init) => {
5252
if (url === "/api/index") {
@@ -65,16 +65,10 @@ describe("StatsTab index modal", () => {
6565
fireEvent.change(await screen.findByLabelText("Repository path"), {
6666
target: { value: "D:\\work\\信租风控通后端" },
6767
});
68-
fireEvent.change(screen.getByLabelText("Project name"), {
69-
target: { value: "信租风控通后端" },
70-
});
7168
fireEvent.click(screen.getByRole("button", { name: "Index This Folder" }));
7269

7370
await waitFor(() => {
74-
expect(submitted).toEqual({
75-
root_path: "D:\\work\\信租风控通后端",
76-
project_name: "信租风控通后端",
77-
});
71+
expect(submitted).toEqual({ root_path: "D:\\work\\信租风控通后端" });
7872
});
7973
});
8074

graph-ui/src/components/StatsTab.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ function CreateIndexModal({ onClose, onCreated }: { onClose: () => void; onCreat
172172
const [dirs, setDirs] = useState<string[]>([]);
173173
const [roots, setRoots] = useState<string[]>(["/"]);
174174
const [parentPath, setParentPath] = useState("");
175-
const [projectName, setProjectName] = useState("");
176175
const [filter, setFilter] = useState("");
177176
const [activeIndex, setActiveIndex] = useState(0);
178177
const [loading, setLoading] = useState(false);
@@ -211,9 +210,7 @@ function CreateIndexModal({ onClose, onCreated }: { onClose: () => void; onCreat
211210
if (!path) return;
212211
setSubmitting(true); setError(null);
213212
try {
214-
const body: { root_path: string; project_name?: string } = { root_path: path };
215-
if (projectName.trim()) body.project_name = projectName.trim();
216-
const res = await fetch("/api/index", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) });
213+
const res = await fetch("/api/index", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ root_path: path }) });
217214
const data = await res.json();
218215
if (!res.ok) throw new Error(data.error ?? "Failed");
219216
onCreated(); onClose();
@@ -250,7 +247,7 @@ function CreateIndexModal({ onClose, onCreated }: { onClose: () => void; onCreat
250247
<p className="text-[12px] text-foreground/30">{t.index.instructions}</p>
251248
</div>
252249

253-
<div className="px-5 pb-3 grid grid-cols-[1fr_220px] gap-3 shrink-0">
250+
<div className="px-5 pb-3 shrink-0">
254251
<label className="block">
255252
<span className="block text-[10px] uppercase tracking-widest text-foreground/25 mb-1">{t.index.repositoryPath}</span>
256253
<input
@@ -260,16 +257,6 @@ function CreateIndexModal({ onClose, onCreated }: { onClose: () => void; onCreat
260257
className="w-full bg-white/[0.04] border border-white/[0.06] rounded-lg px-3 py-2 text-[12px] text-foreground font-mono outline-none focus:border-primary/40"
261258
/>
262259
</label>
263-
<label className="block">
264-
<span className="block text-[10px] uppercase tracking-widest text-foreground/25 mb-1">{t.index.projectName}</span>
265-
<input
266-
aria-label={t.index.projectName}
267-
value={projectName}
268-
placeholder={t.index.projectNamePlaceholder}
269-
onChange={(e) => setProjectName(e.target.value)}
270-
className="w-full bg-white/[0.04] border border-white/[0.06] rounded-lg px-3 py-2 text-[12px] text-foreground outline-none focus:border-primary/40 placeholder:text-foreground/20"
271-
/>
272-
</label>
273260
</div>
274261

275262
<div className="px-5 pb-3 flex items-center gap-2 shrink-0">

graph-ui/src/lib/i18n.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ export const messages = {
4545
selectRepositoryFolder: "Select Repository Folder",
4646
instructions: "Navigate to the project root and click \"Index This Folder\".",
4747
repositoryPath: "Repository path",
48-
projectName: "Project name",
49-
projectNamePlaceholder: "Optional display name",
5048
filterFolders: "Filter folders",
5149
noSubdirectories: "No subdirectories",
5250
indexThisFolder: "Index This Folder",
@@ -116,8 +114,6 @@ export const messages = {
116114
selectRepositoryFolder: "选择仓库目录",
117115
instructions: "导航到项目根目录,然后点击“索引此目录”。",
118116
repositoryPath: "仓库路径",
119-
projectName: "项目名称",
120-
projectNamePlaceholder: "可选显示名称",
121117
filterFolders: "筛选目录",
122118
noSubdirectories: "没有子目录",
123119
indexThisFolder: "索引此目录",

0 commit comments

Comments
 (0)