feat(sj_1.0.0): 告警通知通知类型新增每秒限流阈值、通知状态

This commit is contained in:
wodeyangzipingpingwuqi 2024-05-14 18:35:57 +08:00
parent 17385bc241
commit 12b6a1a09f
3 changed files with 51 additions and 10 deletions

View File

@ -703,7 +703,7 @@ const local: App.I18n.Schema = {
title: '告警通知列表',
groupName: '组名称',
businessName: '业务ID',
notifyStatus: '状态',
notifyStatus: '通知状态',
notifyType: '通知类型',
notifyScene: '通知场景',
notifyThreshold: '通知阈值',
@ -748,7 +748,7 @@ const local: App.I18n.Schema = {
workflowClientError: '客户端执行失败'
},
notifyRecipient: '通知人信息',
rateLimiterStatus: '限流开关',
rateLimiterStatus: '限流状态',
rateLimiterThreshold: '每秒限流阈值'
},
notifyRecipient: {

View File

@ -547,7 +547,7 @@ declare namespace Api {
/** 通知人id */
recipientIds: number[];
/** 任务类型 1、重试任务 2、回调任务、3、JOB任务 4、WORKFLOW任务 */
systemTaskType: SystemTaskType;
systemTaskType: SystemTaskType | null;
/** 业务名称 */
businessName?: string;
/** 状态 */

View File

@ -39,6 +39,10 @@ const workflows = ref<Api.Workflow.Workflow[]>([]);
const props = defineProps<Props>();
interface Emits {
(e: 'update:value', value: Api.NotifyConfig.RetryNotifyScene): void;
}
interface Emits {
(e: 'submitted'): void;
}
@ -49,6 +53,10 @@ const visible = defineModel<boolean>('visible', {
default: false
});
const retrySceneDisable = defineModel<boolean>('retrySceneDisable', {
default: true
});
const notifySceneOptions = ref<CommonType.Option<string | number>[]>(translateOptions(retryNotifySceneOptions));
const { formRef, validate, restoreValidation } = useNaiveForm();
@ -95,12 +103,12 @@ function createDefaultModel(): Model {
groupName: '',
businessId: '',
recipientIds: [],
systemTaskType: 1,
systemTaskType: null,
notifyStatus: 1,
notifyScene: 1,
notifyScene: null,
notifyThreshold: 16,
rateLimiterStatus: 0,
rateLimiterThreshold: null,
rateLimiterThreshold: 100,
description: ''
};
}
@ -129,6 +137,7 @@ function handleUpdateModelWhenEdit() {
if (props.operateType === 'edit' && props.rowData) {
Object.assign(model, props.rowData);
systemTaskTypeChange(model.systemTaskType);
retrySceneChange(model.notifyScene);
}
}
@ -201,7 +210,7 @@ async function handleSubmit() {
emit('submitted');
}
async function systemTaskTypeChange(value: number) {
async function systemTaskTypeChange(value: number | null) {
if (value === 1) {
const res = await fetchGetRetrySceneList({ groupName: model.groupName });
retryScenes.value = res.data as Api.RetryScene.Scene[];
@ -231,10 +240,21 @@ async function systemTaskTypeChange(value: number) {
}
}
async function retrySceneChange(
value:
| Api.NotifyConfig.JobNotifyScene
| Api.NotifyConfig.RetryNotifyScene
| Api.NotifyConfig.WorkflowNotifyScene
| null
) {
retrySceneDisable.value = !(value === 5 || value === 6);
}
function groupNameUpdate(groupName: string) {
handleUpdateModelWhenEdit();
model.groupName = groupName;
systemTaskTypeChange(1);
retrySceneChange(1);
}
watch(visible, () => {
@ -306,8 +326,9 @@ watch(visible, () => {
<NSelect
v-model:value="model.notifyScene"
:placeholder="$t('page.notifyConfig.form.notifyScene')"
:options="translateOptions(notifySceneOptions)"
:options="notifySceneOptions"
clearable
@update:value="retrySceneChange"
/>
</NFormItem>
<NFormItem :label="$t('page.notifyConfig.notifyRecipient')" path="recipientIds">
@ -320,7 +341,27 @@ watch(visible, () => {
/>
</NFormItem>
<NFormItem :label="$t('page.notifyConfig.rateLimiterStatus')" path="rateLimiterStatus">
<NRadioGroup v-model:value="model.rateLimiterStatus" name="rateLimiterStatus" disabled>
<NRadioGroup v-model:value="model.rateLimiterStatus" name="rateLimiterStatus" :disabled="retrySceneDisable">
<NSpace>
<NRadio
v-for="item in enableStatusNumberOptions"
:key="item.value"
:value="item.value"
:label="$t(item.label)"
/>
</NSpace>
</NRadioGroup>
</NFormItem>
<NFormItem :label="$t('page.notifyConfig.rateLimiterThreshold')" path="notifyThreshold">
<NInputNumber
v-model:value="model.rateLimiterThreshold"
:min="1"
:placeholder="$t('page.notifyConfig.form.notifyThreshold')"
:disabled="retrySceneDisable"
/>
</NFormItem>
<NFormItem :label="$t('page.notifyConfig.notifyStatus')" path="rateLimiterStatus">
<NRadioGroup v-model:value="model.notifyStatus" name="rateLimiterStatus">
<NSpace>
<NRadio
v-for="item in enableStatusNumberOptions"
@ -336,7 +377,7 @@ watch(visible, () => {
v-model:value="model.notifyThreshold"
:min="1"
:placeholder="$t('page.notifyConfig.form.notifyThreshold')"
disabled
:disabled="retrySceneDisable"
/>
</NFormItem>
<NFormItem :label="$t('page.notifyConfig.description')" path="description">