@bigbinary/neeto-rules-frontend 0.8.1 → 1.1.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 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
- - [NeetoRulesForm](#1-neetorulesform)
15
- - [Field components for NeetoRulesForm](#2-field-components-for-neetorulesform)
16
- - [InputField](#21-inputfield)
17
- - [TextareaField](#22-textareafield)
18
- - [SelectField](#23-selectfield)
19
- - [MultiSelectField](#24-multiselectfield)
20
- - [RadioField](#25-radiofield)
21
- - [EventConditions](#26-eventconditions)
22
- - [Conditions](#27-conditions)
23
- - [Actions](#28-actions)
24
- - [Custom action component](#29-custom-action-component)
25
- - [RulePreview](#3-rulepreview)
26
- - [RulesTable](#4-rulestable)
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,94 @@ Check the [Frontend package development guide](https://neeto-engineering.neetokb
84
84
 
85
85
  ### Components
86
86
 
87
- #### 1. `NeetoRulesForm`
87
+ #### 1. `NeetoRules`
88
+
89
+ The `NeetoRules` component is used to add the dashboard for automation rules.
90
+
91
+ ![rules-dashboard](./docs/images/rules-dashboard.png)
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
+ 7. `updateRule`: Object that define methods for update rule operation.
162
+ - `onSuccess`: Object for handling update rule success callback.
163
+ - `callback`: Function to be called on success.
164
+ 8. `deleteRule`: Object that define methods for delete rule operation.
165
+ - `onSuccess`: Object for handling delete rule success callback.
166
+ - `callback`: Function to be called on success.
167
+ 9. `cloneRule`: Object that define methods for clone rule operation.
168
+ - `onSuccess`: Object for handling clone rule success callback.
169
+ - `callback`: Function to be called on success.
170
+ 10. `reoderRules`: Function to be called on reorder success.
171
+ - `onSuccess`: Object for handling reorder rule success callback.
172
+ - `callback`: Function to be called on success.
173
+
174
+ #### 2. `NeetoRulesForm`
88
175
 
89
176
  <div align="center">
90
177
  <img src="./docs/images/rules-form.png"/>
@@ -105,6 +192,8 @@ The `NeetoRulesForm` component is used to create and edit automation rules.
105
192
  7. condition
106
193
  8. actions
107
194
 
195
+ > **Note:** The `NeetoRulesForm` component includes three fields by default with the following names: `name`(required), `description` and `status`.
196
+
108
197
  #### Props
109
198
 
110
199
  - `data`: The initial props for the form.
@@ -144,7 +233,7 @@ const { InputField, TextareaField, SelectField, Events, Card, Conditions, Action
144
233
 
145
234
  <br>
146
235
 
147
- #### 2. Field components for `NeetoRulesForm`
236
+ #### 3. Field components for `NeetoRulesForm`
148
237
 
149
238
  NeetoRulesForm provides field components to create the automation rules form.
150
239
 
@@ -154,7 +243,7 @@ NeetoRulesForm provides field components to create the automation rules form.
154
243
  2. [neeto-desk-web](https://github.com/bigbinary/neeto-desk-web/blob/edc9bad9305d55c18a67de3931cbe2633fe3710f/app/javascript/src/components/Macros/Form/FormContent.jsx#L8)
155
244
  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
245
 
157
- #### 2.1 `InputField`
246
+ #### 3.1 `InputField`
158
247
 
159
248
  ```jsx
160
249
  import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
@@ -182,7 +271,7 @@ const initialProps = {
182
271
  2. `data`: The same `initialProps` that is passed to data prop in `NeetoRulesForm`.
183
272
  3. `label`: Label for the field.
184
273
 
185
- #### 2.2 `TextareaField`
274
+ #### 3.2 `TextareaField`
186
275
 
187
276
  ```jsx
188
277
  import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
@@ -235,7 +324,7 @@ const initialProps = {
235
324
  4. `options`: Options for the dropdown. The options should be an array of objects with `label` and `value` keys. `[{label, value}]`.
236
325
  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
326
 
238
- #### 2.4 `MultiSelectField`
327
+ #### 3.4 `MultiSelectField`
239
328
 
240
329
  ```jsx
241
330
  import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
@@ -266,7 +355,7 @@ const initialProps = {
266
355
  4. `options`: Options for the dropdown. The options should be an array of objects with `label` and `value` keys. `[{label, value}]`.
267
356
  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
357
 
269
- #### 2.5 `RadioField`
358
+ #### 3.5 `RadioField`
270
359
 
271
360
  ```jsx
272
361
  import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
@@ -296,7 +385,7 @@ const initialProps = {
296
385
  3. `label`: Label for the field.
297
386
  4. `options`: Options for the radio buttons. The options should be an array of objects with `label` and `value` keys. `[{label, value}]`.
298
387
 
299
- #### 2.6 `EventConditions`
388
+ #### 3.6 `EventConditions`
300
389
 
301
390
  ![event-conditions](./docs/images/event-conditions.png)
302
391
 
@@ -398,7 +487,7 @@ const initialProps = {
398
487
 
399
488
  Refer to the [EventCondition section](./docs/event-conditions.md) for more information.
400
489
 
401
- #### 2.7 `Conditions`
490
+ #### 3.7 `Conditions`
402
491
 
403
492
  ```jsx
404
493
  import { NeetoRulesForm } from "@bigbinary/neeto-rules-frontend";
@@ -479,7 +568,7 @@ const initialProps = {
479
568
  6. `isCallback`: To specify if there is a preview callback function for the conditions. (Boolean).
480
569
  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
570
 
482
- #### 2.8 `Actions`
571
+ #### 3.8 `Actions`
483
572
 
484
573
  ![actions](./docs/images/action.png)
485
574
 
@@ -547,7 +636,7 @@ const initialProps = {
547
636
 
548
637
  Refer to the [Actions section](./docs/actions.md) for more information.
549
638
 
550
- #### 2.9 Custom action component
639
+ #### 3.9 Custom action component
551
640
 
552
641
  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
642
 
@@ -561,7 +650,7 @@ neetoRulesFrontend allows to pass custom action components from host application
561
650
  },
562
651
  ```
563
652
 
564
- #### 2.10 Custom message templates
653
+ #### 3.10 Custom message templates
565
654
 
566
655
  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
656
 
@@ -581,7 +670,7 @@ neetoRulesFrontend allows to pass predefined email, SMS and API templates from h
581
670
  }
582
671
  ```
583
672
 
584
- #### 3. `RulePreview`
673
+ #### 4. `RulePreview`
585
674
 
586
675
  The `RulePreview` component is used to preview the automation rule.
587
676
 
@@ -593,89 +682,12 @@ The `RulePreview` component is used to preview the automation rule.
593
682
  2. `isLoading`: To specify if the preview is loading. (Boolean).
594
683
  3. `isOpen`: To specify if the preview is open. (Boolean).
595
684
  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
685
 
598
686
  reference:
599
687
 
600
688
  1. [neeto-crm-web](https://github.com/bigbinary/neeto-crm-web/blob/b4c59181aec20d7519dd73b54b0695362ed4466f/app/javascript/src/components/Settings/Automations/index.jsx#L115)
601
689
 
602
690
 
603
- #### 4. `RulesReorder`
604
-
605
- The `RulesReorder` component is used to reorder the automation rule.
606
-
607
- ![rule-reorder](./docs/images/rules-reorder.png)
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
691
  ## Instructions for Publishing
680
692
 
681
693
  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 automation rule"
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
  }