Skip to content

Commit c720bf1

Browse files
committed
feat(web): 添加平台推送仓库列表配置界面
- 为 GitHub、Gitee、GitCode 和 CnbCool 平台添加推送仓库列表的 Web 界面 - 新增 RepoInfo 类型定义用于存储仓库信息 - 实现动态加载推送列表功能,支持仓库所有者、名称、分支等配置
1 parent 84cbfa9 commit c720bf1

6 files changed

Lines changed: 457 additions & 99 deletions

File tree

packages/core/src/models/platform/cnbcool/web.ts

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Config } from '@/common'
2+
import { EventType } from '@/types'
3+
import { RepoInfo } from '@/types/web'
24
import { components } from 'node-karin'
35

4-
export const web = () => {
6+
export const web = (list: RepoInfo[]) => {
57
return [
68
components.accordion.create('cnbcool', {
79
label: 'CnbCool 相关',
@@ -20,5 +22,48 @@ export const web = () => {
2022
}),
2123
],
2224
}),
25+
components.accordionPro.create(
26+
'pushlist:cnbcool',
27+
list.map((repo) => {
28+
return {
29+
title: `${repo.owner}/${repo.repo}:${repo.branch}`,
30+
...repo,
31+
}
32+
}),
33+
{
34+
label: 'CnbCool 推送仓库列表',
35+
children: components.accordion.createItem('accordion-item-cnbcoool', {
36+
subtitle: 'CnbCool 仓库',
37+
children: [
38+
components.input.string('owner', {
39+
label: '仓库所有者',
40+
placeholder: '请输入 CnbCool 仓库所有者',
41+
}),
42+
components.input.string('repo', {
43+
label: '仓库名称',
44+
placeholder: '请输入 CnbCool 仓库名称',
45+
}),
46+
components.input.string('branch', {
47+
label: '仓库分支',
48+
placeholder: '请输入 CnbCool 仓库分支',
49+
}),
50+
components.checkbox.group('event', {
51+
label: '推送事件',
52+
checkbox: [
53+
components.checkbox.create('event:push', {
54+
label: 'push',
55+
value: EventType.Push,
56+
}),
57+
components.checkbox.create('event:release', {
58+
label: 'release',
59+
value: EventType.Release,
60+
isDisabled: true,
61+
}),
62+
],
63+
}),
64+
],
65+
}),
66+
},
67+
),
2368
]
2469
}

packages/core/src/models/platform/gitcode/web.ts

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Config } from '@/common'
2+
import { EventType } from '@/types'
3+
import { RepoInfo } from '@/types/web'
24
import { ComponentConfig, components } from 'node-karin'
35

4-
export const web = (): ComponentConfig[] => {
6+
export const web = (list: RepoInfo[]): ComponentConfig[] => {
57
return [
68
components.accordion.create('gitcode', {
79
label: 'GitCode 相关',
@@ -20,5 +22,48 @@ export const web = (): ComponentConfig[] => {
2022
}),
2123
],
2224
}),
25+
components.accordionPro.create(
26+
'pushlist:gitcode',
27+
list.map((repo) => {
28+
return {
29+
title: `${repo.owner}/${repo.repo}:${repo.branch}`,
30+
...repo,
31+
}
32+
}),
33+
{
34+
label: 'GitCode 推送仓库列表',
35+
children: components.accordion.createItem('accordion-item-gitcode', {
36+
subtitle: 'GitCode 仓库',
37+
children: [
38+
components.input.string('owner', {
39+
label: '仓库所有者',
40+
placeholder: '请输入 GitCode 仓库所有者',
41+
}),
42+
components.input.string('repo', {
43+
label: '仓库名称',
44+
placeholder: '请输入 GitCode 仓库名称',
45+
}),
46+
components.input.string('branch', {
47+
label: '仓库分支',
48+
placeholder: '请输入 GitCode 仓库分支',
49+
}),
50+
components.checkbox.group('event', {
51+
label: '推送事件',
52+
checkbox: [
53+
components.checkbox.create('event:push', {
54+
label: 'push',
55+
value: EventType.Push,
56+
}),
57+
components.checkbox.create('event:release', {
58+
label: 'release',
59+
value: EventType.Release,
60+
isDisabled: true,
61+
}),
62+
],
63+
}),
64+
],
65+
}),
66+
},
67+
),
2368
]
2469
}

packages/core/src/models/platform/gitee/web.ts

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Config } from '@/common'
2+
import { EventType } from '@/types'
3+
import { RepoInfo } from '@/types/web'
24
import { components } from 'node-karin'
35

4-
export const web = () => {
6+
export const web = (list: RepoInfo[]) => {
57
return [
68
components.accordion.create('gitee', {
79
label: 'Gitee 相关',
@@ -20,5 +22,49 @@ export const web = () => {
2022
}),
2123
],
2224
}),
25+
components.accordionPro.create(
26+
'pushlist:gitee',
27+
list.map((repo) => {
28+
return {
29+
title: `${repo.owner}/${repo.repo}:${repo.branch}`,
30+
...repo,
31+
}
32+
}),
33+
{
34+
label: 'Gitee 推送仓库列表',
35+
children: components.accordion.createItem('accordion-item-gitee', {
36+
subtitle: 'Gitee 仓库',
37+
children: [
38+
components.input.string('owner', {
39+
label: '仓库所有者',
40+
placeholder: '请输入 Gitee 仓库所有者',
41+
}),
42+
components.input.string('repo', {
43+
label: '仓库名称',
44+
placeholder: '请输入 Gitee 仓库名称',
45+
}),
46+
components.input.string('branch', {
47+
label: '仓库分支',
48+
placeholder: '请输入 Gitee 仓库分支',
49+
isRequired: true
50+
}),
51+
components.checkbox.group('event', {
52+
label: '推送事件',
53+
checkbox: [
54+
components.checkbox.create('event:push', {
55+
label: 'push',
56+
value: EventType.Push,
57+
}),
58+
components.checkbox.create('event:release', {
59+
label: 'release',
60+
value: EventType.Release,
61+
isDisabled: true,
62+
}),
63+
],
64+
}),
65+
],
66+
}),
67+
},
68+
),
2369
]
2470
}

packages/core/src/models/platform/github/web.ts

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Config } from '@/common'
22
import { components } from 'node-karin'
3+
import { RepoInfo } from '@/types/web'
4+
import { EventType } from '@/types'
35

4-
export const web = () => {
6+
export const web = (list: RepoInfo[]) => {
57
return [
68
components.accordion.create('github', {
79
label: 'Github 相关',
@@ -20,5 +22,56 @@ export const web = () => {
2022
}),
2123
],
2224
}),
25+
components.accordionPro.create(
26+
'pushlist:github',
27+
list.map((repo) => {
28+
return {
29+
title: `${repo.owner}/${repo.repo}:${repo.branch}`,
30+
subtitle: `${repo.botId}:${repo.groupId}`,
31+
...repo,
32+
}
33+
}),
34+
{
35+
label: 'Github 推送仓库列表',
36+
children: components.accordion.createItem('accordion-item-github', {
37+
children: [
38+
components.input.string('owner', {
39+
label: '仓库所有者',
40+
placeholder: '请输入 Github 仓库所有者',
41+
}),
42+
components.input.string('repo', {
43+
label: '仓库名称',
44+
placeholder: '请输入 Github 仓库名称',
45+
}),
46+
components.input.string('branch', {
47+
label: '仓库分支',
48+
placeholder: '请输入 Github 仓库分支',
49+
}),
50+
components.input.string('botId', {
51+
label: '推送机器人',
52+
placeholder: '请输入 推送机器人账号',
53+
}),
54+
components.input.string('groupId', {
55+
label: '推送群组',
56+
placeholder: '请输入 推送群组ID',
57+
}),
58+
components.checkbox.group('event', {
59+
label: '推送事件',
60+
checkbox: [
61+
components.checkbox.create('event:push', {
62+
label: 'push',
63+
value: EventType.Push,
64+
}),
65+
components.checkbox.create('event:release', {
66+
label: 'release',
67+
value: EventType.Release,
68+
isDisabled: true,
69+
}),
70+
],
71+
}),
72+
],
73+
}),
74+
},
75+
),
2376
]
2477
}

packages/core/src/types/web.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { EventType } from './index'
2+
3+
export interface RepoInfo {
4+
owner: string
5+
repo: string
6+
botId: string
7+
groupId: string
8+
branch: string
9+
event: EventType[]
10+
}

0 commit comments

Comments
 (0)