feat: 🚀 定时任务暂停和恢复
This commit is contained in:
parent
6fd118aebc
commit
6ef4e73842
|
@ -1239,46 +1239,55 @@ packages:
|
|||
resolution: {integrity: sha512-sWWgdQ1fq+XKrlda8PsMCfut8caFwZBmhYeoehJ05FdI0YZXk6ZyUjWLrIgbR/VgiGycrFKMMgp7eJ69HOF2pQ==}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-arm-musleabihf@4.21.1':
|
||||
resolution: {integrity: sha512-9OIiSuj5EsYQlmwhmFRA0LRO0dRRjdCVZA3hnmZe1rEwRk11Jy3ECGGq3a7RrVEZ0/pCsYWx8jG3IvcrJ6RCew==}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-linux-arm64-gnu@4.21.1':
|
||||
resolution: {integrity: sha512-0kuAkRK4MeIUbzQYu63NrJmfoUVicajoRAL1bpwdYIYRcs57iyIV9NLcuyDyDXE2GiZCL4uhKSYAnyWpjZkWow==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-arm64-musl@4.21.1':
|
||||
resolution: {integrity: sha512-/6dYC9fZtfEY0vozpc5bx1RP4VrtEOhNQGb0HwvYNwXD1BBbwQ5cKIbUVVU7G2d5WRE90NfB922elN8ASXAJEA==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-linux-powerpc64le-gnu@4.21.1':
|
||||
resolution: {integrity: sha512-ltUWy+sHeAh3YZ91NUsV4Xg3uBXAlscQe8ZOXRCVAKLsivGuJsrkawYPUEyCV3DYa9urgJugMLn8Z3Z/6CeyRQ==}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-riscv64-gnu@4.21.1':
|
||||
resolution: {integrity: sha512-BggMndzI7Tlv4/abrgLwa/dxNEMn2gC61DCLrTzw8LkpSKel4o+O+gtjbnkevZ18SKkeN3ihRGPuBxjaetWzWg==}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-s390x-gnu@4.21.1':
|
||||
resolution: {integrity: sha512-z/9rtlGd/OMv+gb1mNSjElasMf9yXusAxnRDrBaYB+eS1shFm6/4/xDH1SAISO5729fFKUkJ88TkGPRUh8WSAA==}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-x64-gnu@4.21.1':
|
||||
resolution: {integrity: sha512-kXQVcWqDcDKw0S2E0TmhlTLlUgAmMVqPrJZR+KpH/1ZaZhLSl23GZpQVmawBQGVhyP5WXIsIQ/zqbDBBYmxm5w==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-x64-musl@4.21.1':
|
||||
resolution: {integrity: sha512-CbFv/WMQsSdl+bpX6rVbzR4kAjSSBuDgCqb1l4J68UYsQNalz5wOqLGYj4ZI0thGpyX5kc+LLZ9CL+kpqDovZA==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-win32-arm64-msvc@4.21.1':
|
||||
resolution: {integrity: sha512-3Q3brDgA86gHXWHklrwdREKIrIbxC0ZgU8lwpj0eEKGBQH+31uPqr0P2v11pn0tSIxHvcdOWxa4j+YvLNx1i6g==}
|
||||
|
|
|
@ -21,6 +21,16 @@ export const fetchUpdateSchedulers = (data: any) => {
|
|||
return http.request<BaseResult<object>>('put', 'schedulers/updateSchedulers', { data });
|
||||
};
|
||||
|
||||
/** Schedulers视图---暂停任务 */
|
||||
export const fetchPauseSchedulers = (data: any) => {
|
||||
return http.request<BaseResult<object>>('put', 'schedulers/pauseSchedulers', { data });
|
||||
};
|
||||
|
||||
/** Schedulers视图---恢复任务 */
|
||||
export const fetchResumeSchedulers = (data: any) => {
|
||||
return http.request<BaseResult<object>>('put', 'schedulers/resumeSchedulers', { data });
|
||||
};
|
||||
|
||||
/** Schedulers视图---删除Schedulers视图 */
|
||||
export const fetchDeleteSchedulers = (data: any) => {
|
||||
return http.request<BaseResult<object>>('delete', 'schedulers/deleteSchedulers', { data });
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { defineStore } from 'pinia';
|
||||
import { fetchAddSchedulers, fetchDeleteSchedulers, fetchGetAllScheduleJobList, fetchGetSchedulersList, fetchUpdateSchedulers } from '@/api/v1/schedulers';
|
||||
import { fetchAddSchedulers, fetchDeleteSchedulers, fetchGetAllScheduleJobList, fetchGetSchedulersList, fetchPauseSchedulers, fetchResumeSchedulers, fetchUpdateSchedulers } from '@/api/v1/schedulers';
|
||||
import { pageSizes } from '@/enums/baseConstant';
|
||||
import { storeMessage } from '@/utils/message';
|
||||
import { storePagination } from '@/store/useStorePagination';
|
||||
|
@ -84,5 +84,17 @@ export const useSchedulersStore = defineStore('schedulersStore', {
|
|||
const result = await fetchDeleteSchedulers(data);
|
||||
return storeMessage(result);
|
||||
},
|
||||
|
||||
/** 暂停任务 */
|
||||
async pauseSchedulers(data: any) {
|
||||
const result = await fetchPauseSchedulers(data);
|
||||
return storeMessage(result);
|
||||
},
|
||||
|
||||
/** 恢复任务 */
|
||||
async resumeSchedulers(data: any) {
|
||||
const result = await fetchResumeSchedulers(data);
|
||||
return storeMessage(result);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { columns } from '@/views/monitor/schedulerExecuteLog/utils/columns';
|
||||
import { columns, state } from '@/views/monitor/schedulerExecuteLog/utils/columns';
|
||||
import PureTableBar from '@/components/TableBar/src/bar';
|
||||
import PureTable from '@pureadmin/table';
|
||||
import { deleteIds, onDelete, onDeleteBatch, onSearch, onView } from '@/views/monitor/schedulerExecuteLog/utils/hooks';
|
||||
|
@ -12,6 +12,8 @@ import { useQuartzExecuteLogStore } from '@/store/monitor/quartzExecuteLog';
|
|||
import { useRenderIcon } from '@/components/CommonIcon/src/hooks';
|
||||
import { FormInstance } from 'element-plus';
|
||||
import View from '@iconify-icons/ep/view';
|
||||
import VueJsonPretty from 'vue-json-pretty';
|
||||
import 'vue-json-pretty/lib/styles.css';
|
||||
|
||||
const tableRef = ref();
|
||||
const formRef = ref();
|
||||
|
@ -75,9 +77,6 @@ onMounted(() => {
|
|||
<el-form-item :label="$t('quartzExecuteLog_triggerName')" prop="triggerName">
|
||||
<el-input v-model="quartzExecuteLogStore.form.triggerName" :placeholder="`${$t('input')}${$t('quartzExecuteLog_triggerName')}`" class="!w-[180px]" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('quartzExecuteLog_endTime')" prop="endTime">
|
||||
<el-input v-model="quartzExecuteLogStore.form.endTime" :placeholder="`${$t('input')}${$t('quartzExecuteLog_endTime')}`" class="!w-[180px]" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button :icon="useRenderIcon('ri:search-line')" :loading="quartzExecuteLogStore.loading" type="primary" @click="onSearch"> {{ $t('search') }} </el-button>
|
||||
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(formRef)"> {{ $t('buttons.reset') }}</el-button>
|
||||
|
@ -113,6 +112,20 @@ onMounted(() => {
|
|||
@selection-change="onSelectionChange"
|
||||
@page-current-change="onCurrentPageChange"
|
||||
>
|
||||
<template #executeResult="{ row }">
|
||||
<VueJsonPretty
|
||||
:data="JSON.parse(row.executeResult)"
|
||||
:deep="state.deep"
|
||||
:editable="state.editable"
|
||||
:editable-trigger="state.editableTrigger as any"
|
||||
:show-double-quotes="state.showDoubleQuotes"
|
||||
:show-icon="state.showIcon"
|
||||
:show-length="state.showLength"
|
||||
:show-line="state.showLine"
|
||||
:show-line-number="state.showLineNumber"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #createUser="{ row }">
|
||||
<el-button v-show="row.createUser" link type="primary" @click="selectUserinfo(row.createUser)">
|
||||
{{ $t('table.createUser') }}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { FormInstance } from 'element-plus';
|
||||
import { rules } from '@/views/monitor/schedulerExecuteLog/utils/columns';
|
||||
import { rules, state } from '@/views/monitor/schedulerExecuteLog/utils/columns';
|
||||
import { FormProps } from '@/views/monitor/schedulerExecuteLog/utils/types';
|
||||
import { $t } from '@/plugins/i18n';
|
||||
import VueJsonPretty from 'vue-json-pretty';
|
||||
|
||||
const props = withDefaults(defineProps<FormProps>(), {
|
||||
formInline: () => ({
|
||||
|
@ -61,17 +62,22 @@ defineExpose({ formRef });
|
|||
|
||||
<!-- 执行结果 -->
|
||||
<el-form-item :label="$t('quartzExecuteLog_executeResult')" prop="executeResult">
|
||||
<el-input v-model="form.executeResult" :placeholder="$t('input') + $t('quartzExecuteLog_executeResult')" autocomplete="off" type="text" />
|
||||
<VueJsonPretty
|
||||
:data="JSON.parse(form.executeResult)"
|
||||
:deep="state.deep"
|
||||
:editable="state.editable"
|
||||
:editable-trigger="state.editableTrigger as any"
|
||||
:show-double-quotes="state.showDoubleQuotes"
|
||||
:show-icon="state.showIcon"
|
||||
:show-length="state.showLength"
|
||||
:show-line="state.showLine"
|
||||
:show-line-number="state.showLineNumber"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 用执行时间户Id -->
|
||||
<el-form-item :label="$t('quartzExecuteLog_duration')" prop="duration">
|
||||
<el-input v-model="form.duration" :placeholder="$t('input') + $t('quartzExecuteLog_duration')" autocomplete="off" type="text" />
|
||||
</el-form-item>
|
||||
|
||||
<!-- 结束时间 -->
|
||||
<el-form-item :label="$t('quartzExecuteLog_endTime')" prop="endTime">
|
||||
<el-input v-model="form.endTime" :placeholder="$t('input') + $t('quartzExecuteLog_endTime')" autocomplete="off" type="text" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
|
|
|
@ -16,11 +16,9 @@ export const columns: TableColumnList = [
|
|||
// 触发器名称
|
||||
{ label: $t('quartzExecuteLog_triggerName'), prop: 'triggerName' },
|
||||
// 执行结果
|
||||
{ label: $t('quartzExecuteLog_executeResult'), prop: 'executeResult', width: 210 },
|
||||
{ label: $t('quartzExecuteLog_executeResult'), prop: 'executeResult', width: 410, slot: 'executeResult' },
|
||||
// 执行时间
|
||||
{ label: $t('quartzExecuteLog_duration'), prop: 'duration' },
|
||||
// 结束时间
|
||||
{ label: $t('quartzExecuteLog_endTime'), prop: 'endTime' },
|
||||
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
|
||||
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
|
||||
{ label: $t('table.createUser'), prop: 'createUser', slot: 'createUser', width: 90 },
|
||||
|
@ -29,3 +27,14 @@ export const columns: TableColumnList = [
|
|||
];
|
||||
// 添加规则
|
||||
export const rules = reactive({});
|
||||
|
||||
export const state = reactive({
|
||||
showLine: true,
|
||||
showLineNumber: true,
|
||||
showDoubleQuotes: true,
|
||||
showLength: true,
|
||||
editable: true,
|
||||
showIcon: true,
|
||||
editableTrigger: 'click',
|
||||
deep: 3,
|
||||
});
|
||||
|
|
|
@ -36,7 +36,6 @@ export function onView(row: any) {
|
|||
triggerName: row.triggerName,
|
||||
executeResult: row.executeResult,
|
||||
duration: row.duration,
|
||||
endTime: row.endTime,
|
||||
},
|
||||
},
|
||||
draggable: true,
|
||||
|
|
|
@ -14,8 +14,6 @@ export interface FormItemProps {
|
|||
executeResult: any;
|
||||
// 执行时间
|
||||
duration: number;
|
||||
// 结束时间
|
||||
endTime: any;
|
||||
}
|
||||
|
||||
// 添加或修改表单Props
|
||||
|
|
|
@ -4,7 +4,7 @@ import { columns } from '@/views/scheduler/schedulers/utils/columns';
|
|||
import PureTableBar from '@/components/TableBar/src/bar';
|
||||
import AddFill from '@iconify-icons/ri/add-circle-line';
|
||||
import PureTable from '@pureadmin/table';
|
||||
import { onAdd, onDelete, onSearch, onUpdate } from '@/views/scheduler/schedulers/utils/hooks';
|
||||
import { onAdd, onDelete, onPause, onResume, onSearch, onUpdate } from '@/views/scheduler/schedulers/utils/hooks';
|
||||
import Delete from '@iconify-icons/ep/delete';
|
||||
import EditPen from '@iconify-icons/ep/edit-pen';
|
||||
import Refresh from '@iconify-icons/ep/refresh';
|
||||
|
@ -116,6 +116,18 @@ onMounted(() => {
|
|||
|
||||
<template #operation="{ row }">
|
||||
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary" @click="onUpdate(row)"> {{ $t('modify') }} </el-button>
|
||||
|
||||
<!-- 暂停-->
|
||||
<el-button v-if="row.triggerState === 'ACQUIRED'" :icon="useRenderIcon('line-md:pause')" :size="size" class="reset-margin" link type="primary" @click="onPause(row)">
|
||||
{{ $t('pause') }}
|
||||
</el-button>
|
||||
|
||||
<!-- 恢复 -->
|
||||
<el-button v-if="row.triggerState === 'PAUSED'" :icon="useRenderIcon('material-symbols:resume')" :size="size" class="reset-margin" link type="primary" @click="onResume(row)">
|
||||
{{ $t('resume') }}
|
||||
</el-button>
|
||||
|
||||
<!-- 删除 -->
|
||||
<el-popconfirm :title="`${$t('delete')}${row.jobName}?`" @confirm="onDelete(row)">
|
||||
<template #reference>
|
||||
<el-button :icon="useRenderIcon(Delete)" :size="size" class="reset-margin" link type="primary">
|
||||
|
|
|
@ -12,12 +12,12 @@ export const columns: TableColumnList = [
|
|||
{ label: $t('schedulers_description'), prop: 'description' },
|
||||
// 任务类名称
|
||||
{ label: $t('schedulers_jobClassName'), prop: 'jobClassName' },
|
||||
// 触发器名称
|
||||
{ label: $t('schedulers_triggerName'), prop: 'triggerName' },
|
||||
// 触发器状态
|
||||
{ label: $t('schedulers_triggerState'), prop: 'triggerState' },
|
||||
// corn表达式
|
||||
{ label: $t('schedulers_cronExpression'), prop: 'cronExpression' },
|
||||
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
|
||||
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
|
||||
{ label: $t('table.createUser'), prop: 'createUser', slot: 'createUser', width: 90 },
|
||||
{ label: $t('table.updateUser'), prop: 'updateUser', slot: 'updateUser', width: 90 },
|
||||
{ label: $t('table.operation'), fixed: 'right', width: 210, slot: 'operation' },
|
||||
];
|
||||
|
||||
|
|
|
@ -87,9 +87,7 @@ export function onUpdate(row: any) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* * 删除Schedulers视图
|
||||
*/
|
||||
/** 删除Schedulers视图 */
|
||||
export const onDelete = async (row: any) => {
|
||||
const data = { jobName: row.jobName, jobGroup: row.jobGroup };
|
||||
|
||||
|
@ -106,3 +104,39 @@ export const onDelete = async (row: any) => {
|
|||
await schedulersStore.deleteSchedulers(data);
|
||||
await onSearch();
|
||||
};
|
||||
|
||||
/** 暂停任务 */
|
||||
export const onPause = async (row: any) => {
|
||||
const data = { jobName: row.jobName, jobGroup: row.jobGroup };
|
||||
|
||||
// 是否确认删除
|
||||
const result = await messageBox({
|
||||
title: $t('confirm_update_status'),
|
||||
showMessage: false,
|
||||
confirmMessage: undefined,
|
||||
cancelMessage: $t('cancel'),
|
||||
});
|
||||
if (!result) return;
|
||||
|
||||
// 暂停任务
|
||||
await schedulersStore.pauseSchedulers(data);
|
||||
await onSearch();
|
||||
};
|
||||
|
||||
/** 恢复任务 */
|
||||
export const onResume = async (row: any) => {
|
||||
const data = { jobName: row.jobName, jobGroup: row.jobGroup };
|
||||
|
||||
// 是否确认删除
|
||||
const result = await messageBox({
|
||||
title: $t('confirm_update_status'),
|
||||
showMessage: false,
|
||||
confirmMessage: undefined,
|
||||
cancelMessage: $t('cancel'),
|
||||
});
|
||||
if (!result) return;
|
||||
|
||||
// 恢复任务
|
||||
await schedulersStore.resumeSchedulers(data);
|
||||
await onSearch();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue