plugin-git-manager 1.2.14 → 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.
Files changed (61) hide show
  1. package/dist/client/156.c27c2392746e7866.js +10 -0
  2. package/dist/client/434.1d19d4d6acc114f1.js +10 -0
  3. package/dist/client/900.ee2fa037aff389e2.js +10 -0
  4. package/dist/client/index.js +1 -1
  5. package/dist/client-v2/356.11ed4f8d56a6c08a.js +10 -0
  6. package/dist/client-v2/434.f8836ea116648de1.js +10 -0
  7. package/dist/client-v2/900.bef1c41d267e50c5.js +10 -0
  8. package/dist/client-v2/index.js +1 -1
  9. package/dist/externalVersion.js +8 -7
  10. package/dist/locale/en-US.json +73 -2
  11. package/dist/locale/vi-VN.json +72 -1
  12. package/dist/locale/zh-CN.json +49 -0
  13. package/dist/server/actions/git-actions.js +31 -15
  14. package/dist/server/actions/gitlab-api.js +46 -20
  15. package/dist/server/actions/review.js +13 -10
  16. package/dist/server/actions/subtree.js +430 -0
  17. package/dist/server/collections/gitAccounts.js +86 -0
  18. package/dist/server/collections/gitRepositories.js +11 -10
  19. package/dist/server/collections/gitSubtreeConfigs.js +67 -0
  20. package/dist/server/collections/gitSubtreeRuns.js +60 -0
  21. package/dist/server/migrations/20260712000000-add-git-accounts.js +186 -0
  22. package/dist/server/plugin.js +76 -12
  23. package/dist/server/poller.js +12 -24
  24. package/dist/server/utils/get-repo-account.js +49 -0
  25. package/package.json +1 -1
  26. package/src/client/components/CommitHistory.tsx +21 -5
  27. package/src/client/components/GitAccounts.tsx +179 -0
  28. package/src/client/components/GitManagerSettings.tsx +10 -6
  29. package/src/client/components/GitOperations.tsx +27 -18
  30. package/src/client/components/LLMModelSelect.tsx +2 -2
  31. package/src/client/components/MarkdownView.tsx +1 -4
  32. package/src/client/components/MergeRequests.tsx +238 -129
  33. package/src/client/components/PollingStatus.tsx +10 -5
  34. package/src/client/components/RepositoryConfig.tsx +32 -14
  35. package/src/client/components/RepositoryPermissions.tsx +1 -8
  36. package/src/client/index.tsx +11 -0
  37. package/src/client-v2/components/SubtreeSplits.tsx +503 -0
  38. package/src/client-v2/locale.ts +8 -0
  39. package/src/client-v2/plugin.tsx +12 -5
  40. package/src/locale/en-US.json +73 -2
  41. package/src/locale/vi-VN.json +72 -1
  42. package/src/locale/zh-CN.json +49 -0
  43. package/src/server/__tests__/smoke.test.ts +1 -1
  44. package/src/server/__tests__/subtree.test.ts +73 -0
  45. package/src/server/actions/git-actions.ts +40 -19
  46. package/src/server/actions/gitlab-api.ts +59 -28
  47. package/src/server/actions/review.ts +13 -10
  48. package/src/server/actions/role-permissions.ts +2 -1
  49. package/src/server/actions/subtree.ts +460 -0
  50. package/src/server/collections/gitAccounts.ts +56 -0
  51. package/src/server/collections/gitRepositories.ts +11 -10
  52. package/src/server/collections/gitSubtreeConfigs.ts +37 -0
  53. package/src/server/collections/gitSubtreeRuns.ts +30 -0
  54. package/src/server/migrations/20260712000000-add-git-accounts.ts +198 -0
  55. package/src/server/plugin.ts +79 -5
  56. package/src/server/poller.ts +31 -32
  57. package/src/server/utils/get-repo-account.ts +23 -0
  58. package/dist/client/434.f82454801cf84906.js +0 -10
  59. package/dist/client/900.ec1fa7f16eb8cce6.js +0 -10
  60. package/dist/client-v2/434.c2f944f911a56da0.js +0 -10
  61. package/dist/client-v2/900.7a5e80bf21feda66.js +0 -10
@@ -0,0 +1,503 @@
1
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
+ import {
3
+ Alert,
4
+ AutoComplete,
5
+ Button,
6
+ Card,
7
+ Descriptions,
8
+ Form,
9
+ Input,
10
+ Modal,
11
+ Popconfirm,
12
+ Radio,
13
+ Select,
14
+ Space,
15
+ Switch,
16
+ Table,
17
+ Tag,
18
+ Typography,
19
+ message,
20
+ } from 'antd';
21
+ import { DeleteOutlined, EditOutlined, HistoryOutlined, PlayCircleOutlined, PlusOutlined } from '@ant-design/icons';
22
+ import { useFlowContext } from '@nocobase/flow-engine';
23
+ import { useT } from '../locale';
24
+
25
+ type SubtreePolicy = 'fastForward' | 'replace' | 'merge';
26
+
27
+ interface RepositoryItem {
28
+ id: number;
29
+ name: string;
30
+ }
31
+
32
+ interface SubtreeConfig {
33
+ id: number;
34
+ name: string;
35
+ repositoryId: number;
36
+ sourceBranch: string;
37
+ sourcePrefix: string;
38
+ targetBranch: string;
39
+ remoteName: string;
40
+ defaultPolicy: SubtreePolicy;
41
+ pushAfterRun: boolean;
42
+ enabled: boolean;
43
+ lastStatus?: string;
44
+ lastRunAt?: string;
45
+ }
46
+
47
+ type ConfigFormValues = Omit<SubtreeConfig, 'id' | 'lastStatus' | 'lastRunAt'>;
48
+
49
+ interface PreviewResult {
50
+ sourceSha: string;
51
+ splitSha: string;
52
+ targetExists: boolean;
53
+ targetSha: string | null;
54
+ relationship: 'target-missing' | 'already-up-to-date' | 'fast-forward' | 'diverged';
55
+ recommendedPolicy: SubtreePolicy;
56
+ }
57
+
58
+ interface OptionsResult {
59
+ branches: string[];
60
+ folders: string[];
61
+ }
62
+
63
+ interface SubtreeRun {
64
+ id: number;
65
+ policy: SubtreePolicy;
66
+ executionMode: 'app';
67
+ status: string;
68
+ sourceSha?: string;
69
+ splitSha?: string;
70
+ targetBeforeSha?: string;
71
+ targetAfterSha?: string;
72
+ startedAt: string;
73
+ finishedAt?: string;
74
+ error?: string;
75
+ }
76
+
77
+ function errorMessage(error: unknown): string {
78
+ if (error && typeof error === 'object') {
79
+ const response = 'response' in error ? error.response : undefined;
80
+ if (response && typeof response === 'object' && 'data' in response) {
81
+ const data = response.data;
82
+ if (data && typeof data === 'object' && 'errors' in data && Array.isArray(data.errors)) {
83
+ const first = data.errors[0];
84
+ if (first && typeof first === 'object' && 'message' in first && typeof first.message === 'string') {
85
+ return first.message;
86
+ }
87
+ }
88
+ }
89
+ if ('message' in error && typeof error.message === 'string') return error.message;
90
+ }
91
+ return String(error);
92
+ }
93
+
94
+ export default function SubtreeSplits() {
95
+ const ctx = useFlowContext();
96
+ const t = useT();
97
+ const [form] = Form.useForm<ConfigFormValues>();
98
+ const [configs, setConfigs] = useState<SubtreeConfig[]>([]);
99
+ const [repositories, setRepositories] = useState<RepositoryItem[]>([]);
100
+ const [branches, setBranches] = useState<string[]>([]);
101
+ const [folders, setFolders] = useState<string[]>([]);
102
+ const [loading, setLoading] = useState(false);
103
+ const [saving, setSaving] = useState(false);
104
+ const [configOpen, setConfigOpen] = useState(false);
105
+ const [editing, setEditing] = useState<SubtreeConfig | null>(null);
106
+ const [runningConfig, setRunningConfig] = useState<SubtreeConfig | null>(null);
107
+ const [policy, setPolicy] = useState<SubtreePolicy>('fastForward');
108
+ const [pushAfterRun, setPushAfterRun] = useState(true);
109
+ const [preview, setPreview] = useState<PreviewResult | null>(null);
110
+ const [previewing, setPreviewing] = useState(false);
111
+ const [running, setRunning] = useState(false);
112
+ const [replaceConfirmation, setReplaceConfirmation] = useState('');
113
+ const [historyConfig, setHistoryConfig] = useState<SubtreeConfig | null>(null);
114
+ const [historyRuns, setHistoryRuns] = useState<SubtreeRun[]>([]);
115
+ const [historyLoading, setHistoryLoading] = useState(false);
116
+
117
+ const repositoryName = useMemo(
118
+ () => new Map(repositories.map((repository) => [repository.id, repository.name])),
119
+ [repositories],
120
+ );
121
+
122
+ const loadData = useCallback(async () => {
123
+ setLoading(true);
124
+ try {
125
+ const [configResponse, repositoryResponse] = await Promise.all([
126
+ ctx.api.request({ url: 'gitSubtreeConfigs:list', params: { pageSize: 200, sort: ['name'] } }),
127
+ ctx.api.request({ url: 'gitRepositories:list', params: { pageSize: 200, sort: ['name'] } }),
128
+ ]);
129
+ setConfigs((configResponse.data?.data || []) as SubtreeConfig[]);
130
+ setRepositories((repositoryResponse.data?.data || []) as RepositoryItem[]);
131
+ } catch (error) {
132
+ message.error(errorMessage(error));
133
+ } finally {
134
+ setLoading(false);
135
+ }
136
+ }, [ctx.api]);
137
+
138
+ useEffect(() => {
139
+ loadData();
140
+ }, [loadData]);
141
+
142
+ const loadOptions = async (repositoryId: number, sourceBranch?: string, remoteName = 'origin') => {
143
+ const response = await ctx.api.request({
144
+ url: 'gitManager:subtreeOptions',
145
+ params: { repositoryId, sourceBranch, remoteName },
146
+ });
147
+ const data = response.data?.data as OptionsResult;
148
+ setBranches(data?.branches || []);
149
+ setFolders(data?.folders || []);
150
+ };
151
+
152
+ const openCreate = () => {
153
+ setEditing(null);
154
+ setBranches([]);
155
+ setFolders([]);
156
+ form.resetFields();
157
+ form.setFieldsValue({ remoteName: 'origin', defaultPolicy: 'fastForward', pushAfterRun: true, enabled: true });
158
+ setConfigOpen(true);
159
+ };
160
+
161
+ const openEdit = async (config: SubtreeConfig) => {
162
+ setEditing(config);
163
+ form.setFieldsValue(config);
164
+ setConfigOpen(true);
165
+ try {
166
+ await loadOptions(config.repositoryId, config.sourceBranch, config.remoteName);
167
+ } catch (error) {
168
+ message.error(errorMessage(error));
169
+ }
170
+ };
171
+
172
+ const saveConfig = async () => {
173
+ const values = await form.validateFields();
174
+ setSaving(true);
175
+ try {
176
+ await ctx.api.request({
177
+ url: editing ? 'gitSubtreeConfigs:update' : 'gitSubtreeConfigs:create',
178
+ method: 'post',
179
+ params: editing ? { filterByTk: editing.id } : undefined,
180
+ data: values,
181
+ });
182
+ message.success(t(editing ? 'Subtree configuration updated' : 'Subtree configuration created'));
183
+ setConfigOpen(false);
184
+ await loadData();
185
+ } catch (error) {
186
+ message.error(errorMessage(error));
187
+ } finally {
188
+ setSaving(false);
189
+ }
190
+ };
191
+
192
+ const deleteConfig = async (id: number) => {
193
+ try {
194
+ await ctx.api.request({ url: 'gitSubtreeConfigs:destroy', method: 'post', params: { filterByTk: id } });
195
+ message.success(t('Deleted'));
196
+ await loadData();
197
+ } catch (error) {
198
+ message.error(errorMessage(error));
199
+ }
200
+ };
201
+
202
+ const openRun = (config: SubtreeConfig) => {
203
+ setRunningConfig(config);
204
+ setPolicy(config.defaultPolicy || 'fastForward');
205
+ setPushAfterRun(config.pushAfterRun !== false);
206
+ setPreview(null);
207
+ setReplaceConfirmation('');
208
+ };
209
+
210
+ const openHistory = async (config: SubtreeConfig) => {
211
+ setHistoryConfig(config);
212
+ setHistoryLoading(true);
213
+ try {
214
+ const response = await ctx.api.request({
215
+ url: 'gitSubtreeRuns:list',
216
+ params: { filter: { configId: config.id }, pageSize: 100, sort: ['-startedAt'] },
217
+ });
218
+ setHistoryRuns((response.data?.data || []) as SubtreeRun[]);
219
+ } catch (error) {
220
+ message.error(errorMessage(error));
221
+ } finally {
222
+ setHistoryLoading(false);
223
+ }
224
+ };
225
+
226
+ const previewRun = async () => {
227
+ if (!runningConfig) return;
228
+ setPreviewing(true);
229
+ try {
230
+ const response = await ctx.api.request({
231
+ url: 'gitManager:subtreePreview',
232
+ method: 'post',
233
+ data: { configId: runningConfig.id },
234
+ });
235
+ const data = response.data?.data as PreviewResult;
236
+ setPreview(data);
237
+ setPolicy(data.recommendedPolicy);
238
+ } catch (error) {
239
+ message.error(errorMessage(error));
240
+ } finally {
241
+ setPreviewing(false);
242
+ }
243
+ };
244
+
245
+ const runSubtree = async () => {
246
+ if (!runningConfig || !preview) return;
247
+ if (policy === 'replace' && replaceConfirmation !== runningConfig.targetBranch) return;
248
+ setRunning(true);
249
+ try {
250
+ await ctx.api.request({
251
+ url: policy === 'replace' ? 'gitManager:subtreeReplace' : 'gitManager:subtreeRun',
252
+ method: 'post',
253
+ data: {
254
+ configId: runningConfig.id,
255
+ policy,
256
+ push: pushAfterRun,
257
+ expectedTargetSha: preview.targetSha,
258
+ },
259
+ });
260
+ message.success(t('Subtree split completed'));
261
+ setRunningConfig(null);
262
+ await loadData();
263
+ } catch (error) {
264
+ message.error(errorMessage(error));
265
+ } finally {
266
+ setRunning(false);
267
+ }
268
+ };
269
+
270
+ const columns = [
271
+ { title: t('Name'), dataIndex: 'name', key: 'name' },
272
+ {
273
+ title: t('Repository'),
274
+ dataIndex: 'repositoryId',
275
+ key: 'repositoryId',
276
+ render: (repositoryId: number) => repositoryName.get(repositoryId) || repositoryId,
277
+ },
278
+ {
279
+ title: t('Source'),
280
+ key: 'source',
281
+ render: (_: unknown, config: SubtreeConfig) => `${config.sourceBranch}:${config.sourcePrefix}`,
282
+ },
283
+ { title: t('Target branch'), dataIndex: 'targetBranch', key: 'targetBranch' },
284
+ {
285
+ title: t('Last status'),
286
+ dataIndex: 'lastStatus',
287
+ key: 'lastStatus',
288
+ render: (status?: string) =>
289
+ status ? (
290
+ <Tag color={status === 'success' ? 'green' : status === 'conflict' ? 'orange' : 'red'}>{status}</Tag>
291
+ ) : (
292
+ '—'
293
+ ),
294
+ },
295
+ {
296
+ title: t('Actions'),
297
+ key: 'actions',
298
+ render: (_: unknown, config: SubtreeConfig) => (
299
+ <Space>
300
+ <Button icon={<PlayCircleOutlined />} size="small" disabled={!config.enabled} onClick={() => openRun(config)}>
301
+ {t('Run')}
302
+ </Button>
303
+ <Button icon={<EditOutlined />} size="small" onClick={() => openEdit(config)} aria-label={t('Edit')} />
304
+ <Button
305
+ icon={<HistoryOutlined />}
306
+ size="small"
307
+ onClick={() => openHistory(config)}
308
+ aria-label={t('Run history')}
309
+ />
310
+ <Popconfirm title={t('Delete this subtree configuration?')} onConfirm={() => deleteConfig(config.id)}>
311
+ <Button icon={<DeleteOutlined />} size="small" danger aria-label={t('Delete')} />
312
+ </Popconfirm>
313
+ </Space>
314
+ ),
315
+ },
316
+ ];
317
+
318
+ return (
319
+ <Card
320
+ title={t('Subtree Splits')}
321
+ extra={
322
+ <Button type="primary" icon={<PlusOutlined />} onClick={openCreate}>
323
+ {t('Add subtree configuration')}
324
+ </Button>
325
+ }
326
+ >
327
+ <Table rowKey="id" dataSource={configs} columns={columns} loading={loading} pagination={{ pageSize: 20 }} />
328
+
329
+ <Modal
330
+ title={editing ? t('Edit subtree configuration') : t('Add subtree configuration')}
331
+ open={configOpen}
332
+ onCancel={() => setConfigOpen(false)}
333
+ onOk={saveConfig}
334
+ confirmLoading={saving}
335
+ width={680}
336
+ destroyOnClose
337
+ >
338
+ <Form form={form} layout="vertical">
339
+ <Form.Item name="name" label={t('Name')} rules={[{ required: true }]}>
340
+ <Input />
341
+ </Form.Item>
342
+ <Form.Item name="repositoryId" label={t('Repository')} rules={[{ required: true }]}>
343
+ <Select
344
+ showSearch
345
+ optionFilterProp="label"
346
+ options={repositories.map((repository) => ({ value: repository.id, label: repository.name }))}
347
+ onChange={async (repositoryId: number) => {
348
+ form.setFieldsValue({ sourceBranch: undefined, sourcePrefix: undefined });
349
+ setFolders([]);
350
+ try {
351
+ await loadOptions(repositoryId, undefined, form.getFieldValue('remoteName'));
352
+ } catch (error) {
353
+ message.error(errorMessage(error));
354
+ }
355
+ }}
356
+ />
357
+ </Form.Item>
358
+ <Form.Item name="remoteName" label={t('Remote name')} rules={[{ required: true }]}>
359
+ <Input placeholder="origin" />
360
+ </Form.Item>
361
+ <Form.Item name="sourceBranch" label={t('Source branch')} rules={[{ required: true }]}>
362
+ <Select
363
+ showSearch
364
+ options={branches.map((branch) => ({ value: branch, label: branch }))}
365
+ onChange={async (sourceBranch: string) => {
366
+ form.setFieldValue('sourcePrefix', undefined);
367
+ const repositoryId = form.getFieldValue('repositoryId');
368
+ if (!repositoryId) return;
369
+ try {
370
+ await loadOptions(repositoryId, sourceBranch, form.getFieldValue('remoteName'));
371
+ } catch (error) {
372
+ message.error(errorMessage(error));
373
+ }
374
+ }}
375
+ />
376
+ </Form.Item>
377
+ <Form.Item name="sourcePrefix" label={t('Source folder')} rules={[{ required: true }]}>
378
+ <Select
379
+ showSearch
380
+ optionFilterProp="label"
381
+ options={folders.map((folder) => ({ value: folder, label: folder }))}
382
+ />
383
+ </Form.Item>
384
+ <Form.Item name="targetBranch" label={t('Target branch')} rules={[{ required: true }]}>
385
+ <AutoComplete options={branches.map((branch) => ({ value: branch }))} />
386
+ </Form.Item>
387
+ <Form.Item name="defaultPolicy" label={t('Default policy')} rules={[{ required: true }]}>
388
+ <Select
389
+ options={[
390
+ { value: 'fastForward', label: t('Fast-forward only') },
391
+ { value: 'replace', label: t('Replace target') },
392
+ { value: 'merge', label: t('Merge histories') },
393
+ ]}
394
+ />
395
+ </Form.Item>
396
+ <Form.Item name="pushAfterRun" label={t('Push after run')} valuePropName="checked">
397
+ <Switch />
398
+ </Form.Item>
399
+ <Form.Item name="enabled" label={t('Enabled')} valuePropName="checked">
400
+ <Switch />
401
+ </Form.Item>
402
+ </Form>
403
+ </Modal>
404
+
405
+ <Modal
406
+ title={t('Run subtree split')}
407
+ open={!!runningConfig}
408
+ onCancel={() => setRunningConfig(null)}
409
+ onOk={runSubtree}
410
+ okText={t('Run')}
411
+ okButtonProps={{
412
+ disabled: !preview || (policy === 'replace' && replaceConfirmation !== runningConfig?.targetBranch),
413
+ }}
414
+ confirmLoading={running}
415
+ width={720}
416
+ >
417
+ {runningConfig && (
418
+ <Space direction="vertical" size="middle" style={{ width: '100%' }}>
419
+ <Descriptions size="small" bordered column={1}>
420
+ <Descriptions.Item label={t('Source')}>
421
+ {runningConfig.sourceBranch}:{runningConfig.sourcePrefix}
422
+ </Descriptions.Item>
423
+ <Descriptions.Item label={t('Target branch')}>{runningConfig.targetBranch}</Descriptions.Item>
424
+ </Descriptions>
425
+ <Button onClick={previewRun} loading={previewing}>
426
+ {t('Preview')}
427
+ </Button>
428
+ {preview && (
429
+ <Alert
430
+ type={preview.relationship === 'diverged' ? 'warning' : 'info'}
431
+ showIcon
432
+ message={t(`Subtree relationship: ${preview.relationship}`)}
433
+ description={`${preview.targetSha || t('Target branch does not exist')} → ${preview.splitSha}`}
434
+ />
435
+ )}
436
+ <Radio.Group value={policy} onChange={(event) => setPolicy(event.target.value as SubtreePolicy)}>
437
+ <Space direction="vertical">
438
+ <Radio value="fastForward">{t('Fast-forward only')}</Radio>
439
+ <Radio value="replace">{t('Replace target')}</Radio>
440
+ <Radio value="merge">{t('Merge histories')}</Radio>
441
+ </Space>
442
+ </Radio.Group>
443
+ {policy === 'replace' && (
444
+ <Alert
445
+ type="error"
446
+ showIcon
447
+ message={t('Replace target may discard target-only commits')}
448
+ description={
449
+ <Space direction="vertical" style={{ width: '100%' }}>
450
+ <Typography.Text>{t('Type the target branch name to confirm')}</Typography.Text>
451
+ <Input
452
+ value={replaceConfirmation}
453
+ onChange={(event) => setReplaceConfirmation(event.target.value)}
454
+ />
455
+ </Space>
456
+ }
457
+ />
458
+ )}
459
+ <Space>
460
+ <Switch checked={pushAfterRun} onChange={setPushAfterRun} />
461
+ <Typography.Text>{t('Push target branch after success')}</Typography.Text>
462
+ </Space>
463
+ </Space>
464
+ )}
465
+ </Modal>
466
+
467
+ <Modal
468
+ title={`${t('Run history')}: ${historyConfig?.name || ''}`}
469
+ open={!!historyConfig}
470
+ onCancel={() => setHistoryConfig(null)}
471
+ footer={null}
472
+ width={1000}
473
+ >
474
+ <Table
475
+ rowKey="id"
476
+ loading={historyLoading}
477
+ dataSource={historyRuns}
478
+ pagination={{ pageSize: 10 }}
479
+ columns={[
480
+ {
481
+ title: t('Started at'),
482
+ dataIndex: 'startedAt',
483
+ render: (value: string) => new Date(value).toLocaleString(),
484
+ },
485
+ { title: t('Policy'), dataIndex: 'policy' },
486
+ { title: t('Execution mode'), dataIndex: 'executionMode', render: () => t('App process') },
487
+ {
488
+ title: t('Status'),
489
+ dataIndex: 'status',
490
+ render: (value: string) => (
491
+ <Tag color={value === 'success' ? 'green' : value === 'conflict' ? 'orange' : 'red'}>{value}</Tag>
492
+ ),
493
+ },
494
+ { title: t('Split SHA'), dataIndex: 'splitSha', ellipsis: true },
495
+ { title: t('Target before'), dataIndex: 'targetBeforeSha', ellipsis: true },
496
+ { title: t('Target after'), dataIndex: 'targetAfterSha', ellipsis: true },
497
+ { title: t('Error'), dataIndex: 'error', ellipsis: true },
498
+ ]}
499
+ />
500
+ </Modal>
501
+ </Card>
502
+ );
503
+ }
@@ -0,0 +1,8 @@
1
+ import { useFlowEngine } from '@nocobase/flow-engine';
2
+ import packageJson from '../../package.json';
3
+
4
+ export function useT() {
5
+ const engine = useFlowEngine();
6
+ return (key: string, options?: Record<string, unknown>) =>
7
+ engine.context.t(key, { ns: [packageJson.name, 'client'], ...options }) as string;
8
+ }
@@ -1,5 +1,4 @@
1
1
  import { Plugin, Application } from '@nocobase/client-v2';
2
- import React from 'react';
3
2
 
4
3
  export class PluginGitManagerClient extends Plugin<Record<string, never>, Application> {
5
4
  async load() {
@@ -7,7 +6,14 @@ export class PluginGitManagerClient extends Plugin<Record<string, never>, Applic
7
6
  key: 'git-manager',
8
7
  title: this.t('Git Manager'),
9
8
  icon: 'BranchesOutlined',
10
-
9
+ });
10
+
11
+ this.pluginSettingsManager.addPageTabItem({
12
+ menuKey: 'git-manager',
13
+ key: 'subtree-splits',
14
+ title: this.t('Subtree Splits'),
15
+ aclSnippet: 'pm.plugin-git-manager.write',
16
+ componentLoader: () => import('./components/SubtreeSplits'),
11
17
  });
12
18
 
13
19
  this.pluginSettingsManager.addPageTabItem({
@@ -15,7 +21,8 @@ export class PluginGitManagerClient extends Plugin<Record<string, never>, Applic
15
21
  key: 'repositories',
16
22
  title: this.t('Repositories'),
17
23
  aclSnippet: 'pm.plugin-git-manager.repositories',
18
- componentLoader: () => import('../client/components/RepositoryConfig').then(m => ({ default: m.RepositoryConfig })),
24
+ componentLoader: () =>
25
+ import('../client/components/RepositoryConfig').then((m) => ({ default: m.RepositoryConfig })),
19
26
  });
20
27
 
21
28
  this.pluginSettingsManager.addPageTabItem({
@@ -23,9 +30,9 @@ export class PluginGitManagerClient extends Plugin<Record<string, never>, Applic
23
30
  key: 'manage',
24
31
  title: this.t('Manage'),
25
32
  aclSnippet: 'pm.plugin-git-manager.manage',
26
- componentLoader: () => import('../client/components/GitManagerSettings').then(m => ({ default: m.GitManagerSettings })),
33
+ componentLoader: () =>
34
+ import('../client/components/GitManagerSettings').then((m) => ({ default: m.GitManagerSettings })),
27
35
  });
28
-
29
36
  }
30
37
  }
31
38
 
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "Git Manager": "Git Manager",
3
+ "Git Accounts": "Git Accounts",
4
+ "Git Account": "Git Account",
3
5
  "Repositories": "Repositories",
4
6
  "File Explorer": "File Explorer",
5
7
  "History": "History",
@@ -97,7 +99,6 @@
97
99
  "Branch Filter (regex, optional)": "Branch Filter (regex, optional)",
98
100
  "Additional Instructions (optional)": "Additional Instructions (optional)",
99
101
  "Extra guidance appended to every review prompt": "Extra guidance appended to every review prompt",
100
- "Enabled": "Enabled",
101
102
  "Disabled": "Disabled",
102
103
  "Name": "Name",
103
104
  "e.g. Default review flow": "e.g. Default review flow",
@@ -220,5 +221,75 @@
220
221
  "MR": "MR",
221
222
  "COMMIT": "Commit",
222
223
  "BRANCH": "Branch",
223
- "FOLDER": "Folder"
224
+ "FOLDER": "Folder",
225
+ "Add Account": "Add Account",
226
+ "Edit Account": "Edit Account",
227
+ "Account Name": "Account Name",
228
+ "Account updated": "Account updated",
229
+ "Account added": "Account added",
230
+ "Delete this account?": "Delete this account?",
231
+ "Provider": "Provider",
232
+ "Base URL": "Base URL",
233
+ "Leave empty for gitlab.com or github.com": "Leave empty for gitlab.com or github.com",
234
+ "Leave empty to keep current": "Leave empty to keep current",
235
+ "Please select a Git account": "Please select a Git account",
236
+ "Select the GitLab or GitHub account to use for this repository": "Select the GitLab or GitHub account to use for this repository",
237
+ "Select an account": "Select an account",
238
+ "No accounts configured. Add one in the Git Accounts tab.": "No accounts configured. Add one in the Git Accounts tab.",
239
+ "None": "None",
240
+ "e.g. Company GitLab": "e.g. Company GitLab",
241
+ "Cannot delete this Git account because {{count}} repositories are using it": "Cannot delete this Git account because {{count}} repositories are using it",
242
+ "Subtree Splits": "Subtree Splits",
243
+ "Add subtree configuration": "Add subtree configuration",
244
+ "Edit subtree configuration": "Edit subtree configuration",
245
+ "Subtree configuration created": "Subtree configuration created",
246
+ "Subtree configuration updated": "Subtree configuration updated",
247
+ "Delete this subtree configuration?": "Delete this subtree configuration?",
248
+ "Source": "Source",
249
+ "Source branch": "Source branch",
250
+ "Source folder": "Source folder",
251
+ "Target branch": "Target branch",
252
+ "Remote name": "Remote name",
253
+ "Default policy": "Default policy",
254
+ "Push after run": "Push after run",
255
+ "Enabled": "Enabled",
256
+ "Last status": "Last status",
257
+ "Actions": "Actions",
258
+ "Run": "Run",
259
+ "Run subtree split": "Run subtree split",
260
+ "Preview": "Preview",
261
+ "Fast-forward only": "Fast-forward only",
262
+ "Replace target": "Replace target",
263
+ "Merge histories": "Merge histories",
264
+ "Replace target may discard target-only commits": "Replace target may discard target-only commits",
265
+ "Type the target branch name to confirm": "Type the target branch name to confirm",
266
+ "Push target branch after success": "Push target branch after success",
267
+ "Target branch does not exist": "Target branch does not exist",
268
+ "Subtree split completed": "Subtree split completed",
269
+ "Subtree relationship: target-missing": "Target branch does not exist",
270
+ "Subtree relationship: already-up-to-date": "Target branch is already up to date",
271
+ "Subtree relationship: fast-forward": "Target branch can be fast-forwarded",
272
+ "Subtree relationship: diverged": "Target branch has diverged",
273
+ "Source folder must be a non-empty relative path": "Source folder must be a non-empty relative path",
274
+ "Source folder contains an invalid path segment": "Source folder contains an invalid path segment",
275
+ "Invalid Git remote name": "Invalid Git remote name",
276
+ "Invalid subtree update policy": "Invalid subtree update policy",
277
+ "Source branch and target branch must be different": "Source branch and target branch must be different",
278
+ "Repository working tree must be clean before running a subtree split": "Repository working tree must be clean before running a subtree split",
279
+ "Source branch was not found on the configured remote": "Source branch was not found on the configured remote",
280
+ "Source folder was not found in the selected source branch": "Source folder was not found in the selected source branch",
281
+ "Selected source path is not a folder": "Selected source path is not a folder",
282
+ "Git subtree split did not return a valid commit": "Git subtree split did not return a valid commit",
283
+ "Target branch cannot be fast-forwarded to the new subtree commit": "Target branch cannot be fast-forwarded to the new subtree commit",
284
+ "Replace policy requires the preview target SHA": "Replace policy requires the preview target SHA",
285
+ "Target branch changed after preview; run preview again": "Target branch changed after preview; run preview again",
286
+ "Replace policy requires the destructive subtree permission": "Replace policy requires the destructive subtree permission",
287
+ "Run history": "Run history",
288
+ "Started at": "Started at",
289
+ "Policy": "Policy",
290
+ "Split SHA": "Split SHA",
291
+ "Target before": "Target before",
292
+ "Target after": "Target after"
293
+ ,"Execution mode": "Execution mode"
294
+ ,"App process": "App process"
224
295
  }