@bigbinary/neeto-rules-frontend 1.0.0 → 1.1.1
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 +12 -0
- package/dist/index.cjs.js +53 -26
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +53 -26
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -158,6 +158,18 @@ The `NeetoRules` component is used to add the dashboard for automation rules.
|
|
|
158
158
|
| DELETE `{automationRulesEndpoint}/{id}` | `destroy` | To delete the automation rule. |
|
|
159
159
|
| PATCH `{automationRulesEndpoint}/reorder` | `reorder` | To reorder the automation rules. |
|
|
160
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. (Optional)
|
|
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. (Optional)
|
|
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. (Optional)
|
|
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. (Optional)
|
|
161
173
|
|
|
162
174
|
#### 2. `NeetoRulesForm`
|
|
163
175
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -9490,7 +9490,8 @@ var RulesReorder = function RulesReorder(_ref) {
|
|
|
9490
9490
|
rules = _ref.rules,
|
|
9491
9491
|
_ref$paginationProps = _ref.paginationProps,
|
|
9492
9492
|
paginationProps = _ref$paginationProps === void 0 ? {} : _ref$paginationProps,
|
|
9493
|
-
url = _ref.url
|
|
9493
|
+
url = _ref.url,
|
|
9494
|
+
onReorderSuccess = _ref.onReorderSuccess;
|
|
9494
9495
|
var _useState = React.useState(rules),
|
|
9495
9496
|
_useState2 = _slicedToArray$1(_useState, 2),
|
|
9496
9497
|
initialRules = _useState2[0],
|
|
@@ -9516,7 +9517,10 @@ var RulesReorder = function RulesReorder(_ref) {
|
|
|
9516
9517
|
}
|
|
9517
9518
|
}
|
|
9518
9519
|
}, {
|
|
9519
|
-
onSuccess:
|
|
9520
|
+
onSuccess: function onSuccess() {
|
|
9521
|
+
onReorderSuccess === null || onReorderSuccess === void 0 || onReorderSuccess();
|
|
9522
|
+
onClose();
|
|
9523
|
+
}
|
|
9520
9524
|
});
|
|
9521
9525
|
};
|
|
9522
9526
|
var onDragEnd = function onDragEnd(result) {
|
|
@@ -9810,7 +9814,12 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9810
9814
|
rules = _ref$rules === void 0 ? [] : _ref$rules,
|
|
9811
9815
|
totalCount = _ref.totalCount,
|
|
9812
9816
|
helpDocUrl = _ref.helpDocUrl,
|
|
9813
|
-
isLoading = _ref.isLoading
|
|
9817
|
+
isLoading = _ref.isLoading,
|
|
9818
|
+
onDeleteSuccess = _ref.onDeleteSuccess,
|
|
9819
|
+
onCloneSuccess = _ref.onCloneSuccess,
|
|
9820
|
+
onUpdateSuccess = _ref.onUpdateSuccess,
|
|
9821
|
+
page = _ref.page,
|
|
9822
|
+
setPage = _ref.setPage;
|
|
9814
9823
|
var _useQueryParams = reactUtils.useQueryParams(),
|
|
9815
9824
|
_useQueryParams$searc = _useQueryParams.searchTerm,
|
|
9816
9825
|
searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
|
|
@@ -9818,10 +9827,6 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9818
9827
|
_useState2 = _slicedToArray$1(_useState, 2),
|
|
9819
9828
|
selectedRule = _useState2[0],
|
|
9820
9829
|
setSelectedRule = _useState2[1];
|
|
9821
|
-
var _useState3 = React.useState(DEFAULT_INIT_PAGE),
|
|
9822
|
-
_useState4 = _slicedToArray$1(_useState3, 2),
|
|
9823
|
-
page = _useState4[0],
|
|
9824
|
-
setPage = _useState4[1];
|
|
9825
9830
|
var _useUtilityStore = useUtilityStore(function (store) {
|
|
9826
9831
|
return {
|
|
9827
9832
|
hidePreviewPane: store["hidePreviewPane"]
|
|
@@ -9850,8 +9855,21 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9850
9855
|
id: id,
|
|
9851
9856
|
url: url,
|
|
9852
9857
|
payload: payload
|
|
9858
|
+
}, {
|
|
9859
|
+
onSuccess: function onSuccess() {
|
|
9860
|
+
return onUpdateSuccess === null || onUpdateSuccess === void 0 ? void 0 : onUpdateSuccess();
|
|
9861
|
+
}
|
|
9853
9862
|
});
|
|
9854
9863
|
};
|
|
9864
|
+
var handleCloneSuccess = function handleCloneSuccess() {
|
|
9865
|
+
onCloneSuccess === null || onCloneSuccess === void 0 || onCloneSuccess();
|
|
9866
|
+
hidePreviewPane();
|
|
9867
|
+
};
|
|
9868
|
+
var handleDeleteSuccess = function handleDeleteSuccess() {
|
|
9869
|
+
onDeleteSuccess === null || onDeleteSuccess === void 0 || onDeleteSuccess();
|
|
9870
|
+
hidePreviewPane();
|
|
9871
|
+
setSelectedRule(null);
|
|
9872
|
+
};
|
|
9855
9873
|
var columnData = getColumnData({
|
|
9856
9874
|
handleChangeStatus: handleChangeStatus,
|
|
9857
9875
|
additionalColumns: additionalColumns,
|
|
@@ -9860,7 +9878,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9860
9878
|
id: id,
|
|
9861
9879
|
url: url
|
|
9862
9880
|
}, {
|
|
9863
|
-
onSuccess:
|
|
9881
|
+
onSuccess: handleCloneSuccess
|
|
9864
9882
|
});
|
|
9865
9883
|
},
|
|
9866
9884
|
onDelete: setSelectedRule,
|
|
@@ -9868,7 +9886,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9868
9886
|
automationRulesPath: automationRulesPath,
|
|
9869
9887
|
moreDropdownItems: moreDropdownItems
|
|
9870
9888
|
});
|
|
9871
|
-
if (isLoading) {
|
|
9889
|
+
if (isLoading && ramda.isEmpty(rules)) {
|
|
9872
9890
|
return /*#__PURE__*/jsxRuntime.jsx(PageLoader__default["default"], {});
|
|
9873
9891
|
}
|
|
9874
9892
|
if (ramda.isEmpty(rules)) {
|
|
@@ -9904,7 +9922,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9904
9922
|
currentPageNumber: page,
|
|
9905
9923
|
defaultPageSize: constants.DEFAULT_PAGE_SIZE,
|
|
9906
9924
|
handlePageChange: setPage,
|
|
9907
|
-
loading: isUpdating || isCloning || isDeleting,
|
|
9925
|
+
loading: isUpdating || isCloning || isDeleting || isLoading,
|
|
9908
9926
|
rowData: rules.map(function (item) {
|
|
9909
9927
|
return _objectSpread$n({
|
|
9910
9928
|
key: item.id
|
|
@@ -9935,10 +9953,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9935
9953
|
id: selectedRule === null || selectedRule === void 0 ? void 0 : selectedRule.id,
|
|
9936
9954
|
url: url
|
|
9937
9955
|
}, {
|
|
9938
|
-
onSuccess:
|
|
9939
|
-
hidePreviewPane();
|
|
9940
|
-
setSelectedRule(null);
|
|
9941
|
-
}
|
|
9956
|
+
onSuccess: handleDeleteSuccess
|
|
9942
9957
|
});
|
|
9943
9958
|
}
|
|
9944
9959
|
})]
|
|
@@ -9948,7 +9963,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9948
9963
|
function ownKeys$n(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9949
9964
|
function _objectSpread$m(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$n(Object(t), !0).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$n(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9950
9965
|
var NeetoRules = function NeetoRules(_ref) {
|
|
9951
|
-
var _helpPopoverProps$hel;
|
|
9966
|
+
var _helpPopoverProps$hel, _cloneRule$onSuccess, _deleteRule$onSuccess, _updateRule$onSuccess, _reorderRules$onSucce;
|
|
9952
9967
|
var breadcrumbs = _ref.breadcrumbs,
|
|
9953
9968
|
automationRulesPath = _ref.automationRulesPath,
|
|
9954
9969
|
url = _ref.automationRulesEndpoint,
|
|
@@ -9957,13 +9972,17 @@ var NeetoRules = function NeetoRules(_ref) {
|
|
|
9957
9972
|
_ref$rulesTableProps = _ref.rulesTableProps,
|
|
9958
9973
|
rulesTableProps = _ref$rulesTableProps === void 0 ? {} : _ref$rulesTableProps,
|
|
9959
9974
|
_ref$helpPopoverProps = _ref.helpPopoverProps,
|
|
9960
|
-
helpPopoverProps = _ref$helpPopoverProps === void 0 ? {} : _ref$helpPopoverProps
|
|
9975
|
+
helpPopoverProps = _ref$helpPopoverProps === void 0 ? {} : _ref$helpPopoverProps,
|
|
9976
|
+
deleteRule = _ref.deleteRule,
|
|
9977
|
+
cloneRule = _ref.cloneRule,
|
|
9978
|
+
updateRule = _ref.updateRule,
|
|
9979
|
+
reorderRules = _ref.reorderRules;
|
|
9961
9980
|
var _useState = React.useState(false),
|
|
9962
9981
|
_useState2 = _slicedToArray$1(_useState, 2),
|
|
9963
9982
|
isReorderPaneOpen = _useState2[0],
|
|
9964
9983
|
setIsReorderPaneOpen = _useState2[1];
|
|
9965
9984
|
var helpDocUrl = helpPopoverProps === null || helpPopoverProps === void 0 || (_helpPopoverProps$hel = helpPopoverProps.helpLinkProps) === null || _helpPopoverProps$hel === void 0 ? void 0 : _helpPopoverProps$hel.href;
|
|
9966
|
-
var _useState3 = React.useState(
|
|
9985
|
+
var _useState3 = React.useState(DEFAULT_INIT_PAGE),
|
|
9967
9986
|
_useState4 = _slicedToArray$1(_useState3, 2),
|
|
9968
9987
|
page = _useState4[0],
|
|
9969
9988
|
setPage = _useState4[1];
|
|
@@ -9982,7 +10001,8 @@ var NeetoRules = function NeetoRules(_ref) {
|
|
|
9982
10001
|
rules = _useFetchAutomationRu4 === void 0 ? [] : _useFetchAutomationRu4,
|
|
9983
10002
|
_useFetchAutomationRu5 = _useFetchAutomationRu3.totalCount,
|
|
9984
10003
|
totalCount = _useFetchAutomationRu5 === void 0 ? 0 : _useFetchAutomationRu5,
|
|
9985
|
-
isLoading = _useFetchAutomationRu.isLoading
|
|
10004
|
+
isLoading = _useFetchAutomationRu.isLoading,
|
|
10005
|
+
isFetching = _useFetchAutomationRu.isFetching;
|
|
9986
10006
|
var hasUnfilteredRules = neetoCist.isPresent(searchTerm) || totalCount > 0;
|
|
9987
10007
|
return /*#__PURE__*/jsxRuntime.jsxs(Container__default["default"], {
|
|
9988
10008
|
children: [/*#__PURE__*/jsxRuntime.jsx(Header$1, {
|
|
@@ -9992,26 +10012,33 @@ var NeetoRules = function NeetoRules(_ref) {
|
|
|
9992
10012
|
hasUnfilteredRules: hasUnfilteredRules,
|
|
9993
10013
|
helpPopoverProps: helpPopoverProps,
|
|
9994
10014
|
setIsReorderPaneOpen: setIsReorderPaneOpen
|
|
9995
|
-
}), /*#__PURE__*/jsxRuntime.jsx(RulesTable, _objectSpread$m({}, _objectSpread$m({
|
|
10015
|
+
}), /*#__PURE__*/jsxRuntime.jsx(RulesTable, _objectSpread$m(_objectSpread$m({}, _objectSpread$m({
|
|
9996
10016
|
automationRulesPath: automationRulesPath,
|
|
9997
10017
|
helpDocUrl: helpDocUrl,
|
|
9998
|
-
|
|
10018
|
+
page: page,
|
|
9999
10019
|
rules: rules,
|
|
10020
|
+
setPage: setPage,
|
|
10000
10021
|
totalCount: totalCount,
|
|
10001
10022
|
url: url
|
|
10002
|
-
}, rulesTableProps))
|
|
10023
|
+
}, rulesTableProps)), {}, {
|
|
10024
|
+
isLoading: isLoading || isFetching,
|
|
10025
|
+
onCloneSuccess: cloneRule === null || cloneRule === void 0 || (_cloneRule$onSuccess = cloneRule.onSuccess) === null || _cloneRule$onSuccess === void 0 ? void 0 : _cloneRule$onSuccess.callback,
|
|
10026
|
+
onDeleteSuccess: deleteRule === null || deleteRule === void 0 || (_deleteRule$onSuccess = deleteRule.onSuccess) === null || _deleteRule$onSuccess === void 0 ? void 0 : _deleteRule$onSuccess.callback,
|
|
10027
|
+
onUpdateSuccess: updateRule === null || updateRule === void 0 || (_updateRule$onSuccess = updateRule.onSuccess) === null || _updateRule$onSuccess === void 0 ? void 0 : _updateRule$onSuccess.callback
|
|
10028
|
+
})), allowReordering && !isLoading && /*#__PURE__*/jsxRuntime.jsx(RulesReorder, {
|
|
10003
10029
|
rules: rules,
|
|
10004
10030
|
url: url,
|
|
10005
10031
|
isOpen: isReorderPaneOpen,
|
|
10006
10032
|
paginationProps: {
|
|
10007
10033
|
pageNo: page,
|
|
10008
|
-
setPage: setPage,
|
|
10009
10034
|
count: totalCount,
|
|
10010
|
-
pageSize: constants.DEFAULT_PAGE_SIZE
|
|
10035
|
+
pageSize: constants.DEFAULT_PAGE_SIZE,
|
|
10036
|
+
navigate: setPage
|
|
10011
10037
|
},
|
|
10012
10038
|
onClose: function onClose() {
|
|
10013
10039
|
return setIsReorderPaneOpen(false);
|
|
10014
|
-
}
|
|
10040
|
+
},
|
|
10041
|
+
onReorderSuccess: reorderRules === null || reorderRules === void 0 || (_reorderRules$onSucce = reorderRules.onSuccess) === null || _reorderRules$onSucce === void 0 ? void 0 : _reorderRules$onSucce.callback
|
|
10015
10042
|
})]
|
|
10016
10043
|
});
|
|
10017
10044
|
};
|
|
@@ -10671,6 +10698,8 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
10671
10698
|
name = _ref.name,
|
|
10672
10699
|
index = _ref.index,
|
|
10673
10700
|
selectedField = _ref.selectedField;
|
|
10701
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
10702
|
+
t = _useTranslation.t;
|
|
10674
10703
|
var _useFormikContext = formik.useFormikContext(),
|
|
10675
10704
|
actions = _useFormikContext.values.actions,
|
|
10676
10705
|
setFieldValue = _useFormikContext.setFieldValue,
|
|
@@ -10692,8 +10721,6 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
10692
10721
|
_useState6 = _slicedToArray$1(_useState5, 2),
|
|
10693
10722
|
searchTerm = _useState6[0],
|
|
10694
10723
|
setSearchTerm = _useState6[1];
|
|
10695
|
-
var _useTranslation = reactI18next.useTranslation(),
|
|
10696
|
-
t = _useTranslation.t;
|
|
10697
10724
|
var defaultValue = ((_actions$value$index$ = actions.value[index].metadata) === null || _actions$value$index$ === void 0 ? void 0 : _actions$value$index$.value) || ((_actions$value$index = actions.value[index]) === null || _actions$value$index === void 0 ? void 0 : _actions$value$index.value);
|
|
10698
10725
|
var searchedOptions = getSearchedOptions$3(dropdownOptions, searchTerm);
|
|
10699
10726
|
var isValueSelected = defaultSelectedOption.label === defaultLabel && errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|