feat(sj_1.3.0-beta1): 重试任务、工作流任务新增告警通知场景
This commit is contained in:
parent
a4c8916000
commit
044f731aa2
@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from 'vue';
|
import { nextTick, onMounted, ref, watch } from 'vue';
|
||||||
import CronInput from '@sa/cron-input';
|
import CronInput from '@sa/cron-input';
|
||||||
import { type FormInst, type FormItemRule } from 'naive-ui';
|
import { type FormInst, type FormItemRule } from 'naive-ui';
|
||||||
import {
|
import {
|
||||||
@ -8,7 +8,7 @@ import {
|
|||||||
workFlowNodeStatusOptions
|
workFlowNodeStatusOptions
|
||||||
} from '@/constants/business';
|
} from '@/constants/business';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import { fetchGetAllGroupNameList } from '@/service/api';
|
import { fetchGetAllGroupNameList, fetchGetNotifyConfigSystemTaskTypeList } from '@/service/api';
|
||||||
import { isNotNull, parseContent, stringToContent } from '@/utils/common';
|
import { isNotNull, parseContent, stringToContent } from '@/utils/common';
|
||||||
import { useWorkflowStore } from '@/store/modules/workflow';
|
import { useWorkflowStore } from '@/store/modules/workflow';
|
||||||
import EditableInput from '@/components/common/editable-input.vue';
|
import EditableInput from '@/components/common/editable-input.vue';
|
||||||
@ -22,6 +22,7 @@ interface Props {
|
|||||||
open?: boolean;
|
open?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const notifyNameList = ref<CommonType.Option<number>[]>([]);
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
open: false,
|
open: false,
|
||||||
modelValue: () => ({
|
modelValue: () => ({
|
||||||
@ -34,6 +35,16 @@ interface Emits {
|
|||||||
(e: 'save', form: Workflow.NodeDataType): void;
|
(e: 'save', form: Workflow.NodeDataType): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
nextTick(() => {
|
||||||
|
getNotifyConfigSystemTaskTypeList();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
async function getNotifyConfigSystemTaskTypeList() {
|
||||||
|
const res = await fetchGetNotifyConfigSystemTaskTypeList(4);
|
||||||
|
notifyNameList.value = res.data as CommonType.Option<number>[];
|
||||||
|
}
|
||||||
const emit = defineEmits<Emits>();
|
const emit = defineEmits<Emits>();
|
||||||
|
|
||||||
const store = useWorkflowStore();
|
const store = useWorkflowStore();
|
||||||
@ -225,6 +236,17 @@ const rules: Record<RuleKey, FormItemRule> = {
|
|||||||
</NSpace>
|
</NSpace>
|
||||||
</NRadioGroup>
|
</NRadioGroup>
|
||||||
</NFormItem>
|
</NFormItem>
|
||||||
|
<NFormItem path="notifyIds" label="通知场景名称">
|
||||||
|
<NSelect
|
||||||
|
v-model:value="form.notifyIds"
|
||||||
|
value-field="id"
|
||||||
|
label-field="notifyName"
|
||||||
|
placeholder="请选择告警通知名称"
|
||||||
|
:options="notifyNameList"
|
||||||
|
clearable
|
||||||
|
multiple
|
||||||
|
/>
|
||||||
|
</NFormItem>
|
||||||
<NFormItem path="description" label="描述">
|
<NFormItem path="description" label="描述">
|
||||||
<NInput
|
<NInput
|
||||||
v-model:value="form.description"
|
v-model:value="form.description"
|
||||||
|
@ -686,6 +686,7 @@ const local: App.I18n.Schema = {
|
|||||||
detail: 'Scene Detail',
|
detail: 'Scene Detail',
|
||||||
groupName: 'Group name',
|
groupName: 'Group name',
|
||||||
sceneName: 'Scene name',
|
sceneName: 'Scene name',
|
||||||
|
notifyName: 'Notify name',
|
||||||
sceneStatus: 'State',
|
sceneStatus: 'State',
|
||||||
backOff: 'Backoff strategy',
|
backOff: 'Backoff strategy',
|
||||||
maxRetryCount: 'Maximum number of retries',
|
maxRetryCount: 'Maximum number of retries',
|
||||||
@ -698,6 +699,7 @@ const local: App.I18n.Schema = {
|
|||||||
routeKey: 'Routing strategy',
|
routeKey: 'Routing strategy',
|
||||||
form: {
|
form: {
|
||||||
maxRetryCount: 'Please enter Maximum number of retries',
|
maxRetryCount: 'Please enter Maximum number of retries',
|
||||||
|
notifyName: 'Plase enter Notify name',
|
||||||
triggerInterval: 'Please enter Intervals(s)',
|
triggerInterval: 'Please enter Intervals(s)',
|
||||||
groupName: 'Please enter Group name',
|
groupName: 'Please enter Group name',
|
||||||
description: 'Please enter Describe',
|
description: 'Please enter Describe',
|
||||||
|
@ -694,6 +694,7 @@ const local: App.I18n.Schema = {
|
|||||||
detail: '场景详情',
|
detail: '场景详情',
|
||||||
groupName: '组名',
|
groupName: '组名',
|
||||||
sceneName: '场景名',
|
sceneName: '场景名',
|
||||||
|
notifyName: '告警通知名称',
|
||||||
sceneStatus: '状态',
|
sceneStatus: '状态',
|
||||||
backOff: '退避策略',
|
backOff: '退避策略',
|
||||||
maxRetryCount: '最大重试次数',
|
maxRetryCount: '最大重试次数',
|
||||||
@ -705,6 +706,7 @@ const local: App.I18n.Schema = {
|
|||||||
description: '描述',
|
description: '描述',
|
||||||
routeKey: '路由策略',
|
routeKey: '路由策略',
|
||||||
form: {
|
form: {
|
||||||
|
notifyName: '请选择告警通知名称',
|
||||||
maxRetryCount: '请输入最大重试次数',
|
maxRetryCount: '请输入最大重试次数',
|
||||||
triggerInterval: '请输入间隔时间(秒)',
|
triggerInterval: '请输入间隔时间(秒)',
|
||||||
groupName: '请输入组名',
|
groupName: '请输入组名',
|
||||||
|
4
src/typings/api.d.ts
vendored
4
src/typings/api.d.ts
vendored
@ -838,6 +838,8 @@ declare namespace Api {
|
|||||||
groupName: string;
|
groupName: string;
|
||||||
/** 场景名 */
|
/** 场景名 */
|
||||||
sceneName: string;
|
sceneName: string;
|
||||||
|
/** 通知场景ids */
|
||||||
|
notifyIds: number[];
|
||||||
/** 状态 */
|
/** 状态 */
|
||||||
sceneStatus: EnableStatusNumber;
|
sceneStatus: EnableStatusNumber;
|
||||||
/** 退避策略 */
|
/** 退避策略 */
|
||||||
@ -903,6 +905,8 @@ declare namespace Api {
|
|||||||
groupName: string;
|
groupName: string;
|
||||||
/** 触发时间 */
|
/** 触发时间 */
|
||||||
nextTriggerAt: string;
|
nextTriggerAt: string;
|
||||||
|
/** 告警通知场景ids */
|
||||||
|
notifyIds: number[];
|
||||||
/** 状态 */
|
/** 状态 */
|
||||||
workflowStatus: EnableStatusNumber;
|
workflowStatus: EnableStatusNumber;
|
||||||
/** 触发类型 */
|
/** 触发类型 */
|
||||||
|
2
src/typings/app.d.ts
vendored
2
src/typings/app.d.ts
vendored
@ -894,6 +894,7 @@ declare namespace App {
|
|||||||
detail: string;
|
detail: string;
|
||||||
groupName: string;
|
groupName: string;
|
||||||
sceneName: string;
|
sceneName: string;
|
||||||
|
notifyName: string;
|
||||||
sceneStatus: string;
|
sceneStatus: string;
|
||||||
backOff: string;
|
backOff: string;
|
||||||
maxRetryCount: string;
|
maxRetryCount: string;
|
||||||
@ -905,6 +906,7 @@ declare namespace App {
|
|||||||
description: string;
|
description: string;
|
||||||
routeKey: string;
|
routeKey: string;
|
||||||
form: {
|
form: {
|
||||||
|
notifyName: string;
|
||||||
maxRetryCount: string;
|
maxRetryCount: string;
|
||||||
triggerInterval: string;
|
triggerInterval: string;
|
||||||
groupName: string;
|
groupName: string;
|
||||||
|
8
src/typings/workflow.d.ts
vendored
8
src/typings/workflow.d.ts
vendored
@ -7,6 +7,8 @@ declare namespace Workflow {
|
|||||||
workflowName?: string;
|
workflowName?: string;
|
||||||
/** 组名称 */
|
/** 组名称 */
|
||||||
groupName?: string;
|
groupName?: string;
|
||||||
|
/** 告警通知场景ids */
|
||||||
|
notifyIds?: number[];
|
||||||
/** 触发类型 */
|
/** 触发类型 */
|
||||||
triggerType?: Api.Common.TriggerType;
|
triggerType?: Api.Common.TriggerType;
|
||||||
/** 触发间隔 */
|
/** 触发间隔 */
|
||||||
@ -179,13 +181,13 @@ declare namespace Workflow {
|
|||||||
taskStatus?: Api.Common.TaskBatchStatus;
|
taskStatus?: Api.Common.TaskBatchStatus;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type JobBatchPage = {
|
/* export type JobBatchPage = {
|
||||||
total: number;
|
total: number;
|
||||||
data: JobTaskType[];
|
data: JobTaskType[];
|
||||||
};
|
}; */
|
||||||
|
|
||||||
/** 任务日志 */
|
/** 任务日志 */
|
||||||
export type JobLogType = {};
|
/* export type JobLogType = {}; */
|
||||||
|
|
||||||
/** Tag */
|
/** Tag */
|
||||||
export type JobTagType = {
|
export type JobTagType = {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, reactive, ref, watch } from 'vue';
|
import { computed, nextTick, onMounted, reactive, ref, watch } from 'vue';
|
||||||
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
||||||
import OperateDrawer from '@/components/common/operate-drawer.vue';
|
import OperateDrawer from '@/components/common/operate-drawer.vue';
|
||||||
import RouteKey from '@/components/common/route-key.vue';
|
import RouteKey from '@/components/common/route-key.vue';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import { fetchAddRetryScene, fetchEditRetryScene } from '@/service/api';
|
import { fetchAddRetryScene, fetchEditRetryScene, fetchGetNotifyConfigSystemTaskTypeList } from '@/service/api';
|
||||||
import { DelayLevel, backOffRecordOptions, enableStatusNumberOptions } from '@/constants/business';
|
import { DelayLevel, backOffRecordOptions, enableStatusNumberOptions } from '@/constants/business';
|
||||||
import { isNotNull, translateOptions } from '@/utils/common';
|
import { isNotNull, translateOptions } from '@/utils/common';
|
||||||
|
|
||||||
@ -21,6 +21,7 @@ interface Props {
|
|||||||
|
|
||||||
const delayLevelDesc = ref<string>('10s');
|
const delayLevelDesc = ref<string>('10s');
|
||||||
|
|
||||||
|
const notifyNameList = ref<CommonType.Option<number>[]>([]);
|
||||||
const props = defineProps<Props>();
|
const props = defineProps<Props>();
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
@ -48,6 +49,7 @@ type Model = Pick<
|
|||||||
Api.RetryScene.Scene,
|
Api.RetryScene.Scene,
|
||||||
| 'id'
|
| 'id'
|
||||||
| 'groupName'
|
| 'groupName'
|
||||||
|
| 'notifyIds'
|
||||||
| 'sceneName'
|
| 'sceneName'
|
||||||
| 'sceneStatus'
|
| 'sceneStatus'
|
||||||
| 'backOff'
|
| 'backOff'
|
||||||
@ -59,12 +61,24 @@ type Model = Pick<
|
|||||||
| 'routeKey'
|
| 'routeKey'
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
nextTick(() => {
|
||||||
|
getNotifyConfigSystemTaskTypeList();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
async function getNotifyConfigSystemTaskTypeList() {
|
||||||
|
const res = await fetchGetNotifyConfigSystemTaskTypeList(1);
|
||||||
|
notifyNameList.value = res.data as CommonType.Option<number>[];
|
||||||
|
}
|
||||||
|
|
||||||
const model: Model = reactive(createDefaultModel());
|
const model: Model = reactive(createDefaultModel());
|
||||||
|
|
||||||
function createDefaultModel(): Model {
|
function createDefaultModel(): Model {
|
||||||
return {
|
return {
|
||||||
groupName: '',
|
groupName: '',
|
||||||
sceneName: '',
|
sceneName: '',
|
||||||
|
notifyIds: [],
|
||||||
sceneStatus: 1,
|
sceneStatus: 1,
|
||||||
backOff: 2,
|
backOff: 2,
|
||||||
maxRetryCount: 1,
|
maxRetryCount: 1,
|
||||||
@ -133,6 +147,7 @@ async function handleSubmit() {
|
|||||||
const {
|
const {
|
||||||
groupName,
|
groupName,
|
||||||
sceneName,
|
sceneName,
|
||||||
|
notifyIds,
|
||||||
sceneStatus,
|
sceneStatus,
|
||||||
backOff,
|
backOff,
|
||||||
maxRetryCount,
|
maxRetryCount,
|
||||||
@ -145,6 +160,7 @@ async function handleSubmit() {
|
|||||||
const { error } = await fetchAddRetryScene({
|
const { error } = await fetchAddRetryScene({
|
||||||
groupName,
|
groupName,
|
||||||
sceneName,
|
sceneName,
|
||||||
|
notifyIds,
|
||||||
sceneStatus,
|
sceneStatus,
|
||||||
backOff,
|
backOff,
|
||||||
maxRetryCount,
|
maxRetryCount,
|
||||||
@ -163,6 +179,7 @@ async function handleSubmit() {
|
|||||||
id,
|
id,
|
||||||
groupName,
|
groupName,
|
||||||
sceneName,
|
sceneName,
|
||||||
|
notifyIds,
|
||||||
sceneStatus,
|
sceneStatus,
|
||||||
backOff,
|
backOff,
|
||||||
maxRetryCount,
|
maxRetryCount,
|
||||||
@ -176,6 +193,7 @@ async function handleSubmit() {
|
|||||||
id,
|
id,
|
||||||
groupName,
|
groupName,
|
||||||
sceneName,
|
sceneName,
|
||||||
|
notifyIds,
|
||||||
sceneStatus,
|
sceneStatus,
|
||||||
backOff,
|
backOff,
|
||||||
maxRetryCount,
|
maxRetryCount,
|
||||||
@ -342,6 +360,17 @@ watch(
|
|||||||
</NFormItem>
|
</NFormItem>
|
||||||
</NGi>
|
</NGi>
|
||||||
</NGrid>
|
</NGrid>
|
||||||
|
<NFormItem :label="$t('page.retryScene.notifyName')" path="notifyIds">
|
||||||
|
<NSelect
|
||||||
|
v-model:value="model.notifyIds"
|
||||||
|
value-field="id"
|
||||||
|
label-field="notifyName"
|
||||||
|
:placeholder="$t('page.retryScene.form.notifyName')"
|
||||||
|
:options="notifyNameList"
|
||||||
|
clearable
|
||||||
|
multiple
|
||||||
|
/>
|
||||||
|
</NFormItem>
|
||||||
<NFormItem :label="$t('page.retryScene.description')" path="description">
|
<NFormItem :label="$t('page.retryScene.description')" path="description">
|
||||||
<NInput
|
<NInput
|
||||||
v-model:value="model.description"
|
v-model:value="model.description"
|
||||||
|
Loading…
Reference in New Issue
Block a user