feat(sj_1.0.0): 完成重试日志接入
This commit is contained in:
parent
792c419ec9
commit
cf7658fad7
@ -836,6 +836,7 @@ const local: App.I18n.Schema = {
|
|||||||
idempotentId: 'Idempotent ID',
|
idempotentId: 'Idempotent ID',
|
||||||
bizNo: 'Business Number',
|
bizNo: 'Business Number',
|
||||||
createDt: 'Creation time',
|
createDt: 'Creation time',
|
||||||
|
|
||||||
form: {
|
form: {
|
||||||
groupName: 'Please enter Group name',
|
groupName: 'Please enter Group name',
|
||||||
idempotentId: 'Please enter Idempotent ID',
|
idempotentId: 'Please enter Idempotent ID',
|
||||||
|
@ -9,6 +9,14 @@ export function fetchGetRetryTaskList(params?: Api.RetryTask.RetryTaskSearchPara
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** get retryTask */
|
||||||
|
export function fetchGetRetryTaskById(id: string, groupName: string) {
|
||||||
|
return request<Api.RetryTask.RetryTask>({
|
||||||
|
url: `/retry-task/${id}?groupName=${groupName}`,
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** add retryTask */
|
/** add retryTask */
|
||||||
export function fetchAddRetryTask(data: Api.RetryTask.RetryTask) {
|
export function fetchAddRetryTask(data: Api.RetryTask.RetryTask) {
|
||||||
return request<boolean>({
|
return request<boolean>({
|
||||||
|
@ -44,7 +44,7 @@ export function fetchUpdateSceneStatus(id: string, status: Api.Common.EnableStat
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** update retry log list */
|
/** get retry log list */
|
||||||
export function fetchRetryLogPageList(params?: Api.RetryLog.RetryLogSearchParams) {
|
export function fetchRetryLogPageList(params?: Api.RetryLog.RetryLogSearchParams) {
|
||||||
return request<Api.RetryLog.RetryLogList>({
|
return request<Api.RetryLog.RetryLogList>({
|
||||||
url: '/retry-task-log/list',
|
url: '/retry-task-log/list',
|
||||||
@ -53,6 +53,14 @@ export function fetchRetryLogPageList(params?: Api.RetryLog.RetryLogSearchParams
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** get retry log list */
|
||||||
|
export function fetchRetryLogById(id: string) {
|
||||||
|
return request<Api.RetryLog.RetryLog>({
|
||||||
|
url: `/retry-task-log/${id}`,
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** delete retry log */
|
/** delete retry log */
|
||||||
export function fetchDeleteRetryLog(id: number) {
|
export function fetchDeleteRetryLog(id: number) {
|
||||||
return request<boolean>({
|
return request<boolean>({
|
||||||
|
10
src/typings/api.d.ts
vendored
10
src/typings/api.d.ts
vendored
@ -1067,6 +1067,16 @@ declare namespace Api {
|
|||||||
bizNo: string;
|
bizNo: string;
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
createDt: string;
|
createDt: string;
|
||||||
|
/** 执行器名称 */
|
||||||
|
executorName: string;
|
||||||
|
/** 执行方法参数 */
|
||||||
|
argsStr: string;
|
||||||
|
/** 扩展字段 */
|
||||||
|
extAttrs?: string;
|
||||||
|
/** 下次触发时间 */
|
||||||
|
nextTriggerAt?: string;
|
||||||
|
/** 重试次数 */
|
||||||
|
retryCount?: number;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
/** retryLog search params */
|
/** retryLog search params */
|
||||||
|
@ -78,5 +78,9 @@ export function tagColor(index: number) {
|
|||||||
4: 'default'
|
4: 'default'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (index === null || index < 0) {
|
||||||
|
return tagMap[1];
|
||||||
|
}
|
||||||
|
|
||||||
return tagMap[index % 5];
|
return tagMap[index % 5];
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
<script setup lang="tsx">
|
<script setup lang="tsx">
|
||||||
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
||||||
import { fetchBatchDeleteRetryLog, fetchDeleteRetryLog, fetchRetryLogPageList } from '@/service/api';
|
import { ref } from 'vue';
|
||||||
|
import { fetchBatchDeleteRetryLog, fetchDeleteRetryLog, fetchRetryLogById, fetchRetryLogPageList } from '@/service/api';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import { useAppStore } from '@/store/modules/app';
|
import { useAppStore } from '@/store/modules/app';
|
||||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||||
import { retryTaskStatusTypeRecord, retryTaskTypeRecord } from '@/constants/business';
|
import { retryTaskStatusTypeRecord, retryTaskTypeRecord } from '@/constants/business';
|
||||||
|
import { tagColor } from '@/utils/common';
|
||||||
import RetryLogSearch from './modules/retry-log-search.vue';
|
import RetryLogSearch from './modules/retry-log-search.vue';
|
||||||
|
import RetryLogDetailDrawer from './modules/retry-log-detail-drawer.vue';
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
const detailData = ref();
|
||||||
|
const detailVisible = defineModel<boolean>('detailVisible', {
|
||||||
|
default: false
|
||||||
|
});
|
||||||
|
|
||||||
const { columns, columnChecks, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({
|
const { columns, columnChecks, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({
|
||||||
apiFn: fetchRetryLogPageList,
|
apiFn: fetchRetryLogPageList,
|
||||||
@ -39,7 +46,19 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
key: 'uniqueId',
|
key: 'uniqueId',
|
||||||
title: $t('page.retryLog.UniqueId'),
|
title: $t('page.retryLog.UniqueId'),
|
||||||
align: 'left',
|
align: 'left',
|
||||||
minWidth: 120
|
minWidth: 120,
|
||||||
|
render: row => {
|
||||||
|
async function showDetailDrawer() {
|
||||||
|
await loadRetryInfo(row);
|
||||||
|
detailVisible.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<n-button text tag="a" type="primary" onClick={showDetailDrawer} class="ws-normal">
|
||||||
|
{row.uniqueId}
|
||||||
|
</n-button>
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'groupName',
|
key: 'groupName',
|
||||||
@ -62,15 +81,9 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
if (row.retryStatus === null) {
|
if (row.retryStatus === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const tagMap: Record<Api.RetryTask.RetryStatusType, NaiveUI.ThemeColor> = {
|
|
||||||
0: 'info',
|
|
||||||
1: 'success',
|
|
||||||
2: 'error',
|
|
||||||
3: 'warning'
|
|
||||||
};
|
|
||||||
const label = $t(retryTaskStatusTypeRecord[row.retryStatus!]);
|
const label = $t(retryTaskStatusTypeRecord[row.retryStatus!]);
|
||||||
|
|
||||||
return <NTag type={tagMap[row.retryStatus!]}>{label}</NTag>;
|
return <NTag type={tagColor(row.retryStatus!)}>{label}</NTag>;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -82,13 +95,9 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
if (row.taskType === null) {
|
if (row.taskType === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const tagMap: Record<Api.RetryTask.TaskType, NaiveUI.ThemeColor> = {
|
|
||||||
1: 'warning',
|
|
||||||
2: 'error'
|
|
||||||
};
|
|
||||||
const label = $t(retryTaskTypeRecord[row.taskType!]);
|
const label = $t(retryTaskTypeRecord[row.taskType!]);
|
||||||
|
|
||||||
return <NTag type={tagMap[row.taskType!]}>{label}</NTag>;
|
return <NTag type={tagColor(row.taskType!)}>{label}</NTag>;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -155,6 +164,11 @@ async function handleDelete(id: any) {
|
|||||||
getData();
|
getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function loadRetryInfo(row: Api.RetryLog.RetryLog) {
|
||||||
|
const res = await fetchRetryLogById(row.id!);
|
||||||
|
detailData.value = (res.data as Api.RetryLog.RetryLog) || null;
|
||||||
|
}
|
||||||
|
|
||||||
function edit(id: any) {
|
function edit(id: any) {
|
||||||
handleEdit(id);
|
handleEdit(id);
|
||||||
}
|
}
|
||||||
@ -193,6 +207,7 @@ function edit(id: any) {
|
|||||||
class="sm:h-full"
|
class="sm:h-full"
|
||||||
/>
|
/>
|
||||||
</NCard>
|
</NCard>
|
||||||
|
<RetryLogDetailDrawer v-model:visible="detailVisible" :row-data="detailData" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
66
src/views/retry/log/modules/retry-log-detail-drawer.vue
Normal file
66
src/views/retry/log/modules/retry-log-detail-drawer.vue
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import { $t } from '@/locales';
|
||||||
|
import { tagColor } from '@/utils/common';
|
||||||
|
import { retryTaskStatusTypeRecord, retryTaskTypeRecord } from '@/constants/business';
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'SceneDetailDrawer'
|
||||||
|
});
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
/** row data */
|
||||||
|
rowData?: Api.RetryLog.RetryLog | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const visible = defineModel<boolean>('visible', {
|
||||||
|
default: false
|
||||||
|
});
|
||||||
|
const props = defineProps<Props>();
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.rowData,
|
||||||
|
() => {
|
||||||
|
console.log(props.rowData);
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<OperateDrawer v-model="visible" :title="$t('page.retryScene.detail')">
|
||||||
|
<NDescriptions label-placement="top" bordered :column="6">
|
||||||
|
<NDescriptionsItem :label="$t('page.retryLog.UniqueId')">
|
||||||
|
{{ rowData?.uniqueId }}
|
||||||
|
</NDescriptionsItem>
|
||||||
|
</NDescriptions>
|
||||||
|
<NDescriptions label-placement="top" bordered :column="6">
|
||||||
|
<NDescriptionsItem :label="$t('page.retryLog.groupName')">{{ rowData?.groupName }}</NDescriptionsItem>
|
||||||
|
</NDescriptions>
|
||||||
|
<NDescriptions label-placement="top" bordered :column="6">
|
||||||
|
<NDescriptionsItem :label="$t('page.retryLog.sceneName')">{{ rowData?.sceneName }}</NDescriptionsItem>
|
||||||
|
</NDescriptions>
|
||||||
|
<NDescriptions label-placement="top" bordered :column="6">
|
||||||
|
<NDescriptionsItem :label="$t('page.retryLog.retryStatus')">
|
||||||
|
<NTag :type="tagColor(rowData?.retryStatus!)">
|
||||||
|
{{ $t(retryTaskStatusTypeRecord[rowData?.retryStatus!]) }}
|
||||||
|
</NTag>
|
||||||
|
</NDescriptionsItem>
|
||||||
|
</NDescriptions>
|
||||||
|
<NDescriptions label-placement="top" bordered :column="6">
|
||||||
|
<NDescriptionsItem :label="$t('page.retryLog.taskType')">
|
||||||
|
<NTag :type="tagColor(rowData?.taskType!)">{{ $t(retryTaskTypeRecord[rowData?.taskType!]) }}</NTag>
|
||||||
|
</NDescriptionsItem>
|
||||||
|
</NDescriptions>
|
||||||
|
<NDescriptions label-placement="top" bordered :column="6">
|
||||||
|
<NDescriptionsItem :label="$t('page.retryLog.bizNo')">{{ rowData?.bizNo }}</NDescriptionsItem>
|
||||||
|
</NDescriptions>
|
||||||
|
<NDescriptions label-placement="top" bordered :column="6">
|
||||||
|
<NDescriptionsItem :label="$t('page.retryLog.idempotentId')">
|
||||||
|
{{ rowData?.idempotentId }}
|
||||||
|
</NDescriptionsItem>
|
||||||
|
</NDescriptions>
|
||||||
|
</OperateDrawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
Loading…
Reference in New Issue
Block a user