完善拉取私有仓库

This commit is contained in:
whyour
2022-05-18 01:14:10 +08:00
parent 1695b8c0fe
commit 7caabe9063
6 changed files with 96 additions and 34 deletions
+16
View File
@@ -51,6 +51,12 @@ export enum IntervalSchedule {
'seconds' = '秒',
}
export enum SubscriptionType {
'private-repo' = '私有仓库',
'public-repo' = '公开仓库',
'file' = '单文件',
}
const Subscription = ({ headerStyle, isPhone, socketMessage }: any) => {
const columns: any = [
{
@@ -88,6 +94,16 @@ const Subscription = ({ headerStyle, isPhone, socketMessage }: any) => {
);
},
},
{
title: '类型',
dataIndex: 'type',
key: 'type',
width: 130,
align: 'center' as const,
render: (text: string, record: any) => {
return (SubscriptionType as any)[record.type];
},
},
{
title: '分支',
dataIndex: 'branch',
+19 -5
View File
@@ -56,7 +56,9 @@ const SubscriptionModal = ({
form.setFieldsValue({
alias: formatAlias(_url, _branch, e.target.value),
});
form.validateFields(['url']);
if (_url) {
form.validateFields(['url']);
}
};
const scheduleTypeChange = (e) => {
@@ -149,16 +151,28 @@ const SubscriptionModal = ({
onChange?: (param: any) => void;
}) => {
return type === 'ssh-key' ? (
<Form.Item name="private_key" label="私钥" rules={[{ required: true }]}>
<Input.TextArea rows={4} autoSize={true} placeholder="请输入私钥" />
<Form.Item
name={['pull_option', 'private_key']}
label="私钥"
rules={[{ required: true }]}
>
<Input.TextArea
rows={4}
autoSize={{ minRows: 1, maxRows: 6 }}
placeholder="请输入私钥"
/>
</Form.Item>
) : (
<>
<Form.Item name="username" label="用户名" rules={[{ required: true }]}>
<Form.Item
name={['pull_option', 'username']}
label="用户名"
rules={[{ required: true }]}
>
<Input placeholder="请输入认证用户名" />
</Form.Item>
<Form.Item
name="password"
name={['pull_option', 'password']}
tooltip="Github已不支持密码认证,请使用Token方式"
label="密码/Token"
rules={[{ required: true }]}