feat(infra): 增加定时任务同步入口
- 为 vue3 同步任务按钮补充 infra:job:create 权限 - 为 vben antd、antdv-next、ele 增加 syncJob API - 为 vben 定时任务列表增加同步任务按钮和确认/loading 流程pull/361/MERGE
parent
3014428775
commit
c814d31cd3
|
|
@ -75,3 +75,8 @@ export function runJob(id: number) {
|
||||||
export function getJobNextTimes(id: number) {
|
export function getJobNextTimes(id: number) {
|
||||||
return requestClient.get(`/infra/job/get_next_times?id=${id}`);
|
return requestClient.get(`/infra/job/get_next_times?id=${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 同步定时任务到 Quartz */
|
||||||
|
export function syncJob() {
|
||||||
|
return requestClient.post('/infra/job/sync');
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import {
|
||||||
exportJob,
|
exportJob,
|
||||||
getJobPage,
|
getJobPage,
|
||||||
runJob,
|
runJob,
|
||||||
|
syncJob,
|
||||||
updateJobStatus,
|
updateJobStatus,
|
||||||
} from '#/api/infra/job';
|
} from '#/api/infra/job';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
@ -101,6 +102,22 @@ async function handleTrigger(row: InfraJobApi.Job) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 同步任务到 Quartz */
|
||||||
|
async function handleSyncJob() {
|
||||||
|
await confirm('确认要同步所有任务到调度器?');
|
||||||
|
const hideLoading = message.loading({
|
||||||
|
content: '正在同步任务...',
|
||||||
|
duration: 0,
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
await syncJob();
|
||||||
|
message.success('同步成功');
|
||||||
|
handleRefresh();
|
||||||
|
} finally {
|
||||||
|
hideLoading();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 跳转到任务日志 */
|
/** 跳转到任务日志 */
|
||||||
function handleLog(row?: InfraJobApi.Job) {
|
function handleLog(row?: InfraJobApi.Job) {
|
||||||
push({
|
push({
|
||||||
|
|
@ -216,6 +233,13 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
auth: ['infra:job:query'],
|
auth: ['infra:job:query'],
|
||||||
onClick: () => handleLog(undefined),
|
onClick: () => handleLog(undefined),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '同步任务',
|
||||||
|
type: 'primary',
|
||||||
|
icon: 'lucide:refresh-cw',
|
||||||
|
auth: ['infra:job:create'],
|
||||||
|
onClick: handleSyncJob,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: $t('ui.actionTitle.deleteBatch'),
|
label: $t('ui.actionTitle.deleteBatch'),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
|
|
|
||||||
|
|
@ -75,3 +75,8 @@ export function runJob(id: number) {
|
||||||
export function getJobNextTimes(id: number) {
|
export function getJobNextTimes(id: number) {
|
||||||
return requestClient.get(`/infra/job/get_next_times?id=${id}`);
|
return requestClient.get(`/infra/job/get_next_times?id=${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 同步定时任务到 Quartz */
|
||||||
|
export function syncJob() {
|
||||||
|
return requestClient.post('/infra/job/sync');
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import {
|
||||||
exportJob,
|
exportJob,
|
||||||
getJobPage,
|
getJobPage,
|
||||||
runJob,
|
runJob,
|
||||||
|
syncJob,
|
||||||
updateJobStatus,
|
updateJobStatus,
|
||||||
} from '#/api/infra/job';
|
} from '#/api/infra/job';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
@ -101,6 +102,22 @@ async function handleTrigger(row: InfraJobApi.Job) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 同步任务到 Quartz */
|
||||||
|
async function handleSyncJob() {
|
||||||
|
await confirm('确认要同步所有任务到调度器?');
|
||||||
|
const hideLoading = message.loading({
|
||||||
|
content: '正在同步任务...',
|
||||||
|
duration: 0,
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
await syncJob();
|
||||||
|
message.success('同步成功');
|
||||||
|
handleRefresh();
|
||||||
|
} finally {
|
||||||
|
hideLoading();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 跳转到任务日志 */
|
/** 跳转到任务日志 */
|
||||||
function handleLog(row?: InfraJobApi.Job) {
|
function handleLog(row?: InfraJobApi.Job) {
|
||||||
push({
|
push({
|
||||||
|
|
@ -216,6 +233,13 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
auth: ['infra:job:query'],
|
auth: ['infra:job:query'],
|
||||||
onClick: () => handleLog(undefined),
|
onClick: () => handleLog(undefined),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '同步任务',
|
||||||
|
type: 'primary',
|
||||||
|
icon: 'lucide:refresh-cw',
|
||||||
|
auth: ['infra:job:create'],
|
||||||
|
onClick: handleSyncJob,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: $t('ui.actionTitle.deleteBatch'),
|
label: $t('ui.actionTitle.deleteBatch'),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
|
|
|
||||||
|
|
@ -75,3 +75,8 @@ export function runJob(id: number) {
|
||||||
export function getJobNextTimes(id: number) {
|
export function getJobNextTimes(id: number) {
|
||||||
return requestClient.get(`/infra/job/get_next_times?id=${id}`);
|
return requestClient.get(`/infra/job/get_next_times?id=${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 同步定时任务到 Quartz */
|
||||||
|
export function syncJob() {
|
||||||
|
return requestClient.post('/infra/job/sync');
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import {
|
||||||
exportJob,
|
exportJob,
|
||||||
getJobPage,
|
getJobPage,
|
||||||
runJob,
|
runJob,
|
||||||
|
syncJob,
|
||||||
updateJobStatus,
|
updateJobStatus,
|
||||||
} from '#/api/infra/job';
|
} from '#/api/infra/job';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
@ -99,6 +100,21 @@ async function handleTrigger(row: InfraJobApi.Job) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 同步任务到 Quartz */
|
||||||
|
async function handleSyncJob() {
|
||||||
|
await confirm('确认要同步所有任务到调度器?');
|
||||||
|
const loadingInstance = ElLoading.service({
|
||||||
|
text: '正在同步任务...',
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
await syncJob();
|
||||||
|
ElMessage.success('同步成功');
|
||||||
|
handleRefresh();
|
||||||
|
} finally {
|
||||||
|
loadingInstance.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 跳转到任务日志 */
|
/** 跳转到任务日志 */
|
||||||
function handleLog(row?: InfraJobApi.Job) {
|
function handleLog(row?: InfraJobApi.Job) {
|
||||||
push({
|
push({
|
||||||
|
|
@ -212,6 +228,13 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
auth: ['infra:job:query'],
|
auth: ['infra:job:query'],
|
||||||
onClick: () => handleLog(undefined),
|
onClick: () => handleLog(undefined),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '同步任务',
|
||||||
|
type: 'primary',
|
||||||
|
icon: 'lucide:refresh-cw',
|
||||||
|
auth: ['infra:job:create'],
|
||||||
|
onClick: handleSyncJob,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: $t('ui.actionTitle.deleteBatch'),
|
label: $t('ui.actionTitle.deleteBatch'),
|
||||||
type: 'danger',
|
type: 'danger',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue