@bigbinary/neeto-rules-frontend 1.2.0-beta1 → 1.2.0-beta3
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 +4 -4
- package/dist/index.cjs.js +22 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +22 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -160,16 +160,16 @@ The `NeetoRules` component is used to add the dashboard for automation rules.
|
|
|
160
160
|
|
|
161
161
|
7. `updateRule`: Object that define methods for update rule operation.
|
|
162
162
|
- `onSuccess`: Object for handling update rule success callback.
|
|
163
|
-
- `callback`: Function to be called on success.
|
|
163
|
+
- `callback`: Function to be called on success. (Optional)
|
|
164
164
|
8. `deleteRule`: Object that define methods for delete rule operation.
|
|
165
165
|
- `onSuccess`: Object for handling delete rule success callback.
|
|
166
|
-
- `callback`: Function to be called on success.
|
|
166
|
+
- `callback`: Function to be called on success. (Optional)
|
|
167
167
|
9. `cloneRule`: Object that define methods for clone rule operation.
|
|
168
168
|
- `onSuccess`: Object for handling clone rule success callback.
|
|
169
|
-
- `callback`: Function to be called on success.
|
|
169
|
+
- `callback`: Function to be called on success. (Optional)
|
|
170
170
|
10. `reoderRules`: Function to be called on reorder success.
|
|
171
171
|
- `onSuccess`: Object for handling reorder rule success callback.
|
|
172
|
-
- `callback`: Function to be called on success.
|
|
172
|
+
- `callback`: Function to be called on success. (Optional)
|
|
173
173
|
|
|
174
174
|
#### 2. `NeetoRulesForm`
|
|
175
175
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -7,7 +7,7 @@ var neetoCist = require('@bigbinary/neeto-cist');
|
|
|
7
7
|
var constants = require('@bigbinary/neeto-commons-frontend/constants');
|
|
8
8
|
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
9
9
|
var Container = require('@bigbinary/neeto-molecules/Container');
|
|
10
|
-
var reactQuery = require('react-query');
|
|
10
|
+
var reactQuery = require('@tanstack/react-query');
|
|
11
11
|
var axios = require('axios');
|
|
12
12
|
var NeetoHeader = require('@bigbinary/neeto-molecules/Header');
|
|
13
13
|
var HelpPopover = require('@bigbinary/neeto-molecules/HelpPopover');
|
|
@@ -284,34 +284,36 @@ function ownKeys$v(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
|
|
|
284
284
|
function _objectSpread$t(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$v(Object(t), !0).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$v(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
285
285
|
var useFetchAutomationRules = function useFetchAutomationRules(params) {
|
|
286
286
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
287
|
-
return reactQuery.useQuery(
|
|
288
|
-
|
|
289
|
-
|
|
287
|
+
return reactQuery.useQuery(_objectSpread$t({
|
|
288
|
+
queryKey: [AUTOMATION_RULES, params],
|
|
289
|
+
queryFn: function queryFn() {
|
|
290
|
+
return automationRulesApi.fetch(params);
|
|
291
|
+
},
|
|
290
292
|
staleTime: STALE_TIME,
|
|
291
293
|
select: function select(response) {
|
|
292
294
|
return response.data || response;
|
|
293
295
|
},
|
|
294
|
-
|
|
296
|
+
placeholderData: reactQuery.keepPreviousData
|
|
295
297
|
}, options));
|
|
296
298
|
};
|
|
297
299
|
var useUpdateAutomationRule = function useUpdateAutomationRule() {
|
|
298
300
|
return reactUtils.useMutationWithInvalidation(automationRulesApi.update, {
|
|
299
|
-
keysToInvalidate: [AUTOMATION_RULES]
|
|
301
|
+
keysToInvalidate: [[AUTOMATION_RULES]]
|
|
300
302
|
});
|
|
301
303
|
};
|
|
302
304
|
var useCloneAutomationRule = function useCloneAutomationRule() {
|
|
303
305
|
return reactUtils.useMutationWithInvalidation(automationRulesApi.clone, {
|
|
304
|
-
keysToInvalidate: [AUTOMATION_RULES]
|
|
306
|
+
keysToInvalidate: [[AUTOMATION_RULES]]
|
|
305
307
|
});
|
|
306
308
|
};
|
|
307
309
|
var useDeleteAutomationRule = function useDeleteAutomationRule() {
|
|
308
310
|
return reactUtils.useMutationWithInvalidation(automationRulesApi.destroy, {
|
|
309
|
-
keysToInvalidate: [AUTOMATION_RULES]
|
|
311
|
+
keysToInvalidate: [[AUTOMATION_RULES]]
|
|
310
312
|
});
|
|
311
313
|
};
|
|
312
314
|
var useReorderAutomationRules = function useReorderAutomationRules() {
|
|
313
315
|
return reactUtils.useMutationWithInvalidation(automationRulesApi.reorder, {
|
|
314
|
-
keysToInvalidate: [AUTOMATION_RULES]
|
|
316
|
+
keysToInvalidate: [[AUTOMATION_RULES]]
|
|
315
317
|
});
|
|
316
318
|
};
|
|
317
319
|
|
|
@@ -9500,7 +9502,7 @@ var RulesReorder = function RulesReorder(_ref) {
|
|
|
9500
9502
|
t = _useTranslation.t;
|
|
9501
9503
|
var _useReorderAutomation = useReorderAutomationRules(),
|
|
9502
9504
|
reOrder = _useReorderAutomation.mutate,
|
|
9503
|
-
|
|
9505
|
+
isPending = _useReorderAutomation.isPending;
|
|
9504
9506
|
var handleReorderSave = function handleReorderSave(rules) {
|
|
9505
9507
|
var params = [];
|
|
9506
9508
|
rules.forEach(function (rule, index) {
|
|
@@ -9594,9 +9596,9 @@ var RulesReorder = function RulesReorder(_ref) {
|
|
|
9594
9596
|
}), /*#__PURE__*/jsxRuntime.jsxs(Pane__default["default"].Footer, {
|
|
9595
9597
|
className: "flex items-center gap-x-2",
|
|
9596
9598
|
children: [/*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
9597
|
-
disabled:
|
|
9599
|
+
disabled: isPending || ramda.equals(rules, initialRules),
|
|
9598
9600
|
label: t("neetoRules.common.saveChange"),
|
|
9599
|
-
loading:
|
|
9601
|
+
loading: isPending,
|
|
9600
9602
|
style: "primary",
|
|
9601
9603
|
onClick: function onClick() {
|
|
9602
9604
|
return handleReorderSave(initialRules);
|
|
@@ -9837,13 +9839,13 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9837
9839
|
t = _useTranslation.t;
|
|
9838
9840
|
var _useUpdateAutomationR = useUpdateAutomationRule(),
|
|
9839
9841
|
updateRule = _useUpdateAutomationR.mutate,
|
|
9840
|
-
isUpdating = _useUpdateAutomationR.
|
|
9842
|
+
isUpdating = _useUpdateAutomationR.isPending;
|
|
9841
9843
|
var _useCloneAutomationRu = useCloneAutomationRule(),
|
|
9842
9844
|
cloneRule = _useCloneAutomationRu.mutate,
|
|
9843
|
-
isCloning = _useCloneAutomationRu.
|
|
9845
|
+
isCloning = _useCloneAutomationRu.isPending;
|
|
9844
9846
|
var _useDeleteAutomationR = useDeleteAutomationRule(),
|
|
9845
9847
|
deleteRule = _useDeleteAutomationR.mutate,
|
|
9846
|
-
isDeleting = _useDeleteAutomationR.
|
|
9848
|
+
isDeleting = _useDeleteAutomationR.isPending;
|
|
9847
9849
|
var handleChangeStatus = function handleChangeStatus(event, id) {
|
|
9848
9850
|
var status = event.target.checked ? STATUS_KEYS$1.ENABLED : STATUS_KEYS$1.DISABLED;
|
|
9849
9851
|
var payload = {
|
|
@@ -9856,15 +9858,17 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9856
9858
|
url: url,
|
|
9857
9859
|
payload: payload
|
|
9858
9860
|
}, {
|
|
9859
|
-
onSuccess:
|
|
9861
|
+
onSuccess: function onSuccess() {
|
|
9862
|
+
return onUpdateSuccess === null || onUpdateSuccess === void 0 ? void 0 : onUpdateSuccess();
|
|
9863
|
+
}
|
|
9860
9864
|
});
|
|
9861
9865
|
};
|
|
9862
9866
|
var handleCloneSuccess = function handleCloneSuccess() {
|
|
9863
|
-
onCloneSuccess();
|
|
9867
|
+
onCloneSuccess === null || onCloneSuccess === void 0 || onCloneSuccess();
|
|
9864
9868
|
hidePreviewPane();
|
|
9865
9869
|
};
|
|
9866
9870
|
var handleDeleteSuccess = function handleDeleteSuccess() {
|
|
9867
|
-
onDeleteSuccess();
|
|
9871
|
+
onDeleteSuccess === null || onDeleteSuccess === void 0 || onDeleteSuccess();
|
|
9868
9872
|
hidePreviewPane();
|
|
9869
9873
|
setSelectedRule(null);
|
|
9870
9874
|
};
|