@bigbinary/neeto-rules-frontend 0.8.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -102
- package/app/javascript/src/translations/en.json +13 -2
- package/dist/index.cjs.js +4029 -3738
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +4368 -4079
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -11,19 +11,19 @@ The `neeto-rules-nano` facilitates the management of automation rules within nee
|
|
|
11
11
|
- [Installation](#installation-1)
|
|
12
12
|
- [Instructions for development](#instructions-for-development)
|
|
13
13
|
- [Components](#components)
|
|
14
|
-
- [
|
|
15
|
-
- [
|
|
16
|
-
|
|
17
|
-
- [
|
|
18
|
-
- [
|
|
19
|
-
- [
|
|
20
|
-
- [
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
23
|
-
- [
|
|
24
|
-
- [
|
|
25
|
-
|
|
26
|
-
- [
|
|
14
|
+
- [NeetoRules](#1-neetorules)
|
|
15
|
+
- [NeetoRulesForm](#2-neetorulesform)
|
|
16
|
+
- [Field components for NeetoRulesForm](#3-field-components-for-neetorulesform)
|
|
17
|
+
- [InputField](#31-inputfield)
|
|
18
|
+
- [TextareaField](#32-textareafield)
|
|
19
|
+
- [SelectField](#33-selectfield)
|
|
20
|
+
- [MultiSelectField](#34-multiselectfield)
|
|
21
|
+
- [RadioField](#35-radiofield)
|
|
22
|
+
- [EventConditions](#36-eventconditions)
|
|
23
|
+
- [Conditions](#37-conditions)
|
|
24
|
+
- [Actions](#38-actions)
|
|
25
|
+
- [Custom action component](#39-custom-action-component)
|
|
26
|
+
- [RulePreview](#4-rulepreview)
|
|
27
27
|
2. [Instructions for Publishing](#instructions-for-publishing)
|
|
28
28
|
|
|
29
29
|
## Development with Host Application
|
|
@@ -84,7 +84,82 @@ Check the [Frontend package development guide](https://neeto-engineering.neetokb
|
|
|
84
84
|
|
|
85
85
|
### Components
|
|
86
86
|
|
|
87
|
-
#### 1. `
|
|
87
|
+
#### 1. `NeetoRules`
|
|
88
|
+
|
|
89
|
+
The `NeetoRules` component is used to add the dashboard for automation rules.
|
|
90
|
+
|
|
91
|
+

|
|
92
|
+
|
|
93
|
+
#### Props
|
|
94
|
+
1. `breadcrumbs`: Breadcrumbs for the header of the dashboard.
|
|
95
|
+
1. `text`: Text for breadcrumb item
|
|
96
|
+
2. `link`: Link to breadcrumb item
|
|
97
|
+
2. `allowReordering`: To specify if the user can reorder the automation rules. (Boolean).
|
|
98
|
+
3. `helpPopoverProps`: To add help popover for the component. Refer [HelpPopover component doc](https://neeto-molecules.neeto.com/?path=/docs/helppopover--docs). NOTE: `href` from `helpLinkProps` will be used for displaying the link when showing `NoData` component.
|
|
99
|
+
4. `rulesTableProps`: Props for the table in the dashboard:
|
|
100
|
+
1. `additionalColumns`: To add additional columns to the table. Refer [Table component doc](https://neeto-ui.neeto.com/?path=/docs/components-table--docs).
|
|
101
|
+
|
|
102
|
+
```jsx
|
|
103
|
+
const additionalColumns = [
|
|
104
|
+
{
|
|
105
|
+
title: "Operated on",
|
|
106
|
+
dataIndex: "recentlyModifiedTickets",
|
|
107
|
+
width: 160,
|
|
108
|
+
description: "Number of tickets the rule has acted upon in the last 7 days",
|
|
109
|
+
render: recentlyModifiedTickets => (
|
|
110
|
+
<div className="text-center">{recentlyModifiedTickets}</div>
|
|
111
|
+
),
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
2. `moreDropdownItems`: Array of dropdown items to be added to the MoreDropdown component in the table. Refer [MoreDropdown in table doc](https://neeto-ui.neeto.com/?path=/docs/components-table--docs).
|
|
117
|
+
|
|
118
|
+
```jsx
|
|
119
|
+
const moreDropdownItems = [
|
|
120
|
+
{
|
|
121
|
+
key: "view-matching-tickets",
|
|
122
|
+
label: "View matching rules",
|
|
123
|
+
// onClick callback receives the selected rule
|
|
124
|
+
onClick: rule => {
|
|
125
|
+
setSelectedRule(rule);
|
|
126
|
+
setShowMatchingTickets(true);
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
];
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
3. `onPreview`: The callback function to call when the preview is clicked.
|
|
133
|
+
```jsx
|
|
134
|
+
const onPreview = id => {
|
|
135
|
+
setRuleId(id);
|
|
136
|
+
};
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
5. `automationRulesPath`: The path for automation rules dashboard.
|
|
141
|
+
|
|
142
|
+
Following additional routes are considered by the component:
|
|
143
|
+
|
|
144
|
+
| Routes | Description |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| `{automationRulesPath}/edit` | Route to the rule edit form component. |
|
|
147
|
+
| `{automationRulesPath}/new` | Route to the rule create form component. |
|
|
148
|
+
|
|
149
|
+
6. `automationRulesEndpoint`: The endpoint for automation rules.
|
|
150
|
+
|
|
151
|
+
Following endpoints will be used by the component:
|
|
152
|
+
|
|
153
|
+
| Endpoint | Action | Description |
|
|
154
|
+
| --- | --- | --- |
|
|
155
|
+
| GET `{automationRulesEndpoint}` | `index` | To fetch the list of automation rules.(Same will be used for pagination/filtering) |
|
|
156
|
+
| POST `{automationRulesEndpoint}/{id}/clone` | `clone` | To create the clone of the automation rule. |
|
|
157
|
+
| PATCH `{automationRulesEndpoint}/{id}` | `update` | To update the status of the automation rule. |
|
|
158
|
+
| DELETE `{automationRulesEndpoint}/{id}` | `destroy` | To delete the automation rule. |
|
|
159
|
+
| PATCH `{automationRulesEndpoint}/reorder` | `reorder` | To reorder the automation rules. |
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
#### 2. `NeetoRulesForm`
|
|
88
163
|
|
|
89
164
|
<div align="center">
|
|
90
165
|
<img src="./docs/images/rules-form.png"/>
|
|
@@ -105,6 +180,8 @@ The `NeetoRulesForm` component is used to create and edit automation rules.
|
|
|
105
180
|
7. condition
|
|
106
181
|
8. actions
|
|
107
182
|
|
|
183
|
+
> **Note:** The `NeetoRulesForm` component includes three fields by default with the following names: `name`(required), `description` and `status`.
|
|
184
|
+
|
|
108
185
|
#### Props
|
|
109
186
|
|
|
110
187
|
- `data`: The initial props for the form.
|
|
@@ -144,7 +221,7 @@ const { InputField, TextareaField, SelectField, Events, Card, Conditions, Action
|
|
|
144
221
|
|
|
145
222
|
<br>
|
|
146
223
|
|
|
147
|
-
####
|
|
224
|
+
#### 3. Field components for `NeetoRulesForm`
|
|
148
225
|
|
|
149
226
|
NeetoRulesForm provides field components to create the automation rules form.
|
|
150
227
|
|
|
@@ -154,7 +231,7 @@ NeetoRulesForm provides field components to create the automation rules form.
|
|
|
154
231
|
2. [neeto-desk-web](https://github.com/bigbinary/neeto-desk-web/blob/edc9bad9305d55c18a67de3931cbe2633fe3710f/app/javascript/src/components/Macros/Form/FormContent.jsx#L8)
|
|
155
232
|
3. [neeto-planner-web](https://github.com/bigbinary/neeto-planner-web/blob/73bb48e1721bb8ae3c71dbabe7b3b99c443a3f6e/app/javascript/src/components/Settings/Automations/Automation/Form/FormContent.jsx#L24)
|
|
156
233
|
|
|
157
|
-
####
|
|
234
|
+
#### 3.1 `InputField`
|
|
158
235
|
|
|
159
236
|
```jsx
|
|
160
237
|
import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
|
|
@@ -182,7 +259,7 @@ const initialProps = {
|
|
|
182
259
|
2. `data`: The same `initialProps` that is passed to data prop in `NeetoRulesForm`.
|
|
183
260
|
3. `label`: Label for the field.
|
|
184
261
|
|
|
185
|
-
####
|
|
262
|
+
#### 3.2 `TextareaField`
|
|
186
263
|
|
|
187
264
|
```jsx
|
|
188
265
|
import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
|
|
@@ -235,7 +312,7 @@ const initialProps = {
|
|
|
235
312
|
4. `options`: Options for the dropdown. The options should be an array of objects with `label` and `value` keys. `[{label, value}]`.
|
|
236
313
|
5. `onChange`: Callback function that is called when the value of the dropdown changes. `(value, setValue) => void` `setValue` is to set the new value.
|
|
237
314
|
|
|
238
|
-
####
|
|
315
|
+
#### 3.4 `MultiSelectField`
|
|
239
316
|
|
|
240
317
|
```jsx
|
|
241
318
|
import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
|
|
@@ -266,7 +343,7 @@ const initialProps = {
|
|
|
266
343
|
4. `options`: Options for the dropdown. The options should be an array of objects with `label` and `value` keys. `[{label, value}]`.
|
|
267
344
|
5. `onChange`: Callback function that is called when the value of the dropdown changes. `(value, setValue) => void` `setValue` is to set the new value.
|
|
268
345
|
|
|
269
|
-
####
|
|
346
|
+
#### 3.5 `RadioField`
|
|
270
347
|
|
|
271
348
|
```jsx
|
|
272
349
|
import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
|
|
@@ -296,7 +373,7 @@ const initialProps = {
|
|
|
296
373
|
3. `label`: Label for the field.
|
|
297
374
|
4. `options`: Options for the radio buttons. The options should be an array of objects with `label` and `value` keys. `[{label, value}]`.
|
|
298
375
|
|
|
299
|
-
####
|
|
376
|
+
#### 3.6 `EventConditions`
|
|
300
377
|
|
|
301
378
|

|
|
302
379
|
|
|
@@ -398,7 +475,7 @@ const initialProps = {
|
|
|
398
475
|
|
|
399
476
|
Refer to the [EventCondition section](./docs/event-conditions.md) for more information.
|
|
400
477
|
|
|
401
|
-
####
|
|
478
|
+
#### 3.7 `Conditions`
|
|
402
479
|
|
|
403
480
|
```jsx
|
|
404
481
|
import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
|
|
@@ -479,7 +556,7 @@ const initialProps = {
|
|
|
479
556
|
6. `isCallback`: To specify if there is a preview callback function for the conditions. (Boolean).
|
|
480
557
|
7. `previewCallback`: `(conditions) => void`. This method will trigger when we click on the preview button. The conditions are the selected conditions in the formik context.
|
|
481
558
|
|
|
482
|
-
####
|
|
559
|
+
#### 3.8 `Actions`
|
|
483
560
|
|
|
484
561
|

|
|
485
562
|
|
|
@@ -547,7 +624,7 @@ const initialProps = {
|
|
|
547
624
|
|
|
548
625
|
Refer to the [Actions section](./docs/actions.md) for more information.
|
|
549
626
|
|
|
550
|
-
####
|
|
627
|
+
#### 3.9 Custom action component
|
|
551
628
|
|
|
552
629
|
neetoRulesFrontend allows to pass custom action components from host application. Below is an example for customize task component which is being sent by neeto-crm in action options.
|
|
553
630
|
|
|
@@ -561,7 +638,7 @@ neetoRulesFrontend allows to pass custom action components from host application
|
|
|
561
638
|
},
|
|
562
639
|
```
|
|
563
640
|
|
|
564
|
-
####
|
|
641
|
+
#### 3.10 Custom message templates
|
|
565
642
|
|
|
566
643
|
neetoRulesFrontend allows to pass predefined email, SMS and API templates from host application. This enables to use templates created using neeto-message-templates-nano. Below is an example for custom message template which is being sent by neeto-form in action options.
|
|
567
644
|
|
|
@@ -581,7 +658,7 @@ neetoRulesFrontend allows to pass predefined email, SMS and API templates from h
|
|
|
581
658
|
}
|
|
582
659
|
```
|
|
583
660
|
|
|
584
|
-
####
|
|
661
|
+
#### 4. `RulePreview`
|
|
585
662
|
|
|
586
663
|
The `RulePreview` component is used to preview the automation rule.
|
|
587
664
|
|
|
@@ -593,89 +670,12 @@ The `RulePreview` component is used to preview the automation rule.
|
|
|
593
670
|
2. `isLoading`: To specify if the preview is loading. (Boolean).
|
|
594
671
|
3. `isOpen`: To specify if the preview is open. (Boolean).
|
|
595
672
|
4. `onClose`: The callback function to call when the preview is closed. `() => void`.
|
|
596
|
-
4. `moreDropdownProps`: To add and specify actions for MoreDropdown. Refer [MoreDropdown component doc](https://neeto-molecules.neeto.com/?path=/docs/moredropdown--docs).
|
|
597
673
|
|
|
598
674
|
reference:
|
|
599
675
|
|
|
600
676
|
1. [neeto-crm-web](https://github.com/bigbinary/neeto-crm-web/blob/b4c59181aec20d7519dd73b54b0695362ed4466f/app/javascript/src/components/Settings/Automations/index.jsx#L115)
|
|
601
677
|
|
|
602
678
|
|
|
603
|
-
#### 4. `RulesReorder`
|
|
604
|
-
|
|
605
|
-
The `RulesReorder` component is used to reorder the automation rule.
|
|
606
|
-
|
|
607
|
-

|
|
608
|
-
|
|
609
|
-
#### Props
|
|
610
|
-
|
|
611
|
-
1. `isOpen`: To specify if the reorder pane is open. (Boolean).
|
|
612
|
-
2. `onClose`: The callback function to call when the reorder pane is closed. `() => void`.
|
|
613
|
-
3. `rules`: The list of rules to be reordered.
|
|
614
|
-
4. `onReorderCancel`: The callback function to call when the reorder is cancelled. `() => void`.
|
|
615
|
-
5. `onReorderSave`: The callback function to call when the reorder is saved. `(reorderedRules) => {}`.
|
|
616
|
-
6. `isReordering`: To specify if the reordering is in progress. (Boolean).
|
|
617
|
-
7. `paginationProps`: To add pagination to the list of rules. Refer [Pagination component doc](https://neeto-ui.neeto.com/?path=/docs/components-pagination--docs).
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
#### 5. `RulesTable`
|
|
621
|
-
|
|
622
|
-
The `RulesTable` component is used to display the list of automation rules.
|
|
623
|
-
> Includes subheader which displays count of the automation rules.
|
|
624
|
-
|
|
625
|
-
#### Props
|
|
626
|
-
|
|
627
|
-
1. `automationRulesEndpoint`: The endpoint for automation rules.
|
|
628
|
-
|
|
629
|
-
Following actions will be used by the component
|
|
630
|
-
| Action | Description |
|
|
631
|
-
| --- | --- |
|
|
632
|
-
| `clone` | To create the clone of the automation rule. |
|
|
633
|
-
| `update` | To update the status of the automation rule. |
|
|
634
|
-
| `destroy` | To delete the automation rule. |
|
|
635
|
-
|
|
636
|
-
2. `additionalColumns`: To add additional columns to the table. Refer [Table component doc](https://neeto-ui.neeto.com/?path=/docs/components-table--docs)
|
|
637
|
-
|
|
638
|
-
```jsx
|
|
639
|
-
const additionalColumns = [
|
|
640
|
-
{
|
|
641
|
-
title: "Operated on",
|
|
642
|
-
dataIndex: "recentlyModifiedTickets",
|
|
643
|
-
width: 160,
|
|
644
|
-
description: "Number of tickets the rule has acted upon in the last 7 days",
|
|
645
|
-
render: recentlyModifiedTickets => (
|
|
646
|
-
<div className="text-center">{recentlyModifiedTickets}</div>
|
|
647
|
-
),
|
|
648
|
-
},
|
|
649
|
-
];
|
|
650
|
-
```
|
|
651
|
-
|
|
652
|
-
3. `automationRulesPath`: The path for automation rules component.
|
|
653
|
-
|
|
654
|
-
Following additional routes are considered by the component:
|
|
655
|
-
| Routes | Description |
|
|
656
|
-
| --- | --- |
|
|
657
|
-
| `{automationRulesPath}/edit` | Page to display rule edit form. |
|
|
658
|
-
| `{automationRulesPath}/new` | Page to display rule create form. |
|
|
659
|
-
|
|
660
|
-
4. `onPreview`: The callback function to call when the preview is clicked.
|
|
661
|
-
|
|
662
|
-
5. `helpDocUrl`: The URL of the help doc to be displayed when no data is available.
|
|
663
|
-
|
|
664
|
-
6. `MoreDropdownItems`: Array of dropdown items to be added to the MoreDropdown component in the table. Refer [MoreDropdown in table doc](https://neeto-ui.neeto.com/?path=/docs/components-table--docs).
|
|
665
|
-
|
|
666
|
-
```jsx
|
|
667
|
-
const moreDropdownItems = [
|
|
668
|
-
{
|
|
669
|
-
key: "view-matching-tickets",
|
|
670
|
-
label: "View matching rules",
|
|
671
|
-
// onClick callback receives the selected rule
|
|
672
|
-
onClick: rule => {
|
|
673
|
-
setSelectedRule(rule);
|
|
674
|
-
setShowMatchingTickets(true);
|
|
675
|
-
},
|
|
676
|
-
},
|
|
677
|
-
];
|
|
678
|
-
```
|
|
679
679
|
## Instructions for Publishing
|
|
680
680
|
|
|
681
681
|
Consult the [building and releasing packages](https://neeto-engineering.neetokb.com/articles/building-and-releasing-packages) guide for details on how to publish.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"neetoRules": {
|
|
3
3
|
"common": {
|
|
4
|
+
"title": "Automation rules",
|
|
4
5
|
"automationRuleWithCount_one": "{{count}} automation rule",
|
|
5
6
|
"automationRuleWithCount_other": "{{count}} automation rules",
|
|
6
7
|
"events": "Events",
|
|
@@ -157,7 +158,8 @@
|
|
|
157
158
|
"selectOption": "Select option",
|
|
158
159
|
"value": "Value",
|
|
159
160
|
"selectTemplate": "Select a template",
|
|
160
|
-
"phoneNumberField": "Type phone number and press enter"
|
|
161
|
+
"phoneNumberField": "Type phone number and press enter",
|
|
162
|
+
"searchRules": "Search automation rules"
|
|
161
163
|
},
|
|
162
164
|
"buttons": {
|
|
163
165
|
"save": "Save",
|
|
@@ -315,7 +317,7 @@
|
|
|
315
317
|
"clone": "Clone",
|
|
316
318
|
"delete": "Delete",
|
|
317
319
|
"edit": "Edit",
|
|
318
|
-
"addNew": "Add new
|
|
320
|
+
"addNew": "Add new rule"
|
|
319
321
|
},
|
|
320
322
|
"deleteAlert": {
|
|
321
323
|
"message": "You are permanently deleting the automation rule <strong>{{name, anyCase}}</strong>. This can't be undone.",
|
|
@@ -324,6 +326,15 @@
|
|
|
324
326
|
"noData": {
|
|
325
327
|
"title": "There are no automation rule to show",
|
|
326
328
|
"helpText": "Here is how you can use <a>automation rules.</a>"
|
|
329
|
+
},
|
|
330
|
+
"tooltips": {
|
|
331
|
+
"rule": {
|
|
332
|
+
"active": "This automation rule is currently Active. Toggle to make it Inactive.",
|
|
333
|
+
"inactive": "This automation rule is currently Inactive. Toggle to make it Active."
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
"helpText": {
|
|
337
|
+
"description": "Automation rules feature allows you to create rules to automate specific actions when certain events occur."
|
|
327
338
|
}
|
|
328
339
|
}
|
|
329
340
|
}
|