@bigbinary/neeto-rules-frontend 1.0.0 → 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 +12 -0
- package/dist/index.cjs.js +51 -26
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +51 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.
|
|
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.
|
|
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,19 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9850
9855
|
id: id,
|
|
9851
9856
|
url: url,
|
|
9852
9857
|
payload: payload
|
|
9858
|
+
}, {
|
|
9859
|
+
onSuccess: onUpdateSuccess
|
|
9853
9860
|
});
|
|
9854
9861
|
};
|
|
9862
|
+
var handleCloneSuccess = function handleCloneSuccess() {
|
|
9863
|
+
onCloneSuccess();
|
|
9864
|
+
hidePreviewPane();
|
|
9865
|
+
};
|
|
9866
|
+
var handleDeleteSuccess = function handleDeleteSuccess() {
|
|
9867
|
+
onDeleteSuccess();
|
|
9868
|
+
hidePreviewPane();
|
|
9869
|
+
setSelectedRule(null);
|
|
9870
|
+
};
|
|
9855
9871
|
var columnData = getColumnData({
|
|
9856
9872
|
handleChangeStatus: handleChangeStatus,
|
|
9857
9873
|
additionalColumns: additionalColumns,
|
|
@@ -9860,7 +9876,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9860
9876
|
id: id,
|
|
9861
9877
|
url: url
|
|
9862
9878
|
}, {
|
|
9863
|
-
onSuccess:
|
|
9879
|
+
onSuccess: handleCloneSuccess
|
|
9864
9880
|
});
|
|
9865
9881
|
},
|
|
9866
9882
|
onDelete: setSelectedRule,
|
|
@@ -9868,7 +9884,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9868
9884
|
automationRulesPath: automationRulesPath,
|
|
9869
9885
|
moreDropdownItems: moreDropdownItems
|
|
9870
9886
|
});
|
|
9871
|
-
if (isLoading) {
|
|
9887
|
+
if (isLoading && ramda.isEmpty(rules)) {
|
|
9872
9888
|
return /*#__PURE__*/jsxRuntime.jsx(PageLoader__default["default"], {});
|
|
9873
9889
|
}
|
|
9874
9890
|
if (ramda.isEmpty(rules)) {
|
|
@@ -9904,7 +9920,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9904
9920
|
currentPageNumber: page,
|
|
9905
9921
|
defaultPageSize: constants.DEFAULT_PAGE_SIZE,
|
|
9906
9922
|
handlePageChange: setPage,
|
|
9907
|
-
loading: isUpdating || isCloning || isDeleting,
|
|
9923
|
+
loading: isUpdating || isCloning || isDeleting || isLoading,
|
|
9908
9924
|
rowData: rules.map(function (item) {
|
|
9909
9925
|
return _objectSpread$n({
|
|
9910
9926
|
key: item.id
|
|
@@ -9935,10 +9951,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9935
9951
|
id: selectedRule === null || selectedRule === void 0 ? void 0 : selectedRule.id,
|
|
9936
9952
|
url: url
|
|
9937
9953
|
}, {
|
|
9938
|
-
onSuccess:
|
|
9939
|
-
hidePreviewPane();
|
|
9940
|
-
setSelectedRule(null);
|
|
9941
|
-
}
|
|
9954
|
+
onSuccess: handleDeleteSuccess
|
|
9942
9955
|
});
|
|
9943
9956
|
}
|
|
9944
9957
|
})]
|
|
@@ -9948,7 +9961,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9948
9961
|
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
9962
|
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
9963
|
var NeetoRules = function NeetoRules(_ref) {
|
|
9951
|
-
var _helpPopoverProps$hel;
|
|
9964
|
+
var _helpPopoverProps$hel, _cloneRule$onSuccess, _deleteRule$onSuccess, _updateRule$onSuccess, _reorderRules$onSucce;
|
|
9952
9965
|
var breadcrumbs = _ref.breadcrumbs,
|
|
9953
9966
|
automationRulesPath = _ref.automationRulesPath,
|
|
9954
9967
|
url = _ref.automationRulesEndpoint,
|
|
@@ -9957,13 +9970,17 @@ var NeetoRules = function NeetoRules(_ref) {
|
|
|
9957
9970
|
_ref$rulesTableProps = _ref.rulesTableProps,
|
|
9958
9971
|
rulesTableProps = _ref$rulesTableProps === void 0 ? {} : _ref$rulesTableProps,
|
|
9959
9972
|
_ref$helpPopoverProps = _ref.helpPopoverProps,
|
|
9960
|
-
helpPopoverProps = _ref$helpPopoverProps === void 0 ? {} : _ref$helpPopoverProps
|
|
9973
|
+
helpPopoverProps = _ref$helpPopoverProps === void 0 ? {} : _ref$helpPopoverProps,
|
|
9974
|
+
deleteRule = _ref.deleteRule,
|
|
9975
|
+
cloneRule = _ref.cloneRule,
|
|
9976
|
+
updateRule = _ref.updateRule,
|
|
9977
|
+
reorderRules = _ref.reorderRules;
|
|
9961
9978
|
var _useState = React.useState(false),
|
|
9962
9979
|
_useState2 = _slicedToArray$1(_useState, 2),
|
|
9963
9980
|
isReorderPaneOpen = _useState2[0],
|
|
9964
9981
|
setIsReorderPaneOpen = _useState2[1];
|
|
9965
9982
|
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(
|
|
9983
|
+
var _useState3 = React.useState(DEFAULT_INIT_PAGE),
|
|
9967
9984
|
_useState4 = _slicedToArray$1(_useState3, 2),
|
|
9968
9985
|
page = _useState4[0],
|
|
9969
9986
|
setPage = _useState4[1];
|
|
@@ -9982,7 +9999,8 @@ var NeetoRules = function NeetoRules(_ref) {
|
|
|
9982
9999
|
rules = _useFetchAutomationRu4 === void 0 ? [] : _useFetchAutomationRu4,
|
|
9983
10000
|
_useFetchAutomationRu5 = _useFetchAutomationRu3.totalCount,
|
|
9984
10001
|
totalCount = _useFetchAutomationRu5 === void 0 ? 0 : _useFetchAutomationRu5,
|
|
9985
|
-
isLoading = _useFetchAutomationRu.isLoading
|
|
10002
|
+
isLoading = _useFetchAutomationRu.isLoading,
|
|
10003
|
+
isFetching = _useFetchAutomationRu.isFetching;
|
|
9986
10004
|
var hasUnfilteredRules = neetoCist.isPresent(searchTerm) || totalCount > 0;
|
|
9987
10005
|
return /*#__PURE__*/jsxRuntime.jsxs(Container__default["default"], {
|
|
9988
10006
|
children: [/*#__PURE__*/jsxRuntime.jsx(Header$1, {
|
|
@@ -9992,26 +10010,33 @@ var NeetoRules = function NeetoRules(_ref) {
|
|
|
9992
10010
|
hasUnfilteredRules: hasUnfilteredRules,
|
|
9993
10011
|
helpPopoverProps: helpPopoverProps,
|
|
9994
10012
|
setIsReorderPaneOpen: setIsReorderPaneOpen
|
|
9995
|
-
}), /*#__PURE__*/jsxRuntime.jsx(RulesTable, _objectSpread$m({}, _objectSpread$m({
|
|
10013
|
+
}), /*#__PURE__*/jsxRuntime.jsx(RulesTable, _objectSpread$m(_objectSpread$m({}, _objectSpread$m({
|
|
9996
10014
|
automationRulesPath: automationRulesPath,
|
|
9997
10015
|
helpDocUrl: helpDocUrl,
|
|
9998
|
-
|
|
10016
|
+
page: page,
|
|
9999
10017
|
rules: rules,
|
|
10018
|
+
setPage: setPage,
|
|
10000
10019
|
totalCount: totalCount,
|
|
10001
10020
|
url: url
|
|
10002
|
-
}, rulesTableProps))
|
|
10021
|
+
}, rulesTableProps)), {}, {
|
|
10022
|
+
isLoading: isLoading || isFetching,
|
|
10023
|
+
onCloneSuccess: cloneRule === null || cloneRule === void 0 || (_cloneRule$onSuccess = cloneRule.onSuccess) === null || _cloneRule$onSuccess === void 0 ? void 0 : _cloneRule$onSuccess.callback,
|
|
10024
|
+
onDeleteSuccess: deleteRule === null || deleteRule === void 0 || (_deleteRule$onSuccess = deleteRule.onSuccess) === null || _deleteRule$onSuccess === void 0 ? void 0 : _deleteRule$onSuccess.callback,
|
|
10025
|
+
onUpdateSuccess: updateRule === null || updateRule === void 0 || (_updateRule$onSuccess = updateRule.onSuccess) === null || _updateRule$onSuccess === void 0 ? void 0 : _updateRule$onSuccess.callback
|
|
10026
|
+
})), allowReordering && !isLoading && /*#__PURE__*/jsxRuntime.jsx(RulesReorder, {
|
|
10003
10027
|
rules: rules,
|
|
10004
10028
|
url: url,
|
|
10005
10029
|
isOpen: isReorderPaneOpen,
|
|
10006
10030
|
paginationProps: {
|
|
10007
10031
|
pageNo: page,
|
|
10008
|
-
setPage: setPage,
|
|
10009
10032
|
count: totalCount,
|
|
10010
|
-
pageSize: constants.DEFAULT_PAGE_SIZE
|
|
10033
|
+
pageSize: constants.DEFAULT_PAGE_SIZE,
|
|
10034
|
+
navigate: setPage
|
|
10011
10035
|
},
|
|
10012
10036
|
onClose: function onClose() {
|
|
10013
10037
|
return setIsReorderPaneOpen(false);
|
|
10014
|
-
}
|
|
10038
|
+
},
|
|
10039
|
+
onReorderSuccess: reorderRules === null || reorderRules === void 0 || (_reorderRules$onSucce = reorderRules.onSuccess) === null || _reorderRules$onSucce === void 0 ? void 0 : _reorderRules$onSucce.callback
|
|
10015
10040
|
})]
|
|
10016
10041
|
});
|
|
10017
10042
|
};
|
|
@@ -10671,6 +10696,8 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
10671
10696
|
name = _ref.name,
|
|
10672
10697
|
index = _ref.index,
|
|
10673
10698
|
selectedField = _ref.selectedField;
|
|
10699
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
10700
|
+
t = _useTranslation.t;
|
|
10674
10701
|
var _useFormikContext = formik.useFormikContext(),
|
|
10675
10702
|
actions = _useFormikContext.values.actions,
|
|
10676
10703
|
setFieldValue = _useFormikContext.setFieldValue,
|
|
@@ -10692,8 +10719,6 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
10692
10719
|
_useState6 = _slicedToArray$1(_useState5, 2),
|
|
10693
10720
|
searchTerm = _useState6[0],
|
|
10694
10721
|
setSearchTerm = _useState6[1];
|
|
10695
|
-
var _useTranslation = reactI18next.useTranslation(),
|
|
10696
|
-
t = _useTranslation.t;
|
|
10697
10722
|
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
10723
|
var searchedOptions = getSearchedOptions$3(dropdownOptions, searchTerm);
|
|
10699
10724
|
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]);
|