Skip to content

Commit b362375

Browse files
committed
feat(manager): 企业管理后台新增其他配置页面
- 新增「其他配置」页面 /manager/other-settings - 新增 TeamNotifications 组件,使用 teams notify API - 事件类型调用 v1TeamsNotifyEventTypesList - 侧边栏添加入口 Made-with: Cursor
1 parent cab1609 commit b362375

File tree

7 files changed

+692
-15
lines changed

7 files changed

+692
-15
lines changed

frontend/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import TeamManagerHosts from "./pages/console/manager/hosts"
2121
import ResetPasswordPage from "./pages/resetpassword"
2222
import FindPasswordPage from "./pages/findpassword"
2323
import TeamManagerManager from "./pages/console/manager/manager"
24+
import TeamManagerOtherSettings from "./pages/console/manager/other-settings"
2425
import ProjectPage from "./pages/console/user/project/project"
2526
import PlaygroundPage from "./pages/playground"
2627
import PlaygroundDetailPage from "./pages/playground-detail"
@@ -69,6 +70,7 @@ function App() {
6970
<Route path="models" element={<TeamManagerModels />} />
7071
<Route path="logs" element={<TeamManagerLogs />} />
7172
<Route path="manager" element={<TeamManagerManager />} />
73+
<Route path="other-settings" element={<TeamManagerOtherSettings />} />
7274
</Route>
7375
<Route path="*" element={<Navigate to="/" replace />} />
7476
</Routes>

frontend/src/api/Api.ts

Lines changed: 144 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export enum ConstsNotifyChannelKind {
7878
export enum ConstsNotifyEventType {
7979
NotifyEventTaskCreated = "task.created",
8080
NotifyEventTaskEnded = "task.ended",
81-
NotifyEventVMRecycled = "vm.recycled",
8281
NotifyEventVMExpiringSoon = "vm.expiring_soon",
8382
}
8483

@@ -425,8 +424,6 @@ export interface DomainCreateNotifyChannelReq {
425424
kind: "dingtalk" | "feishu" | "wecom" | "webhook";
426425
/** @maxLength 64 */
427426
name: string;
428-
/** "self" | "team:<uuid>" */
429-
scope: string;
430427
secret?: string;
431428
webhook_url: string;
432429
}
@@ -1417,7 +1414,6 @@ export interface DomainUpdateNotifyChannelReq {
14171414
event_types?: ConstsNotifyEventType[];
14181415
headers?: Record<string, string>;
14191416
name?: string;
1420-
scope?: string;
14211417
secret?: string;
14221418
webhook_url?: string;
14231419
}
@@ -2878,6 +2874,142 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
28782874
...params,
28792875
}),
28802876

2877+
/**
2878+
* @description 列出当前团队的所有推送渠道及其订阅配置
2879+
*
2880+
* @tags 【Team 管理员】通知推送
2881+
* @name V1TeamsNotifyChannelsList
2882+
* @summary 列出团队推送渠道
2883+
* @request GET:/api/v1/teams/notify/channels
2884+
* @secure
2885+
*/
2886+
v1TeamsNotifyChannelsList: (params: RequestParams = {}) =>
2887+
this.request<
2888+
WebResp & {
2889+
data?: DomainNotifyChannel[];
2890+
},
2891+
WebResp
2892+
>({
2893+
path: `/api/v1/teams/notify/channels`,
2894+
method: "GET",
2895+
secure: true,
2896+
type: ContentType.Json,
2897+
format: "json",
2898+
...params,
2899+
}),
2900+
2901+
/**
2902+
* @description 创建团队推送渠道(钉钉/飞书/企业微信/Webhook),同时配置订阅的事件类型
2903+
*
2904+
* @tags 【Team 管理员】通知推送
2905+
* @name V1TeamsNotifyChannelsCreate
2906+
* @summary 创建团队推送渠道
2907+
* @request POST:/api/v1/teams/notify/channels
2908+
* @secure
2909+
*/
2910+
v1TeamsNotifyChannelsCreate: (param: DomainCreateNotifyChannelReq, params: RequestParams = {}) =>
2911+
this.request<
2912+
WebResp & {
2913+
data?: DomainNotifyChannel;
2914+
},
2915+
WebResp
2916+
>({
2917+
path: `/api/v1/teams/notify/channels`,
2918+
method: "POST",
2919+
body: param,
2920+
secure: true,
2921+
type: ContentType.Json,
2922+
format: "json",
2923+
...params,
2924+
}),
2925+
2926+
/**
2927+
* @description 更新团队推送渠道配置及订阅的事件类型
2928+
*
2929+
* @tags 【Team 管理员】通知推送
2930+
* @name V1TeamsNotifyChannelsUpdate
2931+
* @summary 更新团队推送渠道
2932+
* @request PUT:/api/v1/teams/notify/channels/{id}
2933+
* @secure
2934+
*/
2935+
v1TeamsNotifyChannelsUpdate: (id: string, param: DomainUpdateNotifyChannelReq, params: RequestParams = {}) =>
2936+
this.request<
2937+
WebResp & {
2938+
data?: DomainNotifyChannel;
2939+
},
2940+
WebResp
2941+
>({
2942+
path: `/api/v1/teams/notify/channels/${id}`,
2943+
method: "PUT",
2944+
body: param,
2945+
secure: true,
2946+
type: ContentType.Json,
2947+
format: "json",
2948+
...params,
2949+
}),
2950+
2951+
/**
2952+
* @description 删除团队推送渠道及其关联的订阅
2953+
*
2954+
* @tags 【Team 管理员】通知推送
2955+
* @name V1TeamsNotifyChannelsDelete
2956+
* @summary 删除团队推送渠道
2957+
* @request DELETE:/api/v1/teams/notify/channels/{id}
2958+
* @secure
2959+
*/
2960+
v1TeamsNotifyChannelsDelete: (id: string, params: RequestParams = {}) =>
2961+
this.request<WebResp, WebResp>({
2962+
path: `/api/v1/teams/notify/channels/${id}`,
2963+
method: "DELETE",
2964+
secure: true,
2965+
type: ContentType.Json,
2966+
format: "json",
2967+
...params,
2968+
}),
2969+
2970+
/**
2971+
* @description 发送测试消息验证渠道配置是否正确
2972+
*
2973+
* @tags 【Team 管理员】通知推送
2974+
* @name V1TeamsNotifyChannelsTestCreate
2975+
* @summary 测试团队推送渠道
2976+
* @request POST:/api/v1/teams/notify/channels/{id}/test
2977+
* @secure
2978+
*/
2979+
v1TeamsNotifyChannelsTestCreate: (id: string, params: RequestParams = {}) =>
2980+
this.request<WebResp, WebResp>({
2981+
path: `/api/v1/teams/notify/channels/${id}/test`,
2982+
method: "POST",
2983+
secure: true,
2984+
type: ContentType.Json,
2985+
format: "json",
2986+
...params,
2987+
}),
2988+
2989+
/**
2990+
* @description 列出所有支持订阅的事件类型
2991+
*
2992+
* @tags 通知推送
2993+
* @name V1TeamsNotifyEventTypesList
2994+
* @summary 列出事件类型
2995+
* @request GET:/api/v1/teams/notify/event-types
2996+
* @secure
2997+
*/
2998+
v1TeamsNotifyEventTypesList: (params: RequestParams = {}) =>
2999+
this.request<
3000+
WebResp & {
3001+
data?: ConstsNotifyEventTypeInfo[];
3002+
},
3003+
WebResp
3004+
>({
3005+
path: `/api/v1/teams/notify/event-types`,
3006+
method: "GET",
3007+
secure: true,
3008+
type: ContentType.Json,
3009+
format: "json",
3010+
...params,
3011+
}),
3012+
28813013
/**
28823014
* @description 获取团队 OAuth 站点列表
28833015
*
@@ -4502,7 +4634,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
45024634
*
45034635
* @tags 通知推送
45044636
* @name V1UsersNotifyChannelsList
4505-
* @summary 列出推送渠道
4637+
* @summary 列出用户推送渠道
45064638
* @request GET:/api/v1/users/notify/channels
45074639
* @secure
45084640
*/
@@ -4522,11 +4654,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
45224654
}),
45234655

45244656
/**
4525-
* @description 创建推送渠道(钉钉/飞书/企业微信/Webhook),同时配置订阅的事件类型
4657+
* @description 创建用户推送渠道(钉钉/飞书/企业微信/Webhook),同时配置订阅的事件类型
45264658
*
45274659
* @tags 通知推送
45284660
* @name V1UsersNotifyChannelsCreate
4529-
* @summary 创建推送渠道
4661+
* @summary 创建用户推送渠道
45304662
* @request POST:/api/v1/users/notify/channels
45314663
* @secure
45324664
*/
@@ -4547,11 +4679,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
45474679
}),
45484680

45494681
/**
4550-
* @description 更新推送渠道配置及订阅的事件类型
4682+
* @description 更新用户推送渠道配置及订阅的事件类型
45514683
*
45524684
* @tags 通知推送
45534685
* @name V1UsersNotifyChannelsUpdate
4554-
* @summary 更新推送渠道
4686+
* @summary 更新用户推送渠道
45554687
* @request PUT:/api/v1/users/notify/channels/{id}
45564688
* @secure
45574689
*/
@@ -4572,11 +4704,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
45724704
}),
45734705

45744706
/**
4575-
* @description 删除推送渠道及其关联的订阅
4707+
* @description 删除用户推送渠道及其关联的订阅
45764708
*
45774709
* @tags 通知推送
45784710
* @name V1UsersNotifyChannelsDelete
4579-
* @summary 删除推送渠道
4711+
* @summary 删除用户推送渠道
45804712
* @request DELETE:/api/v1/users/notify/channels/{id}
45814713
* @secure
45824714
*/
@@ -4595,7 +4727,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
45954727
*
45964728
* @tags 通知推送
45974729
* @name V1UsersNotifyChannelsTestCreate
4598-
* @summary 测试推送渠道
4730+
* @summary 测试用户推送渠道
45994731
* @request POST:/api/v1/users/notify/channels/{id}/test
46004732
* @secure
46014733
*/

frontend/src/components/manager/nav-teams.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
SidebarMenuButton,
88
SidebarMenuItem,
99
} from "@/components/ui/sidebar"
10-
import { IconChartBar, IconReport, IconUsersGroup } from "@tabler/icons-react"
10+
import { IconChartBar, IconReport, IconSettings2, IconUsersGroup } from "@tabler/icons-react"
1111
import { Bot, Box, MonitorCloud, User } from "lucide-react"
1212

1313
export default function NavTeams() {
@@ -94,7 +94,17 @@ export default function NavTeams() {
9494
</Link>
9595
</SidebarMenuButton>
9696
</SidebarMenuItem>
97-
97+
<SidebarMenuItem>
98+
<SidebarMenuButton
99+
isActive={location.pathname === "/manager/other-settings"}
100+
asChild
101+
>
102+
<Link to="/manager/other-settings">
103+
<IconSettings2 />
104+
<span>其他配置</span>
105+
</Link>
106+
</SidebarMenuButton>
107+
</SidebarMenuItem>
98108
</SidebarMenu>
99109
</SidebarGroup>
100110
)

0 commit comments

Comments
 (0)