mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-29 20:26:11 +08:00
修复订阅自动增加/删除任务默认值
This commit is contained in:
parent
7bce5c4f6a
commit
622fe2a8f8
|
@ -1,4 +1,5 @@
|
|||
import { Subscription } from '../data/subscription';
|
||||
import isNil from 'lodash/isNil';
|
||||
|
||||
export function formatUrl(doc: Subscription) {
|
||||
let url = doc.url;
|
||||
|
@ -33,11 +34,9 @@ export function formatCommand(doc: Subscription, url?: string) {
|
|||
if (type === 'file') {
|
||||
command += `raw "${_url}"`;
|
||||
} else {
|
||||
command += `repo "${_url}" "${whitelist || ''}" "${blacklist || ''}" "${
|
||||
dependences || ''
|
||||
}" "${branch || ''}" "${extensions || ''}" "${proxy || ''}" "${
|
||||
Boolean(autoAddCron) ?? ''
|
||||
}" "${Boolean(autoDelCron) ?? ''}"`;
|
||||
command += `repo "${_url}" "${whitelist || ''}" "${blacklist || ''}" "${dependences || ''
|
||||
}" "${branch || ''}" "${extensions || ''}" "${proxy || ''}" "${isNil(autoAddCron) ? true : Boolean(autoAddCron)
|
||||
}" "${isNil(autoDelCron) ? true : Boolean(autoDelCron)}"`;
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ export default class SubscriptionService {
|
|||
['createdAt', 'DESC'],
|
||||
],
|
||||
});
|
||||
return result as any;
|
||||
return result;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
import { request } from '@/utils/http';
|
||||
import config from '@/utils/config';
|
||||
import cron_parser from 'cron-parser';
|
||||
import isNil from 'lodash/isNil';
|
||||
|
||||
const { Option } = Select;
|
||||
const repoUrlRegx = /[^\/\:]+\/[^\/]+(?=\.git)/;
|
||||
|
@ -243,6 +244,14 @@ const SubscriptionModal = ({
|
|||
}
|
||||
}, []);
|
||||
|
||||
const formatParams = (sub) => {
|
||||
return {
|
||||
...sub,
|
||||
autoAddCron: isNil(sub.autoAddCron) ? true : Boolean(sub.autoAddCron),
|
||||
autoDelCron: isNil(sub.autoDelCron) ? true : Boolean(sub.autoDelCron),
|
||||
};
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
window.addEventListener('paste', onPaste);
|
||||
|
@ -252,7 +261,9 @@ const SubscriptionModal = ({
|
|||
}, [visible]);
|
||||
|
||||
useEffect(() => {
|
||||
form.setFieldsValue(subscription || {});
|
||||
form.setFieldsValue(
|
||||
{ ...subscription, ...formatParams(subscription) } || {},
|
||||
);
|
||||
setType((subscription && subscription.type) || 'public-repo');
|
||||
setScheduleType((subscription && subscription.schedule_type) || 'crontab');
|
||||
setPullType((subscription && subscription.pull_type) || 'ssh-key');
|
||||
|
|
Loading…
Reference in New Issue
Block a user