需要规则 - 不
这个 neeto-rules-nano 便利内部自动化规则的管理
需要申请。 纳米出口 @bigbinary/neeto-rules-frontend 国家预防机制
软件包和 neeto-rules-engine 铁路发动机.
改造后判刑建造者(
NeetoRulesBuilder) (中文(简体) ). 一种新的自然语言, 周一.com式规则编辑器现在和船一起NeetoRulesForm。 。 融合指南——道具,申报schema合同, 窗帘如何 有效载荷保障和地标迁移步骤——生命 内docs/README_REVAMP.md。从那里开始 在新产品中采用构建器.
目录
用主机应用程序开发
发动机
引擎用于管理neto应用程序中的自动化规则功能.
安装
-
将此行添加到您的应用程序的 Gemfile 中 :
source "NEETO_GEM_SERVER_URL" do # ..existing gems gem "neeto-rules-engine" end -
然后执行:
bundle install -
将此行添加到您的应用程序
config/routes.rb文件 :mount NeetoRulesEngine::Engine, at: "/neeto_rules" -
运行以下命令以复制从引擎到主机的迁移 应用程序 :
bundle exec rails neeto_rules_engine:install:migrations -
添加迁移到数据库 :
bundle exec rails db:migrate
前端软件包
安装
安装最新的 neetoRules nano 使用下列命令的软件包:
yarn add @bigbinary/neeto-rules-frontend
发展指示
检查 前端软件包开发指南 用于开发前端软件包的分步指令.
构成部分
1. 联合国. NeetoRules
这个 NeetoRules 组件用于为自动化规则添加仪表板.

道具
-
breadcrumbs: Breadcrumbs 为仪表板头.text: 面包屑项目文本link: 链接到面包屑项目
-
allowReordering: 指定用户能否重排自动化规则. (宝莲. -
helpPopoverProps: 为组件添加帮助 popover 。 参考 帮助Popover 组件 doc。 。 。 . 注:href从helpLinkProps将用来显示链接,当 显示NoData组件. -
rulesTableProps: 仪表板上桌子的道具:additionalColumns: 在表格中添加额外的一栏。 参考 表格组件 doc。 。 。 .
const additionalColumns = [ { title: "Operated on", dataIndex: "recentlyModifiedTickets", width: 160, description: "Number of tickets the rule has acted upon in the last 7 days", render: recentlyModifiedTickets => ( <div className="text-center">{recentlyModifiedTickets}</div> ), }, ];moreDropdownItems: 将降入项数组 表中的更倒放组件 。 参考 表格 doc 中的更下垂。 。 。 .
const moreDropdownItems = [ { key: "view-matching-tickets", label: "View matching rules", // onClick callback receives the selected rule onClick: rule => { setSelectedRule(rule); setShowMatchingTickets(true); }, }, ];onPreview: 点击预览时调用回调函数 .
const onPreview = id => { setRuleId(id); };payloadKey:在有效载荷对象中用于指定目标的密钥. 如果没有提供用途rule默认.
-
automationRulesPath:自动化规则仪表板的路径.本构成部分考虑采用其他路线:
路线 说明 {automationRulesPath}/edit规则编辑窗体组件的路径 . {automationRulesPath}/new规则的路径创建窗体组件 . -
automationRulesEndpoint:自动化规则的终点.组件将使用以下终点:
终点 行动 说明 获取 {automationRulesEndpoint}index获取自动化规则列表 。 (同样将被用于平分/过滤) 邮政 {automationRulesEndpoint}/{id}/cloneclone以创建自动化规则的克隆. 帕齐 {automationRulesEndpoint}/{id}update以更新自动化规则的现状. 迪莱特 {automationRulesEndpoint}/{id}destroy删除自动化规则. 帕齐 {automationRulesEndpoint}/reorderreorder重订自动化规则. -
updateRule: 定义规则操作更新方法的对象.onSuccess: 处理更新规则成功回调的对象 .callback: 函数需要成功。 (备选)
-
deleteRule: 定义规则操作方法的对象.onSuccess: 处理删除规则成功回调的对象.callback: 函数需要成功。 (备选)
-
cloneRule: 定义克隆规则操作方法的对象.allowed: 指定是否允许克隆规则, 默认true。 。 。 . (宝莲onSuccess: 处理克隆规则成功回调的对象 .callback: 函数需要成功。 (备选)
-
reoderRules: 函数需要调用以重排成功 .onSuccess: 处理重排规则成功回调对象 .callback: 函数需要成功。 (备选)
-
headerProps:头部组件的道具. 参考 页眉组件 doc。 。 。 .
2. 联合国. NeetoRulesForm
这个 NeetoRulesForm 组件用于创建和编辑自动化规则.
NeetoRulesForm 接受在
initialProps
(单位:千美元)参考文献:
- 文本
- 长文本
- 降级
- 多选择
- 电台
- 事件
- 条件
- 动作
说明: 这个
NeetoRulesForm组件默认包含三个字段 名称如下:name(必须),description财务报告和审定财务报表status。 。 。 .
道具
data:表格的初始道具.children:形式字段.className:提供外部班级形成.handleSubmit:处理表单提交函数.handleClose:处理窗体关闭的函数.showStatusSwitch: 指定应显示状态开关还是 没有 没错true默认.statusHelpText: 要覆盖状态开关旁边显示的帮助文本 . 接受{ active, inactive }。默认自动化规则帮助文本.
使用量
import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
const {
InputField,
TextareaField,
SelectField,
Events,
Card,
Conditions,
Actions,
} = NeetoRulesForm;
<NeetoRulesForm data={initialProps}>
{({ formattedValues, values, ...formikBag }) => (
<>
<InputField name="name" data={initialProps} />
<TextareaField name="description" data={initialProps} />
<SelectField name="projectId" data={initialProps} />
<Events name="events" data={initialProps} performerName="performer" />
<Card title="Conditions">
<Conditions name="conditions" data={initialProps} />
</Card>
<Actions name="actions" data={initialProps} />
</>
)}
</NeetoRulesForm>;
参考资料
3. 外地构成部分 NeetoRulesForm
Neeto RulesForm提供字段组件来创建自动化规则表.
参考资料
3.1 国家 InputField
import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
const { InputField } = NeetoRulesForm;
const initialProps = {
...otherProps,
firstName: {
label: "First Name",
type: "text",
value: "", // Default value.
componentProps: {
placeholder: "Enter name",
},
},
};
<InputField name="firstName" data={initialProps} />;
道具
name:字段名称. 名字应该和在initialProps。 。 。 .data: 不变initialProps数据道克NeetoRulesForm。 。 。 .label:为地标.
3.2 国家 TextareaField
import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
const { TextareaField } = NeetoRulesForm;
const initialProps = {
...otherProps,
description: {
label: "Description",
type: "long-text",
value: "", // Default value.
},
};
<TextareaField name="description" data={initialProps} />;
道具
name:字段名称. 名字应该和在initialProps。 。 。 .data: 不变initialProps作为data道具输入NeetoRulesForm。 。 。 .label:为地标.
3.3 国家 SelectField
import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
const { SelectField } = NeetoRulesForm;
const initialProps = {
...otherProps,
user: {
label: "Project",
type: "dropdown",
options: [{ label: "Oliver", value: "oliver" }],
value: "oliver", // Default selected option will be Oliver
},
};
<SelectField name="user" data={initialProps} />;
道具
name:字段名称. 名字应该和在initialProps。 。 。 .data: 不变initialProps数据道克NeetoRulesForm。 。 。 .label:为地标.options: 下拉的选项。 选项应包括: 对象为label财务报告和审定财务报表value键.[{label, value}]。 。 。 .onChange: 回调函数,在下拉值时调用 变化.(value, setValue) => voidsetValue设置新值.
3.4 国家 MultiSelectField
import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
const { MultiSelectField } = NeetoRulesForm;
const initialProps = {
...otherProps,
users: {
label: "Projects",
type: "multi-select",
options: [
{ label: "Oliver", value: "oliver" },
{ label: "John", value: "john" },
],
value: ["oliver"], // Default selected option will be Oliver
},
};
<MultiSelectField name="users" data={initialProps} />;
道具
name:字段名称. 名字应该和在initialProps。 。 。 .data: 不变initialProps数据道克NeetoRulesForm。 。 。 .label:为地标.options: 下拉的选项。 选项应包括: 对象为label财务报告和审定财务报表value键.[{label, value}]。 。 。 .onChange: 回调函数,在下拉值时调用 变化.(value, setValue) => voidsetValue设置新值.
3.5 (中文(简体) ) RadioField
import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
const { RadioField } = NeetoRulesForm;
const initialProps = {
...otherProps,
performer: {
label: "Performer",
type: "radio",
value: "any", // Default selected value will be "any"
options: [
{ label: "Admin", value: "admin" },
{ label: "Any", value: "any" },
],
},
};
<RadioField name="performer" data={initialProps} />;
道具
name:字段名称. 名字应该和在initialProps。 。 。 .data: 不变initialProps数据道克NeetoRulesForm。 。 。 .label:为地标.options: 无线电按钮的选项。 选项应包括: 对象为label财务报告和审定财务报表value键.[{label, value}]。 。 。 .
3.6 国家 EventConditions

import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
const { EventConditions } = NeetoRulesForm;
const EVENT_OPTIONS = [
{ label: "Ticket is created", value: "created" },
{ label: "Ticket is updated", value: "updated" },
...otherOptions,
];
const PERFORMER_OPTIONS = [
{ label: "Any", value: "any" },
{ label: "Member", value: "agent" },
...otherOptions,
];
const CONDITION_OPTIONS = [
{
value: "status",
label: "Status",
type: "multi-select",
allowMatching: ["any_of", "none_of"],
dropdownOptions: [
{ label: "Open", value: "open" },
{ label: "Closed", value: "closed" },
{ label: "On hold", value: "on_hold" },
],
},
{
value: "name",
label: "Name",
allowMatching: ["is", "is_not"],
type: "text",
},
...otherOptions,
];
const DEFAULT_CONDITION_VALUE = [
{
id: "1",
field: "status",
verb: "any_of",
metadata: { values: ["open", "closed"] },
joinType: "and_operator",
},
{
id: "2",
field: "name",
verb: "is",
metadata: { value: "Test" },
joinType: "and_operator",
},
...otherConditionValues,
];
const initialProps = {
...otherProps,
events: {
label: "Events",
type: "events",
value: [{ name: EVENT_OPTIONS[0].value }],
eventOptions: EVENT_OPTIONS,
defaultData: { name: "time_based", performer: "system" },
},
performer: {
label: "Performer",
type: "dropdown",
value: "any",
options: PERFORMER_OPTIONS,
},
conditions: {
label: "Conditions",
type: "condition",
conditionOptions: CONDITION_OPTIONS,
value: DEFAULT_CONDITION_VALUE,
},
execution_delay: {
value: { value: 2, unit: "minutes" },
defaultValue: { value: 2, unit: "minutes" },
type: "execution-delay",
};
<EventConditions
name="events"
data={initialProps}
performerName="performer"
conditionsName="conditions"
/>;
道具
name:字段名称. 名字应该和在initialProps。 。 。 .data: 不变initialProps数据道克 (原始内容存档于2018-10-12). Neeto Rulesform.label:为地标.performerName: 表演者场名. 这个performerName应该是 和《规约》中的规定相同initialProps。 。 。 .conditionsName: 条件字段的名称。 这个conditionsName应 和《公约》中的内容相同initialProps。 。 。 .onSelectEvent数字 :(name, selectedOption) => void。这种方法将触发 当我们选择一个事件选项时。 名字是指在形式上的事件 上下文.enableAddingDelay: 添加添加执行延迟的选项。 (宝莲. 参考: NeetoForm PR # 11704 (英语)
参见 事件条件部分 为了更多 资料.
3.7 国家 Conditions
import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
const { Card, Conditions } = NeetoRulesForm;
const initialProps = {
...otherProps,
conditions: {
label: "Conditions",
type: "condition",
conditionOptions: [
{
value: "status",
label: "Status",
type: "dropdown", // Types : text, number, email, decimal, url, dropdown, multi-select, multi-select-create, date, time.
allowMatching: ["is", "is_not", "any_of", "none_of"],
dropdownOptions: [
{ label: "Open", value: "open" },
{ label: "Closed", value: "closed" },
],
additionalData: {
any_of: "multi-select",
none_of: "multi-select",
},
},
{
value: "name",
label: "Name",
type: "text",
allowMatching: ["is", "is_not"],
},
{
value: "tags",
label: "Tags",
type: "multi-select-create",
allowMatching: ["contains_any_of", "contains_none_of"],
},
],
value: [
{
id: "1",
field: "status",
verb: "is",
metadata: { value: "open" },
joinType: "and_operator",
},
{
id: "2",
field: "name",
verb: "is",
metadata: { value: "Test" },
joinType: "and_operator",
},
{
id: "3",
field: "tags",
verb: "contains_any_of",
metadata: { values: ["Test", "Open"] },
joinType: "and_operator",
},
],
},
};
<Card title="Conditions">
<Conditions name="conditions" data={initialProps} />
</Card>;
道具
name:字段名称. 名字应该和在initialProps。 。 。 .data: 不变initialProps数据道克NeetoRulesForm。 。 。 .label:为地标.onSelectCondition数字 :(name, selectedOption) => void。这种方法将 当我们选择条件选项时触发。 名称是引用条件 在形式背景.selectedConditionOptions数字 :(selectedCondition)=> [{label, value}]改为: 如果选中条件的类型, 提供选定条件的选项 实值dropdown, (中文(简体) ),multi-select,或multi-select-create。 。 。 .isCallback: 指定是否有预览回调功能 条件。 (宝莲.previewCallback数字 :(conditions) => void。这种方法将触发当我们 单击预览按钮。 条件是: 语境.
3.8 国家 Actions

import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
const { Actions } = NeetoRulesForm;
const initialProps = {
...otherProps,
actions: {
label: "Actions",
type: "actions",
actionOptions: [
{
value: "add_tags",
label: "Add Tags",
type: "multiSelect", // Types : emailToIds, emailTo, email, dropdown, list, multiSelect, note, date, text, textarea, decimal, number, regex, longText, sms, smsToNumbers, smsTo, sendToApi
hideSeparator: true,
placeholder: "Select tags",
dropdownOptions: [
{ label: "Open", value: "open" },
{ label: "Close", value: "close" },
{ label: "Hold", value: "hold" },
],
},
{
value: "email_to_agent",
label: "Email To Agent",
type: "emailTo",
separator: ["with the name", "with the content"],
hideSubject: true,
},
{
value: "email_to",
label: "Email To",
type: "emailToIds",
separator: "as",
hideSubject: true, // Hide subject field if this prop is true
maxLimit: 5, // Adds validation to limit up to specified number of email addresses
},
{
value: "send_sms",
label: "Send sms",
type: "longText",
},
],
value: [
{
id: "1",
name: "email_to", // Specify the value of the selected action.
metadata: { emails: ["[email protected]"], subject: "test", body: "test" },
},
{
id: "2",
name: "add_tags",
metadata: { values: ["close"] },
},
],
},
};
<Actions name="fieldName" data={initialProps} />;
道具
name:字段名称. 名字应该和在initialProps。 。 。 .data: 不变initialProps数据道克NeetoRulesForm。 。 。 .label:为地标.onSelectAction数字 :(name, selectedOption) => void。这种方法将触发 当我们选择一个动作选项。 名称是指在 语境.selectedActionOptions数字 :(selectedAction)=> [{label, value}]。提供 如果选定的行动类型是dropdown或者说multi-select。 。 。 .separator: 在动作子项目之间显示分隔符。 如果有的话 一个子项,提供一个字符串值。 如果有多个子项, 提供一组分隔符.isSaveAsTemplateEnabled:允许用户保存当前内容 消息作为新模板.
参见 行动部分 更多信息.
3.9 自定义行动部分
需要从主机通过自定义动作组件 应用。 下面是自定义任务组件的例子,它正在 由 neto-crm 在动作选项中发送.
{
label: "Add task",
value: "add_task",
placeholder: "Task",
component: TaskComponent,
validation: TASK_VALIDATION,
},
3.10 自定义信件模板
needo RulesFrontend 允许通过预定义的电子邮件、短消息和 API 模板 主机应用程序. 这样可以使用使用创建的模板 需要 - 消息 - Templates - nano。 下面是自定义消息模板的示例 它正在由 neto-form 在行动选项中发送.
{
"label": "Email to responder",
"value": "email_to_responder",
"type": "emailTo",
"templates": [
{
"id": "caca1cc9-f9db-480a-a64f-6ea0c72d4b05",
"name": "Send emails to rejected candidates",
"subject": "Application Status - Screening Round Unsuccessful",
"body": "<p>Dear {{full-name}},</p><p>Thank you for your interest. Unfortunately, we regret to inform you that you did not pass the screener round.</p><p>Best regards, </p><p>Spinkart</p>"
}
]
}
3.11 将当前消息的内容保存为新模板
要将当前信件的内容保存为新模板, 设置
isSaveAsTemplateEnabled 真实的。 信件内容将随即提供
中的数值 handleSubmit 调用, 允许主机
用于创建新模板的应用程序.
3.12 在动作面板上显示弹出帮助
您可以配置帮助 popovers 在 Email, SMS, 输入字段旁边出现 ,
和 API 动作。 为此,应提供 helpPopoverProps 输入
行动选项.
{
label: t("form.settings.automationRules.actions.sendToApi"),
value: ACTION_OPTIONS.sendToApi,
type: "sendToApi",
helpPopoverProps: {
customHeaders: {
title: "Title for custom headers popover",
description: "Description for custom headers popover.",
helpLinkProps: { href: CUSTOM_HEADERS_HELP_DOC_URL },
},
body: {
title: "Title for API payload popover",
description: "Description for API payload popover.",
helpLinkProps: { href: API_PAYLOAD_HELP_DOC_URL },
},
},
}
以下是支持的动作和可以显示帮助弹出符的字段:
-
电子邮件动作 :
template: 在模板下拉边显示帮助弹出recipientField: 在收件人选择旁显示帮助弹出 下放( 用电子邮件列出记录)
-
短消息动作 :
template: 在模板下拉边显示帮助弹出recipientField: 在收件人选择旁显示帮助弹出 下放( 列出有电话号码的记录)
-
API 动作 :
template: 在模板下拉边显示帮助弹出customHeaders: 显示自定义页眉标签旁边的帮助弹出body: 在身体标签旁边显示帮助弹出
4.四. RulePreview
这个 RulePreview 组件用于预览自动化规则.

道具
ruleDetails: 要预览的规则细节 .isLoading: 指定预览是否在加载 。 (宝莲.isOpen: 指定预览是否打开。 (宝莲.onClose: 预览关闭时调用功能 .() => void。 。 。 .
常数
1. 联合国. AUTOMATION_RULES_QUERY_KEY
这个 AUTOMATION_RULES_QUERY_KEY 是用作
用于查询获取的密钥.
参考文献 :
5 (韩语). CannedResponsesPane
这个 CannedResponsesPane 组件用于预览罐装答复和
应用它们.
道具
actionNameOptions:任何罐装反应都可以采取的一系列行动 来 阵列中的每个对象可以有label, (中文(简体) ),value, (中文(简体) ),type, (中文(简体) ),placeholder, (中文(简体) ),dropdownOptions, (中文(简体) ),defaultData财务报告和审定财务报表variables其中,dropdownOptions, (中文(简体) ),defaultData财务报告和审定财务报表variables是可选的.areDropdownListsLoading: 指定下拉列表是否在加载 .dropdownList: 它是在倒放中使用的数值对象. 这个 可以拥有钥匙tags, (中文(简体) ),teams, (中文(简体) ),members, (中文(简体) ),fields,以及status,与 的值.isCannedResponsePaneOpen:布尔以指定罐装响应面板是否 打开.isLoadingPreview:布尔以指定预览是否在加载 .macros: 用户可以提供的一系列可能的宏/扫描响应 选择从.onApply: 调用函数来应用罐头响应.onCancel:在罐装响应面板关闭时调用回调功能.previewCannedResponses: 用于调用API的方法 获取罐头响应的预览 .previewParams:包含预览API调用参数的对象.variables: 一系列变量,可用于罐装反应. 这是可选道具.
使用量
import { useState } from "react";
import { CannedResponsesPane } from "@bigbinary/neeto-rules-frontend";
import { usePreviewCannedResponses } from "./hooks";
const Component = ({ visitorId }) => {
const [isCannedResponsePaneOpen, setIsCannedResponsePaneOpen] =
useState(false);
const { mutate: previewCannedResponses, isLoading } =
usePreviewCannedResponses();
const dropdownList = {
status: [
{ label: "Open", value: "open" },
{ label: "Closed", value: "closed" },
],
tags: [
{ label: "Tag 1", value: "tag1" },
{ label: "Tag 2", value: "tag2" },
],
teams: [
{ label: "Team 1", value: "team1" },
{ label: "Team 2", value: "team2" },
],
};
const ACTION_NAME_OPTIONS = [
{
label: "Add reply",
value: "add_reply",
type: "note",
placeholder: "Reply",
},
{
label: "Assign member",
value: "assign_agent",
type: "dropdown",
placeholder: "Select member",
dropdownOptions: [],
defaultData: { actionable_type: "User" },
},
{
label: "Assign team",
value: "assign_group",
type: "dropdown",
placeholder: "Select team",
dropdownOptions: [],
defaultData: { actionable_type: "NeetoTeamMembersEngine::Group" },
},
];
const handleApply = ({
cannedResponse,
setCannedResponse,
onSettled,
updatedValues,
}) => {
// logic to apply canned response
};
return (
<CannedResponsesPane
{...{
dropdownList,
isCannedResponsePaneOpen,
isLoadingPreview,
previewCannedResponses,
}}
actionNameOptions={ACTION_NAME_OPTIONS}
macros={cannedResponses}
previewParams={{ visitorId }}
onApply={handleApply}
onCancel={() => setIsCannedResponsePaneOpen(false)}
/>
);
};
出版指令
咨询 构建和释放软件包 关于如何出版的详细指南.