feat(sj_1.0.0): 工作流接入告警

This commit is contained in:
opensnail 2024-05-05 23:22:53 +08:00
parent 4b738d4907
commit f30827f01f
6 changed files with 57 additions and 9 deletions

View File

@ -76,6 +76,13 @@ export const jobNotifyScene: Record<Api.NotifyConfig.JobNotifyScene, App.I18n.I1
};
export const jobNotifySceneOptions = transformRecordToOption(jobNotifyScene);
export const workflowNotifyScene: Record<Api.NotifyConfig.WorkflowNotifyScene, App.I18n.I18nKey> = {
100: 'page.notifyConfig.workflowNotifyScene.workTaskError',
101: 'page.notifyConfig.workflowNotifyScene.workflowTaskCallbackError',
102: 'page.notifyConfig.workflowNotifyScene.workflowTaskDecisionError'
};
export const workflowNotifySceneOptions = transformRecordToOption(workflowNotifyScene);
export const groupConfigStatusRecord: Record<Api.GroupConfig.GroupStatusType, App.I18n.I18nKey> = {
0: 'page.manage.common.status.disable',
1: 'page.manage.common.status.enable'

View File

@ -693,7 +693,10 @@ const local: App.I18n.Schema = {
notifyStatus: 'Please select State',
systemTaskType: '请选择任务类型',
notifyRecipient: '请选择通知人',
rateLimiterThreshold: '请选择阈值'
rateLimiterThreshold: '请选择阈值',
sceneName: '请选择重试场景',
jobName: '请选择定时任务',
workflowName: '请选择工作流'
},
addNotifyConfig: 'Add Alarm notification',
editNotifyConfig: 'Add Alarm notification',
@ -709,6 +712,11 @@ const local: App.I18n.Schema = {
jobNotifyScene: {
jobTaskError: '任务执行失败'
},
workflowNotifyScene: {
workTaskError: '任务执行失败',
workflowTaskCallbackError: '回调任务执行失败',
workflowTaskDecisionError: '判定节点执行失败'
},
notifyRecipient: '通知人信息',
rateLimiterStatus: '限流开关',
rateLimiterThreshold: '每秒限流阈值'

View File

@ -689,7 +689,10 @@ const local: App.I18n.Schema = {
notifyStatus: '请选择状态',
systemTaskType: '请选择任务类型',
notifyRecipient: '请选择通知人',
rateLimiterThreshold: '请选择阈值'
rateLimiterThreshold: '请选择阈值',
sceneName: '请选择重试场景',
jobName: '请选择定时任务',
workflowName: '请选择工作流'
},
addNotifyConfig: '新增告警通知',
editNotifyConfig: '编辑告警通知',
@ -705,6 +708,11 @@ const local: App.I18n.Schema = {
jobNotifyScene: {
jobTaskError: '任务执行失败'
},
workflowNotifyScene: {
workTaskError: '工作流任务执行失败',
workflowTaskCallbackError: '工作流回调任务执行失败',
workflowTaskDecisionError: '工作流判定节点执行失败'
},
notifyRecipient: '通知人信息',
rateLimiterStatus: '限流开关',
rateLimiterThreshold: '每秒限流阈值'

View File

@ -565,7 +565,7 @@ declare namespace Api {
/** 状态 */
notifyStatus: Api.Common.EnableStatusNumber;
/** 通知场景 */
notifyScene: JobNotifyScene | RetryNotifyScene;
notifyScene: JobNotifyScene | RetryNotifyScene | WorkflowNotifyScene | null;
/** 通知阈值 */
notifyThreshold: number;
/** 限流开关 */
@ -596,6 +596,9 @@ declare namespace Api {
/** 1、任务执行失败 */
type JobNotifyScene = 1;
/** 100、工作流任务执行失败 101、回调节点执行失败 102、判定节点执行失败 */
type WorkflowNotifyScene = 100 | 101 | 102;
}
/**

View File

@ -837,6 +837,9 @@ declare namespace App {
systemTaskType: string;
notifyRecipient: string;
rateLimiterThreshold: string;
sceneName: string;
jobName: string;
workflowName: string;
};
addNotifyConfig: string;
editNotifyConfig: string;
@ -852,6 +855,11 @@ declare namespace App {
jobNotifyScene: {
jobTaskError: string;
};
workflowNotifyScene: {
workTaskError: string;
workflowTaskCallbackError: string;
workflowTaskDecisionError: string;
};
notifyRecipient: string;
rateLimiterStatus: string;
rateLimiterThreshold: string;

View File

@ -8,13 +8,15 @@ import {
fetchEditNotify,
fetchGetJobList,
fetchGetNotifyRecipientList,
fetchGetRetrySceneList
fetchGetRetrySceneList,
fetchGetWorkflowNameList
} from '@/service/api';
import {
enableStatusNumberOptions,
jobNotifySceneOptions,
retryNotifySceneOptions,
systemTaskTypeOptions
systemTaskTypeOptions,
workflowNotifySceneOptions
} from '@/constants/business';
import { translateOptions } from '@/utils/common';
import SelectGroup from '@/components/common/select-group.vue';
@ -33,6 +35,7 @@ interface Props {
const notifyRecipientList = ref<CommonType.Option<number>[]>([]);
const retryScenes = ref<Api.RetryScene.Scene[]>([]);
const jobs = ref<Api.Job.Job[]>([]);
const workflows = ref<Api.Workflow.Workflow[]>([]);
const props = defineProps<Props>();
@ -212,10 +215,14 @@ async function systemTaskTypeChange(value: number) {
const res = await fetchGetJobList({ groupName: model.groupName });
jobs.value = res.data as Api.Job.Job[];
notifySceneOptions.value = translateOptions(jobNotifySceneOptions);
} else if (value === 4) {
const res = await fetchGetWorkflowNameList({ groupName: model.groupName });
workflows.value = res.data as Api.Workflow.Workflow[];
notifySceneOptions.value = translateOptions(workflowNotifySceneOptions);
}
model.businessId = '';
model.notifyScene = 1;
model.notifyScene = null;
}
function groupNameUpdate(groupName: string) {
@ -262,7 +269,7 @@ watch(visible, () => {
<NFormItem v-if="model.systemTaskType === 1" :label="$t('page.notifyConfig.retryScene')" path="businessId">
<NSelect
v-model:value="model.businessId"
:placeholder="$t('page.notifyConfig.form.groupName')"
:placeholder="$t('page.notifyConfig.form.sceneName')"
:options="retryScenes"
label-field="sceneName"
value-field="sceneName"
@ -272,7 +279,7 @@ watch(visible, () => {
<NFormItem v-if="model.systemTaskType === 3" :label="$t('page.notifyConfig.job')" path="businessId">
<NSelect
v-model:value="model.businessId"
:placeholder="$t('page.notifyConfig.form.groupName')"
:placeholder="$t('page.notifyConfig.form.jobName')"
:options="jobs"
label-field="jobName"
value-field="id"
@ -280,7 +287,14 @@ watch(visible, () => {
/>
</NFormItem>
<NFormItem v-if="model.systemTaskType === 4" :label="$t('page.notifyConfig.workflow')" path="businessId">
<NSelect v-model:value="model.businessId" :placeholder="$t('page.notifyConfig.form.groupName')" clearable />
<NSelect
v-model:value="model.businessId"
:placeholder="$t('page.notifyConfig.form.workflowName')"
:options="workflows"
label-field="workflowName"
value-field="id"
clearable
/>
</NFormItem>
<NFormItem :label="$t('page.notifyConfig.notifyScene')" path="notifyScene">
<NSelect