feat: allow skip notify nodes when all previous nodes were skipped
This commit is contained in:
@@ -2,7 +2,7 @@ import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useState } f
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router";
|
||||
import { PlusOutlined as PlusOutlinedIcon, RightOutlined as RightOutlinedIcon } from "@ant-design/icons";
|
||||
import { Button, Divider, Form, type FormInstance, Input, Select, Typography } from "antd";
|
||||
import { Button, Divider, Flex, Form, type FormInstance, Input, Select, Switch, Typography } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -74,6 +74,7 @@ const NotifyNodeConfigForm = forwardRef<NotifyNodeConfigFormInstance, NotifyNode
|
||||
.string({ message: t("workflow_node.notify.form.provider_access.placeholder") })
|
||||
.nonempty(t("workflow_node.notify.form.provider_access.placeholder")),
|
||||
providerConfig: z.any().nullish(),
|
||||
skipOnAllPrevSkipped: z.boolean().nullish(),
|
||||
});
|
||||
const formRule = createSchemaFieldRule(formSchema);
|
||||
const { form: formInst, formProps } = useAntdForm({
|
||||
@@ -281,6 +282,27 @@ const NotifyNodeConfigForm = forwardRef<NotifyNodeConfigFormInstance, NotifyNode
|
||||
|
||||
{nestedFormEl}
|
||||
</Show>
|
||||
|
||||
<Divider size="small">
|
||||
<Typography.Text className="text-xs font-normal" type="secondary">
|
||||
{t("workflow_node.notify.form.strategy_config.label")}
|
||||
</Typography.Text>
|
||||
</Divider>
|
||||
|
||||
<Form className={className} style={style} {...formProps} disabled={disabled} layout="vertical" scrollToFirstError onValuesChange={handleFormChange}>
|
||||
<Form.Item label={t("workflow_node.notify.form.skip_on_all_prev_skipped.label")}>
|
||||
<Flex align="center" gap={8} wrap="wrap">
|
||||
<div>{t("workflow_node.notify.form.skip_on_all_prev_skipped.prefix")}</div>
|
||||
<Form.Item name="skipOnAllPrevSkipped" noStyle rules={[formRule]}>
|
||||
<Switch
|
||||
checkedChildren={t("workflow_node.notify.form.skip_on_all_prev_skipped.switch.on")}
|
||||
unCheckedChildren={t("workflow_node.notify.form.skip_on_all_prev_skipped.switch.off")}
|
||||
/>
|
||||
</Form.Item>
|
||||
<div>{t("workflow_node.notify.form.skip_on_all_prev_skipped.suffix")}</div>
|
||||
</Flex>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -216,6 +216,7 @@ export type WorkflowNodeConfigForNotify = {
|
||||
provider: string;
|
||||
providerAccessId: string;
|
||||
providerConfig?: Record<string, unknown>;
|
||||
skipOnAllPrevSkipped?: boolean;
|
||||
};
|
||||
|
||||
export const defaultNodeConfigForNotify = (): Partial<WorkflowNodeConfigForNotify> => {
|
||||
|
||||
@@ -878,6 +878,12 @@
|
||||
"workflow_node.notify.form.webhook_data.tooltip": "Leave it blank to use the default Webhook data provided by the authorization.",
|
||||
"workflow_node.notify.form.webhook_data.guide": "<details><summary>Supported variables: </summary><ol style=\"margin-left: 1.25em; list-style: disc;\"><li><strong>${SUBJECT}</strong>: The subject of notification.</li><li><strong>${MESSAGE}</strong>: The message of notification.</li></ol></details><br>Please visit the authorization management page for addtional notes.",
|
||||
"workflow_node.notify.form.webhook_data.errmsg.json_invalid": "Please enter a valiod JSON string",
|
||||
"workflow_node.notify.form.strategy_config.label": "Strategy settings",
|
||||
"workflow_node.notify.form.skip_on_all_prev_skipped.label": "Silent behavior",
|
||||
"workflow_node.notify.form.skip_on_all_prev_skipped.prefix": "If all the previous nodes were skipped, ",
|
||||
"workflow_node.notify.form.skip_on_all_prev_skipped.suffix": " to notify.",
|
||||
"workflow_node.notify.form.skip_on_all_prev_skipped.switch.on": "skip",
|
||||
"workflow_node.notify.form.skip_on_all_prev_skipped.switch.off": "not skip",
|
||||
|
||||
"workflow_node.end.label": "End",
|
||||
"workflow_node.end.default_name": "End",
|
||||
|
||||
@@ -845,7 +845,7 @@
|
||||
"workflow_node.notify.form.subject.placeholder": "请输入通知主题",
|
||||
"workflow_node.notify.form.message.label": "通知内容",
|
||||
"workflow_node.notify.form.message.placeholder": "请输入通知内容",
|
||||
"workflow_node.notify.form.channel.label": "通知渠道(已废弃,请使用「通知渠道授权」字段)",
|
||||
"workflow_node.notify.form.channel.label": "通知渠道(即将废弃,请使用「通知渠道授权」字段)",
|
||||
"workflow_node.notify.form.channel.placeholder": "请选择通知渠道",
|
||||
"workflow_node.notify.form.channel.button": "设置",
|
||||
"workflow_node.notify.form.provider.label": "通知渠道",
|
||||
@@ -877,6 +877,12 @@
|
||||
"workflow_node.notify.form.webhook_data.tooltip": "不填写时,将使用所选部署目标授权的默认 Webhook 回调数据。",
|
||||
"workflow_node.notify.form.webhook_data.guide": "<details><summary>支持的变量:</summary><ol style=\"margin-left: 1.25em; list-style: disc;\"><li><strong>${SUBJECT}</strong>:通知主题。</li><li><strong>${MESSAGE}</strong>:通知内容。</ol></details><br>其他注意事项请前往授权管理页面查看。",
|
||||
"workflow_node.notify.form.webhook_data.errmsg.json_invalid": "请输入有效的 JSON 格式字符串",
|
||||
"workflow_node.notify.form.strategy_config.label": "执行策略",
|
||||
"workflow_node.notify.form.skip_on_all_prev_skipped.label": "静默行为",
|
||||
"workflow_node.notify.form.skip_on_all_prev_skipped.prefix": "当前序申请、上传、部署等节点均已跳过执行时,",
|
||||
"workflow_node.notify.form.skip_on_all_prev_skipped.suffix": "此通知节点。",
|
||||
"workflow_node.notify.form.skip_on_all_prev_skipped.switch.on": "跳过",
|
||||
"workflow_node.notify.form.skip_on_all_prev_skipped.switch.off": "不跳过",
|
||||
|
||||
"workflow_node.end.label": "结束",
|
||||
"workflow_node.end.default_name": "结束",
|
||||
|
||||
Reference in New Issue
Block a user