48 changed files with 1875 additions and 99 deletions
@ -0,0 +1,78 @@ |
|||
import { defAbpHttp } from '/@/utils/http/abp'; |
|||
import { |
|||
BackgroundJobInfo, |
|||
BackgroundJobInfoCreate, |
|||
BackgroundJobInfoUpdate, |
|||
BackgroundJobInfoGetListInput, |
|||
} from './model/backgroundJobInfoModel'; |
|||
import { format } from '/@/utils/strings'; |
|||
import { PagedResultDto } from '../model/baseModel'; |
|||
|
|||
enum Api { |
|||
GetById = '/api/task-management/background-jobs/{id}', |
|||
GetList = '/api/task-management/background-jobs', |
|||
Create = '/api/task-management/background-jobs', |
|||
Update = '/api/task-management/background-jobs/{id}', |
|||
Delete = '/api/task-management/background-jobs/{id}', |
|||
Pause = '/api/task-management/background-jobs/{id}/pause', |
|||
Resume = '/api/task-management/background-jobs/{id}/resume', |
|||
Trigger = '/api/task-management/background-jobs/{id}/trigger', |
|||
Stop = '/api/task-management/background-jobs/{id}/stop', |
|||
} |
|||
|
|||
export const getById = (id: string) => { |
|||
return defAbpHttp.get<BackgroundJobInfo>({ |
|||
url: format(Api.GetById, { id: id }), |
|||
}); |
|||
}; |
|||
|
|||
export const getList = (input: BackgroundJobInfoGetListInput) => { |
|||
return defAbpHttp.get<PagedResultDto<BackgroundJobInfo>>({ |
|||
url: Api.GetList, |
|||
params: input, |
|||
}); |
|||
}; |
|||
|
|||
export const create = (input: BackgroundJobInfoCreate) => { |
|||
return defAbpHttp.post<BackgroundJobInfo>({ |
|||
url: Api.Create, |
|||
data: input, |
|||
}); |
|||
}; |
|||
|
|||
export const update = (id: string, input: BackgroundJobInfoUpdate) => { |
|||
return defAbpHttp.put<BackgroundJobInfo>({ |
|||
url: format(Api.Update, { id: id }), |
|||
data: input, |
|||
}); |
|||
}; |
|||
|
|||
export const deleteById = (id: string) => { |
|||
return defAbpHttp.delete<void>({ |
|||
url: format(Api.Delete, { id: id }), |
|||
}); |
|||
}; |
|||
|
|||
export const pause = (id: string) => { |
|||
return defAbpHttp.put<void>({ |
|||
url: format(Api.Pause, { id: id }), |
|||
}); |
|||
}; |
|||
|
|||
export const resume = (id: string) => { |
|||
return defAbpHttp.put<void>({ |
|||
url: format(Api.Resume, { id: id }), |
|||
}); |
|||
}; |
|||
|
|||
export const trigger = (id: string) => { |
|||
return defAbpHttp.put<void>({ |
|||
url: format(Api.Trigger, { id: id }), |
|||
}); |
|||
}; |
|||
|
|||
export const stop = (id: string) => { |
|||
return defAbpHttp.put<void>({ |
|||
url: format(Api.Stop, { id: id }), |
|||
}); |
|||
}; |
|||
@ -0,0 +1,32 @@ |
|||
import { defAbpHttp } from '/@/utils/http/abp'; |
|||
import { |
|||
BackgroundJobLog, |
|||
BackgroundJobLogGetListInput, |
|||
} from './model/backgroundJobLogModel'; |
|||
import { format } from '/@/utils/strings'; |
|||
import { PagedResultDto } from '../model/baseModel'; |
|||
|
|||
enum Api { |
|||
GetById = '/api/task-management/background-jobs/logs/{id}', |
|||
GetList = '/api/task-management/background-jobs/logs', |
|||
Delete = '/api/task-management/background-jobs/logs/{id}', |
|||
} |
|||
|
|||
export const getById = (id: string) => { |
|||
return defAbpHttp.get<BackgroundJobLog>({ |
|||
url: format(Api.GetById, { id: id }), |
|||
}); |
|||
}; |
|||
|
|||
export const getList = (input: BackgroundJobLogGetListInput) => { |
|||
return defAbpHttp.get<PagedResultDto<BackgroundJobLog>>({ |
|||
url: Api.GetList, |
|||
params: input, |
|||
}); |
|||
}; |
|||
|
|||
export const deleteById = (id: string) => { |
|||
return defAbpHttp.delete<void>({ |
|||
url: format(Api.Delete, { id: id }), |
|||
}); |
|||
}; |
|||
@ -0,0 +1,88 @@ |
|||
import { ExtensibleAuditedEntity, IHasConcurrencyStamp, PagedAndSortedResultRequestDto } from "../../model/baseModel"; |
|||
|
|||
export enum JobStatus { |
|||
None = -1, |
|||
Completed = 0, |
|||
Running = 10, |
|||
Paused = 20, |
|||
Stopped = 30, |
|||
} |
|||
|
|||
export enum JobType { |
|||
Once, |
|||
Period, |
|||
Persistent, |
|||
} |
|||
|
|||
export enum JobPriority { |
|||
Low = 5, |
|||
BelowNormal = 10, |
|||
Normal = 0xF, |
|||
AboveNormal = 20, |
|||
High = 25 |
|||
} |
|||
|
|||
export interface BackgroundJobInfo extends ExtensibleAuditedEntity<string>, IHasConcurrencyStamp { |
|||
isEnabled: boolean; |
|||
name: string; |
|||
group: string; |
|||
type: string; |
|||
result: string; |
|||
args: ExtraPropertyDictionary, |
|||
description?: string; |
|||
beginTime: Date; |
|||
endTime?: Date; |
|||
lastRunTime?: Date; |
|||
nextRunTime?: Date; |
|||
jobType: JobType; |
|||
cron: string; |
|||
triggerCount: number; |
|||
tryCount: number; |
|||
maxTryCount: number; |
|||
maxCount: number; |
|||
isAbandoned: boolean; |
|||
interval: number; |
|||
priority: JobPriority; |
|||
lockTimeOut: number; |
|||
} |
|||
|
|||
interface BackgroundJobInfoCreateOrUpdate { |
|||
isEnabled: boolean; |
|||
args: ExtraPropertyDictionary; |
|||
description?: string; |
|||
beginTime: Date; |
|||
endTime?: Date; |
|||
jobType: JobType; |
|||
cron: string; |
|||
maxCount: number; |
|||
interval: number; |
|||
priority: JobPriority; |
|||
lockTimeOut: number; |
|||
} |
|||
|
|||
export interface BackgroundJobInfoCreate extends BackgroundJobInfoCreateOrUpdate { |
|||
name: string; |
|||
group: string; |
|||
type: string; |
|||
} |
|||
|
|||
export interface BackgroundJobInfoUpdate extends BackgroundJobInfoCreateOrUpdate, IHasConcurrencyStamp { |
|||
|
|||
} |
|||
|
|||
export interface BackgroundJobInfoGetListInput extends PagedAndSortedResultRequestDto { |
|||
filter?: string; |
|||
name?: string; |
|||
group?: string; |
|||
type?: string; |
|||
status?: JobStatus; |
|||
beginTime?: Date; |
|||
endTime?: Date; |
|||
beginLastRunTime?: Date; |
|||
endLastRunTime?: Date; |
|||
beginCreationTime?: Date; |
|||
endCreationTime?: Date; |
|||
isAbandoned?: boolean; |
|||
jobType?: JobType; |
|||
priority?: JobPriority; |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
import { PagedAndSortedResultRequestDto } from '/@/api/model/baseModel'; |
|||
|
|||
export interface BackgroundJobLog { |
|||
id: number; |
|||
jobName: string; |
|||
jobGroup: string; |
|||
jobType: string; |
|||
message: string; |
|||
runTime: Date; |
|||
exception?: string; |
|||
} |
|||
|
|||
export interface BackgroundJobLogGetListInput extends PagedAndSortedResultRequestDto { |
|||
jobId?: string; |
|||
filter?: string; |
|||
hasExceptions?: boolean; |
|||
name?: string; |
|||
group?: string; |
|||
type?: string; |
|||
beginRunTime?: Date; |
|||
endRunTime?: Date; |
|||
} |
|||
@ -0,0 +1,325 @@ |
|||
<template> |
|||
<BasicModal |
|||
@register="registerModal" |
|||
:width="800" |
|||
:height="400" |
|||
:title="modalTitle" |
|||
:mask-closable="false" |
|||
@ok="handleSubmit" |
|||
> |
|||
<Form |
|||
ref="formElRef" |
|||
:colon="false" |
|||
label-align="left" |
|||
layout="horizontal" |
|||
:model="modelRef" |
|||
:rules="modelRules" |
|||
> |
|||
<Tabs v-model:activeKey="activeKey"> |
|||
<TabPane key="basic" :tab="L('BasicInfo')"> |
|||
<FormItem name="isEnabled" :labelCol="{ span: 4 }" :wrapperCol="{ span: 18 }" :label="L('DisplayName:IsEnabled')"> |
|||
<Checkbox v-model:checked="modelRef.isEnabled">{{ L('DisplayName:IsEnabled') }}</Checkbox> |
|||
</FormItem> |
|||
<FormItem name="group" required :label="L('DisplayName:Group')"> |
|||
<Input :disabled="isEditModal" v-model:value="modelRef.group" autocomplete="off" /> |
|||
</FormItem> |
|||
<FormItem name="name" required :label="L('DisplayName:Name')"> |
|||
<Input :disabled="isEditModal" v-model:value="modelRef.name" autocomplete="off" /> |
|||
</FormItem> |
|||
<FormItem name="type" required :label="L('DisplayName:Type')" :extra="L('Description:Type')"> |
|||
<Textarea :readonly="isEditModal" v-model:value="modelRef.type" :auto-size="{ minRows: 3, maxRows: 6 }" /> |
|||
</FormItem> |
|||
<FormItem name="beginTime" :label="L('DisplayName:BeginTime')"> |
|||
<DatePicker style="width: 100%;" v-model:value="modelRef.beginTime" /> |
|||
</FormItem> |
|||
<FormItem name="endTime" :label="L('DisplayName:EndTime')"> |
|||
<DatePicker style="width: 100%;" v-model:value="modelRef.endTime" /> |
|||
</FormItem> |
|||
<FormItem name="jobType" :label="L('DisplayName:JobType')" :help="L('Description:JobType')"> |
|||
<Select :options="jopTypeOptions" v-model:value="modelRef.jobType" :default-value="JobType.Once" /> |
|||
</FormItem> |
|||
<FormItem name="cron" v-if="modelRef.jobType === JobType.Period" :label="L('DisplayName:Cron')" :help="L('Description:Cron')"> |
|||
<Input v-model:value="modelRef.cron" autocomplete="off" /> |
|||
</FormItem> |
|||
<FormItem name="interval" v-if="modelRef.jobType !== JobType.Period" :label="L('DisplayName:Interval')" :help="L('Description:Interval')"> |
|||
<InputNumber style="width: 100%;" v-model:value="modelRef.interval" /> |
|||
</FormItem> |
|||
<FormItem name="maxCount" :label="L('DisplayName:MaxCount')" :help="L('Description:MaxCount')"> |
|||
<InputNumber style="width: 100%;" v-model:value="modelRef.maxCount" /> |
|||
</FormItem> |
|||
<FormItem name="maxTryCount" :label="L('DisplayName:MaxTryCount')" :help="L('Description:MaxTryCount')"> |
|||
<InputNumber style="width: 100%;" v-model:value="modelRef.maxTryCount" /> |
|||
</FormItem> |
|||
<FormItem name="priority" :label="L('DisplayName:Priority')" :help="L('Description:Priority')"> |
|||
<Select :options="jobPriorityOptions" v-model:value="modelRef.priority" :default-value="JobPriority.Normal" /> |
|||
</FormItem> |
|||
<FormItem name="lockTimeOut" :label="L('DisplayName:LockTimeOut')" :help="L('Description:LockTimeOut')"> |
|||
<InputNumber style="width: 100%;" v-model:value="modelRef.lockTimeOut" /> |
|||
</FormItem> |
|||
<FormItem name="description" :label="L('DisplayName:Description')"> |
|||
<Textarea v-model:value="modelRef.description" :row="3" /> |
|||
</FormItem> |
|||
<FormItem :label="L('DisplayName:Result')"> |
|||
<Textarea readonly v-model:value="modelRef.result" :auto-size="{ minRows: 6, maxRows: 12 }" /> |
|||
</FormItem> |
|||
</TabPane> |
|||
<TabPane key="paramters" :tab="L('Paramters')"> |
|||
<BasicTable @register="registerTable" :data-source="jobArgs"> |
|||
<template #toolbar> |
|||
<Button type="primary" @click="handleAddNewArg">{{ L('BackgroundJobs:AddNewArg') }} |
|||
</Button> |
|||
</template> |
|||
<template #action="{ record }"> |
|||
<TableAction |
|||
:stop-button-propagation="true" |
|||
:actions="[ |
|||
{ |
|||
label: L('Edit'), |
|||
icon: 'ant-design:edit-outlined', |
|||
onClick: handleEditParam.bind(null, record), |
|||
}, |
|||
{ |
|||
color: 'error', |
|||
label: L('Delete'), |
|||
icon: 'ant-design:delete-outlined', |
|||
onClick: handleDeleteParam.bind(null, record), |
|||
}, |
|||
]" |
|||
/> |
|||
</template> |
|||
</BasicTable> |
|||
</TabPane> |
|||
</Tabs> |
|||
</Form> |
|||
<BasicModal |
|||
:title="L('BackgroundJobs:Paramter')" |
|||
@register="registerParamModal" |
|||
@ok="handleSaveParam" |
|||
> |
|||
<BasicForm @register="registerParamForm" /> |
|||
</BasicModal> |
|||
</BasicModal> |
|||
</template> |
|||
|
|||
<script lang="ts" setup> |
|||
import { computed, ref, reactive, unref, nextTick } from 'vue'; |
|||
import { useLocalization } from '/@/hooks/abp/useLocalization'; |
|||
import { useValidation } from '/@/hooks/abp/useValidation'; |
|||
import { useMessage } from '/@/hooks/web/useMessage'; |
|||
import { |
|||
Button, |
|||
Checkbox, |
|||
DatePicker, |
|||
Form, |
|||
Select, |
|||
Tabs, |
|||
Input, |
|||
InputNumber, |
|||
Textarea, |
|||
} from 'ant-design-vue'; |
|||
import { BasicForm, useForm } from '/@/components/Form'; |
|||
import { BasicModal, useModal, useModalInner } from '/@/components/Modal'; |
|||
import { BasicTable, BasicColumn, TableAction, useTable } from '/@/components/Table'; |
|||
import { getById, create, update } from '/@/api/task-management/backgroundJobInfo'; |
|||
import { JobType, JobPriority, BackgroundJobInfo } from '/@/api/task-management/model/backgroundJobInfoModel'; |
|||
import { JobTypeMap, JobPriorityMap } from '../datas/typing'; |
|||
|
|||
const FormItem = Form.Item; |
|||
const TabPane = Tabs.TabPane; |
|||
|
|||
const emit = defineEmits(['change', 'register']); |
|||
const { L } = useLocalization('TaskManagement'); |
|||
const { ruleCreator } = useValidation(); |
|||
const { createMessage } = useMessage(); |
|||
const formElRef = ref<any>(); |
|||
const activeKey = ref('basic'); |
|||
const modelRef = ref<BackgroundJobInfo>({ |
|||
id: '', |
|||
isEnabled: true, |
|||
priority: JobPriority.Normal, |
|||
jobType: JobType.Once, |
|||
args: {}, |
|||
} as BackgroundJobInfo); |
|||
const [registerModal, { closeModal, changeOkLoading }] = useModalInner((model) => { |
|||
activeKey.value = 'basic'; |
|||
fetchModel(model.id); |
|||
}); |
|||
const [registerParamModal, { openModal: openParamModal, closeModal: closeParamModal }] = useModal(); |
|||
const [registerParamForm, { resetFields: resetParamFields, setFieldsValue: setParamFields, validate }] = useForm({ |
|||
labelAlign: 'left', |
|||
labelWidth: 120, |
|||
schemas: [ |
|||
{ |
|||
field: 'key', |
|||
component: 'Input', |
|||
label: L('DisplayName:Key'), |
|||
required: true, |
|||
colProps: { span: 24 }, |
|||
componentProps: { |
|||
autocomplete: "off" |
|||
}, |
|||
}, |
|||
{ |
|||
field: 'value', |
|||
component: 'InputTextArea', |
|||
label: L('DisplayName:Value'), |
|||
required: true, |
|||
colProps: { span: 24 }, |
|||
}, |
|||
], |
|||
showActionButtonGroup: false, |
|||
}); |
|||
const columns: BasicColumn[] = [ |
|||
{ |
|||
title: L('DisplayName:Key'), |
|||
dataIndex: 'key', |
|||
align: 'left', |
|||
width: 200, |
|||
sorter: true, |
|||
}, |
|||
{ |
|||
title: L('DisplayName:Value'), |
|||
dataIndex: 'value', |
|||
align: 'left', |
|||
width: 300, |
|||
sorter: true, |
|||
}, |
|||
]; |
|||
const [registerTable] = useTable({ |
|||
rowKey: 'key', |
|||
columns: columns, |
|||
pagination: false, |
|||
maxHeight: 300, |
|||
actionColumn: { |
|||
width: 180, |
|||
title: L('Actions'), |
|||
dataIndex: 'action', |
|||
slots: { customRender: 'action' }, |
|||
}, |
|||
}); |
|||
const isEditModal = computed(() => { |
|||
if (modelRef.value.id) { |
|||
return true; |
|||
} |
|||
return false; |
|||
}); |
|||
const modalTitle = computed(() => { |
|||
return isEditModal.value ? L('BackgroundJobs:Edit') : L('BackgroundJobs:AddNew'); |
|||
}); |
|||
const modelRules = reactive({ |
|||
group: ruleCreator.fieldRequired({ |
|||
name: 'Group', |
|||
resourceName: 'TaskManagement', |
|||
prefix: 'DisplayName', |
|||
}), |
|||
name: ruleCreator.fieldRequired({ |
|||
name: 'Name', |
|||
resourceName: 'TaskManagement', |
|||
prefix: 'DisplayName', |
|||
}), |
|||
type: ruleCreator.fieldRequired({ |
|||
name: 'Type', |
|||
resourceName: 'TaskManagement', |
|||
prefix: 'DisplayName', |
|||
}), |
|||
beginTime: ruleCreator.fieldRequired({ |
|||
name: 'BeginTime', |
|||
resourceName: 'TaskManagement', |
|||
prefix: 'DisplayName', |
|||
type: 'date', |
|||
}), |
|||
}); |
|||
const jopTypeOptions = reactive([ |
|||
{ label: JobTypeMap[JobType.Once], value: JobType.Once }, |
|||
{ label: JobTypeMap[JobType.Period], value: JobType.Period }, |
|||
{ label: JobTypeMap[JobType.Persistent], value: JobType.Persistent }, |
|||
]); |
|||
const jobPriorityOptions = reactive([ |
|||
{ label: JobPriorityMap[JobPriority.Low], value: JobPriority.Low }, |
|||
{ label: JobPriorityMap[JobPriority.BelowNormal], value: JobPriority.BelowNormal }, |
|||
{ label: JobPriorityMap[JobPriority.Normal], value: JobPriority.Normal }, |
|||
{ label: JobPriorityMap[JobPriority.AboveNormal], value: JobPriority.AboveNormal }, |
|||
{ label: JobPriorityMap[JobPriority.High], value: JobPriority.High }, |
|||
]); |
|||
const jobArgs = computed(() => { |
|||
const model = unref(modelRef); |
|||
if (!model.args) return []; |
|||
return Object.keys(model.args).map((key) => { |
|||
return { |
|||
key: key, |
|||
value: model.args[key], |
|||
}; |
|||
}); |
|||
}); |
|||
|
|||
function fetchModel(id: string) { |
|||
if (!id) { |
|||
resetFields(); |
|||
return; |
|||
} |
|||
getById(id).then((res) => { |
|||
modelRef.value = res; |
|||
}); |
|||
} |
|||
|
|||
function resetFields() { |
|||
nextTick(() => { |
|||
modelRef.value = { |
|||
id: '', |
|||
isEnabled: true, |
|||
priority: JobPriority.Normal, |
|||
jobType: JobType.Once, |
|||
args: {}, |
|||
} as BackgroundJobInfo; |
|||
}); |
|||
} |
|||
|
|||
function handleSubmit() { |
|||
const formEl = unref(formElRef); |
|||
formEl?.validate().then(() => { |
|||
changeOkLoading(true); |
|||
const model = unref(modelRef); |
|||
const api = isEditModal.value |
|||
? update(model.id, Object.assign(model)) |
|||
: create(Object.assign(model)); |
|||
api.then(() => { |
|||
createMessage.success(L('Successful')); |
|||
formEl?.resetFields(); |
|||
closeModal(); |
|||
emit('change'); |
|||
}).finally(() => { |
|||
changeOkLoading(false); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
function handleAddNewArg() { |
|||
openParamModal(true); |
|||
nextTick(() => { |
|||
resetParamFields(); |
|||
}); |
|||
} |
|||
|
|||
function handleSaveParam() { |
|||
validate().then((input) => { |
|||
const model = unref(modelRef); |
|||
model.args ??= {}; |
|||
model.args[input.key] = input.value; |
|||
resetParamFields(); |
|||
closeParamModal(); |
|||
}); |
|||
} |
|||
|
|||
function handleEditParam(record) { |
|||
openParamModal(true); |
|||
nextTick(() => { |
|||
setParamFields(record); |
|||
}); |
|||
} |
|||
|
|||
function handleDeleteParam(record) { |
|||
const model = unref(modelRef); |
|||
model.args ??= {}; |
|||
delete model.args[record.key] |
|||
} |
|||
</script> |
|||
@ -0,0 +1,164 @@ |
|||
<template> |
|||
<div class="content"> |
|||
<BasicTable @register="registerTable"> |
|||
<template #toolbar> |
|||
<a-button |
|||
v-if="hasPermission('TaskManagement.BackgroundJobs.Create')" |
|||
type="primary" |
|||
@click="handleAddNew" |
|||
>{{ L('BackgroundJobs:AddNew') }}</a-button |
|||
> |
|||
</template> |
|||
<template #enable="{ record }"> |
|||
<Switch :checked="record.isEnabled" disabled /> |
|||
</template> |
|||
<template #status="{ record }"> |
|||
<Tag :color="JobStatusColor[record.status]">{{ JobStatusMap[record.status] }}</Tag> |
|||
</template> |
|||
<template #type="{ record }"> |
|||
<Tag color="blue">{{ JobTypeMap[record.jobType] }}</Tag> |
|||
</template> |
|||
<template #priority="{ record }"> |
|||
<Tag :color="JobPriorityColor[record.priority]">{{ JobPriorityMap[record.priority] }}</Tag> |
|||
</template> |
|||
<template #action="{ record }"> |
|||
<TableAction |
|||
:stop-button-propagation="true" |
|||
:actions="[ |
|||
{ |
|||
auth: 'TaskManagement.BackgroundJobs.Update', |
|||
label: L('Edit'), |
|||
icon: 'ant-design:edit-outlined', |
|||
onClick: handleEdit.bind(null, record), |
|||
}, |
|||
{ |
|||
auth: 'TaskManagement.BackgroundJobs.Delete', |
|||
color: 'error', |
|||
label: L('Delete'), |
|||
icon: 'ant-design:delete-outlined', |
|||
onClick: handleDelete.bind(null, record), |
|||
}, |
|||
]" |
|||
:dropDownActions="[ |
|||
{ |
|||
auth: 'TaskManagement.BackgroundJobs.Pause', |
|||
label: L('BackgroundJobs:Pause'), |
|||
ifShow: record.status === JobStatus.Running, |
|||
onClick: handlePause.bind(null, record), |
|||
}, |
|||
{ |
|||
auth: 'TaskManagement.BackgroundJobs.Resume', |
|||
label: L('BackgroundJobs:Resume'), |
|||
ifShow: [JobStatus.Paused, JobStatus.Stopped].includes(record.status), |
|||
onClick: handleResume.bind(null, record), |
|||
}, |
|||
{ |
|||
auth: 'TaskManagement.BackgroundJobs.Trigger', |
|||
label: L('BackgroundJobs:Trigger'), |
|||
ifShow: [JobStatus.Running, JobStatus.Completed].includes(record.status), |
|||
onClick: handleTrigger.bind(null, record), |
|||
}, |
|||
{ |
|||
auth: 'TaskManagement.BackgroundJobs.Stop', |
|||
label: L('BackgroundJobs:Stop'), |
|||
ifShow: record.status === JobStatus.Running, |
|||
onClick: handleStop.bind(null, record), |
|||
}, |
|||
]" |
|||
/> |
|||
</template> |
|||
</BasicTable> |
|||
<BackgroundJobInfoModal @change="handleChange" @register="registerModal" /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script lang="ts" setup> |
|||
import { Switch, Modal, Tag, message } from 'ant-design-vue'; |
|||
import { useLocalization } from '/@/hooks/abp/useLocalization'; |
|||
import { usePermission } from '/@/hooks/web/usePermission'; |
|||
import { useModal } from '/@/components/Modal'; |
|||
import { BasicTable, TableAction, useTable } from '/@/components/Table'; |
|||
import { formatPagedRequest } from '/@/utils/http/abp/helper'; |
|||
import { getList, deleteById, pause, resume, trigger, stop } from '/@/api/task-management/backgroundJobInfo'; |
|||
import { JobStatus } from '/@/api/task-management/model/backgroundJobInfoModel'; |
|||
import { getDataColumns } from '../datas/TableData'; |
|||
import { getSearchFormSchemas } from '../datas/ModalData'; |
|||
import { JobStatusMap, JobStatusColor, JobTypeMap, JobPriorityMap, JobPriorityColor } from '../datas/typing'; |
|||
import BackgroundJobInfoModal from './BackgroundJobInfoModal.vue'; |
|||
|
|||
const { L } = useLocalization('TaskManagement'); |
|||
const { hasPermission } = usePermission(); |
|||
const [registerModal, { openModal }] = useModal(); |
|||
const [registerTable, { reload }] = useTable({ |
|||
rowKey: 'id', |
|||
title: L('BackgroundJobs'), |
|||
columns: getDataColumns(), |
|||
api: getList, |
|||
beforeFetch: formatPagedRequest, |
|||
pagination: true, |
|||
striped: false, |
|||
useSearchForm: true, |
|||
showTableSetting: true, |
|||
bordered: true, |
|||
showIndexColumn: false, |
|||
canResize: false, |
|||
immediate: true, |
|||
rowSelection: { type: 'radio' }, |
|||
formConfig: getSearchFormSchemas(), |
|||
actionColumn: { |
|||
width: 220, |
|||
title: L('Actions'), |
|||
dataIndex: 'action', |
|||
slots: { customRender: 'action' }, |
|||
}, |
|||
}); |
|||
|
|||
function handleChange() { |
|||
reload(); |
|||
} |
|||
|
|||
function handleAddNew() { |
|||
openModal(true, { id: null }); |
|||
} |
|||
|
|||
function handleEdit(record) { |
|||
openModal(true, record); |
|||
} |
|||
|
|||
function handlePause(record) { |
|||
pause(record.id).then(() => { |
|||
message.success(L('Successful')); |
|||
}); |
|||
} |
|||
|
|||
function handleResume(record) { |
|||
resume(record.id).then(() => { |
|||
message.success(L('Successful')); |
|||
}); |
|||
} |
|||
|
|||
function handleTrigger(record) { |
|||
trigger(record.id).then(() => { |
|||
message.success(L('Successful')); |
|||
}); |
|||
} |
|||
|
|||
function handleStop(record) { |
|||
stop(record.id).then(() => { |
|||
message.success(L('Successful')); |
|||
}); |
|||
} |
|||
|
|||
function handleDelete(record) { |
|||
Modal.warning({ |
|||
title: L('AreYouSure'), |
|||
content: L('ItemWillBeDeletedMessage'), |
|||
okCancel: true, |
|||
onOk: () => { |
|||
deleteById(record.id).then(() => { |
|||
reload(); |
|||
}); |
|||
}, |
|||
}); |
|||
} |
|||
</script> |
|||
@ -0,0 +1,154 @@ |
|||
import { useLocalization } from '/@/hooks/abp/useLocalization'; |
|||
import { FormProps } from '/@/components/Form'; |
|||
import { JobStatus, JobType, JobPriority } from '/@/api/task-management/model/backgroundJobInfoModel'; |
|||
import { JobStatusMap, JobTypeMap, JobPriorityMap } from './typing'; |
|||
|
|||
const { L } = useLocalization('TaskManagement', 'AbpUi'); |
|||
|
|||
export function getSearchFormSchemas(): Partial<FormProps> { |
|||
return { |
|||
labelWidth: 100, |
|||
schemas: [ |
|||
{ |
|||
field: 'group', |
|||
component: 'Input', |
|||
label: L('DisplayName:Group'), |
|||
colProps: { span: 6 }, |
|||
}, |
|||
{ |
|||
field: 'name', |
|||
component: 'Input', |
|||
label: L('DisplayName:Name'), |
|||
colProps: { span: 6 }, |
|||
}, |
|||
{ |
|||
field: 'type', |
|||
component: 'Input', |
|||
label: L('DisplayName:Type'), |
|||
colProps: { span: 12 }, |
|||
}, |
|||
{ |
|||
field: 'status', |
|||
component: 'Select', |
|||
label: L('DisplayName:Status'), |
|||
colProps: { span: 6 }, |
|||
componentProps: { |
|||
options: [ |
|||
{ label: JobStatusMap[JobStatus.None], value: JobStatus.None }, |
|||
{ label: JobStatusMap[JobStatus.Running], value: JobStatus.Running }, |
|||
{ label: JobStatusMap[JobStatus.Completed], value: JobStatus.Completed }, |
|||
{ label: JobStatusMap[JobStatus.Paused], value: JobStatus.Paused }, |
|||
{ label: JobStatusMap[JobStatus.Stopped], value: JobStatus.Stopped }, |
|||
], |
|||
}, |
|||
}, |
|||
{ |
|||
field: 'beginTime', |
|||
component: 'DatePicker', |
|||
label: L('DisplayName:BeginTime'), |
|||
colProps: { span: 9 }, |
|||
componentProps: { |
|||
style: { |
|||
width: '100%', |
|||
}, |
|||
}, |
|||
}, |
|||
{ |
|||
field: 'endTime', |
|||
component: 'DatePicker', |
|||
label: L('DisplayName:EndTime'), |
|||
colProps: { span: 9 }, |
|||
componentProps: { |
|||
style: { |
|||
width: '100%', |
|||
}, |
|||
}, |
|||
}, |
|||
{ |
|||
field: 'jobType', |
|||
component: 'Select', |
|||
label: L('DisplayName:JobType'), |
|||
colProps: { span: 6 }, |
|||
componentProps: { |
|||
options: [ |
|||
{ label: JobTypeMap[JobType.Once], value: JobType.Once }, |
|||
{ label: JobTypeMap[JobType.Period], value: JobType.Period }, |
|||
{ label: JobTypeMap[JobType.Persistent], value: JobType.Persistent }, |
|||
], |
|||
}, |
|||
}, |
|||
{ |
|||
field: 'beginLastRunTime', |
|||
component: 'DatePicker', |
|||
label: L('DisplayName:BeginLastRunTime'), |
|||
colProps: { span: 9 }, |
|||
componentProps: { |
|||
style: { |
|||
width: '100%', |
|||
}, |
|||
}, |
|||
}, |
|||
{ |
|||
field: 'endLastRunTime', |
|||
component: 'DatePicker', |
|||
label: L('DisplayName:EndLastRunTime'), |
|||
colProps: { span: 9 }, |
|||
componentProps: { |
|||
style: { |
|||
width: '100%', |
|||
}, |
|||
}, |
|||
}, |
|||
{ |
|||
field: 'priority', |
|||
component: 'Select', |
|||
label: L('DisplayName:Priority'), |
|||
colProps: { span: 6 }, |
|||
componentProps: { |
|||
options: [ |
|||
{ label: JobPriorityMap[JobPriority.Low], value: JobPriority.Low }, |
|||
{ label: JobPriorityMap[JobPriority.BelowNormal], value: JobPriority.BelowNormal }, |
|||
{ label: JobPriorityMap[JobPriority.Normal], value: JobPriority.Normal }, |
|||
{ label: JobPriorityMap[JobPriority.AboveNormal], value: JobPriority.AboveNormal }, |
|||
{ label: JobPriorityMap[JobPriority.High], value: JobPriority.High }, |
|||
], |
|||
}, |
|||
}, |
|||
{ |
|||
field: 'beginCreationTime', |
|||
component: 'DatePicker', |
|||
label: L('DisplayName:BeginCreationTime'), |
|||
colProps: { span: 9 }, |
|||
componentProps: { |
|||
style: { |
|||
width: '100%', |
|||
}, |
|||
}, |
|||
}, |
|||
{ |
|||
field: 'endCreationTime', |
|||
component: 'DatePicker', |
|||
label: L('DisplayName:EndCreationTime'), |
|||
colProps: { span: 9 }, |
|||
componentProps: { |
|||
style: { |
|||
width: '100%', |
|||
}, |
|||
}, |
|||
}, |
|||
{ |
|||
field: 'isAbandoned', |
|||
component: 'Checkbox', |
|||
label: L('DisplayName:IsAbandoned'), |
|||
colProps: { span: 4 }, |
|||
renderComponentContent: L('DisplayName:IsAbandoned'), |
|||
}, |
|||
{ |
|||
field: 'filter', |
|||
component: 'Input', |
|||
label: L('Search'), |
|||
colProps: { span: 20 }, |
|||
}, |
|||
], |
|||
}; |
|||
} |
|||
@ -0,0 +1,125 @@ |
|||
import { useLocalization } from '/@/hooks/abp/useLocalization'; |
|||
import { BasicColumn } from '/@/components/Table'; |
|||
import { formatToDateTime } from '/@/utils/dateUtil'; |
|||
|
|||
const { L } = useLocalization('TaskManagement'); |
|||
|
|||
export function getDataColumns(): BasicColumn[] { |
|||
return [ |
|||
{ |
|||
title: 'id', |
|||
dataIndex: 'id', |
|||
width: 1, |
|||
ifShow: false, |
|||
}, |
|||
{ |
|||
title: L('DisplayName:Group'), |
|||
dataIndex: 'group', |
|||
align: 'left', |
|||
width: 150, |
|||
sorter: true, |
|||
}, |
|||
{ |
|||
title: L('DisplayName:Name'), |
|||
dataIndex: 'name', |
|||
align: 'left', |
|||
width: 300, |
|||
sorter: true, |
|||
}, |
|||
{ |
|||
title: L('DisplayName:Type'), |
|||
dataIndex: 'type', |
|||
align: 'left', |
|||
width: 350, |
|||
sorter: true, |
|||
}, |
|||
{ |
|||
title: L('DisplayName:CreationTime'), |
|||
dataIndex: 'creationTime', |
|||
align: 'left', |
|||
width: 150, |
|||
sorter: true, |
|||
format: (text) => { |
|||
return formatToDateTime(text); |
|||
}, |
|||
}, |
|||
{ |
|||
title: L('DisplayName:Status'), |
|||
dataIndex: 'status', |
|||
align: 'left', |
|||
width: 100, |
|||
sorter: true, |
|||
slots: { |
|||
customRender: 'status', |
|||
} |
|||
}, |
|||
{ |
|||
title: L('DisplayName:Result'), |
|||
dataIndex: 'result', |
|||
align: 'left', |
|||
width: 200, |
|||
sorter: true, |
|||
}, |
|||
{ |
|||
title: L('DisplayName:LastRunTime'), |
|||
dataIndex: 'lastRunTime', |
|||
align: 'left', |
|||
width: 150, |
|||
sorter: true, |
|||
format: (text) => { |
|||
return text ? formatToDateTime(text) : ''; |
|||
}, |
|||
}, |
|||
{ |
|||
title: L('DisplayName:NextRunTime'), |
|||
dataIndex: 'nextRunTime', |
|||
align: 'left', |
|||
width: 150, |
|||
sorter: true, |
|||
format: (text) => { |
|||
return text ? formatToDateTime(text) : ''; |
|||
}, |
|||
}, |
|||
{ |
|||
title: L('DisplayName:JobType'), |
|||
dataIndex: 'jobType', |
|||
align: 'left', |
|||
width: 150, |
|||
sorter: true, |
|||
slots: { |
|||
customRender: 'type', |
|||
} |
|||
}, |
|||
{ |
|||
title: L('DisplayName:Priority'), |
|||
dataIndex: 'priority', |
|||
align: 'left', |
|||
width: 150, |
|||
sorter: true, |
|||
slots: { |
|||
customRender: 'priority', |
|||
} |
|||
}, |
|||
{ |
|||
title: L('DisplayName:Cron'), |
|||
dataIndex: 'cron', |
|||
align: 'left', |
|||
width: 150, |
|||
sorter: true, |
|||
}, |
|||
{ |
|||
title: L('DisplayName:TriggerCount'), |
|||
dataIndex: 'triggerCount', |
|||
align: 'left', |
|||
width: 100, |
|||
sorter: true, |
|||
}, |
|||
{ |
|||
title: L('DisplayName:TryCount'), |
|||
dataIndex: 'tryCount', |
|||
align: 'left', |
|||
width: 100, |
|||
sorter: true, |
|||
}, |
|||
]; |
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
import { JobStatus, JobType, JobPriority } from '/@/api/task-management/model/backgroundJobInfoModel'; |
|||
import { useLocalization } from '/@/hooks/abp/useLocalization'; |
|||
|
|||
const { L } = useLocalization('TaskManagement'); |
|||
|
|||
export const JobStatusMap = { |
|||
[JobStatus.None]: L('DisplayName:None'), |
|||
[JobStatus.Completed]: L('DisplayName:Completed'), |
|||
[JobStatus.Running]: L('DisplayName:Running'), |
|||
[JobStatus.Paused]: L('DisplayName:Paused'), |
|||
[JobStatus.Stopped]: L('DisplayName:Stopped'), |
|||
} |
|||
export const JobStatusColor = { |
|||
[JobStatus.None]: '', |
|||
[JobStatus.Completed]: '#339933', |
|||
[JobStatus.Running]: '#3399CC', |
|||
[JobStatus.Paused]: '#CC6633', |
|||
[JobStatus.Stopped]: '#FF6600', |
|||
} |
|||
|
|||
export const JobTypeMap = { |
|||
[JobType.Once]: L('DisplayName:Once'), |
|||
[JobType.Period]: L('DisplayName:Period'), |
|||
[JobType.Persistent]: L('DisplayName:Persistent'), |
|||
} |
|||
|
|||
export const JobPriorityMap = { |
|||
[JobPriority.Low]: L('DisplayName:Low'), |
|||
[JobPriority.BelowNormal]: L('DisplayName:BelowNormal'), |
|||
[JobPriority.Normal]: L('DisplayName:Normal'), |
|||
[JobPriority.AboveNormal]: L('DisplayName:AboveNormal'), |
|||
[JobPriority.High]: L('DisplayName:High'), |
|||
} |
|||
|
|||
export const JobPriorityColor = { |
|||
[JobPriority.Low]: 'purple', |
|||
[JobPriority.BelowNormal]: 'cyan', |
|||
[JobPriority.Normal]: 'blue', |
|||
[JobPriority.AboveNormal]: 'orange', |
|||
[JobPriority.High]: 'red', |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
<template> |
|||
<BackgroundJobInfoTable /> |
|||
</template> |
|||
|
|||
<script lang="ts"> |
|||
import { defineComponent } from 'vue'; |
|||
|
|||
import BackgroundJobInfoTable from './components/BackgroundJobInfoTable.vue'; |
|||
export default defineComponent({ |
|||
components: { |
|||
BackgroundJobInfoTable, |
|||
}, |
|||
setup() {}, |
|||
}); |
|||
</script> |
|||
@ -1,17 +1,36 @@ |
|||
namespace LINGYUN.Abp.TaskManagement; |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Volo.Abp.Validation; |
|||
|
|||
namespace LINGYUN.Abp.TaskManagement; |
|||
|
|||
public class BackgroundJobInfoCreateDto : BackgroundJobInfoCreateOrUpdateDto |
|||
{ |
|||
/// <summary>
|
|||
/// 任务名称
|
|||
/// </summary>
|
|||
[Required] |
|||
[DynamicStringLength(typeof(BackgroundJobInfoConsts), nameof(BackgroundJobInfoConsts.MaxNameLength))] |
|||
public string Name { get; set; } |
|||
/// <summary>
|
|||
/// 任务分组
|
|||
/// </summary>
|
|||
[Required] |
|||
[DynamicStringLength(typeof(BackgroundJobInfoConsts), nameof(BackgroundJobInfoConsts.MaxGroupLength))] |
|||
public string Group { get; set; } |
|||
/// <summary>
|
|||
/// 任务类型
|
|||
/// </summary>
|
|||
[Required] |
|||
[DynamicStringLength(typeof(BackgroundJobInfoConsts), nameof(BackgroundJobInfoConsts.MaxTypeLength))] |
|||
public string Type { get; set; } |
|||
/// <summary>
|
|||
/// 开始时间
|
|||
/// </summary>
|
|||
[Required] |
|||
public DateTime BeginTime { get; set; } |
|||
/// <summary>
|
|||
/// 结束时间
|
|||
/// </summary>
|
|||
public DateTime? EndTime { get; set; } |
|||
} |
|||
|
|||
@ -0,0 +1,193 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using LY.MicroService.TaskManagement.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace LY.MicroService.TaskManagement.Migrations |
|||
{ |
|||
[DbContext(typeof(TaskManagementMigrationsDbContext))] |
|||
[Migration("20220110104046_Reset-Field-Type-Length-With-Background-Job-Info")] |
|||
partial class ResetFieldTypeLengthWithBackgroundJobInfo |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) |
|||
.HasAnnotation("ProductVersion", "6.0.1") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 64); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.TaskManagement.BackgroundJobInfo", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Args") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("Args"); |
|||
|
|||
b.Property<DateTime>("BeginTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("Cron") |
|||
.HasMaxLength(50) |
|||
.HasColumnType("varchar(50)") |
|||
.HasColumnName("Cron"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Description"); |
|||
|
|||
b.Property<DateTime?>("EndTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("Group") |
|||
.IsRequired() |
|||
.HasMaxLength(50) |
|||
.HasColumnType("varchar(50)") |
|||
.HasColumnName("Group"); |
|||
|
|||
b.Property<int>("Interval") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<bool>("IsAbandoned") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<bool>("IsEnabled") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<int>("JobType") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<DateTime?>("LastRunTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<int>("LockTimeOut") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<int>("MaxCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<int>("MaxTryCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<DateTime?>("NextRunTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.Property<int>("Priority") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Result") |
|||
.HasMaxLength(1000) |
|||
.HasColumnType("varchar(1000)") |
|||
.HasColumnName("Result"); |
|||
|
|||
b.Property<int>("Status") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<int>("TriggerCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<int>("TryCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<string>("Type") |
|||
.IsRequired() |
|||
.HasMaxLength(1000) |
|||
.HasColumnType("varchar(1000)") |
|||
.HasColumnName("Type"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name", "Group"); |
|||
|
|||
b.ToTable("TK_BackgroundJobs", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Abp.TaskManagement.BackgroundJobLog", b => |
|||
{ |
|||
b.Property<long>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<string>("Exception") |
|||
.HasMaxLength(2000) |
|||
.HasColumnType("varchar(2000)") |
|||
.HasColumnName("Exception"); |
|||
|
|||
b.Property<string>("JobGroup") |
|||
.HasMaxLength(50) |
|||
.HasColumnType("varchar(50)") |
|||
.HasColumnName("JobGroup"); |
|||
|
|||
b.Property<Guid?>("JobId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("JobName") |
|||
.HasMaxLength(100) |
|||
.HasColumnType("varchar(100)") |
|||
.HasColumnName("JobName"); |
|||
|
|||
b.Property<string>("JobType") |
|||
.HasMaxLength(1000) |
|||
.HasColumnType("varchar(1000)") |
|||
.HasColumnName("JobType"); |
|||
|
|||
b.Property<string>("Message") |
|||
.HasMaxLength(1000) |
|||
.HasColumnType("varchar(1000)") |
|||
.HasColumnName("Message"); |
|||
|
|||
b.Property<DateTime>("RunTime") |
|||
.HasColumnType("datetime(6)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("JobGroup", "JobName"); |
|||
|
|||
b.ToTable("TK_BackgroundJobLogs", (string)null); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,65 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace LY.MicroService.TaskManagement.Migrations |
|||
{ |
|||
public partial class ResetFieldTypeLengthWithBackgroundJobInfo : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "Type", |
|||
table: "TK_BackgroundJobs", |
|||
type: "varchar(1000)", |
|||
maxLength: 1000, |
|||
nullable: false, |
|||
oldClrType: typeof(string), |
|||
oldType: "varchar(200)", |
|||
oldMaxLength: 200) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
.OldAnnotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "JobType", |
|||
table: "TK_BackgroundJobLogs", |
|||
type: "varchar(1000)", |
|||
maxLength: 1000, |
|||
nullable: true, |
|||
oldClrType: typeof(string), |
|||
oldType: "varchar(200)", |
|||
oldMaxLength: 200, |
|||
oldNullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
.OldAnnotation("MySql:CharSet", "utf8mb4"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "Type", |
|||
table: "TK_BackgroundJobs", |
|||
type: "varchar(200)", |
|||
maxLength: 200, |
|||
nullable: false, |
|||
oldClrType: typeof(string), |
|||
oldType: "varchar(1000)", |
|||
oldMaxLength: 1000) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
.OldAnnotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "JobType", |
|||
table: "TK_BackgroundJobLogs", |
|||
type: "varchar(200)", |
|||
maxLength: 200, |
|||
nullable: true, |
|||
oldClrType: typeof(string), |
|||
oldType: "varchar(1000)", |
|||
oldMaxLength: 1000, |
|||
oldNullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
.OldAnnotation("MySql:CharSet", "utf8mb4"); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue