fix(web): settings deep links use section hash; agent report links to download detail
settingsPath() now builds /console/settings#section[/anchor] directly. Smoke covers the old ?tab= redirects and every settings section hash (hash-only URLs load from about:blank first). Agent report download links go to /console/downloads/:id without the /tasks 404 probe. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
d64f735810
commit
45ebef4a88
4 files changed
+27
-21
No files matched your search
@@ -49,8 +49,8 @@ describe("控制台导航", () => {
|
||||
});
|
||||
|
||||
it("settingsPath 只认新分区名", () => {
|
||||
expect(settingsPath("automation", "cache").startsWith("/console/settings")).toBe(true);
|
||||
expect(settingsPath("agent").startsWith("/console/settings")).toBe(true);
|
||||
expect(settingsPath("automation", "cache")).toBe("/console/settings#automation/cache");
|
||||
expect(settingsPath("agent")).toBe("/console/settings#agent");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -194,10 +194,7 @@ export const NAV_GROUPS: NavGroup[] = [
|
||||
|
||||
export const NAV_ITEMS = NAV_GROUPS.flatMap((g) => g.items);
|
||||
|
||||
/**
|
||||
* 设置页深链。IA-2 把设置改为 /console/settings/:section 之前,先落到现有 ?tab=;
|
||||
* 调用方只认新分区名,切换时只改这里。
|
||||
*/
|
||||
/** 设置页深链(IA-2):`/console/settings#分区[/节]`。调用方只认新分区名 */
|
||||
export type SettingsSection =
|
||||
| "automation"
|
||||
| "sites"
|
||||
@@ -208,19 +205,8 @@ export type SettingsSection =
|
||||
| "agent"
|
||||
| "api-keys"
|
||||
| "account";
|
||||
const SETTINGS_LEGACY_TAB: Partial<Record<SettingsSection, string>> = {
|
||||
automation: "automation",
|
||||
sites: "site-credentials",
|
||||
downloaders: "downloaders",
|
||||
library: "library-roots",
|
||||
"media-servers": "media-servers",
|
||||
agent: "pi",
|
||||
"api-keys": "api-keys",
|
||||
};
|
||||
export function settingsPath(section: SettingsSection, anchor?: string): string {
|
||||
// 缓存阈值现在在"缓存与入库"页签,IA-2 后归到 automation#cache
|
||||
const tab = section === "automation" && anchor === "cache" ? "storage" : SETTINGS_LEGACY_TAB[section];
|
||||
return tab ? `${CONSOLE_BASE}/settings?tab=${tab}` : `${CONSOLE_BASE}/settings`;
|
||||
return `${CONSOLE_BASE}/settings#${section}${anchor ? `/${anchor}` : ""}`;
|
||||
}
|
||||
|
||||
/** 按路径找当前导航项(最长前缀匹配) */
|
||||
|
||||
Reference in new issue
Block a user