plugin-git-manager 1.4.0 → 1.4.1
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/317.e7b1d59371812c30.js +10 -0
- package/dist/client/434.05d0ba2b821105dc.js +10 -0
- package/dist/client/453.cdcba6d2d0c9522b.js +10 -0
- package/dist/client/454.625da741a7e1161f.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/317.4e116f84ed9081b6.js +10 -0
- package/dist/client-v2/434.764113d20743a45b.js +10 -0
- package/dist/client-v2/453.5ab80c06d8e61a7e.js +10 -0
- package/dist/client-v2/454.b885b1d35ef7ff72.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/locale/en-US.json +12 -1
- package/dist/locale/vi-VN.json +12 -1
- package/dist/locale/zh-CN.json +12 -1
- package/dist/node_modules/simple-git/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/actions/git-actions.js +299 -87
- package/dist/server/actions/gitlab-api.js +19 -12
- package/dist/server/actions/subtree.js +20 -10
- package/dist/server/plugin.js +134 -10
- package/dist/server/repository-access.js +2 -2
- package/dist/server/request-method-policy.js +2 -1
- package/dist/server/services/review-source.js +2 -1
- package/dist/server/utils/cluster-git.js +181 -0
- package/package.json +2 -2
- package/src/client/__tests__/FileExplorerAndManage.test.tsx +236 -0
- package/src/client/__tests__/workflowRoutes.test.ts +3 -1
- package/src/client/components/CommitHistory.tsx +19 -7
- package/src/client/components/FileExplorer.tsx +80 -34
- package/src/client/components/GitManagerSettings.tsx +21 -5
- package/src/client/components/GitOperations.tsx +25 -4
- package/src/client/components/GitRuntimeBanner.tsx +97 -0
- package/src/client/components/RepositoryConfig.tsx +28 -6
- package/src/client/context/GitManagerContext.tsx +156 -13
- package/src/client/workflowRoutes.ts +11 -0
- package/src/locale/en-US.json +12 -1
- package/src/locale/vi-VN.json +12 -1
- package/src/locale/zh-CN.json +12 -1
- package/src/server/__tests__/git-actions.test.ts +329 -4
- package/src/server/__tests__/smoke.test.ts +32 -1
- package/src/server/actions/git-actions.ts +322 -96
- package/src/server/actions/gitlab-api.ts +20 -14
- package/src/server/actions/subtree.ts +23 -6
- package/src/server/plugin.ts +152 -3
- package/src/server/repository-access.ts +2 -2
- package/src/server/request-method-policy.ts +1 -0
- package/src/server/services/review-source.ts +3 -2
- package/src/server/utils/cluster-git.ts +209 -0
- package/dist/client/317.2d0d33871e24ee24.js +0 -10
- package/dist/client/434.2401f7257495b66e.js +0 -10
- package/dist/client/453.58657b9ba0904477.js +0 -10
- package/dist/client-v2/317.d2466574d00f94d0.js +0 -10
- package/dist/client-v2/434.32b0a07b821b9329.js +0 -10
- package/dist/client-v2/453.f9a0ec6d8e1bd1cc.js +0 -10
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Alert, Button, Progress, Space, message } from 'antd';
|
|
5
|
+
import { CloudDownloadOutlined, ReloadOutlined } from '@ant-design/icons';
|
|
6
|
+
import { useApp } from '@nocobase/client-v2';
|
|
7
|
+
import { useGitManager } from '../context/GitManagerContext';
|
|
8
|
+
import { useT } from '../locale';
|
|
9
|
+
import { clusterPackageInstallerHref } from '../workflowRoutes';
|
|
10
|
+
|
|
11
|
+
export const GitRuntimeBanner: React.FC = () => {
|
|
12
|
+
const t = useT();
|
|
13
|
+
const app = useApp();
|
|
14
|
+
const { gitRuntime, installingGit, installGitViaCluster, refreshRuntimeStatus } = useGitManager();
|
|
15
|
+
|
|
16
|
+
if (!gitRuntime?.checked || gitRuntime.gitAvailable) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const { clusterManager } = gitRuntime;
|
|
21
|
+
const isInstalling = clusterManager.status === 'running' || installingGit;
|
|
22
|
+
|
|
23
|
+
const handleInstall = async () => {
|
|
24
|
+
const ok = await installGitViaCluster();
|
|
25
|
+
if (ok) {
|
|
26
|
+
message.info(t('Git installation dispatched via Cluster Manager'));
|
|
27
|
+
} else {
|
|
28
|
+
message.error(t('Failed to start Git installation via Cluster Manager'));
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div role="status" aria-live="polite" style={{ marginBottom: 16 }}>
|
|
34
|
+
{isInstalling ? (
|
|
35
|
+
<Alert
|
|
36
|
+
type="info"
|
|
37
|
+
showIcon
|
|
38
|
+
message={t('Installing Git via Cluster Manager...')}
|
|
39
|
+
description={
|
|
40
|
+
<div>
|
|
41
|
+
<div>
|
|
42
|
+
{t(
|
|
43
|
+
'Local Git operations will unlock automatically as soon as Cluster Manager finishes installing git on this node.',
|
|
44
|
+
)}
|
|
45
|
+
</div>
|
|
46
|
+
{clusterManager.progressPercent > 0 && (
|
|
47
|
+
<Progress
|
|
48
|
+
percent={clusterManager.progressPercent}
|
|
49
|
+
size="small"
|
|
50
|
+
style={{ marginTop: 8, maxWidth: 360 }}
|
|
51
|
+
/>
|
|
52
|
+
)}
|
|
53
|
+
</div>
|
|
54
|
+
}
|
|
55
|
+
action={
|
|
56
|
+
<Button size="small" icon={<ReloadOutlined />} onClick={() => refreshRuntimeStatus()}>
|
|
57
|
+
{t('Refresh')}
|
|
58
|
+
</Button>
|
|
59
|
+
}
|
|
60
|
+
/>
|
|
61
|
+
) : (
|
|
62
|
+
<Alert
|
|
63
|
+
type="warning"
|
|
64
|
+
showIcon
|
|
65
|
+
message={t('Git CLI is not installed on this node yet')}
|
|
66
|
+
description={
|
|
67
|
+
clusterManager.available
|
|
68
|
+
? t(
|
|
69
|
+
'Git is managed separately via Cluster Manager. Install git now to enable File Explorer, Commit History, Operations, and Clone.',
|
|
70
|
+
)
|
|
71
|
+
: t('Install git in the app/worker container or set GIT_BINARY_PATH to use local repository features.')
|
|
72
|
+
}
|
|
73
|
+
action={
|
|
74
|
+
clusterManager.available ? (
|
|
75
|
+
<Space wrap>
|
|
76
|
+
<Button
|
|
77
|
+
type="primary"
|
|
78
|
+
size="small"
|
|
79
|
+
icon={<CloudDownloadOutlined />}
|
|
80
|
+
loading={installingGit}
|
|
81
|
+
onClick={handleInstall}
|
|
82
|
+
>
|
|
83
|
+
{t('Install Git via Cluster Manager')}
|
|
84
|
+
</Button>
|
|
85
|
+
<a href={clusterPackageInstallerHref(app)}>{t('Open Cluster Package Installer')}</a>
|
|
86
|
+
</Space>
|
|
87
|
+
) : (
|
|
88
|
+
<Button size="small" icon={<ReloadOutlined />} onClick={() => refreshRuntimeStatus()}>
|
|
89
|
+
{t('Refresh')}
|
|
90
|
+
</Button>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
/>
|
|
94
|
+
)}
|
|
95
|
+
</div>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
@@ -1,14 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
11
|
import { Table, Button, Modal, Form, Input, Space, Tag, Popconfirm, Switch, Tooltip, Select, message } from 'antd';
|
|
3
12
|
import { PlusOutlined, DeleteOutlined, LinkOutlined, RobotOutlined } from '@ant-design/icons';
|
|
4
13
|
import { useApp } from '@nocobase/client-v2';
|
|
5
14
|
import { GitManagerProvider, useGitManager } from '../context/GitManagerContext';
|
|
15
|
+
import { GitRuntimeBanner } from './GitRuntimeBanner';
|
|
16
|
+
import { gitManagerManageHref } from '../workflowRoutes';
|
|
6
17
|
import { useT } from '../locale';
|
|
7
18
|
|
|
8
19
|
export const RepositoryConfig: React.FC = () => {
|
|
9
20
|
const t = useT();
|
|
10
|
-
const
|
|
11
|
-
const
|
|
21
|
+
const app = useApp();
|
|
22
|
+
const api = app.apiClient;
|
|
23
|
+
const { repos, refreshRepos, selectedRepo, setSelectedRepo, gitRuntime, refreshRuntimeStatus } = useGitManager();
|
|
24
|
+
const gitAvailable = gitRuntime?.gitAvailable !== false;
|
|
12
25
|
const [modalOpen, setModalOpen] = useState(false);
|
|
13
26
|
const [editingRepo, setEditingRepo] = useState<any>(null);
|
|
14
27
|
const [form] = Form.useForm();
|
|
@@ -98,7 +111,10 @@ export const RepositoryConfig: React.FC = () => {
|
|
|
98
111
|
message.success(t('Clone successful'));
|
|
99
112
|
await refreshRepos();
|
|
100
113
|
} catch (err) {
|
|
101
|
-
|
|
114
|
+
const apiError = (err as { response?: { data?: { errors?: Array<{ message?: string }> } } })?.response?.data
|
|
115
|
+
?.errors?.[0]?.message;
|
|
116
|
+
message.error(apiError || t('Clone failed'));
|
|
117
|
+
refreshRuntimeStatus?.();
|
|
102
118
|
} finally {
|
|
103
119
|
setActionLoading(null);
|
|
104
120
|
}
|
|
@@ -109,7 +125,9 @@ export const RepositoryConfig: React.FC = () => {
|
|
|
109
125
|
title: t('Repository Name'),
|
|
110
126
|
dataIndex: 'name',
|
|
111
127
|
key: 'name',
|
|
112
|
-
render: (text: string, record:
|
|
128
|
+
render: (text: string, record: { id: number; name: string }) => (
|
|
129
|
+
<a href={gitManagerManageHref(app, record.id)}>{text}</a>
|
|
130
|
+
),
|
|
113
131
|
},
|
|
114
132
|
{ title: t('Repository URL'), dataIndex: 'repoUrl', key: 'repoUrl', ellipsis: true },
|
|
115
133
|
{
|
|
@@ -214,12 +232,14 @@ export const RepositoryConfig: React.FC = () => {
|
|
|
214
232
|
title: '',
|
|
215
233
|
key: 'actions',
|
|
216
234
|
width: 200,
|
|
217
|
-
render: (_:
|
|
235
|
+
render: (_: unknown, record: { id: number; name: string; status: string }) => (
|
|
218
236
|
<Space size="small">
|
|
219
237
|
{record.status !== 'connected' && (
|
|
220
238
|
<Button
|
|
221
239
|
size="small"
|
|
222
240
|
icon={<LinkOutlined />}
|
|
241
|
+
disabled={!gitAvailable}
|
|
242
|
+
aria-label={`${t('Clone')} ${record.name}`}
|
|
223
243
|
loading={actionLoading === `clone-${record.id}`}
|
|
224
244
|
onClick={() => handleClone(record)}
|
|
225
245
|
>
|
|
@@ -228,6 +248,7 @@ export const RepositoryConfig: React.FC = () => {
|
|
|
228
248
|
)}
|
|
229
249
|
<Button
|
|
230
250
|
size="small"
|
|
251
|
+
aria-label={`${t('Edit')} ${record.name}`}
|
|
231
252
|
onClick={() => {
|
|
232
253
|
setEditingRepo(record);
|
|
233
254
|
form.setFieldsValue(record);
|
|
@@ -237,7 +258,7 @@ export const RepositoryConfig: React.FC = () => {
|
|
|
237
258
|
{t('Edit')}
|
|
238
259
|
</Button>
|
|
239
260
|
<Popconfirm title={t('Delete this repository?')} onConfirm={() => handleDelete(record.id)}>
|
|
240
|
-
<Button size="small" danger icon={<DeleteOutlined />} />
|
|
261
|
+
<Button size="small" danger icon={<DeleteOutlined />} aria-label={`${t('Delete')} ${record.name}`} />
|
|
241
262
|
</Popconfirm>
|
|
242
263
|
</Space>
|
|
243
264
|
),
|
|
@@ -246,6 +267,7 @@ export const RepositoryConfig: React.FC = () => {
|
|
|
246
267
|
|
|
247
268
|
return (
|
|
248
269
|
<div>
|
|
270
|
+
<GitRuntimeBanner />
|
|
249
271
|
<div style={{ marginBottom: 16 }}>
|
|
250
272
|
<Button
|
|
251
273
|
type="primary"
|
|
@@ -11,7 +11,7 @@ import React, { createContext, useContext, useState, useCallback, useRef, useEff
|
|
|
11
11
|
import { useApp } from '@nocobase/client-v2';
|
|
12
12
|
import { setCurrentGitRepository } from '../../client-v2/git-context-api';
|
|
13
13
|
|
|
14
|
-
interface Repository {
|
|
14
|
+
export interface Repository {
|
|
15
15
|
id: number;
|
|
16
16
|
name: string;
|
|
17
17
|
repoUrl: string;
|
|
@@ -22,19 +22,65 @@ interface Repository {
|
|
|
22
22
|
autoReviewFlowId?: number | null;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
export interface GitRuntimeInfo {
|
|
26
|
+
checked: boolean;
|
|
27
|
+
gitAvailable: boolean;
|
|
28
|
+
gitBinary: string;
|
|
29
|
+
clusterManager: {
|
|
30
|
+
available: boolean;
|
|
31
|
+
gitConfigured: boolean;
|
|
32
|
+
status: 'idle' | 'running' | 'succeeded' | 'failed';
|
|
33
|
+
progressPercent: number;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
25
37
|
interface GitManagerContextType {
|
|
26
38
|
repos: Repository[];
|
|
27
39
|
selectedRepo: Repository | null;
|
|
28
40
|
loading: boolean;
|
|
29
41
|
branches: string[];
|
|
30
42
|
currentBranch: string;
|
|
43
|
+
gitRuntime: GitRuntimeInfo;
|
|
44
|
+
installingGit: boolean;
|
|
31
45
|
setSelectedRepo: (repo: Repository | null) => void;
|
|
32
46
|
refreshRepos: () => Promise<void>;
|
|
33
|
-
refreshBranches: () => Promise<
|
|
47
|
+
refreshBranches: () => Promise<string>;
|
|
48
|
+
refreshRuntimeStatus: () => Promise<void>;
|
|
49
|
+
installGitViaCluster: () => Promise<boolean>;
|
|
34
50
|
}
|
|
35
51
|
|
|
52
|
+
const DEFAULT_GIT_RUNTIME: GitRuntimeInfo = {
|
|
53
|
+
checked: false,
|
|
54
|
+
gitAvailable: true,
|
|
55
|
+
gitBinary: 'git',
|
|
56
|
+
clusterManager: {
|
|
57
|
+
available: false,
|
|
58
|
+
gitConfigured: false,
|
|
59
|
+
status: 'idle',
|
|
60
|
+
progressPercent: 0,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
36
64
|
const GitManagerContext = createContext<GitManagerContextType | null>(null);
|
|
37
65
|
|
|
66
|
+
function readQueryRepositoryId(): string | null {
|
|
67
|
+
if (typeof window === 'undefined') return null;
|
|
68
|
+
return new URLSearchParams(window.location.search).get('repositoryId');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function syncManageQueryRepositoryId(repositoryId: number | null): void {
|
|
72
|
+
if (typeof window === 'undefined' || !window.location.pathname.endsWith('/git-manager/manage')) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const url = new URL(window.location.href);
|
|
76
|
+
if (repositoryId == null) {
|
|
77
|
+
url.searchParams.delete('repositoryId');
|
|
78
|
+
} else {
|
|
79
|
+
url.searchParams.set('repositoryId', String(repositoryId));
|
|
80
|
+
}
|
|
81
|
+
window.history.replaceState(window.history.state, '', `${url.pathname}${url.search}${url.hash}`);
|
|
82
|
+
}
|
|
83
|
+
|
|
38
84
|
export function useGitManager() {
|
|
39
85
|
const context = useContext(GitManagerContext);
|
|
40
86
|
if (!context) {
|
|
@@ -47,51 +93,135 @@ export const GitManagerProvider: React.FC<{ children: React.ReactNode }> = ({ ch
|
|
|
47
93
|
const app = useApp();
|
|
48
94
|
const api = app.apiClient;
|
|
49
95
|
const [repos, setRepos] = useState<Repository[]>([]);
|
|
50
|
-
const [selectedRepo,
|
|
96
|
+
const [selectedRepo, setSelectedRepoState] = useState<Repository | null>(null);
|
|
51
97
|
const [loading, setLoading] = useState(false);
|
|
52
98
|
const [branches, setBranches] = useState<string[]>([]);
|
|
53
99
|
const [currentBranch, setCurrentBranch] = useState('');
|
|
100
|
+
const [gitRuntime, setGitRuntime] = useState<GitRuntimeInfo>(DEFAULT_GIT_RUNTIME);
|
|
101
|
+
const [installingGit, setInstallingGit] = useState(false);
|
|
54
102
|
const selectedRepoRef = useRef(selectedRepo);
|
|
55
103
|
selectedRepoRef.current = selectedRepo;
|
|
104
|
+
const gitRuntimeRef = useRef(gitRuntime);
|
|
105
|
+
gitRuntimeRef.current = gitRuntime;
|
|
106
|
+
|
|
107
|
+
const setSelectedRepo = useCallback((repo: Repository | null) => {
|
|
108
|
+
setSelectedRepoState(repo);
|
|
109
|
+
syncManageQueryRepositoryId(repo?.id ?? null);
|
|
110
|
+
}, []);
|
|
56
111
|
|
|
57
112
|
useEffect(() => {
|
|
58
113
|
setCurrentGitRepository(app, selectedRepo?.id);
|
|
59
114
|
return () => setCurrentGitRepository(app);
|
|
60
115
|
}, [app, selectedRepo?.id]);
|
|
61
116
|
|
|
62
|
-
const
|
|
117
|
+
const refreshRuntimeStatus = useCallback(async () => {
|
|
118
|
+
try {
|
|
119
|
+
const { data } = await api.request({
|
|
120
|
+
url: 'gitManager:runtimeStatus',
|
|
121
|
+
skipNotify: true,
|
|
122
|
+
});
|
|
123
|
+
const payload = data?.data?.data || data?.data;
|
|
124
|
+
if (payload && typeof payload.gitAvailable === 'boolean') {
|
|
125
|
+
const cluster = payload.clusterManager || {};
|
|
126
|
+
setGitRuntime({
|
|
127
|
+
checked: true,
|
|
128
|
+
gitAvailable: payload.gitAvailable,
|
|
129
|
+
gitBinary: typeof payload.gitBinary === 'string' ? payload.gitBinary : 'git',
|
|
130
|
+
clusterManager: {
|
|
131
|
+
available: Boolean(cluster.available),
|
|
132
|
+
gitConfigured: Boolean(cluster.gitConfigured),
|
|
133
|
+
status:
|
|
134
|
+
cluster.status === 'running' || cluster.status === 'succeeded' || cluster.status === 'failed'
|
|
135
|
+
? cluster.status
|
|
136
|
+
: 'idle',
|
|
137
|
+
progressPercent: typeof cluster.progressPercent === 'number' ? cluster.progressPercent : 0,
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
} catch {
|
|
142
|
+
// Preserve optimistic default when runtimeStatus is unavailable in test mocks.
|
|
143
|
+
}
|
|
144
|
+
}, [api]);
|
|
145
|
+
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
refreshRuntimeStatus();
|
|
148
|
+
}, [refreshRuntimeStatus]);
|
|
149
|
+
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
if (!gitRuntime.checked || gitRuntime.gitAvailable || gitRuntime.clusterManager.status !== 'running') {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const interval = setInterval(() => {
|
|
155
|
+
refreshRuntimeStatus();
|
|
156
|
+
}, 3000);
|
|
157
|
+
return () => clearInterval(interval);
|
|
158
|
+
}, [gitRuntime.checked, gitRuntime.gitAvailable, gitRuntime.clusterManager.status, refreshRuntimeStatus]);
|
|
159
|
+
|
|
160
|
+
const installGitViaCluster = useCallback(async (): Promise<boolean> => {
|
|
161
|
+
setInstallingGit(true);
|
|
162
|
+
try {
|
|
163
|
+
await api.request({
|
|
164
|
+
url: 'gitManager:installGit',
|
|
165
|
+
method: 'post',
|
|
166
|
+
});
|
|
167
|
+
await refreshRuntimeStatus();
|
|
168
|
+
return true;
|
|
169
|
+
} catch {
|
|
170
|
+
return false;
|
|
171
|
+
} finally {
|
|
172
|
+
setInstallingGit(false);
|
|
173
|
+
}
|
|
174
|
+
}, [api, refreshRuntimeStatus]);
|
|
175
|
+
|
|
176
|
+
const refreshBranches = useCallback(async (): Promise<string> => {
|
|
63
177
|
const repo = selectedRepoRef.current;
|
|
64
|
-
if (
|
|
178
|
+
if (
|
|
179
|
+
!repo ||
|
|
180
|
+
repo.status !== 'connected' ||
|
|
181
|
+
(gitRuntimeRef.current.checked && !gitRuntimeRef.current.gitAvailable)
|
|
182
|
+
) {
|
|
65
183
|
setBranches([]);
|
|
66
184
|
setCurrentBranch('');
|
|
67
|
-
return;
|
|
185
|
+
return '';
|
|
68
186
|
}
|
|
69
187
|
try {
|
|
70
188
|
const { data } = await api.request({
|
|
71
189
|
url: 'gitManager:branches',
|
|
72
190
|
params: { repositoryId: repo.id },
|
|
191
|
+
skipNotify: true,
|
|
73
192
|
});
|
|
74
193
|
const responseData = data?.data?.data || data?.data;
|
|
75
194
|
if (responseData) {
|
|
76
|
-
|
|
77
|
-
|
|
195
|
+
const nextBranches = Array.isArray(responseData.all) ? (responseData.all as string[]) : [];
|
|
196
|
+
const nextCurrent = typeof responseData.current === 'string' ? responseData.current : '';
|
|
197
|
+
setBranches(nextBranches);
|
|
198
|
+
setCurrentBranch(nextCurrent);
|
|
199
|
+
return nextCurrent;
|
|
78
200
|
}
|
|
79
201
|
} catch {
|
|
80
202
|
setBranches([]);
|
|
81
203
|
setCurrentBranch('');
|
|
204
|
+
refreshRuntimeStatus();
|
|
82
205
|
}
|
|
83
|
-
|
|
206
|
+
return '';
|
|
207
|
+
}, [api, refreshRuntimeStatus]);
|
|
84
208
|
|
|
85
209
|
const refreshRepos = useCallback(async () => {
|
|
86
210
|
setLoading(true);
|
|
87
211
|
try {
|
|
88
212
|
const { data } = await api.request({ url: 'gitRepositories:list', params: { pageSize: 100 } });
|
|
89
|
-
const list = data?.data || [];
|
|
213
|
+
const list = (data?.data || []) as Repository[];
|
|
90
214
|
setRepos(list);
|
|
91
215
|
const current = selectedRepoRef.current;
|
|
92
216
|
if (current) {
|
|
93
|
-
const updated = list.find((r
|
|
94
|
-
if (updated)
|
|
217
|
+
const updated = list.find((r) => r.id === current.id);
|
|
218
|
+
if (updated) setSelectedRepoState(updated);
|
|
219
|
+
} else {
|
|
220
|
+
const queryRepoId = readQueryRepositoryId();
|
|
221
|
+
if (queryRepoId) {
|
|
222
|
+
const matched = list.find((r) => String(r.id) === queryRepoId);
|
|
223
|
+
if (matched) setSelectedRepoState(matched);
|
|
224
|
+
}
|
|
95
225
|
}
|
|
96
226
|
} finally {
|
|
97
227
|
setLoading(false);
|
|
@@ -100,7 +230,20 @@ export const GitManagerProvider: React.FC<{ children: React.ReactNode }> = ({ ch
|
|
|
100
230
|
|
|
101
231
|
return (
|
|
102
232
|
<GitManagerContext.Provider
|
|
103
|
-
value={{
|
|
233
|
+
value={{
|
|
234
|
+
repos,
|
|
235
|
+
selectedRepo,
|
|
236
|
+
loading,
|
|
237
|
+
branches,
|
|
238
|
+
currentBranch,
|
|
239
|
+
gitRuntime,
|
|
240
|
+
installingGit,
|
|
241
|
+
setSelectedRepo,
|
|
242
|
+
refreshRepos,
|
|
243
|
+
refreshBranches,
|
|
244
|
+
refreshRuntimeStatus,
|
|
245
|
+
installGitViaCluster,
|
|
246
|
+
}}
|
|
104
247
|
>
|
|
105
248
|
{children}
|
|
106
249
|
</GitManagerContext.Provider>
|
|
@@ -25,3 +25,14 @@ export function reviewApprovalHref(app: App) {
|
|
|
25
25
|
const base = getRouteRuntimeVersion() === 'modern' ? getV2EffectiveBasePath(app) : legacyBase(app);
|
|
26
26
|
return join(base, '/admin/workflow/tasks/git-review-approval/pending');
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
export function gitManagerManageHref(app: App, repositoryId?: string | number) {
|
|
30
|
+
const base = getRouteRuntimeVersion() === 'modern' ? getV2EffectiveBasePath(app) : legacyBase(app);
|
|
31
|
+
const path = join(base, '/admin/settings/git-manager/manage');
|
|
32
|
+
return repositoryId == null ? path : `${path}?repositoryId=${encodeURIComponent(String(repositoryId))}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function clusterPackageInstallerHref(app: App) {
|
|
36
|
+
const base = getRouteRuntimeVersion() === 'modern' ? getV2EffectiveBasePath(app) : legacyBase(app);
|
|
37
|
+
return join(base, '/admin/settings/plugin-cluster-manager');
|
|
38
|
+
}
|
package/src/locale/en-US.json
CHANGED
|
@@ -418,5 +418,16 @@
|
|
|
418
418
|
"Additional changed files were omitted by the provider.": "Additional changed files were omitted by the provider.",
|
|
419
419
|
"The provider omitted patches for one or more files, including binary or large files.": "The provider omitted patches for one or more files, including binary or large files.",
|
|
420
420
|
"The provider omitted additional changed files or patches.": "The provider omitted additional changed files or patches.",
|
|
421
|
-
"Additional changed files or diff content were omitted.": "Additional changed files or diff content were omitted."
|
|
421
|
+
"Additional changed files or diff content were omitted.": "Additional changed files or diff content were omitted.",
|
|
422
|
+
"Repository": "Repository",
|
|
423
|
+
"Refresh": "Refresh",
|
|
424
|
+
"Installing Git via Cluster Manager...": "Installing Git via Cluster Manager...",
|
|
425
|
+
"Local Git operations will unlock automatically as soon as Cluster Manager finishes installing git on this node.": "Local Git operations will unlock automatically as soon as Cluster Manager finishes installing git on this node.",
|
|
426
|
+
"Git CLI is not installed on this node yet": "Git CLI is not installed on this node yet",
|
|
427
|
+
"Git is managed separately via Cluster Manager. Install git now to enable File Explorer, Commit History, Operations, and Clone.": "Git is managed separately via Cluster Manager. Install git now to enable File Explorer, Commit History, Operations, and Clone.",
|
|
428
|
+
"Install git in the app/worker container or set GIT_BINARY_PATH to use local repository features.": "Install git in the app/worker container or set GIT_BINARY_PATH to use local repository features.",
|
|
429
|
+
"Install Git via Cluster Manager": "Install Git via Cluster Manager",
|
|
430
|
+
"Open Cluster Package Installer": "Open Cluster Package Installer",
|
|
431
|
+
"Git installation dispatched via Cluster Manager": "Git installation dispatched via Cluster Manager",
|
|
432
|
+
"Failed to start Git installation via Cluster Manager": "Failed to start Git installation via Cluster Manager"
|
|
422
433
|
}
|
package/src/locale/vi-VN.json
CHANGED
|
@@ -406,5 +406,16 @@
|
|
|
406
406
|
"Additional changed files were omitted by the provider.": "Nhà cung cấp đã lược bỏ một số tệp thay đổi khác.",
|
|
407
407
|
"The provider omitted patches for one or more files, including binary or large files.": "Nhà cung cấp không trả patch cho một hoặc nhiều tệp, bao gồm tệp nhị phân hoặc tệp lớn.",
|
|
408
408
|
"The provider omitted additional changed files or patches.": "Nhà cung cấp đã lược bỏ một số tệp thay đổi hoặc patch khác.",
|
|
409
|
-
"Additional changed files or diff content were omitted.": "Một số tệp thay đổi hoặc nội dung diff khác đã được lược bỏ."
|
|
409
|
+
"Additional changed files or diff content were omitted.": "Một số tệp thay đổi hoặc nội dung diff khác đã được lược bỏ.",
|
|
410
|
+
"Repository": "Kho mã nguồn",
|
|
411
|
+
"Refresh": "Làm mới",
|
|
412
|
+
"Installing Git via Cluster Manager...": "Đang cài đặt Git qua Cluster Manager...",
|
|
413
|
+
"Local Git operations will unlock automatically as soon as Cluster Manager finishes installing git on this node.": "Các thao tác Git cục bộ sẽ tự động mở khóa ngay khi Cluster Manager cài xong git trên node này.",
|
|
414
|
+
"Git CLI is not installed on this node yet": "Node hiện tại chưa được cài đặt Git CLI",
|
|
415
|
+
"Git is managed separately via Cluster Manager. Install git now to enable File Explorer, Commit History, Operations, and Clone.": "Git được quản lý cài đặt riêng qua Cluster Manager. Hãy bấm cài đặt git để dùng Duyệt tệp, Lịch sử commit, Thao tác Git và Clone.",
|
|
416
|
+
"Install git in the app/worker container or set GIT_BINARY_PATH to use local repository features.": "Hãy cài git trong container app/worker hoặc cấu hình GIT_BINARY_PATH để dùng các tính năng kho cục bộ.",
|
|
417
|
+
"Install Git via Cluster Manager": "Cài đặt Git qua Cluster Manager",
|
|
418
|
+
"Open Cluster Package Installer": "Mở trình cài gói Cluster Manager",
|
|
419
|
+
"Git installation dispatched via Cluster Manager": "Đã gửi lệnh cài đặt Git qua Cluster Manager",
|
|
420
|
+
"Failed to start Git installation via Cluster Manager": "Không thể khởi chạy cài đặt Git qua Cluster Manager"
|
|
410
421
|
}
|
package/src/locale/zh-CN.json
CHANGED
|
@@ -175,5 +175,16 @@
|
|
|
175
175
|
"Additional changed files were omitted by the provider.": "提供商省略了其他更改的文件。",
|
|
176
176
|
"The provider omitted patches for one or more files, including binary or large files.": "提供商省略了一个或多个文件的补丁,包括二进制文件或大文件。",
|
|
177
177
|
"The provider omitted additional changed files or patches.": "提供商省略了其他更改的文件或补丁。",
|
|
178
|
-
"Additional changed files or diff content were omitted.": "已省略其他更改的文件或差异内容。"
|
|
178
|
+
"Additional changed files or diff content were omitted.": "已省略其他更改的文件或差异内容。",
|
|
179
|
+
"Repository": "仓库",
|
|
180
|
+
"Refresh": "刷新",
|
|
181
|
+
"Installing Git via Cluster Manager...": "正在通过集群管理器安装 Git...",
|
|
182
|
+
"Local Git operations will unlock automatically as soon as Cluster Manager finishes installing git on this node.": "集群管理器在此节点完成 git 安装后,本地 Git 操作将自动启用。",
|
|
183
|
+
"Git CLI is not installed on this node yet": "此节点尚未安装 Git CLI",
|
|
184
|
+
"Git is managed separately via Cluster Manager. Install git now to enable File Explorer, Commit History, Operations, and Clone.": "Git 通过集群管理器单独管理。立即安装 git 以启用文件浏览、提交历史、Git 操作与克隆功能。",
|
|
185
|
+
"Install git in the app/worker container or set GIT_BINARY_PATH to use local repository features.": "请在 app/worker 容器中安装 git 或设置 GIT_BINARY_PATH 以使用本地仓库功能。",
|
|
186
|
+
"Install Git via Cluster Manager": "通过集群管理器安装 Git",
|
|
187
|
+
"Open Cluster Package Installer": "打开集群包安装器",
|
|
188
|
+
"Git installation dispatched via Cluster Manager": "已通过集群管理器下发 Git 安装任务",
|
|
189
|
+
"Failed to start Git installation via Cluster Manager": "无法通过集群管理器启动 Git 安装"
|
|
179
190
|
}
|