feat(ui): hide developer console for management backend users

平台定位为管理后台,登录后不再向普通用户暴露 Playground / API Keys / Models
等开发者控制台入口;Usage logs 作为交付链路一环并入 Code delivery 分组。
路由本身保留,仅侧栏不再展示。

Made-with: Cursor
This commit is contained in:
Ubuntu
2026-05-01 04:33:15 +00:00
parent a668e1fca1
commit 8cd82caf72
2 changed files with 135 additions and 22 deletions
+4 -22
View File
@@ -3,9 +3,7 @@ import {
BookOpenText,
Command,
FileBarChart,
KeyRound,
LayoutDashboard,
PlaySquare,
Rocket,
Settings,
ShieldCheck,
@@ -20,12 +18,14 @@ import { type SidebarData } from '@/components/layout/types'
* Heicode Manager 默认 workspace 侧边栏。
*
* 设计原则:
* - 默认进来界面干净,仅展示 Code delivery cockpit + 个人/控制台入口;
* - 平台是管理后台:登录后默认仅展示 Code delivery cockpit + 个人入口;
* - 不再向普通用户暴露 Playground / API Keys / Models 等开发者控制台条目;
* - Usage logs 作为交付链路的一环,归并进 Code delivery 分组;
* - 所有 admin/root 管理类入口(Channels/Models/Tenants/Redemption/...)
* 收纳进 "系统设置" workspace(点击进入 /system-settings 后才出现)。
*
* Visibility rules (filter happens in `app-sidebar.tsx` by `group.id`):
* - everyone (no id filter): cockpit / console / personal
* - everyone (no id filter): cockpit / personal
* - id === 'admin-entry' -> ROLE.ADMIN+ (单一入口:系统设置)
*
* 注意:进入 /system-settings 之后侧边栏由
@@ -74,24 +74,6 @@ export function useSidebarData(): SidebarData {
url: '/audit',
icon: ShieldCheck,
},
],
},
// ============ Console (登录用户均可见) ============
{
id: 'console',
title: t('Console'),
items: [
{
title: t('Playground'),
url: '/playground',
icon: PlaySquare,
},
{
title: t('API Keys'),
url: '/keys',
icon: KeyRound,
},
{
title: t('Usage logs'),
url: '/usage-logs',
+131
View File
@@ -35,15 +35,21 @@ import { Route as PricingModelIdIndexRouteImport } from './routes/pricing/$model
import { Route as AuthenticatedWalletIndexRouteImport } from './routes/_authenticated/wallet/index'
import { Route as AuthenticatedUsersIndexRouteImport } from './routes/_authenticated/users/index'
import { Route as AuthenticatedUsageLogsIndexRouteImport } from './routes/_authenticated/usage-logs/index'
import { Route as AuthenticatedTemplatesIndexRouteImport } from './routes/_authenticated/templates/index'
import { Route as AuthenticatedSystemSettingsIndexRouteImport } from './routes/_authenticated/system-settings/index'
import { Route as AuthenticatedSubscriptionsIndexRouteImport } from './routes/_authenticated/subscriptions/index'
import { Route as AuthenticatedSkSourcesIndexRouteImport } from './routes/_authenticated/sk-sources/index'
import { Route as AuthenticatedRedemptionCodesIndexRouteImport } from './routes/_authenticated/redemption-codes/index'
import { Route as AuthenticatedProfileIndexRouteImport } from './routes/_authenticated/profile/index'
import { Route as AuthenticatedPlaygroundIndexRouteImport } from './routes/_authenticated/playground/index'
import { Route as AuthenticatedModelsIndexRouteImport } from './routes/_authenticated/models/index'
import { Route as AuthenticatedKeysIndexRouteImport } from './routes/_authenticated/keys/index'
import { Route as AuthenticatedEventsIndexRouteImport } from './routes/_authenticated/events/index'
import { Route as AuthenticatedDeploymentsIndexRouteImport } from './routes/_authenticated/deployments/index'
import { Route as AuthenticatedDashboardIndexRouteImport } from './routes/_authenticated/dashboard/index'
import { Route as AuthenticatedChannelsIndexRouteImport } from './routes/_authenticated/channels/index'
import { Route as AuthenticatedAuditIndexRouteImport } from './routes/_authenticated/audit/index'
import { Route as AuthenticatedAgentsIndexRouteImport } from './routes/_authenticated/agents/index'
import { Route as AuthenticatedUsageLogsSectionRouteImport } from './routes/_authenticated/usage-logs/$section'
import { Route as AuthenticatedModelsSectionRouteImport } from './routes/_authenticated/models/$section'
import { Route as AuthenticatedErrorsErrorRouteImport } from './routes/_authenticated/errors/$error'
@@ -196,6 +202,12 @@ const AuthenticatedUsageLogsIndexRoute =
path: '/usage-logs/',
getParentRoute: () => AuthenticatedRouteRoute,
} as any)
const AuthenticatedTemplatesIndexRoute =
AuthenticatedTemplatesIndexRouteImport.update({
id: '/templates/',
path: '/templates/',
getParentRoute: () => AuthenticatedRouteRoute,
} as any)
const AuthenticatedSystemSettingsIndexRoute =
AuthenticatedSystemSettingsIndexRouteImport.update({
id: '/',
@@ -208,6 +220,12 @@ const AuthenticatedSubscriptionsIndexRoute =
path: '/subscriptions/',
getParentRoute: () => AuthenticatedRouteRoute,
} as any)
const AuthenticatedSkSourcesIndexRoute =
AuthenticatedSkSourcesIndexRouteImport.update({
id: '/sk-sources/',
path: '/sk-sources/',
getParentRoute: () => AuthenticatedRouteRoute,
} as any)
const AuthenticatedRedemptionCodesIndexRoute =
AuthenticatedRedemptionCodesIndexRouteImport.update({
id: '/redemption-codes/',
@@ -237,6 +255,18 @@ const AuthenticatedKeysIndexRoute = AuthenticatedKeysIndexRouteImport.update({
path: '/keys/',
getParentRoute: () => AuthenticatedRouteRoute,
} as any)
const AuthenticatedEventsIndexRoute =
AuthenticatedEventsIndexRouteImport.update({
id: '/events/',
path: '/events/',
getParentRoute: () => AuthenticatedRouteRoute,
} as any)
const AuthenticatedDeploymentsIndexRoute =
AuthenticatedDeploymentsIndexRouteImport.update({
id: '/deployments/',
path: '/deployments/',
getParentRoute: () => AuthenticatedRouteRoute,
} as any)
const AuthenticatedDashboardIndexRoute =
AuthenticatedDashboardIndexRouteImport.update({
id: '/dashboard/',
@@ -249,6 +279,17 @@ const AuthenticatedChannelsIndexRoute =
path: '/channels/',
getParentRoute: () => AuthenticatedRouteRoute,
} as any)
const AuthenticatedAuditIndexRoute = AuthenticatedAuditIndexRouteImport.update({
id: '/audit/',
path: '/audit/',
getParentRoute: () => AuthenticatedRouteRoute,
} as any)
const AuthenticatedAgentsIndexRoute =
AuthenticatedAgentsIndexRouteImport.update({
id: '/agents/',
path: '/agents/',
getParentRoute: () => AuthenticatedRouteRoute,
} as any)
const AuthenticatedUsageLogsSectionRoute =
AuthenticatedUsageLogsSectionRouteImport.update({
id: '/usage-logs/$section',
@@ -395,15 +436,21 @@ export interface FileRoutesByFullPath {
'/errors/$error': typeof AuthenticatedErrorsErrorRoute
'/models/$section': typeof AuthenticatedModelsSectionRoute
'/usage-logs/$section': typeof AuthenticatedUsageLogsSectionRoute
'/agents/': typeof AuthenticatedAgentsIndexRoute
'/audit/': typeof AuthenticatedAuditIndexRoute
'/channels/': typeof AuthenticatedChannelsIndexRoute
'/dashboard/': typeof AuthenticatedDashboardIndexRoute
'/deployments/': typeof AuthenticatedDeploymentsIndexRoute
'/events/': typeof AuthenticatedEventsIndexRoute
'/keys/': typeof AuthenticatedKeysIndexRoute
'/models/': typeof AuthenticatedModelsIndexRoute
'/playground/': typeof AuthenticatedPlaygroundIndexRoute
'/profile/': typeof AuthenticatedProfileIndexRoute
'/redemption-codes/': typeof AuthenticatedRedemptionCodesIndexRoute
'/sk-sources/': typeof AuthenticatedSkSourcesIndexRoute
'/subscriptions/': typeof AuthenticatedSubscriptionsIndexRoute
'/system-settings/': typeof AuthenticatedSystemSettingsIndexRoute
'/templates/': typeof AuthenticatedTemplatesIndexRoute
'/usage-logs/': typeof AuthenticatedUsageLogsIndexRoute
'/users/': typeof AuthenticatedUsersIndexRoute
'/wallet/': typeof AuthenticatedWalletIndexRoute
@@ -449,15 +496,21 @@ export interface FileRoutesByTo {
'/errors/$error': typeof AuthenticatedErrorsErrorRoute
'/models/$section': typeof AuthenticatedModelsSectionRoute
'/usage-logs/$section': typeof AuthenticatedUsageLogsSectionRoute
'/agents': typeof AuthenticatedAgentsIndexRoute
'/audit': typeof AuthenticatedAuditIndexRoute
'/channels': typeof AuthenticatedChannelsIndexRoute
'/dashboard': typeof AuthenticatedDashboardIndexRoute
'/deployments': typeof AuthenticatedDeploymentsIndexRoute
'/events': typeof AuthenticatedEventsIndexRoute
'/keys': typeof AuthenticatedKeysIndexRoute
'/models': typeof AuthenticatedModelsIndexRoute
'/playground': typeof AuthenticatedPlaygroundIndexRoute
'/profile': typeof AuthenticatedProfileIndexRoute
'/redemption-codes': typeof AuthenticatedRedemptionCodesIndexRoute
'/sk-sources': typeof AuthenticatedSkSourcesIndexRoute
'/subscriptions': typeof AuthenticatedSubscriptionsIndexRoute
'/system-settings': typeof AuthenticatedSystemSettingsIndexRoute
'/templates': typeof AuthenticatedTemplatesIndexRoute
'/usage-logs': typeof AuthenticatedUsageLogsIndexRoute
'/users': typeof AuthenticatedUsersIndexRoute
'/wallet': typeof AuthenticatedWalletIndexRoute
@@ -507,15 +560,21 @@ export interface FileRoutesById {
'/_authenticated/errors/$error': typeof AuthenticatedErrorsErrorRoute
'/_authenticated/models/$section': typeof AuthenticatedModelsSectionRoute
'/_authenticated/usage-logs/$section': typeof AuthenticatedUsageLogsSectionRoute
'/_authenticated/agents/': typeof AuthenticatedAgentsIndexRoute
'/_authenticated/audit/': typeof AuthenticatedAuditIndexRoute
'/_authenticated/channels/': typeof AuthenticatedChannelsIndexRoute
'/_authenticated/dashboard/': typeof AuthenticatedDashboardIndexRoute
'/_authenticated/deployments/': typeof AuthenticatedDeploymentsIndexRoute
'/_authenticated/events/': typeof AuthenticatedEventsIndexRoute
'/_authenticated/keys/': typeof AuthenticatedKeysIndexRoute
'/_authenticated/models/': typeof AuthenticatedModelsIndexRoute
'/_authenticated/playground/': typeof AuthenticatedPlaygroundIndexRoute
'/_authenticated/profile/': typeof AuthenticatedProfileIndexRoute
'/_authenticated/redemption-codes/': typeof AuthenticatedRedemptionCodesIndexRoute
'/_authenticated/sk-sources/': typeof AuthenticatedSkSourcesIndexRoute
'/_authenticated/subscriptions/': typeof AuthenticatedSubscriptionsIndexRoute
'/_authenticated/system-settings/': typeof AuthenticatedSystemSettingsIndexRoute
'/_authenticated/templates/': typeof AuthenticatedTemplatesIndexRoute
'/_authenticated/usage-logs/': typeof AuthenticatedUsageLogsIndexRoute
'/_authenticated/users/': typeof AuthenticatedUsersIndexRoute
'/_authenticated/wallet/': typeof AuthenticatedWalletIndexRoute
@@ -564,15 +623,21 @@ export interface FileRouteTypes {
| '/errors/$error'
| '/models/$section'
| '/usage-logs/$section'
| '/agents/'
| '/audit/'
| '/channels/'
| '/dashboard/'
| '/deployments/'
| '/events/'
| '/keys/'
| '/models/'
| '/playground/'
| '/profile/'
| '/redemption-codes/'
| '/sk-sources/'
| '/subscriptions/'
| '/system-settings/'
| '/templates/'
| '/usage-logs/'
| '/users/'
| '/wallet/'
@@ -618,15 +683,21 @@ export interface FileRouteTypes {
| '/errors/$error'
| '/models/$section'
| '/usage-logs/$section'
| '/agents'
| '/audit'
| '/channels'
| '/dashboard'
| '/deployments'
| '/events'
| '/keys'
| '/models'
| '/playground'
| '/profile'
| '/redemption-codes'
| '/sk-sources'
| '/subscriptions'
| '/system-settings'
| '/templates'
| '/usage-logs'
| '/users'
| '/wallet'
@@ -675,15 +746,21 @@ export interface FileRouteTypes {
| '/_authenticated/errors/$error'
| '/_authenticated/models/$section'
| '/_authenticated/usage-logs/$section'
| '/_authenticated/agents/'
| '/_authenticated/audit/'
| '/_authenticated/channels/'
| '/_authenticated/dashboard/'
| '/_authenticated/deployments/'
| '/_authenticated/events/'
| '/_authenticated/keys/'
| '/_authenticated/models/'
| '/_authenticated/playground/'
| '/_authenticated/profile/'
| '/_authenticated/redemption-codes/'
| '/_authenticated/sk-sources/'
| '/_authenticated/subscriptions/'
| '/_authenticated/system-settings/'
| '/_authenticated/templates/'
| '/_authenticated/usage-logs/'
| '/_authenticated/users/'
| '/_authenticated/wallet/'
@@ -906,6 +983,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticatedUsageLogsIndexRouteImport
parentRoute: typeof AuthenticatedRouteRoute
}
'/_authenticated/templates/': {
id: '/_authenticated/templates/'
path: '/templates'
fullPath: '/templates/'
preLoaderRoute: typeof AuthenticatedTemplatesIndexRouteImport
parentRoute: typeof AuthenticatedRouteRoute
}
'/_authenticated/system-settings/': {
id: '/_authenticated/system-settings/'
path: '/'
@@ -920,6 +1004,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticatedSubscriptionsIndexRouteImport
parentRoute: typeof AuthenticatedRouteRoute
}
'/_authenticated/sk-sources/': {
id: '/_authenticated/sk-sources/'
path: '/sk-sources'
fullPath: '/sk-sources/'
preLoaderRoute: typeof AuthenticatedSkSourcesIndexRouteImport
parentRoute: typeof AuthenticatedRouteRoute
}
'/_authenticated/redemption-codes/': {
id: '/_authenticated/redemption-codes/'
path: '/redemption-codes'
@@ -955,6 +1046,20 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticatedKeysIndexRouteImport
parentRoute: typeof AuthenticatedRouteRoute
}
'/_authenticated/events/': {
id: '/_authenticated/events/'
path: '/events'
fullPath: '/events/'
preLoaderRoute: typeof AuthenticatedEventsIndexRouteImport
parentRoute: typeof AuthenticatedRouteRoute
}
'/_authenticated/deployments/': {
id: '/_authenticated/deployments/'
path: '/deployments'
fullPath: '/deployments/'
preLoaderRoute: typeof AuthenticatedDeploymentsIndexRouteImport
parentRoute: typeof AuthenticatedRouteRoute
}
'/_authenticated/dashboard/': {
id: '/_authenticated/dashboard/'
path: '/dashboard'
@@ -969,6 +1074,20 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticatedChannelsIndexRouteImport
parentRoute: typeof AuthenticatedRouteRoute
}
'/_authenticated/audit/': {
id: '/_authenticated/audit/'
path: '/audit'
fullPath: '/audit/'
preLoaderRoute: typeof AuthenticatedAuditIndexRouteImport
parentRoute: typeof AuthenticatedRouteRoute
}
'/_authenticated/agents/': {
id: '/_authenticated/agents/'
path: '/agents'
fullPath: '/agents/'
preLoaderRoute: typeof AuthenticatedAgentsIndexRouteImport
parentRoute: typeof AuthenticatedRouteRoute
}
'/_authenticated/usage-logs/$section': {
id: '/_authenticated/usage-logs/$section'
path: '/usage-logs/$section'
@@ -1201,14 +1320,20 @@ interface AuthenticatedRouteRouteChildren {
AuthenticatedErrorsErrorRoute: typeof AuthenticatedErrorsErrorRoute
AuthenticatedModelsSectionRoute: typeof AuthenticatedModelsSectionRoute
AuthenticatedUsageLogsSectionRoute: typeof AuthenticatedUsageLogsSectionRoute
AuthenticatedAgentsIndexRoute: typeof AuthenticatedAgentsIndexRoute
AuthenticatedAuditIndexRoute: typeof AuthenticatedAuditIndexRoute
AuthenticatedChannelsIndexRoute: typeof AuthenticatedChannelsIndexRoute
AuthenticatedDashboardIndexRoute: typeof AuthenticatedDashboardIndexRoute
AuthenticatedDeploymentsIndexRoute: typeof AuthenticatedDeploymentsIndexRoute
AuthenticatedEventsIndexRoute: typeof AuthenticatedEventsIndexRoute
AuthenticatedKeysIndexRoute: typeof AuthenticatedKeysIndexRoute
AuthenticatedModelsIndexRoute: typeof AuthenticatedModelsIndexRoute
AuthenticatedPlaygroundIndexRoute: typeof AuthenticatedPlaygroundIndexRoute
AuthenticatedProfileIndexRoute: typeof AuthenticatedProfileIndexRoute
AuthenticatedRedemptionCodesIndexRoute: typeof AuthenticatedRedemptionCodesIndexRoute
AuthenticatedSkSourcesIndexRoute: typeof AuthenticatedSkSourcesIndexRoute
AuthenticatedSubscriptionsIndexRoute: typeof AuthenticatedSubscriptionsIndexRoute
AuthenticatedTemplatesIndexRoute: typeof AuthenticatedTemplatesIndexRoute
AuthenticatedUsageLogsIndexRoute: typeof AuthenticatedUsageLogsIndexRoute
AuthenticatedUsersIndexRoute: typeof AuthenticatedUsersIndexRoute
AuthenticatedWalletIndexRoute: typeof AuthenticatedWalletIndexRoute
@@ -1223,15 +1348,21 @@ const AuthenticatedRouteRouteChildren: AuthenticatedRouteRouteChildren = {
AuthenticatedErrorsErrorRoute: AuthenticatedErrorsErrorRoute,
AuthenticatedModelsSectionRoute: AuthenticatedModelsSectionRoute,
AuthenticatedUsageLogsSectionRoute: AuthenticatedUsageLogsSectionRoute,
AuthenticatedAgentsIndexRoute: AuthenticatedAgentsIndexRoute,
AuthenticatedAuditIndexRoute: AuthenticatedAuditIndexRoute,
AuthenticatedChannelsIndexRoute: AuthenticatedChannelsIndexRoute,
AuthenticatedDashboardIndexRoute: AuthenticatedDashboardIndexRoute,
AuthenticatedDeploymentsIndexRoute: AuthenticatedDeploymentsIndexRoute,
AuthenticatedEventsIndexRoute: AuthenticatedEventsIndexRoute,
AuthenticatedKeysIndexRoute: AuthenticatedKeysIndexRoute,
AuthenticatedModelsIndexRoute: AuthenticatedModelsIndexRoute,
AuthenticatedPlaygroundIndexRoute: AuthenticatedPlaygroundIndexRoute,
AuthenticatedProfileIndexRoute: AuthenticatedProfileIndexRoute,
AuthenticatedRedemptionCodesIndexRoute:
AuthenticatedRedemptionCodesIndexRoute,
AuthenticatedSkSourcesIndexRoute: AuthenticatedSkSourcesIndexRoute,
AuthenticatedSubscriptionsIndexRoute: AuthenticatedSubscriptionsIndexRoute,
AuthenticatedTemplatesIndexRoute: AuthenticatedTemplatesIndexRoute,
AuthenticatedUsageLogsIndexRoute: AuthenticatedUsageLogsIndexRoute,
AuthenticatedUsersIndexRoute: AuthenticatedUsersIndexRoute,
AuthenticatedWalletIndexRoute: AuthenticatedWalletIndexRoute,