plugin-git-manager 1.2.13 → 1.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/156.c27c2392746e7866.js +10 -0
- package/dist/client/434.1d19d4d6acc114f1.js +10 -0
- package/dist/client/900.ee2fa037aff389e2.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/356.11ed4f8d56a6c08a.js +10 -0
- package/dist/client-v2/434.f8836ea116648de1.js +10 -0
- package/dist/client-v2/900.bef1c41d267e50c5.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +8 -7
- package/dist/locale/en-US.json +73 -2
- package/dist/locale/vi-VN.json +72 -1
- package/dist/locale/zh-CN.json +49 -0
- package/dist/server/actions/git-actions.js +32 -16
- package/dist/server/actions/gitlab-api.js +46 -20
- package/dist/server/actions/review.js +13 -10
- package/dist/server/actions/subtree.js +430 -0
- package/dist/server/collections/gitAccounts.js +86 -0
- package/dist/server/collections/gitRepositories.js +11 -10
- package/dist/server/collections/gitSubtreeConfigs.js +67 -0
- package/dist/server/collections/gitSubtreeRuns.js +60 -0
- package/dist/server/migrations/20260712000000-add-git-accounts.js +186 -0
- package/dist/server/plugin.js +76 -12
- package/dist/server/poller.js +12 -24
- package/dist/server/utils/get-repo-account.js +49 -0
- package/package.json +1 -1
- package/src/client/components/CommitHistory.tsx +21 -5
- package/src/client/components/GitAccounts.tsx +179 -0
- package/src/client/components/GitManagerSettings.tsx +10 -6
- package/src/client/components/GitOperations.tsx +27 -18
- package/src/client/components/LLMModelSelect.tsx +2 -2
- package/src/client/components/MarkdownView.tsx +1 -4
- package/src/client/components/MergeRequests.tsx +238 -129
- package/src/client/components/PollingStatus.tsx +10 -5
- package/src/client/components/RepositoryConfig.tsx +32 -14
- package/src/client/components/RepositoryPermissions.tsx +1 -8
- package/src/client/index.tsx +11 -0
- package/src/client-v2/components/SubtreeSplits.tsx +503 -0
- package/src/client-v2/locale.ts +8 -0
- package/src/client-v2/plugin.tsx +12 -5
- package/src/locale/en-US.json +73 -2
- package/src/locale/vi-VN.json +72 -1
- package/src/locale/zh-CN.json +49 -0
- package/src/server/__tests__/smoke.test.ts +1 -1
- package/src/server/__tests__/subtree.test.ts +73 -0
- package/src/server/actions/git-actions.ts +41 -20
- package/src/server/actions/gitlab-api.ts +59 -28
- package/src/server/actions/review.ts +13 -10
- package/src/server/actions/role-permissions.ts +2 -1
- package/src/server/actions/subtree.ts +460 -0
- package/src/server/collections/gitAccounts.ts +56 -0
- package/src/server/collections/gitRepositories.ts +11 -10
- package/src/server/collections/gitSubtreeConfigs.ts +37 -0
- package/src/server/collections/gitSubtreeRuns.ts +30 -0
- package/src/server/migrations/20260712000000-add-git-accounts.ts +198 -0
- package/src/server/plugin.ts +79 -5
- package/src/server/poller.ts +31 -32
- package/src/server/utils/get-repo-account.ts +23 -0
- package/dist/client/434.f82454801cf84906.js +0 -10
- package/dist/client/900.ec1fa7f16eb8cce6.js +0 -10
- package/dist/client-v2/434.c2f944f911a56da0.js +0 -10
- package/dist/client-v2/900.7a5e80bf21feda66.js +0 -10
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import React, { useEffect, useState, useCallback, memo } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
Table,
|
|
4
|
-
|
|
3
|
+
Table,
|
|
4
|
+
Empty,
|
|
5
|
+
Spin,
|
|
6
|
+
Typography,
|
|
7
|
+
Tag,
|
|
8
|
+
Drawer,
|
|
9
|
+
Space,
|
|
10
|
+
Avatar,
|
|
11
|
+
Select,
|
|
12
|
+
Button,
|
|
13
|
+
Tooltip,
|
|
14
|
+
Input,
|
|
15
|
+
Badge,
|
|
16
|
+
Tabs,
|
|
17
|
+
Divider,
|
|
18
|
+
theme,
|
|
5
19
|
} from 'antd';
|
|
6
20
|
import {
|
|
7
21
|
MergeOutlined,
|
|
@@ -47,31 +61,34 @@ export const MergeRequests: React.FC = () => {
|
|
|
47
61
|
const [notes, setNotes] = useState<any[]>([]);
|
|
48
62
|
const [notesLoading, setNotesLoading] = useState(false);
|
|
49
63
|
|
|
50
|
-
const loadMergeRequests = useCallback(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
const loadMergeRequests = useCallback(
|
|
65
|
+
async (page = 1) => {
|
|
66
|
+
if (!selectedRepo) return;
|
|
67
|
+
setLoading(true);
|
|
68
|
+
try {
|
|
69
|
+
const { data } = await api.request({
|
|
70
|
+
url: 'gitManager:mergeRequests',
|
|
71
|
+
params: {
|
|
72
|
+
repositoryId: selectedRepo.id,
|
|
73
|
+
state: stateFilter,
|
|
74
|
+
search: searchText || undefined,
|
|
75
|
+
page,
|
|
76
|
+
perPage: 20,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
const responseData = data?.data || data;
|
|
80
|
+
setMergeRequestsList(responseData?.data || []);
|
|
81
|
+
if (responseData?.pagination) {
|
|
82
|
+
setPagination(responseData.pagination);
|
|
83
|
+
}
|
|
84
|
+
} catch (err: any) {
|
|
85
|
+
setMergeRequestsList([]);
|
|
86
|
+
} finally {
|
|
87
|
+
setLoading(false);
|
|
68
88
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
setLoading(false);
|
|
73
|
-
}
|
|
74
|
-
}, [api, selectedRepo, stateFilter, searchText]);
|
|
89
|
+
},
|
|
90
|
+
[api, selectedRepo, stateFilter, searchText],
|
|
91
|
+
);
|
|
75
92
|
|
|
76
93
|
useEffect(() => {
|
|
77
94
|
if (selectedRepo?.status === 'connected') {
|
|
@@ -127,7 +144,14 @@ export const MergeRequests: React.FC = () => {
|
|
|
127
144
|
const cfg = STATE_CONFIG[record.state] || STATE_CONFIG.opened;
|
|
128
145
|
return (
|
|
129
146
|
<Tooltip title={cfg.label}>
|
|
130
|
-
<span
|
|
147
|
+
<span
|
|
148
|
+
style={{
|
|
149
|
+
color:
|
|
150
|
+
token[`color${cfg.color === 'blue' ? 'Primary' : cfg.color === 'purple' ? 'PurpleText' : 'Error'}`] ||
|
|
151
|
+
cfg.color,
|
|
152
|
+
fontSize: 16,
|
|
153
|
+
}}
|
|
154
|
+
>
|
|
131
155
|
{cfg.icon}
|
|
132
156
|
</span>
|
|
133
157
|
</Tooltip>
|
|
@@ -141,7 +165,9 @@ export const MergeRequests: React.FC = () => {
|
|
|
141
165
|
<div>
|
|
142
166
|
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
|
143
167
|
{record.draft && (
|
|
144
|
-
<Tag color="default" style={{ fontSize: 11, lineHeight: '16px' }}>
|
|
168
|
+
<Tag color="default" style={{ fontSize: 11, lineHeight: '16px' }}>
|
|
169
|
+
DRAFT
|
|
170
|
+
</Tag>
|
|
145
171
|
)}
|
|
146
172
|
<Text strong style={{ fontSize: 13 }}>
|
|
147
173
|
{record.title}
|
|
@@ -189,10 +215,14 @@ export const MergeRequests: React.FC = () => {
|
|
|
189
215
|
render: (_: any, record: any) => (
|
|
190
216
|
<Space size={2} wrap>
|
|
191
217
|
{(record.labels || []).slice(0, 3).map((label: string) => (
|
|
192
|
-
<Tag key={label} style={{ fontSize: 11 }}>
|
|
218
|
+
<Tag key={label} style={{ fontSize: 11 }}>
|
|
219
|
+
{label}
|
|
220
|
+
</Tag>
|
|
193
221
|
))}
|
|
194
222
|
{record.labels?.length > 3 && (
|
|
195
|
-
<Text type="secondary" style={{ fontSize: 11 }}
|
|
223
|
+
<Text type="secondary" style={{ fontSize: 11 }}>
|
|
224
|
+
+{record.labels.length - 3}
|
|
225
|
+
</Text>
|
|
196
226
|
)}
|
|
197
227
|
</Space>
|
|
198
228
|
),
|
|
@@ -235,10 +265,24 @@ export const MergeRequests: React.FC = () => {
|
|
|
235
265
|
size="small"
|
|
236
266
|
/>
|
|
237
267
|
<Tooltip title={t('View Details')}>
|
|
238
|
-
<Button
|
|
268
|
+
<Button
|
|
269
|
+
size="small"
|
|
270
|
+
icon={<FileTextOutlined />}
|
|
271
|
+
onClick={(e) => {
|
|
272
|
+
e.stopPropagation();
|
|
273
|
+
openMRDetail(record);
|
|
274
|
+
}}
|
|
275
|
+
/>
|
|
239
276
|
</Tooltip>
|
|
240
277
|
<Tooltip title={t('Open in GitLab')}>
|
|
241
|
-
<Button
|
|
278
|
+
<Button
|
|
279
|
+
size="small"
|
|
280
|
+
icon={<ExportOutlined />}
|
|
281
|
+
onClick={(e) => {
|
|
282
|
+
e.stopPropagation();
|
|
283
|
+
window.open(record.webUrl, '_blank');
|
|
284
|
+
}}
|
|
285
|
+
/>
|
|
242
286
|
</Tooltip>
|
|
243
287
|
</Space>
|
|
244
288
|
),
|
|
@@ -308,17 +352,31 @@ export const MergeRequests: React.FC = () => {
|
|
|
308
352
|
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
|
309
353
|
{(() => {
|
|
310
354
|
const cfg = STATE_CONFIG[selectedMR.state] || STATE_CONFIG.opened;
|
|
311
|
-
return
|
|
355
|
+
return (
|
|
356
|
+
<Tag color={cfg.color}>
|
|
357
|
+
{cfg.icon} {cfg.label}
|
|
358
|
+
</Tag>
|
|
359
|
+
);
|
|
312
360
|
})()}
|
|
313
361
|
{selectedMR.draft && <Tag>DRAFT</Tag>}
|
|
314
|
-
<Text strong style={{ fontSize: 15 }}
|
|
362
|
+
<Text strong style={{ fontSize: 15 }}>
|
|
363
|
+
!{selectedMR.iid}
|
|
364
|
+
</Text>
|
|
315
365
|
</div>
|
|
316
|
-
<Text strong style={{ fontSize: 16, display: 'block', marginTop: 4 }}>
|
|
366
|
+
<Text strong style={{ fontSize: 16, display: 'block', marginTop: 4 }}>
|
|
367
|
+
{selectedMR.title}
|
|
368
|
+
</Text>
|
|
317
369
|
</div>
|
|
318
|
-
) :
|
|
370
|
+
) : (
|
|
371
|
+
t('Merge Request')
|
|
372
|
+
)
|
|
319
373
|
}
|
|
320
374
|
open={!!selectedMR}
|
|
321
|
-
onClose={() => {
|
|
375
|
+
onClose={() => {
|
|
376
|
+
setSelectedMR(null);
|
|
377
|
+
setMrDetail(null);
|
|
378
|
+
setNotes([]);
|
|
379
|
+
}}
|
|
322
380
|
width={900}
|
|
323
381
|
extra={
|
|
324
382
|
selectedMR && (
|
|
@@ -332,11 +390,7 @@ export const MergeRequests: React.FC = () => {
|
|
|
332
390
|
}}
|
|
333
391
|
size="small"
|
|
334
392
|
/>
|
|
335
|
-
<Button
|
|
336
|
-
type="link"
|
|
337
|
-
icon={<ExportOutlined />}
|
|
338
|
-
onClick={() => window.open(selectedMR.webUrl, '_blank')}
|
|
339
|
-
>
|
|
393
|
+
<Button type="link" icon={<ExportOutlined />} onClick={() => window.open(selectedMR.webUrl, '_blank')}>
|
|
340
394
|
{t('Open in GitLab')}
|
|
341
395
|
</Button>
|
|
342
396
|
</Space>
|
|
@@ -385,18 +439,24 @@ const MROverview: React.FC<{ mr: any }> = ({ mr }) => {
|
|
|
385
439
|
return (
|
|
386
440
|
<div>
|
|
387
441
|
{/* Branch info */}
|
|
388
|
-
<div
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
442
|
+
<div
|
|
443
|
+
style={{
|
|
444
|
+
padding: '12px 16px',
|
|
445
|
+
background: token.colorBgLayout,
|
|
446
|
+
borderRadius: 8,
|
|
447
|
+
marginBottom: 16,
|
|
448
|
+
display: 'flex',
|
|
449
|
+
alignItems: 'center',
|
|
450
|
+
gap: 8,
|
|
451
|
+
}}
|
|
452
|
+
>
|
|
453
|
+
<Tag color="blue">
|
|
454
|
+
<BranchesOutlined /> {mr.sourceBranch}
|
|
455
|
+
</Tag>
|
|
398
456
|
<span style={{ color: token.colorTextSecondary, fontSize: 16 }}>→</span>
|
|
399
|
-
<Tag color="green"
|
|
457
|
+
<Tag color="green">
|
|
458
|
+
<BranchesOutlined /> {mr.targetBranch}
|
|
459
|
+
</Tag>
|
|
400
460
|
{mr.hasConflicts && (
|
|
401
461
|
<Tag color="warning" icon={<ExclamationCircleOutlined />}>
|
|
402
462
|
{t('Has conflicts')}
|
|
@@ -408,82 +468,124 @@ const MROverview: React.FC<{ mr: any }> = ({ mr }) => {
|
|
|
408
468
|
{mr.description && (
|
|
409
469
|
<div style={{ marginBottom: 16 }}>
|
|
410
470
|
<Text strong>{t('Description')}</Text>
|
|
411
|
-
<div
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
471
|
+
<div
|
|
472
|
+
style={{
|
|
473
|
+
marginTop: 8,
|
|
474
|
+
padding: '12px 16px',
|
|
475
|
+
background: token.colorBgLayout,
|
|
476
|
+
borderRadius: 8,
|
|
477
|
+
whiteSpace: 'pre-wrap',
|
|
478
|
+
wordBreak: 'break-word',
|
|
479
|
+
fontSize: 13,
|
|
480
|
+
lineHeight: 1.6,
|
|
481
|
+
}}
|
|
482
|
+
>
|
|
421
483
|
{mr.description}
|
|
422
484
|
</div>
|
|
423
485
|
</div>
|
|
424
486
|
)}
|
|
425
487
|
|
|
426
488
|
{/* Metadata grid */}
|
|
427
|
-
<div
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
489
|
+
<div
|
|
490
|
+
style={{
|
|
491
|
+
display: 'grid',
|
|
492
|
+
gridTemplateColumns: '1fr 1fr',
|
|
493
|
+
gap: '12px 24px',
|
|
494
|
+
fontSize: 13,
|
|
495
|
+
}}
|
|
496
|
+
>
|
|
497
|
+
<MetaItem
|
|
498
|
+
label={t('Author')}
|
|
499
|
+
value={
|
|
500
|
+
mr.author && (
|
|
501
|
+
<Space size={6}>
|
|
502
|
+
<Avatar size="small" src={mr.author.avatarUrl}>
|
|
503
|
+
{mr.author.name?.[0]}
|
|
504
|
+
</Avatar>
|
|
505
|
+
<Text>{mr.author.name}</Text>
|
|
506
|
+
<Text type="secondary">@{mr.author.username}</Text>
|
|
507
|
+
</Space>
|
|
508
|
+
)
|
|
509
|
+
}
|
|
510
|
+
/>
|
|
442
511
|
|
|
443
|
-
<MetaItem
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
512
|
+
<MetaItem
|
|
513
|
+
label={t('Assignees')}
|
|
514
|
+
value={
|
|
515
|
+
mr.assignees?.length > 0 ? (
|
|
516
|
+
<Space size={4} wrap>
|
|
517
|
+
{mr.assignees.map((a: any) => (
|
|
518
|
+
<Tooltip key={a.username} title={a.name}>
|
|
519
|
+
<Tag
|
|
520
|
+
icon={
|
|
521
|
+
<Avatar size={14} src={a.avatarUrl}>
|
|
522
|
+
{a.name?.[0]}
|
|
523
|
+
</Avatar>
|
|
524
|
+
}
|
|
525
|
+
>
|
|
526
|
+
{a.name}
|
|
527
|
+
</Tag>
|
|
528
|
+
</Tooltip>
|
|
529
|
+
))}
|
|
530
|
+
</Space>
|
|
531
|
+
) : (
|
|
532
|
+
<Text type="secondary">—</Text>
|
|
533
|
+
)
|
|
534
|
+
}
|
|
535
|
+
/>
|
|
466
536
|
|
|
467
|
-
<MetaItem
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
537
|
+
<MetaItem
|
|
538
|
+
label={t('Reviewers')}
|
|
539
|
+
value={
|
|
540
|
+
mr.reviewers?.length > 0 ? (
|
|
541
|
+
<Space size={4} wrap>
|
|
542
|
+
{mr.reviewers.map((r: any) => (
|
|
543
|
+
<Tag key={r.username}>{r.name}</Tag>
|
|
544
|
+
))}
|
|
545
|
+
</Space>
|
|
546
|
+
) : (
|
|
547
|
+
<Text type="secondary">—</Text>
|
|
548
|
+
)
|
|
549
|
+
}
|
|
550
|
+
/>
|
|
551
|
+
|
|
552
|
+
<MetaItem
|
|
553
|
+
label={t('Labels')}
|
|
554
|
+
value={
|
|
555
|
+
mr.labels?.length > 0 ? (
|
|
556
|
+
<Space size={4} wrap>
|
|
557
|
+
{mr.labels.map((l: string) => (
|
|
558
|
+
<Tag key={l}>{l}</Tag>
|
|
559
|
+
))}
|
|
560
|
+
</Space>
|
|
561
|
+
) : (
|
|
562
|
+
<Text type="secondary">—</Text>
|
|
563
|
+
)
|
|
564
|
+
}
|
|
565
|
+
/>
|
|
474
566
|
|
|
475
567
|
<MetaItem label={t('Created')} value={<Text>{formatDateFull(mr.createdAt)}</Text>} />
|
|
476
568
|
<MetaItem label={t('Updated')} value={<Text>{formatDateFull(mr.updatedAt)}</Text>} />
|
|
477
569
|
|
|
478
570
|
{mr.mergedBy && (
|
|
479
|
-
<MetaItem
|
|
480
|
-
|
|
481
|
-
|
|
571
|
+
<MetaItem
|
|
572
|
+
label={t('Merged by')}
|
|
573
|
+
value={
|
|
574
|
+
<Text>
|
|
575
|
+
{mr.mergedBy.name} — {formatDateFull(mr.mergedAt)}
|
|
576
|
+
</Text>
|
|
577
|
+
}
|
|
578
|
+
/>
|
|
482
579
|
)}
|
|
483
580
|
{mr.closedBy && (
|
|
484
|
-
<MetaItem
|
|
485
|
-
|
|
486
|
-
|
|
581
|
+
<MetaItem
|
|
582
|
+
label={t('Closed by')}
|
|
583
|
+
value={
|
|
584
|
+
<Text>
|
|
585
|
+
{mr.closedBy.name} — {formatDateFull(mr.closedAt)}
|
|
586
|
+
</Text>
|
|
587
|
+
}
|
|
588
|
+
/>
|
|
487
589
|
)}
|
|
488
590
|
</div>
|
|
489
591
|
</div>
|
|
@@ -492,7 +594,9 @@ const MROverview: React.FC<{ mr: any }> = ({ mr }) => {
|
|
|
492
594
|
|
|
493
595
|
const MetaItem: React.FC<{ label: string; value: React.ReactNode }> = ({ label, value }) => (
|
|
494
596
|
<div>
|
|
495
|
-
<Text type="secondary" style={{ fontSize: 12, display: 'block', marginBottom: 2 }}>
|
|
597
|
+
<Text type="secondary" style={{ fontSize: 12, display: 'block', marginBottom: 2 }}>
|
|
598
|
+
{label}
|
|
599
|
+
</Text>
|
|
496
600
|
<div>{value}</div>
|
|
497
601
|
</div>
|
|
498
602
|
);
|
|
@@ -539,9 +643,7 @@ const MRChanges: React.FC<{ changes: any[] }> = ({ changes }) => {
|
|
|
539
643
|
</Text>
|
|
540
644
|
)}
|
|
541
645
|
</div>
|
|
542
|
-
{isExpanded && change.diff &&
|
|
543
|
-
<DiffViewer content={change.diff} />
|
|
544
|
-
)}
|
|
646
|
+
{isExpanded && change.diff && <DiffViewer content={change.diff} />}
|
|
545
647
|
</div>
|
|
546
648
|
);
|
|
547
649
|
})}
|
|
@@ -574,7 +676,9 @@ const MRNotes: React.FC<{ notes: any[] }> = ({ notes }) => {
|
|
|
574
676
|
<Avatar size="small" src={note.author?.avatarUrl}>
|
|
575
677
|
{note.author?.name?.[0]}
|
|
576
678
|
</Avatar>
|
|
577
|
-
<Text strong style={{ fontSize: 13 }}>
|
|
679
|
+
<Text strong style={{ fontSize: 13 }}>
|
|
680
|
+
{note.author?.name}
|
|
681
|
+
</Text>
|
|
578
682
|
<Text type="secondary" style={{ fontSize: 12 }}>
|
|
579
683
|
@{note.author?.username}
|
|
580
684
|
</Text>
|
|
@@ -639,14 +743,16 @@ const DiffViewer: React.FC<{ content: string }> = memo(({ content }) => {
|
|
|
639
743
|
minHeight: 20,
|
|
640
744
|
}}
|
|
641
745
|
>
|
|
642
|
-
<span
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
746
|
+
<span
|
|
747
|
+
style={{
|
|
748
|
+
display: 'inline-block',
|
|
749
|
+
width: 40,
|
|
750
|
+
color: token.colorTextQuaternary,
|
|
751
|
+
userSelect: 'none',
|
|
752
|
+
textAlign: 'right',
|
|
753
|
+
marginRight: 12,
|
|
754
|
+
}}
|
|
755
|
+
>
|
|
650
756
|
{i + 1}
|
|
651
757
|
</span>
|
|
652
758
|
{line}
|
|
@@ -675,7 +781,10 @@ function formatDate(dateStr: string): string {
|
|
|
675
781
|
function formatDateFull(dateStr: string): string {
|
|
676
782
|
if (!dateStr) return '';
|
|
677
783
|
return new Date(dateStr).toLocaleString('en-US', {
|
|
678
|
-
year: 'numeric',
|
|
679
|
-
|
|
784
|
+
year: 'numeric',
|
|
785
|
+
month: 'short',
|
|
786
|
+
day: 'numeric',
|
|
787
|
+
hour: '2-digit',
|
|
788
|
+
minute: '2-digit',
|
|
680
789
|
});
|
|
681
790
|
}
|
|
@@ -130,9 +130,7 @@ export const PollingStatus: React.FC = () => {
|
|
|
130
130
|
<Space direction="vertical" size={4} style={{ width: '100%' }}>
|
|
131
131
|
<Space>
|
|
132
132
|
<Text type="secondary">{t('Background poller')}:</Text>
|
|
133
|
-
<Tag color={status?.running ? 'green' : 'default'}>
|
|
134
|
-
{status?.running ? t('Running') : t('Stopped')}
|
|
135
|
-
</Tag>
|
|
133
|
+
<Tag color={status?.running ? 'green' : 'default'}>{status?.running ? t('Running') : t('Stopped')}</Tag>
|
|
136
134
|
{status?.polling && <Tag color="blue">{t('Polling now…')}</Tag>}
|
|
137
135
|
</Space>
|
|
138
136
|
<Space>
|
|
@@ -146,7 +144,9 @@ export const PollingStatus: React.FC = () => {
|
|
|
146
144
|
{status?.lastError && (
|
|
147
145
|
<Space>
|
|
148
146
|
<Text type="secondary">{t('Last error')}:</Text>
|
|
149
|
-
<Text type="danger" style={{ fontSize: 12 }}>
|
|
147
|
+
<Text type="danger" style={{ fontSize: 12 }}>
|
|
148
|
+
{status.lastError}
|
|
149
|
+
</Text>
|
|
150
150
|
</Space>
|
|
151
151
|
)}
|
|
152
152
|
</Space>
|
|
@@ -184,7 +184,12 @@ export const PollingStatus: React.FC = () => {
|
|
|
184
184
|
const flow = flows.find((item) => Number(item.id) === Number(flowId));
|
|
185
185
|
const fallback = flows.find((item) => item.repositoryId === record.id || item.repositoryId == null);
|
|
186
186
|
if (flow) return <Tag color="blue">{flow.name}</Tag>;
|
|
187
|
-
if (fallback)
|
|
187
|
+
if (fallback)
|
|
188
|
+
return (
|
|
189
|
+
<Tag color="default">
|
|
190
|
+
{t('Fallback')}: {fallback.name}
|
|
191
|
+
</Tag>
|
|
192
|
+
);
|
|
188
193
|
return <Tag color="red">{t('No matching flow available')}</Tag>;
|
|
189
194
|
},
|
|
190
195
|
},
|
|
@@ -14,6 +14,7 @@ export const RepositoryConfig: React.FC = () => {
|
|
|
14
14
|
const [form] = Form.useForm();
|
|
15
15
|
const [actionLoading, setActionLoading] = useState<string | null>(null);
|
|
16
16
|
const [reviewFlows, setReviewFlows] = useState<any[]>([]);
|
|
17
|
+
const [gitAccounts, setGitAccounts] = useState<any[]>([]);
|
|
17
18
|
|
|
18
19
|
const loadReviewFlows = useCallback(async () => {
|
|
19
20
|
const { data } = await api.request({
|
|
@@ -29,9 +30,15 @@ export const RepositoryConfig: React.FC = () => {
|
|
|
29
30
|
setReviewFlows(data?.data || []);
|
|
30
31
|
}, [api]);
|
|
31
32
|
|
|
33
|
+
const loadGitAccounts = useCallback(async () => {
|
|
34
|
+
const { data } = await api.request({ url: 'gitAccounts:list', params: { pageSize: 100 } });
|
|
35
|
+
setGitAccounts(data?.data || []);
|
|
36
|
+
}, [api]);
|
|
37
|
+
|
|
32
38
|
useEffect(() => {
|
|
33
39
|
loadReviewFlows().catch(() => undefined);
|
|
34
|
-
|
|
40
|
+
loadGitAccounts().catch(() => undefined);
|
|
41
|
+
}, [loadReviewFlows, loadGitAccounts]);
|
|
35
42
|
|
|
36
43
|
useEffect(() => {
|
|
37
44
|
refreshRepos().catch(() => undefined);
|
|
@@ -47,10 +54,6 @@ export const RepositoryConfig: React.FC = () => {
|
|
|
47
54
|
|
|
48
55
|
const handleSave = async () => {
|
|
49
56
|
const values = await form.validateFields();
|
|
50
|
-
// Don't send PAT if it's empty or the masked placeholder
|
|
51
|
-
if (editingRepo && (!values.pat || values.pat === '••••••••')) {
|
|
52
|
-
delete values.pat;
|
|
53
|
-
}
|
|
54
57
|
try {
|
|
55
58
|
if (editingRepo) {
|
|
56
59
|
await api.request({
|
|
@@ -109,6 +112,17 @@ export const RepositoryConfig: React.FC = () => {
|
|
|
109
112
|
render: (text: string, record: any) => <a onClick={() => setSelectedRepo(record)}>{text}</a>,
|
|
110
113
|
},
|
|
111
114
|
{ title: t('Repository URL'), dataIndex: 'repoUrl', key: 'repoUrl', ellipsis: true },
|
|
115
|
+
{
|
|
116
|
+
title: t('Git Account'),
|
|
117
|
+
dataIndex: 'gitAccountId',
|
|
118
|
+
key: 'gitAccountId',
|
|
119
|
+
width: 160,
|
|
120
|
+
render: (gitAccountId: number | null) => {
|
|
121
|
+
if (!gitAccountId) return <Tag>{t('None')}</Tag>;
|
|
122
|
+
const account = gitAccounts.find((acc) => acc.id === gitAccountId);
|
|
123
|
+
return account ? account.name : <Tag>{t('None')}</Tag>;
|
|
124
|
+
},
|
|
125
|
+
},
|
|
112
126
|
{ title: t('Local Path'), dataIndex: 'localPath', key: 'localPath', ellipsis: true },
|
|
113
127
|
{ title: t('Default Branch'), dataIndex: 'defaultBranch', key: 'defaultBranch', width: 120 },
|
|
114
128
|
{
|
|
@@ -216,7 +230,7 @@ export const RepositoryConfig: React.FC = () => {
|
|
|
216
230
|
size="small"
|
|
217
231
|
onClick={() => {
|
|
218
232
|
setEditingRepo(record);
|
|
219
|
-
form.setFieldsValue(
|
|
233
|
+
form.setFieldsValue(record);
|
|
220
234
|
setModalOpen(true);
|
|
221
235
|
}}
|
|
222
236
|
>
|
|
@@ -273,19 +287,23 @@ export const RepositoryConfig: React.FC = () => {
|
|
|
273
287
|
<Input placeholder="https://gitlab.com/user/repo.git" />
|
|
274
288
|
</Form.Item>
|
|
275
289
|
<Form.Item
|
|
276
|
-
name="
|
|
277
|
-
label={t('
|
|
278
|
-
rules={[{ required: true }]}
|
|
279
|
-
extra={t('GitLab
|
|
290
|
+
name="gitAccountId"
|
|
291
|
+
label={t('Git Account')}
|
|
292
|
+
rules={[{ required: true, message: t('Please select a Git account') }]}
|
|
293
|
+
extra={t('Select the GitLab or GitHub account to use for this repository')}
|
|
280
294
|
>
|
|
281
|
-
<
|
|
295
|
+
<Select
|
|
296
|
+
placeholder={t('Select an account')}
|
|
297
|
+
options={gitAccounts.map((acc) => ({
|
|
298
|
+
value: acc.id,
|
|
299
|
+
label: `${acc.name} (${acc.username})`,
|
|
300
|
+
}))}
|
|
301
|
+
notFoundContent={t('No accounts configured. Add one in the Git Accounts tab.')}
|
|
302
|
+
/>
|
|
282
303
|
</Form.Item>
|
|
283
304
|
<Form.Item name="localPath" label={t('Local Path')} rules={[{ required: true }]}>
|
|
284
305
|
<Input placeholder="my-project" />
|
|
285
306
|
</Form.Item>
|
|
286
|
-
<Form.Item name="pat" label={t('Personal Access Token')} rules={editingRepo ? [] : [{ required: true }]}>
|
|
287
|
-
<Input.Password placeholder={editingRepo ? 'Leave empty to keep current' : 'ghp_xxxx...'} />
|
|
288
|
-
</Form.Item>
|
|
289
307
|
<Form.Item name="defaultBranch" label={t('Default Branch')}>
|
|
290
308
|
<Input placeholder="main" />
|
|
291
309
|
</Form.Item>
|
|
@@ -117,14 +117,7 @@ export const RepositoryPermissions = ({ activeRole }) => {
|
|
|
117
117
|
<Typography.Text strong>{activeRole?.title || activeRole?.name}</Typography.Text>.
|
|
118
118
|
</Typography.Text>
|
|
119
119
|
</div>
|
|
120
|
-
<Table
|
|
121
|
-
dataSource={repositories}
|
|
122
|
-
columns={columns}
|
|
123
|
-
rowKey="id"
|
|
124
|
-
pagination={false}
|
|
125
|
-
size="small"
|
|
126
|
-
bordered
|
|
127
|
-
/>
|
|
120
|
+
<Table dataSource={repositories} columns={columns} rowKey="id" pagination={false} size="small" bordered />
|
|
128
121
|
</div>
|
|
129
122
|
);
|
|
130
123
|
};
|
package/src/client/index.tsx
CHANGED
|
@@ -10,6 +10,10 @@ const RepositoryConfig = React.lazy(() =>
|
|
|
10
10
|
import('./components/RepositoryConfig').then((m) => ({ default: m.RepositoryConfigSettings })),
|
|
11
11
|
);
|
|
12
12
|
|
|
13
|
+
const GitAccounts = React.lazy(() =>
|
|
14
|
+
import('./components/GitAccounts').then((m) => ({ default: m.GitAccountsSettings })),
|
|
15
|
+
);
|
|
16
|
+
|
|
13
17
|
import PluginACLClient from '@nocobase/plugin-acl/client';
|
|
14
18
|
import { RepositoryPermissions } from './components/RepositoryPermissions';
|
|
15
19
|
|
|
@@ -28,6 +32,13 @@ export class PluginGitManagerClient extends Plugin {
|
|
|
28
32
|
aclSnippet: `pm.plugin-git-manager.repositories`,
|
|
29
33
|
});
|
|
30
34
|
|
|
35
|
+
// Git Accounts — separate group for managing shared credentials
|
|
36
|
+
this.app.pluginSettingsManager.add('git-manager.accounts', {
|
|
37
|
+
title: (this as any).t('Git Accounts'),
|
|
38
|
+
Component: GitAccounts,
|
|
39
|
+
aclSnippet: `pm.plugin-git-manager.repositories`,
|
|
40
|
+
});
|
|
41
|
+
|
|
31
42
|
// Full management — requires full plugin permission
|
|
32
43
|
this.app.pluginSettingsManager.add('git-manager.manage', {
|
|
33
44
|
title: (this as any).t('Manage'),
|