Skip to content

Commit a0e72c0

Browse files
authored
MG-15 - Add rules engine docs (#17)
* add rules engine Signed-off-by: Musilah <[email protected]> * restructure re position Signed-off-by: Musilah <[email protected]> --------- Signed-off-by: Musilah <[email protected]>
1 parent 8e7dcf4 commit a0e72c0

9 files changed

+75
-3
lines changed
98.2 KB
Loading

docs/img/rules/create-rule-dialog.png

58.7 KB
Loading

docs/img/rules/create-rule.png

61.6 KB
Loading

docs/img/rules/disabled-rule.png

94.3 KB
Loading

docs/img/rules/switch-to-editor.png

95 KB
Loading

docs/img/rules/switched-to-editor.png

95.6 KB
Loading

docs/img/rules/view-rule.png

90.9 KB
Loading

docs/rules-engine.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: Rules Engine
3+
---
4+
5+
The **Rules Engine** in Magistrala is a feature that allows users to define, manage, and automate message processing logic.
6+
It enables the creation of rules that process input data, apply logical conditions, and output results accordingly.
7+
Users can create rules by attaching input, logic, and output nodes.
8+
9+
## Features
10+
11+
- **Create Rules:** Specify input channel and topic, apply logical conditions, and specify output channel and topic
12+
- **Update Rules:** Modify existing rules, including input, logic, and output nodes.
13+
- **Delete Rules:** Remove rules that are no longer needed.
14+
- **Enable/Disable Rules:** Users can activate or deactivate rules as required.
15+
- **Comparison Blocks:** Add conditional logic to the rules for evaluating message payloads.
16+
- **Lua Script Integration:** Users can switch between a comparison block and a Lua script editor to define custom logic.
17+
18+
## **Create a Rule**
19+
20+
To create a **Rule** navigate to the Rules section and click on the `+ Create` button to open the rule creation dialog. Provide a **name** for the rule and click Create.
21+
22+
![Create a new Rule](../docs/img/rules/create-rule.png)
23+
24+
Users can view all created rules in a structured list, displaying:
25+
26+
- Rule name
27+
- Status (Enabled/Disabled)
28+
- Creation date
29+
30+
![Create a Rule Dialog](../docs/img/rules/create-rule-dialog.png)
31+
32+
## **View a Rule**
33+
34+
Click on the rule name present at the rules table to be redirected to the Rule's ID page.
35+
36+
![View a Rule](../docs/img/rules/view-rule.png)
37+
38+
From here users can view the Rule's input and output nodes as well as the logic.
39+
40+
## **Updating Rule Status**
41+
42+
Users can enable or diable a Rule by clicking on the Toggle at the top right of the Rule page.
43+
44+
![Update Rule Status](../docs/img/rules/disabled-rule.png)
45+
46+
## **Adding Comparison Block**
47+
48+
A **Comparison Block** allows users to define conditions based on message payloads:
49+
50+
- Example conditions:
51+
52+
- `If temperature is greater than 10`
53+
- `And temperature is less than 40`
54+
55+
- Users can combine multiple conditions using **AND/OR** operators.
56+
57+
![Add multiple conditions](../docs/img/rules/add-multiple-conditions.png)
58+
59+
## **Switching Between Logic Types**
60+
61+
Users can switch between a **Comparison Block** and **Lua Script** editor:
62+
63+
1. Click on the options menu (`...`) in the logic node.
64+
2. Select `Switch to editor` to enter the Lua script mode.
65+
3. Enter the custom script for message processing.
66+
4. Save the changes.
67+
68+
![Switch to Editor](../docs/img/rules/switch-to-editor.png)
69+
70+
![Switched to Editor](../docs/img/rules/switched-to-editor.png)

sidebars.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const sidebars: SidebarsConfig = {
2121
type: 'category',
2222
label: 'Domain Management',
2323
collapsible: true,
24-
collapsed: false,
2524
items: [
2625
{type: 'doc', id: 'domains', label: 'Domains'},
2726
{type: 'doc', id: 'billing', label: 'Billing'},
@@ -32,7 +31,6 @@ const sidebars: SidebarsConfig = {
3231
type: 'category',
3332
label: 'Client Management',
3433
collapsible: true,
35-
collapsed: false,
3634
items: [
3735
{type: 'doc', id: 'intro-to-client-mgmnt', label: 'Introduction'},
3836
{type: 'doc', id: 'groups', label: 'Groups'},
@@ -45,7 +43,6 @@ const sidebars: SidebarsConfig = {
4543
type: 'category',
4644
label: 'Dashboards',
4745
collapsible: true,
48-
collapsed: false,
4946
items: [
5047
{type: 'doc', id: 'dashboards', label: 'Dashboards'},
5148
{type: 'doc', id: 'widgets', label: 'Widgets'},
@@ -61,6 +58,11 @@ const sidebars: SidebarsConfig = {
6158
{type: 'doc', id: 'controls', label: 'Controls'},
6259
],
6360
},
61+
{
62+
type: 'doc',
63+
id: 'rules-engine',
64+
label: 'Rules Engine',
65+
},
6466
{
6567
type: 'doc',
6668
id: 'users',

0 commit comments

Comments
 (0)