@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/dist/index.js
CHANGED
|
@@ -9428,7 +9428,8 @@ var RulesReorder = function RulesReorder(_ref) {
|
|
|
9428
9428
|
rules = _ref.rules,
|
|
9429
9429
|
_ref$paginationProps = _ref.paginationProps,
|
|
9430
9430
|
paginationProps = _ref$paginationProps === void 0 ? {} : _ref$paginationProps,
|
|
9431
|
-
url = _ref.url
|
|
9431
|
+
url = _ref.url,
|
|
9432
|
+
onReorderSuccess = _ref.onReorderSuccess;
|
|
9432
9433
|
var _useState = useState(rules),
|
|
9433
9434
|
_useState2 = _slicedToArray$1(_useState, 2),
|
|
9434
9435
|
initialRules = _useState2[0],
|
|
@@ -9454,7 +9455,10 @@ var RulesReorder = function RulesReorder(_ref) {
|
|
|
9454
9455
|
}
|
|
9455
9456
|
}
|
|
9456
9457
|
}, {
|
|
9457
|
-
onSuccess:
|
|
9458
|
+
onSuccess: function onSuccess() {
|
|
9459
|
+
onReorderSuccess === null || onReorderSuccess === void 0 || onReorderSuccess();
|
|
9460
|
+
onClose();
|
|
9461
|
+
}
|
|
9458
9462
|
});
|
|
9459
9463
|
};
|
|
9460
9464
|
var onDragEnd = function onDragEnd(result) {
|
|
@@ -9748,7 +9752,12 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9748
9752
|
rules = _ref$rules === void 0 ? [] : _ref$rules,
|
|
9749
9753
|
totalCount = _ref.totalCount,
|
|
9750
9754
|
helpDocUrl = _ref.helpDocUrl,
|
|
9751
|
-
isLoading = _ref.isLoading
|
|
9755
|
+
isLoading = _ref.isLoading,
|
|
9756
|
+
onDeleteSuccess = _ref.onDeleteSuccess,
|
|
9757
|
+
onCloneSuccess = _ref.onCloneSuccess,
|
|
9758
|
+
onUpdateSuccess = _ref.onUpdateSuccess,
|
|
9759
|
+
page = _ref.page,
|
|
9760
|
+
setPage = _ref.setPage;
|
|
9752
9761
|
var _useQueryParams = useQueryParams(),
|
|
9753
9762
|
_useQueryParams$searc = _useQueryParams.searchTerm,
|
|
9754
9763
|
searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
|
|
@@ -9756,10 +9765,6 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9756
9765
|
_useState2 = _slicedToArray$1(_useState, 2),
|
|
9757
9766
|
selectedRule = _useState2[0],
|
|
9758
9767
|
setSelectedRule = _useState2[1];
|
|
9759
|
-
var _useState3 = useState(DEFAULT_INIT_PAGE),
|
|
9760
|
-
_useState4 = _slicedToArray$1(_useState3, 2),
|
|
9761
|
-
page = _useState4[0],
|
|
9762
|
-
setPage = _useState4[1];
|
|
9763
9768
|
var _useUtilityStore = useUtilityStore(function (store) {
|
|
9764
9769
|
return {
|
|
9765
9770
|
hidePreviewPane: store["hidePreviewPane"]
|
|
@@ -9788,8 +9793,21 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9788
9793
|
id: id,
|
|
9789
9794
|
url: url,
|
|
9790
9795
|
payload: payload
|
|
9796
|
+
}, {
|
|
9797
|
+
onSuccess: function onSuccess() {
|
|
9798
|
+
return onUpdateSuccess === null || onUpdateSuccess === void 0 ? void 0 : onUpdateSuccess();
|
|
9799
|
+
}
|
|
9791
9800
|
});
|
|
9792
9801
|
};
|
|
9802
|
+
var handleCloneSuccess = function handleCloneSuccess() {
|
|
9803
|
+
onCloneSuccess === null || onCloneSuccess === void 0 || onCloneSuccess();
|
|
9804
|
+
hidePreviewPane();
|
|
9805
|
+
};
|
|
9806
|
+
var handleDeleteSuccess = function handleDeleteSuccess() {
|
|
9807
|
+
onDeleteSuccess === null || onDeleteSuccess === void 0 || onDeleteSuccess();
|
|
9808
|
+
hidePreviewPane();
|
|
9809
|
+
setSelectedRule(null);
|
|
9810
|
+
};
|
|
9793
9811
|
var columnData = getColumnData({
|
|
9794
9812
|
handleChangeStatus: handleChangeStatus,
|
|
9795
9813
|
additionalColumns: additionalColumns,
|
|
@@ -9798,7 +9816,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9798
9816
|
id: id,
|
|
9799
9817
|
url: url
|
|
9800
9818
|
}, {
|
|
9801
|
-
onSuccess:
|
|
9819
|
+
onSuccess: handleCloneSuccess
|
|
9802
9820
|
});
|
|
9803
9821
|
},
|
|
9804
9822
|
onDelete: setSelectedRule,
|
|
@@ -9806,7 +9824,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9806
9824
|
automationRulesPath: automationRulesPath,
|
|
9807
9825
|
moreDropdownItems: moreDropdownItems
|
|
9808
9826
|
});
|
|
9809
|
-
if (isLoading) {
|
|
9827
|
+
if (isLoading && isEmpty(rules)) {
|
|
9810
9828
|
return /*#__PURE__*/jsx$1(PageLoader, {});
|
|
9811
9829
|
}
|
|
9812
9830
|
if (isEmpty(rules)) {
|
|
@@ -9842,7 +9860,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9842
9860
|
currentPageNumber: page,
|
|
9843
9861
|
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
9844
9862
|
handlePageChange: setPage,
|
|
9845
|
-
loading: isUpdating || isCloning || isDeleting,
|
|
9863
|
+
loading: isUpdating || isCloning || isDeleting || isLoading,
|
|
9846
9864
|
rowData: rules.map(function (item) {
|
|
9847
9865
|
return _objectSpread$n({
|
|
9848
9866
|
key: item.id
|
|
@@ -9873,10 +9891,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9873
9891
|
id: selectedRule === null || selectedRule === void 0 ? void 0 : selectedRule.id,
|
|
9874
9892
|
url: url
|
|
9875
9893
|
}, {
|
|
9876
|
-
onSuccess:
|
|
9877
|
-
hidePreviewPane();
|
|
9878
|
-
setSelectedRule(null);
|
|
9879
|
-
}
|
|
9894
|
+
onSuccess: handleDeleteSuccess
|
|
9880
9895
|
});
|
|
9881
9896
|
}
|
|
9882
9897
|
})]
|
|
@@ -9886,7 +9901,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9886
9901
|
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; }
|
|
9887
9902
|
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; }
|
|
9888
9903
|
var NeetoRules = function NeetoRules(_ref) {
|
|
9889
|
-
var _helpPopoverProps$hel;
|
|
9904
|
+
var _helpPopoverProps$hel, _cloneRule$onSuccess, _deleteRule$onSuccess, _updateRule$onSuccess, _reorderRules$onSucce;
|
|
9890
9905
|
var breadcrumbs = _ref.breadcrumbs,
|
|
9891
9906
|
automationRulesPath = _ref.automationRulesPath,
|
|
9892
9907
|
url = _ref.automationRulesEndpoint,
|
|
@@ -9895,13 +9910,17 @@ var NeetoRules = function NeetoRules(_ref) {
|
|
|
9895
9910
|
_ref$rulesTableProps = _ref.rulesTableProps,
|
|
9896
9911
|
rulesTableProps = _ref$rulesTableProps === void 0 ? {} : _ref$rulesTableProps,
|
|
9897
9912
|
_ref$helpPopoverProps = _ref.helpPopoverProps,
|
|
9898
|
-
helpPopoverProps = _ref$helpPopoverProps === void 0 ? {} : _ref$helpPopoverProps
|
|
9913
|
+
helpPopoverProps = _ref$helpPopoverProps === void 0 ? {} : _ref$helpPopoverProps,
|
|
9914
|
+
deleteRule = _ref.deleteRule,
|
|
9915
|
+
cloneRule = _ref.cloneRule,
|
|
9916
|
+
updateRule = _ref.updateRule,
|
|
9917
|
+
reorderRules = _ref.reorderRules;
|
|
9899
9918
|
var _useState = useState(false),
|
|
9900
9919
|
_useState2 = _slicedToArray$1(_useState, 2),
|
|
9901
9920
|
isReorderPaneOpen = _useState2[0],
|
|
9902
9921
|
setIsReorderPaneOpen = _useState2[1];
|
|
9903
9922
|
var helpDocUrl = helpPopoverProps === null || helpPopoverProps === void 0 || (_helpPopoverProps$hel = helpPopoverProps.helpLinkProps) === null || _helpPopoverProps$hel === void 0 ? void 0 : _helpPopoverProps$hel.href;
|
|
9904
|
-
var _useState3 = useState(
|
|
9923
|
+
var _useState3 = useState(DEFAULT_INIT_PAGE),
|
|
9905
9924
|
_useState4 = _slicedToArray$1(_useState3, 2),
|
|
9906
9925
|
page = _useState4[0],
|
|
9907
9926
|
setPage = _useState4[1];
|
|
@@ -9920,7 +9939,8 @@ var NeetoRules = function NeetoRules(_ref) {
|
|
|
9920
9939
|
rules = _useFetchAutomationRu4 === void 0 ? [] : _useFetchAutomationRu4,
|
|
9921
9940
|
_useFetchAutomationRu5 = _useFetchAutomationRu3.totalCount,
|
|
9922
9941
|
totalCount = _useFetchAutomationRu5 === void 0 ? 0 : _useFetchAutomationRu5,
|
|
9923
|
-
isLoading = _useFetchAutomationRu.isLoading
|
|
9942
|
+
isLoading = _useFetchAutomationRu.isLoading,
|
|
9943
|
+
isFetching = _useFetchAutomationRu.isFetching;
|
|
9924
9944
|
var hasUnfilteredRules = isPresent(searchTerm) || totalCount > 0;
|
|
9925
9945
|
return /*#__PURE__*/jsxs(Container, {
|
|
9926
9946
|
children: [/*#__PURE__*/jsx$1(Header$1, {
|
|
@@ -9930,26 +9950,33 @@ var NeetoRules = function NeetoRules(_ref) {
|
|
|
9930
9950
|
hasUnfilteredRules: hasUnfilteredRules,
|
|
9931
9951
|
helpPopoverProps: helpPopoverProps,
|
|
9932
9952
|
setIsReorderPaneOpen: setIsReorderPaneOpen
|
|
9933
|
-
}), /*#__PURE__*/jsx$1(RulesTable, _objectSpread$m({}, _objectSpread$m({
|
|
9953
|
+
}), /*#__PURE__*/jsx$1(RulesTable, _objectSpread$m(_objectSpread$m({}, _objectSpread$m({
|
|
9934
9954
|
automationRulesPath: automationRulesPath,
|
|
9935
9955
|
helpDocUrl: helpDocUrl,
|
|
9936
|
-
|
|
9956
|
+
page: page,
|
|
9937
9957
|
rules: rules,
|
|
9958
|
+
setPage: setPage,
|
|
9938
9959
|
totalCount: totalCount,
|
|
9939
9960
|
url: url
|
|
9940
|
-
}, rulesTableProps))
|
|
9961
|
+
}, rulesTableProps)), {}, {
|
|
9962
|
+
isLoading: isLoading || isFetching,
|
|
9963
|
+
onCloneSuccess: cloneRule === null || cloneRule === void 0 || (_cloneRule$onSuccess = cloneRule.onSuccess) === null || _cloneRule$onSuccess === void 0 ? void 0 : _cloneRule$onSuccess.callback,
|
|
9964
|
+
onDeleteSuccess: deleteRule === null || deleteRule === void 0 || (_deleteRule$onSuccess = deleteRule.onSuccess) === null || _deleteRule$onSuccess === void 0 ? void 0 : _deleteRule$onSuccess.callback,
|
|
9965
|
+
onUpdateSuccess: updateRule === null || updateRule === void 0 || (_updateRule$onSuccess = updateRule.onSuccess) === null || _updateRule$onSuccess === void 0 ? void 0 : _updateRule$onSuccess.callback
|
|
9966
|
+
})), allowReordering && !isLoading && /*#__PURE__*/jsx$1(RulesReorder, {
|
|
9941
9967
|
rules: rules,
|
|
9942
9968
|
url: url,
|
|
9943
9969
|
isOpen: isReorderPaneOpen,
|
|
9944
9970
|
paginationProps: {
|
|
9945
9971
|
pageNo: page,
|
|
9946
|
-
setPage: setPage,
|
|
9947
9972
|
count: totalCount,
|
|
9948
|
-
pageSize: DEFAULT_PAGE_SIZE
|
|
9973
|
+
pageSize: DEFAULT_PAGE_SIZE,
|
|
9974
|
+
navigate: setPage
|
|
9949
9975
|
},
|
|
9950
9976
|
onClose: function onClose() {
|
|
9951
9977
|
return setIsReorderPaneOpen(false);
|
|
9952
|
-
}
|
|
9978
|
+
},
|
|
9979
|
+
onReorderSuccess: reorderRules === null || reorderRules === void 0 || (_reorderRules$onSucce = reorderRules.onSuccess) === null || _reorderRules$onSucce === void 0 ? void 0 : _reorderRules$onSucce.callback
|
|
9953
9980
|
})]
|
|
9954
9981
|
});
|
|
9955
9982
|
};
|
|
@@ -10609,6 +10636,8 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
10609
10636
|
name = _ref.name,
|
|
10610
10637
|
index = _ref.index,
|
|
10611
10638
|
selectedField = _ref.selectedField;
|
|
10639
|
+
var _useTranslation = useTranslation(),
|
|
10640
|
+
t = _useTranslation.t;
|
|
10612
10641
|
var _useFormikContext = useFormikContext(),
|
|
10613
10642
|
actions = _useFormikContext.values.actions,
|
|
10614
10643
|
setFieldValue = _useFormikContext.setFieldValue,
|
|
@@ -10630,8 +10659,6 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
10630
10659
|
_useState6 = _slicedToArray$1(_useState5, 2),
|
|
10631
10660
|
searchTerm = _useState6[0],
|
|
10632
10661
|
setSearchTerm = _useState6[1];
|
|
10633
|
-
var _useTranslation = useTranslation(),
|
|
10634
|
-
t = _useTranslation.t;
|
|
10635
10662
|
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);
|
|
10636
10663
|
var searchedOptions = getSearchedOptions$3(dropdownOptions, searchTerm);
|
|
10637
10664
|
var isValueSelected = defaultSelectedOption.label === defaultLabel && errors.actions && 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]) && 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]);
|