mirror of
https://github.com/whyour/qinglong.git
synced 2025-08-24 04:36:08 +08:00
修改更新列表后刷新逻辑
This commit is contained in:
parent
4d34e0dd96
commit
b01f27f2d3
|
@ -721,34 +721,15 @@ const Crontab = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancel = (cron?: any) => {
|
const handleCancel = () => {
|
||||||
setIsModalVisible(false);
|
setIsModalVisible(false);
|
||||||
if (cron) {
|
getCrons();
|
||||||
handleCrons(cron);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSearch = (value: string) => {
|
const onSearch = (value: string) => {
|
||||||
setSearchText(value.trim());
|
setSearchText(value.trim());
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCrons = (cron: any) => {
|
|
||||||
const index = value.findIndex((x) => x.id === cron.id);
|
|
||||||
const result = [...value];
|
|
||||||
cron.nextRunTime = cron_parser
|
|
||||||
.parseExpression(cron.schedule)
|
|
||||||
.next()
|
|
||||||
.toDate();
|
|
||||||
if (index === -1) {
|
|
||||||
result.unshift(cron);
|
|
||||||
} else {
|
|
||||||
result.splice(index, 1, {
|
|
||||||
...cron,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
setValue(result);
|
|
||||||
};
|
|
||||||
|
|
||||||
const getCronDetail = (cron: any) => {
|
const getCronDetail = (cron: any) => {
|
||||||
request
|
request
|
||||||
.get(`${config.apiPrefix}crons/${cron.id}`)
|
.get(`${config.apiPrefix}crons/${cron.id}`)
|
||||||
|
|
16
src/pages/env/index.tsx
vendored
16
src/pages/env/index.tsx
vendored
|
@ -323,7 +323,7 @@ const Env = () => {
|
||||||
|
|
||||||
const handleCancel = (env?: any[]) => {
|
const handleCancel = (env?: any[]) => {
|
||||||
setIsModalVisible(false);
|
setIsModalVisible(false);
|
||||||
env && handleEnv(env);
|
getEnvs();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEditNameCancel = (env?: any[]) => {
|
const handleEditNameCancel = (env?: any[]) => {
|
||||||
|
@ -331,20 +331,6 @@ const Env = () => {
|
||||||
getEnvs();
|
getEnvs();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEnv = (env: any) => {
|
|
||||||
const result = [...value];
|
|
||||||
const index = value.findIndex((x) => x.id === env.id);
|
|
||||||
if (index === -1) {
|
|
||||||
env = Array.isArray(env) ? env : [env];
|
|
||||||
result.push(...env);
|
|
||||||
} else {
|
|
||||||
result.splice(index, 1, {
|
|
||||||
...env,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
setValue(result);
|
|
||||||
};
|
|
||||||
|
|
||||||
const vComponents = useMemo(() => {
|
const vComponents = useMemo(() => {
|
||||||
return VList({
|
return VList({
|
||||||
height: tableScrollHeight!,
|
height: tableScrollHeight!,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user