orc-shared 1.1.0-dev.7 → 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/dist/actions/applications.js +1 -1
- package/dist/actions/authentication.js +1 -1
- package/dist/actions/countries.js +1 -1
- package/dist/actions/locale.js +1 -1
- package/dist/actions/makeApiAction.js +71 -1
- package/dist/actions/metadata.js +295 -31
- package/dist/actions/navigation.js +1 -1
- package/dist/actions/requestState.js +78 -0
- package/dist/actions/requestsApi.js +58 -7
- package/dist/actions/scopes.js +1 -1
- package/dist/actions/timezones.js +1 -1
- package/dist/actions/toasts.js +1 -1
- package/dist/actions/versionInfo.js +1 -1
- package/dist/actions/view.js +1 -1
- package/dist/buildStore.js +5 -2
- package/dist/components/AppFrame/About.js +1 -1
- package/dist/components/AppFrame/ApplicationSelector/ApplicationDialog.js +115 -62
- package/dist/components/AppFrame/ApplicationSelector/index.js +45 -47
- package/dist/components/AppFrame/MenuItem.js +1 -1
- package/dist/components/AppFrame/Preferences.js +1 -1
- package/dist/components/AppFrame/Sidebar.js +1 -1
- package/dist/components/AppFrame/Topbar.js +1 -1
- package/dist/components/Authenticate.js +1 -1
- package/dist/components/CategoryList.js +1 -1
- package/dist/components/Checkbox.js +1 -1
- package/dist/components/DropMenu/Menu.js +1 -1
- package/dist/components/DropMenu/index.js +1 -1
- package/dist/components/Form/FieldList.js +1 -1
- package/dist/components/Form/Form.js +1 -1
- package/dist/components/Form/Inputs/Button.js +1 -1
- package/dist/components/Form/Inputs/FieldButtons.js +1 -1
- package/dist/components/Form/Inputs/Number.js +1 -1
- package/dist/components/Form/Inputs/ReadOnly.js +1 -1
- package/dist/components/Form/Inputs/SmallButton.js +1 -1
- package/dist/components/Form/Inputs/Text.js +1 -1
- package/dist/components/Form/Inputs/Time.js +1 -1
- package/dist/components/Form/Inputs/Toggles.js +1 -1
- package/dist/components/Form/Inputs/Translation.js +1 -1
- package/dist/components/List/HeadCell.js +1 -1
- package/dist/components/List/List.js +1 -1
- package/dist/components/List/Row.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/List.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/NotificationProps.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/SelectionList.js +19 -6
- package/dist/components/MaterialUI/DataDisplay/Table.js +28 -10
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +5 -2
- package/dist/components/MaterialUI/DataDisplay/TransferList.js +5 -2
- package/dist/components/MaterialUI/DataDisplay/chipProps.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/collapsableListProps.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/dividerProps.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/index.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/modalProps.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/useTableSelection.js +1 -1
- package/dist/components/MaterialUI/Feedback/useNotification.js +1 -1
- package/dist/components/MaterialUI/Inputs/AutocompleteProps.js +1 -1
- package/dist/components/MaterialUI/Inputs/CheckboxGroupProps.js +1 -1
- package/dist/components/MaterialUI/Inputs/CheckboxProps.js +1 -1
- package/dist/components/MaterialUI/Inputs/DatePicker.js +11 -0
- package/dist/components/MaterialUI/Inputs/InputBase.js +3 -2
- package/dist/components/MaterialUI/Inputs/InputBaseProps.js +1 -1
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
- package/dist/components/MaterialUI/Inputs/RadioProps.js +1 -1
- package/dist/components/MaterialUI/Inputs/SelectProps.js +1 -1
- package/dist/components/MaterialUI/Inputs/Switch.js +1 -1
- package/dist/components/MaterialUI/Inputs/SwitchProps.js +1 -1
- package/dist/components/MaterialUI/Inputs/TimePicker.js +19 -8
- package/dist/components/MaterialUI/Inputs/createInput.js +1 -1
- package/dist/components/MaterialUI/Inputs/index.js +1 -1
- package/dist/components/MaterialUI/Inputs/standaloneRadioProps.js +1 -1
- package/dist/components/MaterialUI/Navigation/DropDownMenuProps.js +1 -1
- package/dist/components/MaterialUI/Navigation/TabBar.js +38 -33
- package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +6 -4
- package/dist/components/MaterialUI/ScopeSelector/ScopeTreeView.js +8 -4
- package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +9 -6
- package/dist/components/MaterialUI/Surfaces/ExpansionPanel.js +11 -2
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +10 -2
- package/dist/components/MaterialUI/Surfaces/expansionPanelProps.js +5 -2
- package/dist/components/MaterialUI/Surfaces/paperProps.js +1 -1
- package/dist/components/MaterialUI/muiThemes.js +19 -4
- package/dist/components/MaterialUI/textProps.js +1 -1
- package/dist/components/Modules.js +24 -2
- package/dist/components/MultiSelector.js +1 -1
- package/dist/components/Navigation/Bar.js +1 -1
- package/dist/components/Navigation/Tab.js +1 -1
- package/dist/components/Navigation/useNavigationState.js +28 -2
- package/dist/components/Placeholder.js +1 -1
- package/dist/components/Routing/FullPage.js +2 -0
- package/dist/components/Routing/Segment.js +4 -3
- package/dist/components/Routing/SegmentPage.js +24 -11
- package/dist/components/Routing/withWaypointing.js +8 -2
- package/dist/components/Scope/ScopeNode.js +1 -1
- package/dist/components/Scope/Selector.js +1 -1
- package/dist/components/Scope/index.js +9 -1
- package/dist/components/Scope/useScopeSelect.js +1 -1
- package/dist/components/Selector.js +1 -1
- package/dist/components/Sidepanel.js +1 -2
- package/dist/components/Spritesheet.js +1 -1
- package/dist/components/Switch.js +1 -1
- package/dist/components/Text.js +1 -1
- package/dist/components/ToastList.js +1 -1
- package/dist/components/Toolbar.js +1 -1
- package/dist/components/Treeview/Label.js +1 -1
- package/dist/components/Treeview/Leaf.js +1 -1
- package/dist/components/Treeview/Node.js +1 -1
- package/dist/components/Treeview/settings.js +1 -1
- package/dist/constants.js +26 -1
- package/dist/content/icons/html-templates.svg +3 -0
- package/dist/content/iconsSheet.svg +3 -0
- package/dist/hocs/withInfiniteScroll.js +1 -1
- package/dist/hooks/useDispatchWithModulesData.js +1 -1
- package/dist/hooks/useEditState.js +1 -1
- package/dist/hooks/useEntityLoader.js +182 -0
- package/dist/hooks/useFullEntityEditState.js +1 -1
- package/dist/hooks/useInfiniteScroll.js +104 -0
- package/dist/hooks/useLabelMessage.js +1 -1
- package/dist/hooks/useLoader.js +1 -0
- package/dist/hooks/useNavigationHandler.js +1 -1
- package/dist/hooks/useNotificationRequestState.js +159 -0
- package/dist/hooks/useRequestState.js +146 -0
- package/dist/hooks/useSelectorAndUnwrap.js +1 -1
- package/dist/reducers/metadata.js +52 -26
- package/dist/reducers/requestStates.js +181 -0
- package/dist/schemas/countries.js +1 -1
- package/dist/schemas/definitions.js +1 -1
- package/dist/schemas/metadata.js +1 -1
- package/dist/schemas/productDefinitions.js +1 -1
- package/dist/schemas/timezones.js +1 -1
- package/dist/selectors/applications.js +1 -1
- package/dist/selectors/authentication.js +1 -2
- package/dist/selectors/countries.js +1 -1
- package/dist/selectors/locale.js +1 -1
- package/dist/selectors/metadata.js +102 -12
- package/dist/selectors/navigation.js +1 -1
- package/dist/selectors/requestStates.js +82 -0
- package/dist/selectors/requests.js +1 -1
- package/dist/selectors/scope.js +1 -1
- package/dist/selectors/versionInfo.js +1 -1
- package/dist/selectors/view.js +1 -1
- package/dist/sharedMessages.js +44 -0
- package/dist/spawnerMiddleware.js +1 -1
- package/dist/utils/displayModeHelper.js +1 -1
- package/dist/utils/localizationHelper.js +1 -1
- package/dist/utils/mapHelper.js +1 -1
- package/dist/utils/modelValidationHelper.js +2 -2
- package/dist/utils/parseHelper.js +1 -1
- package/dist/utils/propertyHelper.js +2 -2
- package/dist/utils/propertyValidator.js +1 -1
- package/dist/utils/setTranslationWithFallback.js +3 -2
- package/dist/utils/testUtils.js +6 -2
- package/dist/utils/timezoneHelper.js +111 -0
- package/dist/utils/unwrapImmutable.js +1 -1
- package/dist/utils/urlHelper.js +11 -1
- package/package.json +3 -7
- package/src/actions/makeApiAction.js +24 -1
- package/src/actions/makeApiAction.test.js +76 -3
- package/src/actions/metadata.js +130 -0
- package/src/actions/metadata.test.js +337 -5
- package/src/actions/requestState.js +8 -0
- package/src/actions/requestState.test.js +14 -0
- package/src/actions/requestsApi.js +30 -0
- package/src/buildStore.js +2 -0
- package/src/components/AppFrame/AppFrame.test.js +6 -16
- package/src/components/AppFrame/ApplicationSelector/ApplicationDialog.js +105 -82
- package/src/components/AppFrame/ApplicationSelector/ApplicationDialog.test.js +60 -23
- package/src/components/AppFrame/ApplicationSelector/ApplicationSelector.test.js +22 -89
- package/src/components/AppFrame/ApplicationSelector/index.js +34 -15
- package/src/components/AppFrame/Topbar.test.js +2 -4
- package/src/components/MaterialUI/DataDisplay/SelectionList.js +14 -6
- package/src/components/MaterialUI/DataDisplay/SelectionList.test.js +21 -11
- package/src/components/MaterialUI/DataDisplay/Table.js +29 -5
- package/src/components/MaterialUI/DataDisplay/Table.test.js +23 -0
- package/src/components/MaterialUI/DataDisplay/TableProps.js +2 -0
- package/src/components/MaterialUI/DataDisplay/TableProps.test.js +2 -0
- package/src/components/MaterialUI/DataDisplay/TransferList.js +3 -0
- package/src/components/MaterialUI/Inputs/DatePicker.js +11 -0
- package/src/components/MaterialUI/Inputs/InputBase.js +3 -1
- package/src/components/MaterialUI/Inputs/InputBase.test.js +38 -0
- package/src/components/MaterialUI/Inputs/TimePicker.js +9 -3
- package/src/components/MaterialUI/Inputs/TimePicker.test.js +263 -118
- package/src/components/MaterialUI/Navigation/TabBar.js +82 -78
- package/src/components/MaterialUI/Navigation/TabBar.test.js +129 -3
- package/src/components/MaterialUI/ScopeSelector/ScopeSelector.js +4 -2
- package/src/components/MaterialUI/ScopeSelector/ScopeSelector.test.js +29 -0
- package/src/components/MaterialUI/ScopeSelector/ScopeTreeView.js +4 -1
- package/src/components/MaterialUI/ScopeSelector/ScopeTreeView.test.js +52 -0
- package/src/components/MaterialUI/ScopeSelector/TreeItem.js +9 -6
- package/src/components/MaterialUI/ScopeSelector/TreeItem.test.js +63 -2
- package/src/components/MaterialUI/Surfaces/ExpansionPanel.js +14 -1
- package/src/components/MaterialUI/Surfaces/ExpansionPanel.test.js +16 -0
- package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.js +11 -2
- package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.test.js +36 -0
- package/src/components/MaterialUI/Surfaces/expansionPanelProps.js +2 -0
- package/src/components/MaterialUI/Surfaces/expansionPanelProps.test.js +2 -2
- package/src/components/MaterialUI/muiThemes.js +18 -3
- package/src/components/Modules.js +13 -1
- package/src/components/Modules.test.js +133 -1
- package/src/components/Navigation/Navigation.test.js +2 -0
- package/src/components/Navigation/useNavigationState.js +21 -1
- package/src/components/Navigation/useNavigationState.test.js +10 -0
- package/src/components/Routing/FullPage.js +2 -1
- package/src/components/Routing/FullPage.test.js +149 -79
- package/src/components/Routing/Segment.js +5 -2
- package/src/components/Routing/Segment.test.js +22 -1
- package/src/components/Routing/SegmentPage.js +19 -9
- package/src/components/Routing/SubPage.test.js +1 -1
- package/src/components/Routing/withWaypointing.js +19 -17
- package/src/components/Routing/withWaypointing.test.js +50 -0
- package/src/components/Scope/Scope.test.js +117 -0
- package/src/components/Scope/index.js +6 -10
- package/src/components/Sidepanel.js +0 -1
- package/src/components/Sidepanel.test.js +0 -3
- package/src/constants.js +18 -0
- package/src/content/icons/html-templates.svg +3 -0
- package/src/content/iconsSheet.svg +3 -0
- package/src/hooks/useEntityLoader.js +68 -0
- package/src/hooks/useEntityLoader.test.js +266 -0
- package/src/hooks/useInfiniteScroll.js +25 -0
- package/src/hooks/useInfiniteScroll.test.js +87 -0
- package/src/hooks/useLoader.js +1 -0
- package/src/hooks/useNotificationRequestState.js +78 -0
- package/src/hooks/useNotificationRequestState.test.js +264 -0
- package/src/hooks/useRequestState.js +57 -0
- package/src/hooks/useRequestState.test.js +217 -0
- package/src/reducers/metadata.js +76 -16
- package/src/reducers/metadata.test.js +458 -4
- package/src/reducers/requestStates.js +98 -0
- package/src/reducers/requestStates.test.js +399 -0
- package/src/selectors/authentication.js +0 -1
- package/src/selectors/locale.test.js +0 -2
- package/src/selectors/metadata.js +73 -13
- package/src/selectors/metadata.test.js +479 -8
- package/src/selectors/requestStates.js +12 -0
- package/src/selectors/requestStates.test.js +83 -0
- package/src/sharedMessages.js +44 -0
- package/src/translations/en-US.json +12 -1
- package/src/translations/fr-CA.json +13 -2
- package/src/utils/modelValidationHelper.js +1 -1
- package/src/utils/setTranslationWithFallback.js +1 -1
- package/src/utils/setTranslationWithFallback.test.js +4 -14
- package/src/utils/testUtils.js +3 -1
- package/src/utils/timezoneHelper.js +140 -0
- package/src/utils/timezoneHelper.test.js +33 -0
- package/src/utils/urlHelper.js +6 -0
- package/src/translations/it-IT.json +0 -54
|
@@ -95,6 +95,11 @@ export const Scope = ({ children }) => {
|
|
|
95
95
|
selectNewScope(newSelection);
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
+
const isScopeSelectable = scopeId => {
|
|
99
|
+
const scope = getScope(scopeId);
|
|
100
|
+
return scope?.isAuthorizedScope ?? false;
|
|
101
|
+
};
|
|
102
|
+
|
|
98
103
|
return (
|
|
99
104
|
<React.Fragment>
|
|
100
105
|
<ScopeBar
|
|
@@ -105,19 +110,10 @@ export const Scope = ({ children }) => {
|
|
|
105
110
|
disabled,
|
|
106
111
|
}}
|
|
107
112
|
/>
|
|
108
|
-
{/* <Selector
|
|
109
|
-
name={SCOPE_SELECTOR_NAME}
|
|
110
|
-
show={show}
|
|
111
|
-
reset={reset}
|
|
112
|
-
getScope={getScope}
|
|
113
|
-
filter={filter}
|
|
114
|
-
currentScope={currentScope}
|
|
115
|
-
updateFilter={updateFilter}
|
|
116
|
-
defaultNodeState={{}}
|
|
117
|
-
/> */}
|
|
118
113
|
<ScopeSelector
|
|
119
114
|
show={show}
|
|
120
115
|
getScope={getScope}
|
|
116
|
+
isScopeSelectable={isScopeSelectable}
|
|
121
117
|
selectedScope={currentScope}
|
|
122
118
|
closeSelector={onScopeSelectorClose}
|
|
123
119
|
filter={filter}
|
|
@@ -50,9 +50,6 @@ describe("Sidepanel", () => {
|
|
|
50
50
|
"width: 25vw;",
|
|
51
51
|
));
|
|
52
52
|
|
|
53
|
-
it("sets width by default", () =>
|
|
54
|
-
expect(<PanelDrawer in />, "when mounted", "to have style rules satisfying", "to contain", "width: 200px;"));
|
|
55
|
-
|
|
56
53
|
it("sets transition according to timeout", () =>
|
|
57
54
|
expect(
|
|
58
55
|
<PanelDrawer in timeout={300} />,
|
package/src/constants.js
CHANGED
|
@@ -72,3 +72,21 @@ export const attributeDataType = {
|
|
|
72
72
|
entityReference: "EntityReference",
|
|
73
73
|
customType: "CustomType",
|
|
74
74
|
};
|
|
75
|
+
|
|
76
|
+
export const definitionType = {
|
|
77
|
+
shared: "Shared",
|
|
78
|
+
embedded: "Embedded",
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const requestStateOperations = {
|
|
82
|
+
create: "create",
|
|
83
|
+
delete: "delete",
|
|
84
|
+
fetch: "fetch",
|
|
85
|
+
update: "update",
|
|
86
|
+
};
|
|
87
|
+
export const requestStateOperationMap = {
|
|
88
|
+
create: "creates",
|
|
89
|
+
delete: "deletes",
|
|
90
|
+
fetch: "fetches",
|
|
91
|
+
update: "updates",
|
|
92
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
2
|
+
<path fill="#333" d="M19,11.9997 C19.2761424,11.9997 19.5,12.2235576 19.5,12.4997 L19.5,12.4997 L19.499,13.427 L19.6566047,13.4993986 C19.8927357,13.6141055 20.1201337,13.7455983 20.333298,13.8914866 L20.333298,13.8914866 L20.454,13.979 L21.2488074,13.518378 C21.4614547,13.3948233 21.7273591,13.4456535 21.8809858,13.6267593 L21.8809858,13.6267593 L21.9330095,13.7006945 L23.4330095,16.2986945 C23.5710492,16.5377793 23.4891945,16.8434968 23.2501586,16.9816211 L23.2501586,16.9816211 L22.452,17.442 L22.4770891,17.7000633 L22.487,17.9997 C22.487,18.1009077 22.4837801,18.2019589 22.4774041,18.3030612 L22.4774041,18.3030612 L22.453,18.557 L23.2507352,19.0175345 C23.4634351,19.1401635 23.5519352,19.395446 23.4720275,19.6186882 L23.4720275,19.6186882 L23.4340817,19.7005805 L21.9350817,22.2985805 C21.7969257,22.5380263 21.4906825,22.6199209 21.2514505,22.481395 L21.2514505,22.481395 L20.455,22.02 L20.3344481,22.1085643 C20.1215026,22.2544443 19.8941477,22.3858782 19.6577156,22.5006509 L19.6577156,22.5006509 L19.499,22.572 L19.5,23.4997 C19.5,23.7451599 19.3231248,23.9493084 19.0898756,23.9916443 L19.0898756,23.9916443 L19,23.9997 L16,23.9997 C15.7238576,23.9997 15.5,23.7758424 15.5,23.4997 L15.5,23.4997 L15.499,22.573 L15.3337173,22.4981037 C15.0934298,22.3824996 14.8631184,22.250938 14.6492717,22.1058155 L14.6492717,22.1058155 L14.529,22.019 L13.7218347,22.4823834 C13.5093376,22.604308 13.2447593,22.5529424 13.0917988,22.3723845 L13.0917988,22.3723845 L13.0399905,22.2987055 L11.5399905,19.7007055 C11.4018553,19.4614554 11.4839285,19.1555203 11.7232648,19.0175345 L11.7232648,19.0175345 L12.521,18.557 L12.496601,18.299951 L12.487,17.9997 C12.487,17.8523742 12.494511,17.7040106 12.5091349,17.5530613 L12.5091349,17.5530613 L12.522,17.443 L11.7246695,16.9815217 C11.5122149,16.8586446 11.4240411,16.603368 11.5041288,16.3802746 L11.5041288,16.3802746 L11.5421348,16.2984446 L13.0441348,13.7004446 C13.1822478,13.4615515 13.4877822,13.3797106 13.7268155,13.5175808 L13.7268155,13.5175808 L14.529,13.98 L14.6503936,13.8942641 C14.8644713,13.7491306 15.0948649,13.6174886 15.3348619,13.5019407 L15.3348619,13.5019407 L15.499,13.426 L15.5,12.4997 C15.5,12.2542401 15.6768752,12.0500916 15.9101244,12.0077557 L15.9101244,12.0077557 L16,11.9997 Z M18.499,12.999 L16.499,12.999 L16.5,13.7617 C16.5,13.9407606 16.4045809,14.1036441 16.2540185,14.1923955 L16.2540185,14.1923955 L16.1743286,14.2303252 C15.6966614,14.4080174 15.2437535,14.6641912 14.8960185,14.9616512 C14.735023,15.0993703 14.5047086,15.1206727 14.3211845,15.0148192 L14.3211845,15.0148192 L13.659,14.632 L12.657,16.365 L13.3163305,16.7468783 C13.4727338,16.837337 13.566111,17.0035437 13.5660253,17.1798189 L13.5660253,17.1798189 L13.5580529,17.2684915 C13.511165,17.5283285 13.487,17.7686607 13.487,17.9997 C13.487,18.2373819 13.5103696,18.4787947 13.5561109,18.7332306 C13.5934315,18.9408265 13.4964651,19.1495152 13.3137352,19.2548655 L13.3137352,19.2548655 L12.656,19.633 L13.657,21.367 L14.3221653,20.9850166 C14.4795575,20.8947096 14.6710764,20.8977544 14.8237717,20.9872694 L14.8237717,20.9872694 L14.8965463,21.0392008 C15.242943,21.3363508 15.6947614,21.5916758 16.1743286,21.7700748 C16.370124,21.8429107 16.5,22.0297959 16.5,22.2387 L16.5,22.2387 L16.499,22.999 L18.499,22.999 L18.5,22.2387 C18.5,22.0596394 18.5954191,21.8967559 18.7459815,21.8080045 L18.7459815,21.8080045 L18.8256714,21.7700748 C19.2929259,21.5962562 19.7345932,21.3427534 20.0884537,21.0392008 C20.2496875,20.9008895 20.480715,20.8795567 20.6645495,20.986005 L20.6645495,20.986005 L21.318,21.365 L22.317,19.633 L21.6602648,19.2548655 C21.5031454,19.1642806 21.4094794,18.9973313 21.4099758,18.8204234 L21.4099758,18.8204234 L21.4182131,18.731447 C21.463795,18.4830721 21.487,18.2410768 21.487,17.9997 C21.487,17.7651226 21.4629345,17.5235841 21.4162734,17.2702812 C21.3779518,17.0622495 21.4746881,16.852612 21.6578414,16.7467789 L21.6578414,16.7467789 L22.316,16.365 L21.317,14.635 L20.6651926,15.014022 C20.5077428,15.1055052 20.3154767,15.1031439 20.1620923,15.0136362 L20.1620923,15.0136362 L20.0889815,14.9616512 C19.7336822,14.6577206 19.2911159,14.4034705 18.8256714,14.2303252 C18.629876,14.1574893 18.5,13.9706041 18.5,13.7617 L18.5,13.7617 L18.499,12.999 Z M11.5,0 C11.5289644,0 11.5576698,0.00251316923 11.5858244,0.00741874956 L11.5,0 C11.53718,0 11.5734121,0.00405810679 11.6082776,0.0117555499 C11.627752,0.0161752938 11.6470999,0.0217060499 11.6660321,0.0283713194 C11.6767797,0.032003496 11.6875823,0.0362330462 11.6981944,0.04081971 C11.7122274,0.0470222758 11.7258544,0.0536592396 11.7391668,0.06090986 C11.7513627,0.0674500504 11.7634712,0.0747354237 11.7752322,0.0825044328 C11.7813925,0.0866293699 11.7874946,0.090849458 11.7935072,0.0952091774 L11.805052,0.103808328 C11.8176175,0.113497606 11.8297092,0.123771313 11.8412864,0.134588748 L11.8535534,0.146446609 L16.8535534,5.14644661 L16.8654113,5.15871357 C16.8762287,5.17029076 16.8865024,5.18238246 16.8961917,5.19494796 L16.8535534,5.14644661 C16.8776939,5.17058707 16.8991102,5.19694105 16.9176052,5.22503102 C16.9252646,5.23652877 16.9325499,5.24863729 16.9393234,5.26106504 C16.9465411,5.27453926 16.9531837,5.28820982 16.9591906,5.30215157 C16.963767,5.31241775 16.9679965,5.32322028 16.9718538,5.33419807 C16.9779762,5.35206799 16.9831476,5.36993766 16.9873149,5.38808049 C16.9890356,5.39509078 16.9905746,5.40257807 16.9919443,5.41012437 L16.9939073,5.42216869 L16.9939073,5.42216869 L17,5.50109091 L16.9879988,11.0010909 L15.9880012,10.9989091 L15.999,6 L11.5,6 C11.2545401,6 11.0503916,5.82312484 11.0080557,5.58987563 L11,5.5 L11,1 L1,1 L1,21 L11,21 L11,22 L0.5,22 C0.254540111,22 0.0503916296,21.8231248 0.00805566941,21.5898756 L0,21.5 L0,0.5 C0,0.254540111 0.176875161,0.0503916296 0.410124368,0.00805566941 L0.5,0 L11.5,0 Z M17.4863,15.5 C18.8674424,15.5 19.9863,16.6188576 19.9863,18 C19.9863,19.3804491 18.8671357,20.5 17.4863,20.5 C16.1061576,20.5 14.9863,19.3801424 14.9863,18 C14.9863,16.6191643 16.1058509,15.5 17.4863,15.5 Z M17.4863,16.5 C16.6580583,16.5 15.9863,17.1715263 15.9863,18 C15.9863,18.8278576 16.6584424,19.5 17.4863,19.5 C18.3147737,19.5 18.9863,18.8282417 18.9863,18 C18.9863,17.1711424 18.3151576,16.5 17.4863,16.5 Z M6.11135339,8.41104661 C6.28491974,8.58461296 6.30420489,8.85403736 6.16920884,9.0489055 L6.11135339,9.11815339 L3.695,11.534 L6.11128956,13.9499828 C6.28488724,14.1235178 6.30422103,14.3929387 6.16926016,14.5878312 L6.11141721,14.6570896 C5.9378822,14.8306872 5.66846129,14.850021 5.47356878,14.7150602 L5.40431044,14.6572172 L2.63431044,11.8882172 C2.4606906,11.71466 2.44137692,11.4451978 2.5763848,11.2503036 L2.63424661,11.1810466 L5.40424661,8.41104661 C5.59950876,8.21578446 5.91609124,8.21578446 6.11135339,8.41104661 Z M9.5030055,8.35319116 L9.57225339,8.41104661 L12.3422534,11.1810466 C12.5158419,11.3546351 12.5351069,11.6241009 12.4000639,11.8189707 L12.3421896,11.8882172 L9.57218956,14.6572172 C9.37689216,14.8524441 9.06030968,14.8523869 8.86508279,14.6570896 C8.69154777,14.4834919 8.67231126,14.214064 8.80734249,14.0192202 L8.86521044,13.9499828 L11.281,11.534 L8.86514661,9.11815339 C8.69158026,8.94458704 8.67229511,8.67516264 8.80729116,8.4802945 L8.86514661,8.41104661 C9.03871296,8.23748026 9.30813736,8.21819511 9.5030055,8.35319116 Z M12,1.707 L12,5 L15.293,5 L12,1.707 Z"/>
|
|
3
|
+
</svg>
|
|
@@ -312,6 +312,9 @@
|
|
|
312
312
|
<symbol id="icon-grid-view" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 21 21">
|
|
313
313
|
<path stroke="none" fill-rule="evenodd" d="M18.5,17.5 L18.5,15.5 L16.5,15.5 L16.5,17.5 L18.5,17.5 Z M19,18.5 L16,18.5 C15.7,18.5 15.5,18.3 15.5,18 L15.5,15 C15.5,14.7 15.7,14.5 16,14.5 L19,14.5 C19.3,14.5 19.5,14.7 19.5,15 L19.5,18 C19.5,18.3 19.3,18.5 19,18.5 Z M4.5,5.5 L4.5,3.5 L2.5,3.5 L2.5,5.5 L4.5,5.5 Z M5,6.5 L2,6.5 C1.7,6.5 1.5,6.3 1.5,6 L1.5,3 C1.5,2.7 1.7,2.5 2,2.5 L5,2.5 C5.3,2.5 5.5,2.7 5.5,3 L5.5,6 C5.5,6.3 5.3,6.5 5,6.5 Z M4.5,11.5 L4.5,9.5 L2.5,9.5 L2.5,11.5 L4.5,11.5 Z M5,12.5 L2,12.5 C1.7,12.5 1.5,12.3 1.5,12 L1.5,9 C1.5,8.7 1.7,8.5 2,8.5 L5,8.5 C5.3,8.5 5.5,8.7 5.5,9 L5.5,12 C5.5,12.3 5.3,12.5 5,12.5 Z M4.5,17.5 L4.5,15.5 L2.5,15.5 L2.5,17.5 L4.5,17.5 Z M5,18.5 L2,18.5 C1.7,18.5 1.5,18.3 1.5,18 L1.5,15 C1.5,14.7 1.7,14.5 2,14.5 L5,14.5 C5.3,14.5 5.5,14.7 5.5,15 L5.5,18 C5.5,18.3 5.3,18.5 5,18.5 Z M11.5,5.5 L11.5,3.5 L9.5,3.5 L9.5,5.5 L11.5,5.5 Z M12,6.5 L9,6.5 C8.7,6.5 8.5,6.3 8.5,6 L8.5,3 C8.5,2.7 8.7,2.5 9,2.5 L12,2.5 C12.3,2.5 12.5,2.7 12.5,3 L12.5,6 C12.5,6.3 12.3,6.5 12,6.5 Z M11.5,11.5 L11.5,9.5 L9.5,9.5 L9.5,11.5 L11.5,11.5 Z M12,12.5 L9,12.5 C8.7,12.5 8.5,12.3 8.5,12 L8.5,9 C8.5,8.7 8.7,8.5 9,8.5 L12,8.5 C12.3,8.5 12.5,8.7 12.5,9 L12.5,12 C12.5,12.3 12.3,12.5 12,12.5 Z M11.5,17.5 L11.5,15.5 L9.5,15.5 L9.5,17.5 L11.5,17.5 Z M12,18.5 L9,18.5 C8.7,18.5 8.5,18.3 8.5,18 L8.5,15 C8.5,14.7 8.7,14.5 9,14.5 L12,14.5 C12.3,14.5 12.5,14.7 12.5,15 L12.5,18 C12.5,18.3 12.3,18.5 12,18.5 Z M18.5,5.5 L18.5,3.5 L16.5,3.5 L16.5,5.5 L18.5,5.5 Z M19,6.5 L16,6.5 C15.7,6.5 15.5,6.3 15.5,6 L15.5,3 C15.5,2.7 15.7,2.5 16,2.5 L19,2.5 C19.3,2.5 19.5,2.7 19.5,3 L19.5,6 C19.5,6.3 19.3,6.5 19,6.5 Z M18.5,11.5 L18.5,9.5 L16.5,9.5 L16.5,11.5 L18.5,11.5 Z M19,12.5 L16,12.5 C15.7,12.5 15.5,12.3 15.5,12 L15.5,9 C15.5,8.7 15.7,8.5 16,8.5 L19,8.5 C19.3,8.5 19.5,8.7 19.5,9 L19.5,12 C19.5,12.3 19.3,12.5 19,12.5 Z"/>
|
|
314
314
|
</symbol>
|
|
315
|
+
<symbol id="icon-html-templates" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
316
|
+
<path stroke="none" d="M19,11.9997 C19.2761424,11.9997 19.5,12.2235576 19.5,12.4997 L19.5,12.4997 L19.499,13.427 L19.6566047,13.4993986 C19.8927357,13.6141055 20.1201337,13.7455983 20.333298,13.8914866 L20.333298,13.8914866 L20.454,13.979 L21.2488074,13.518378 C21.4614547,13.3948233 21.7273591,13.4456535 21.8809858,13.6267593 L21.8809858,13.6267593 L21.9330095,13.7006945 L23.4330095,16.2986945 C23.5710492,16.5377793 23.4891945,16.8434968 23.2501586,16.9816211 L23.2501586,16.9816211 L22.452,17.442 L22.4770891,17.7000633 L22.487,17.9997 C22.487,18.1009077 22.4837801,18.2019589 22.4774041,18.3030612 L22.4774041,18.3030612 L22.453,18.557 L23.2507352,19.0175345 C23.4634351,19.1401635 23.5519352,19.395446 23.4720275,19.6186882 L23.4720275,19.6186882 L23.4340817,19.7005805 L21.9350817,22.2985805 C21.7969257,22.5380263 21.4906825,22.6199209 21.2514505,22.481395 L21.2514505,22.481395 L20.455,22.02 L20.3344481,22.1085643 C20.1215026,22.2544443 19.8941477,22.3858782 19.6577156,22.5006509 L19.6577156,22.5006509 L19.499,22.572 L19.5,23.4997 C19.5,23.7451599 19.3231248,23.9493084 19.0898756,23.9916443 L19.0898756,23.9916443 L19,23.9997 L16,23.9997 C15.7238576,23.9997 15.5,23.7758424 15.5,23.4997 L15.5,23.4997 L15.499,22.573 L15.3337173,22.4981037 C15.0934298,22.3824996 14.8631184,22.250938 14.6492717,22.1058155 L14.6492717,22.1058155 L14.529,22.019 L13.7218347,22.4823834 C13.5093376,22.604308 13.2447593,22.5529424 13.0917988,22.3723845 L13.0917988,22.3723845 L13.0399905,22.2987055 L11.5399905,19.7007055 C11.4018553,19.4614554 11.4839285,19.1555203 11.7232648,19.0175345 L11.7232648,19.0175345 L12.521,18.557 L12.496601,18.299951 L12.487,17.9997 C12.487,17.8523742 12.494511,17.7040106 12.5091349,17.5530613 L12.5091349,17.5530613 L12.522,17.443 L11.7246695,16.9815217 C11.5122149,16.8586446 11.4240411,16.603368 11.5041288,16.3802746 L11.5041288,16.3802746 L11.5421348,16.2984446 L13.0441348,13.7004446 C13.1822478,13.4615515 13.4877822,13.3797106 13.7268155,13.5175808 L13.7268155,13.5175808 L14.529,13.98 L14.6503936,13.8942641 C14.8644713,13.7491306 15.0948649,13.6174886 15.3348619,13.5019407 L15.3348619,13.5019407 L15.499,13.426 L15.5,12.4997 C15.5,12.2542401 15.6768752,12.0500916 15.9101244,12.0077557 L15.9101244,12.0077557 L16,11.9997 Z M18.499,12.999 L16.499,12.999 L16.5,13.7617 C16.5,13.9407606 16.4045809,14.1036441 16.2540185,14.1923955 L16.2540185,14.1923955 L16.1743286,14.2303252 C15.6966614,14.4080174 15.2437535,14.6641912 14.8960185,14.9616512 C14.735023,15.0993703 14.5047086,15.1206727 14.3211845,15.0148192 L14.3211845,15.0148192 L13.659,14.632 L12.657,16.365 L13.3163305,16.7468783 C13.4727338,16.837337 13.566111,17.0035437 13.5660253,17.1798189 L13.5660253,17.1798189 L13.5580529,17.2684915 C13.511165,17.5283285 13.487,17.7686607 13.487,17.9997 C13.487,18.2373819 13.5103696,18.4787947 13.5561109,18.7332306 C13.5934315,18.9408265 13.4964651,19.1495152 13.3137352,19.2548655 L13.3137352,19.2548655 L12.656,19.633 L13.657,21.367 L14.3221653,20.9850166 C14.4795575,20.8947096 14.6710764,20.8977544 14.8237717,20.9872694 L14.8237717,20.9872694 L14.8965463,21.0392008 C15.242943,21.3363508 15.6947614,21.5916758 16.1743286,21.7700748 C16.370124,21.8429107 16.5,22.0297959 16.5,22.2387 L16.5,22.2387 L16.499,22.999 L18.499,22.999 L18.5,22.2387 C18.5,22.0596394 18.5954191,21.8967559 18.7459815,21.8080045 L18.7459815,21.8080045 L18.8256714,21.7700748 C19.2929259,21.5962562 19.7345932,21.3427534 20.0884537,21.0392008 C20.2496875,20.9008895 20.480715,20.8795567 20.6645495,20.986005 L20.6645495,20.986005 L21.318,21.365 L22.317,19.633 L21.6602648,19.2548655 C21.5031454,19.1642806 21.4094794,18.9973313 21.4099758,18.8204234 L21.4099758,18.8204234 L21.4182131,18.731447 C21.463795,18.4830721 21.487,18.2410768 21.487,17.9997 C21.487,17.7651226 21.4629345,17.5235841 21.4162734,17.2702812 C21.3779518,17.0622495 21.4746881,16.852612 21.6578414,16.7467789 L21.6578414,16.7467789 L22.316,16.365 L21.317,14.635 L20.6651926,15.014022 C20.5077428,15.1055052 20.3154767,15.1031439 20.1620923,15.0136362 L20.1620923,15.0136362 L20.0889815,14.9616512 C19.7336822,14.6577206 19.2911159,14.4034705 18.8256714,14.2303252 C18.629876,14.1574893 18.5,13.9706041 18.5,13.7617 L18.5,13.7617 L18.499,12.999 Z M11.5,0 C11.5289644,0 11.5576698,0.00251316923 11.5858244,0.00741874956 L11.5,0 C11.53718,0 11.5734121,0.00405810679 11.6082776,0.0117555499 C11.627752,0.0161752938 11.6470999,0.0217060499 11.6660321,0.0283713194 C11.6767797,0.032003496 11.6875823,0.0362330462 11.6981944,0.04081971 C11.7122274,0.0470222758 11.7258544,0.0536592396 11.7391668,0.06090986 C11.7513627,0.0674500504 11.7634712,0.0747354237 11.7752322,0.0825044328 C11.7813925,0.0866293699 11.7874946,0.090849458 11.7935072,0.0952091774 L11.805052,0.103808328 C11.8176175,0.113497606 11.8297092,0.123771313 11.8412864,0.134588748 L11.8535534,0.146446609 L16.8535534,5.14644661 L16.8654113,5.15871357 C16.8762287,5.17029076 16.8865024,5.18238246 16.8961917,5.19494796 L16.8535534,5.14644661 C16.8776939,5.17058707 16.8991102,5.19694105 16.9176052,5.22503102 C16.9252646,5.23652877 16.9325499,5.24863729 16.9393234,5.26106504 C16.9465411,5.27453926 16.9531837,5.28820982 16.9591906,5.30215157 C16.963767,5.31241775 16.9679965,5.32322028 16.9718538,5.33419807 C16.9779762,5.35206799 16.9831476,5.36993766 16.9873149,5.38808049 C16.9890356,5.39509078 16.9905746,5.40257807 16.9919443,5.41012437 L16.9939073,5.42216869 L16.9939073,5.42216869 L17,5.50109091 L16.9879988,11.0010909 L15.9880012,10.9989091 L15.999,6 L11.5,6 C11.2545401,6 11.0503916,5.82312484 11.0080557,5.58987563 L11,5.5 L11,1 L1,1 L1,21 L11,21 L11,22 L0.5,22 C0.254540111,22 0.0503916296,21.8231248 0.00805566941,21.5898756 L0,21.5 L0,0.5 C0,0.254540111 0.176875161,0.0503916296 0.410124368,0.00805566941 L0.5,0 L11.5,0 Z M17.4863,15.5 C18.8674424,15.5 19.9863,16.6188576 19.9863,18 C19.9863,19.3804491 18.8671357,20.5 17.4863,20.5 C16.1061576,20.5 14.9863,19.3801424 14.9863,18 C14.9863,16.6191643 16.1058509,15.5 17.4863,15.5 Z M17.4863,16.5 C16.6580583,16.5 15.9863,17.1715263 15.9863,18 C15.9863,18.8278576 16.6584424,19.5 17.4863,19.5 C18.3147737,19.5 18.9863,18.8282417 18.9863,18 C18.9863,17.1711424 18.3151576,16.5 17.4863,16.5 Z M6.11135339,8.41104661 C6.28491974,8.58461296 6.30420489,8.85403736 6.16920884,9.0489055 L6.11135339,9.11815339 L3.695,11.534 L6.11128956,13.9499828 C6.28488724,14.1235178 6.30422103,14.3929387 6.16926016,14.5878312 L6.11141721,14.6570896 C5.9378822,14.8306872 5.66846129,14.850021 5.47356878,14.7150602 L5.40431044,14.6572172 L2.63431044,11.8882172 C2.4606906,11.71466 2.44137692,11.4451978 2.5763848,11.2503036 L2.63424661,11.1810466 L5.40424661,8.41104661 C5.59950876,8.21578446 5.91609124,8.21578446 6.11135339,8.41104661 Z M9.5030055,8.35319116 L9.57225339,8.41104661 L12.3422534,11.1810466 C12.5158419,11.3546351 12.5351069,11.6241009 12.4000639,11.8189707 L12.3421896,11.8882172 L9.57218956,14.6572172 C9.37689216,14.8524441 9.06030968,14.8523869 8.86508279,14.6570896 C8.69154777,14.4834919 8.67231126,14.214064 8.80734249,14.0192202 L8.86521044,13.9499828 L11.281,11.534 L8.86514661,9.11815339 C8.69158026,8.94458704 8.67229511,8.67516264 8.80729116,8.4802945 L8.86514661,8.41104661 C9.03871296,8.23748026 9.30813736,8.21819511 9.5030055,8.35319116 Z M12,1.707 L12,5 L15.293,5 L12,1.707 Z"/>
|
|
317
|
+
</symbol>
|
|
315
318
|
<symbol id="icon-import-export" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
316
319
|
<path stroke="none" fill-rule="evenodd" d="M11.8063167,4.9 L14.9063167,1.7 L14.9063167,12.5 C14.9063167,12.8 15.1063167,13 15.4063167,13 C15.7063167,13 15.9063167,12.8 15.9063167,12.5 L15.9063167,1.7 L19.0063167,4.8 C19.2063167,5 19.5063167,5 19.7063167,4.8 C19.9063167,4.6 19.9063167,4.3 19.7063167,4.1 L15.7063167,0.1 C15.7063167,0.1 15.6063167,0 15.5063167,0 C15.5063167,3.60822483e-16 15.3063167,3.60822483e-16 15.2063167,3.60822483e-16 C15.1063167,3.60822483e-16 15.1063167,0.1 15.0063167,0.1 C15.0063167,0.1 15.0063167,0.1 15.0063167,0.1 L11.0063167,4.1 C10.8063167,4.3 10.8063167,4.6 11.0063167,4.8 C11.2063167,5 11.6063167,5 11.8063167,4.9 Z M9.00631668,12.9 C9.00631668,12.9 9.00631668,12.9 9.00631668,12.9 C9.10631668,12.9 9.10631668,13 9.20631668,13 C9.30631668,13 9.30631668,13 9.40631668,13 C9.40631668,13 9.40631668,13 9.40631668,13 C9.50631668,13 9.50631668,13 9.60631668,13 C9.70631668,13 9.70631668,12.9 9.80631668,12.9 C9.80631668,12.9 9.80631668,12.9 9.80631668,12.9 L13.8063167,8.9 C14.0063167,8.7 14.0063167,8.4 13.8063167,8.2 C13.6063167,8 13.3063167,8 13.1063167,8.2 L9.90631668,11.3 L9.90631668,0.5 C9.90631668,0.2 9.70631668,0 9.40631668,0 C9.10631668,0 8.90631668,0.2 8.90631668,0.5 L8.90631668,11.3 L5.80631668,8.1 C5.60631668,8 5.20631668,8 5.00631668,8.1 C4.90631668,8.3 4.90631668,8.7 5.00631668,8.9 L9.00631668,12.9 Z M15.9063167,21 L19.9063167,21 C20.2063167,21 20.4063167,20.8 20.4063167,20.5 C20.4063167,20.2 20.2063167,20 19.9063167,20 L15.9063167,20 C15.6063167,20 15.4063167,20.2 15.4063167,20.5 C15.4063167,20.8 15.6063167,21 15.9063167,21 Z M23.9063167,17.5 C23.9063167,17.4 23.9063167,17.4 23.9063167,17.5 C23.9063167,17.4 23.8063167,17.3 23.8063167,17.2 C23.8063167,17.2 23.8063167,17.2 23.8063167,17.2 L18.8063167,11.2 C18.2063167,11.1 18.0063167,11.4 18.2063167,12 L22.4063167,17 L1.50631668,17 L5.70631668,12 C6.00631668,11.2 5.80631668,11 5.10631668,11.2 L0.10631668,17.2 C0.10631668,17.2 0.10631668,17.2 0.10631668,17.2 C0.10631668,17.3 0.00631667954,17.3 0.00631667954,17.4 C0.00631667954,17.4 0.00631667954,17.4 0.00631667954,17.5 C0.00631667954,17.5 0.00631667954,17.5 0.00631667954,17.5 L0.00631667954,21.5 C-0.0936833205,22.9 1.00631668,24 2.40631668,24 L21.4063167,24 C22.8063167,24 23.9063167,22.9 23.9063167,21.5 L23.9063167,17.5 C23.9063167,17.5 23.9063167,17.5 23.9063167,17.5 Z M22.9063167,21.5 C22.9063167,22.3 22.2063167,23 21.4063167,23 L2.40631668,23 C1.60631668,23 0.90631668,22.3 0.90631668,21.5 L0.90631668,18 L22.9063167,18 L22.9063167,21.5 Z"/>
|
|
317
320
|
</symbol>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import useLoader from "./useLoader";
|
|
2
|
+
import useRequestState from "./useRequestState";
|
|
3
|
+
import { requestStateOperations } from "../constants";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { selectClosingTabHandlerActionForEntity, selectCurrentModuleName } from "../selectors/navigation";
|
|
6
|
+
import { useSelectorAndUnwrap } from "./useSelectorAndUnwrap";
|
|
7
|
+
import { shallowEqual, useSelector } from "react-redux";
|
|
8
|
+
import { RSAA } from "redux-api-middleware";
|
|
9
|
+
import { makeFailureActionType } from "../actions/makeApiAction";
|
|
10
|
+
|
|
11
|
+
const useEntityLoader = (entityId, loadAction, cutoutSelector) => {
|
|
12
|
+
if (Array.isArray(loadAction)) {
|
|
13
|
+
throw new Error("useEntityLoader does not support an array of actions");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const [loadErrorUnhandled, setLoadErrorUnhandled] = useState(false);
|
|
17
|
+
|
|
18
|
+
const moduleName = useSelectorAndUnwrap(selectCurrentModuleName);
|
|
19
|
+
|
|
20
|
+
const closingTabHandlerAction = useSelector(selectClosingTabHandlerActionForEntity(moduleName, entityId));
|
|
21
|
+
|
|
22
|
+
const [requestState] = useRequestState({
|
|
23
|
+
keys: [loadAction[RSAA]?.endpoint ?? "invalidEndPoint"],
|
|
24
|
+
operation: requestStateOperations.fetch,
|
|
25
|
+
errorAction: errorResponse => {
|
|
26
|
+
setLoadErrorUnhandled(true);
|
|
27
|
+
if (errorResponse.status === 404 && closingTabHandlerAction) {
|
|
28
|
+
closingTabHandlerAction();
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const metaRequestState = requestState();
|
|
34
|
+
|
|
35
|
+
const cutout = !!useSelector(cutoutSelector, shallowEqual) || loadErrorUnhandled;
|
|
36
|
+
|
|
37
|
+
if (!loadAction[RSAA] && !cutout) {
|
|
38
|
+
throw new Error("useEntityLoader only supports RSAA api actions");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (loadAction[RSAA]) {
|
|
42
|
+
loadAction[RSAA].types = (loadAction[RSAA].types ?? []).map(x => {
|
|
43
|
+
if (typeof x === "string") {
|
|
44
|
+
const actionType = x.endsWith("_FAILURE") ? makeFailureActionType(x) : { type: x };
|
|
45
|
+
return {
|
|
46
|
+
...actionType,
|
|
47
|
+
meta: { requestState: { ...metaRequestState } },
|
|
48
|
+
};
|
|
49
|
+
} else if (typeof x === "object") {
|
|
50
|
+
const actionType = x.type.endsWith("_FAILURE") ? makeFailureActionType(x.type) : {};
|
|
51
|
+
return {
|
|
52
|
+
...x,
|
|
53
|
+
...actionType,
|
|
54
|
+
meta: {
|
|
55
|
+
...(x.meta ?? {}),
|
|
56
|
+
requestState: { ...metaRequestState },
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
throw new Error("useEntityLoader only supports RSAA api actions with valid types");
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
useLoader(loadAction, () => cutout);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default useEntityLoader;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Provider, useSelector } from "react-redux";
|
|
3
|
+
import Immutable from "immutable";
|
|
4
|
+
import sinon from "sinon";
|
|
5
|
+
import { RSAA } from "redux-api-middleware";
|
|
6
|
+
import { spyOnConsole } from "../utils/testUtils";
|
|
7
|
+
import useEntityLoader from "./useEntityLoader";
|
|
8
|
+
import { makeActionTypes } from "../actions/makeApiAction";
|
|
9
|
+
import * as getRequestStateInfo from "../selectors/requestStates";
|
|
10
|
+
import { mount } from "enzyme";
|
|
11
|
+
|
|
12
|
+
const TestComp = ({ entityId, loader, cutout }) => {
|
|
13
|
+
useEntityLoader(entityId, loader, cutout);
|
|
14
|
+
const [tick, setTick] = useState(0);
|
|
15
|
+
const live = useSelector(state => state.get("live"));
|
|
16
|
+
return (
|
|
17
|
+
<div id="test" onClick={() => setTick(tick + 1)} data-live={live}>
|
|
18
|
+
{tick}
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
describe("useEntityLoader", () => {
|
|
24
|
+
spyOnConsole(["warn", "error"]);
|
|
25
|
+
|
|
26
|
+
let loader, state, store, appNode;
|
|
27
|
+
|
|
28
|
+
const closingAction = sinon.spy().named("closingAction");
|
|
29
|
+
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
state = Immutable.fromJS({
|
|
32
|
+
cutout: "yes",
|
|
33
|
+
live: 0,
|
|
34
|
+
requests: {
|
|
35
|
+
logout: false,
|
|
36
|
+
},
|
|
37
|
+
requestStates: {
|
|
38
|
+
creates: {},
|
|
39
|
+
deletes: {},
|
|
40
|
+
fetches: {},
|
|
41
|
+
updates: {},
|
|
42
|
+
},
|
|
43
|
+
navigation: {
|
|
44
|
+
route: {
|
|
45
|
+
match: { path: "/:scope/TheModuleName/:entityId", params: { scope: "TheOldScope", entityId: "loaderId" } },
|
|
46
|
+
},
|
|
47
|
+
moduleTabs: {},
|
|
48
|
+
config: { prependPath: "/:scope/", prependHref: "/Scope1/" },
|
|
49
|
+
closingTabsHandlerActions: {
|
|
50
|
+
TheModuleName: [
|
|
51
|
+
{
|
|
52
|
+
entityId: "loaderId",
|
|
53
|
+
closeTab: closingAction,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
const subs = [];
|
|
60
|
+
store = {
|
|
61
|
+
updateState: () => {
|
|
62
|
+
subs.forEach((sub, i) => {
|
|
63
|
+
sub();
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
subscribe: sub => {
|
|
67
|
+
subs.push(sub);
|
|
68
|
+
return () => {};
|
|
69
|
+
},
|
|
70
|
+
getState: () => state,
|
|
71
|
+
dispatch: sinon.spy().named("dispatch"),
|
|
72
|
+
};
|
|
73
|
+
loader = {
|
|
74
|
+
[RSAA]: {
|
|
75
|
+
types: makeActionTypes("TEST_ACTION"),
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
appNode = document.createElement("div");
|
|
79
|
+
document.body.appendChild(appNode);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const getLoaderWithMeta = (withMeta = false) => ({
|
|
83
|
+
[RSAA]: {
|
|
84
|
+
types: makeActionTypes("TEST_ACTION").map(x => ({
|
|
85
|
+
type: x,
|
|
86
|
+
[withMeta ? "meta" : "noMeta"]: { data: "some meta data" },
|
|
87
|
+
})),
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
afterEach(() => {
|
|
92
|
+
closingAction.resetHistory();
|
|
93
|
+
document.body.removeChild(appNode);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("dispatches the entity loader action on mount if cutout returns falsy", () =>
|
|
97
|
+
expect(
|
|
98
|
+
<Provider store={store}>
|
|
99
|
+
<TestComp entityId={"entityId"} loader={loader} cutout={state => state.get("live")} />
|
|
100
|
+
</Provider>,
|
|
101
|
+
"when mounted",
|
|
102
|
+
"to satisfy",
|
|
103
|
+
<div>0</div>,
|
|
104
|
+
).then(() => expect(store.dispatch, "to have calls satisfying", [{ args: [loader] }])));
|
|
105
|
+
|
|
106
|
+
it("dispatches the entity loader action on mount with object types if cutout returns falsy", () =>
|
|
107
|
+
expect(
|
|
108
|
+
<Provider store={store}>
|
|
109
|
+
<TestComp entityId={"entityId"} loader={getLoaderWithMeta(true)} cutout={state => state.get("live")} />
|
|
110
|
+
</Provider>,
|
|
111
|
+
"when mounted",
|
|
112
|
+
"to satisfy",
|
|
113
|
+
<div>0</div>,
|
|
114
|
+
).then(() => expect(store.dispatch, "to have calls satisfying", [{ args: [getLoaderWithMeta(true)] }])));
|
|
115
|
+
|
|
116
|
+
it("dispatches the entity loader action on mount with object types without meta if cutout returns falsy", () =>
|
|
117
|
+
expect(
|
|
118
|
+
<Provider store={store}>
|
|
119
|
+
<TestComp entityId={"entityId"} loader={getLoaderWithMeta()} cutout={state => state.get("live")} />
|
|
120
|
+
</Provider>,
|
|
121
|
+
"when mounted",
|
|
122
|
+
"to satisfy",
|
|
123
|
+
<div>0</div>,
|
|
124
|
+
).then(() => expect(store.dispatch, "to have calls satisfying", [{ args: [getLoaderWithMeta()] }])));
|
|
125
|
+
|
|
126
|
+
it("dispatches the entity loader action without types", () =>
|
|
127
|
+
expect(
|
|
128
|
+
<Provider store={store}>
|
|
129
|
+
<TestComp entityId={"entityId"} loader={{ [RSAA]: {} }} cutout={state => state.get("live")} />
|
|
130
|
+
</Provider>,
|
|
131
|
+
"when mounted",
|
|
132
|
+
"to satisfy",
|
|
133
|
+
<div>0</div>,
|
|
134
|
+
).then(() => expect(store.dispatch, "to have calls satisfying", [{ args: [{ [RSAA]: {} }] }])));
|
|
135
|
+
|
|
136
|
+
it("does not dispatch entity loader if cutout returns truthy", () =>
|
|
137
|
+
expect(
|
|
138
|
+
<Provider store={store}>
|
|
139
|
+
<TestComp entityId={"entityId"} loader={loader} cutout={state => state.get("cutout")} />
|
|
140
|
+
</Provider>,
|
|
141
|
+
"when mounted",
|
|
142
|
+
"to satisfy",
|
|
143
|
+
<div>0</div>,
|
|
144
|
+
).then(() => expect(store.dispatch, "was not called")));
|
|
145
|
+
|
|
146
|
+
it("Throws an exception if loader is not a RSAA action", () =>
|
|
147
|
+
expect(
|
|
148
|
+
() =>
|
|
149
|
+
expect(
|
|
150
|
+
<Provider store={store}>
|
|
151
|
+
<TestComp entityId={"entityId"} loader={{ type: 1 }} cutout={state => state.get("live")} />
|
|
152
|
+
</Provider>,
|
|
153
|
+
"when mounted",
|
|
154
|
+
),
|
|
155
|
+
"to throw",
|
|
156
|
+
"useEntityLoader only supports RSAA api actions",
|
|
157
|
+
));
|
|
158
|
+
|
|
159
|
+
it("Ignores when the loader is not a RSAA action if cutout return true", () =>
|
|
160
|
+
expect(
|
|
161
|
+
<Provider store={store}>
|
|
162
|
+
<TestComp entityId={"entityId"} loader={{ type: 1 }} cutout={state => state.get("cutout")} />
|
|
163
|
+
</Provider>,
|
|
164
|
+
"when mounted",
|
|
165
|
+
"to satisfy",
|
|
166
|
+
<div>0</div>,
|
|
167
|
+
).then(() => expect(store.dispatch, "was not called")));
|
|
168
|
+
|
|
169
|
+
it("Throws an exception if loader is an array", () =>
|
|
170
|
+
expect(
|
|
171
|
+
() =>
|
|
172
|
+
expect(
|
|
173
|
+
<Provider store={store}>
|
|
174
|
+
<TestComp entityId={"entityId"} loader={[loader]} cutout={state => state.get("live")} />
|
|
175
|
+
</Provider>,
|
|
176
|
+
"when mounted",
|
|
177
|
+
),
|
|
178
|
+
"to throw",
|
|
179
|
+
"useEntityLoader does not support an array of actions",
|
|
180
|
+
));
|
|
181
|
+
|
|
182
|
+
it("Throws an exception if loader RSAA action has an invalid type", () =>
|
|
183
|
+
expect(
|
|
184
|
+
() =>
|
|
185
|
+
expect(
|
|
186
|
+
<Provider store={store}>
|
|
187
|
+
<TestComp
|
|
188
|
+
entityId={"entityId"}
|
|
189
|
+
loader={{ [RSAA]: { types: [1, "SSS"] } }}
|
|
190
|
+
cutout={state => state.get("live")}
|
|
191
|
+
/>
|
|
192
|
+
</Provider>,
|
|
193
|
+
"when mounted",
|
|
194
|
+
),
|
|
195
|
+
"to throw",
|
|
196
|
+
"useEntityLoader only supports RSAA api actions with valid types",
|
|
197
|
+
));
|
|
198
|
+
|
|
199
|
+
it("Invoke the closing tab action when entity not found", () => {
|
|
200
|
+
const component = (
|
|
201
|
+
<Provider store={store}>
|
|
202
|
+
<TestComp entityId={"loaderId"} loader={loader} cutout={state => state.get("live")} />
|
|
203
|
+
</Provider>
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
const errorPayload = {
|
|
207
|
+
status: 404,
|
|
208
|
+
response: {
|
|
209
|
+
responseStatus: {
|
|
210
|
+
message: "some error message",
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const getRequestStateInfoOverride = () => ({
|
|
216
|
+
inProgress: false,
|
|
217
|
+
value: false,
|
|
218
|
+
error: closingAction.callCount === 0,
|
|
219
|
+
errorResponse: closingAction.callCount === 0 ? errorPayload : null,
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
const getRequestStateInfoStub = sinon
|
|
223
|
+
.stub(getRequestStateInfo, "getRequestStateInfo")
|
|
224
|
+
.returns(() => getRequestStateInfoOverride());
|
|
225
|
+
|
|
226
|
+
mount(component);
|
|
227
|
+
|
|
228
|
+
expect(closingAction, "was called");
|
|
229
|
+
|
|
230
|
+
getRequestStateInfoStub.restore();
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it("Does not invoke not existing closing tab action when entity not found", () => {
|
|
234
|
+
const component = (
|
|
235
|
+
<Provider store={store}>
|
|
236
|
+
<TestComp entityId={"loaderAnotherId"} loader={loader} cutout={state => state.get("live")} />
|
|
237
|
+
</Provider>
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
const errorPayload = {
|
|
241
|
+
status: 404,
|
|
242
|
+
response: {
|
|
243
|
+
responseStatus: {
|
|
244
|
+
message: "some error message",
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
const getRequestStateInfoOverride = () => ({
|
|
250
|
+
inProgress: false,
|
|
251
|
+
value: false,
|
|
252
|
+
error: closingAction.callCount === 0,
|
|
253
|
+
errorResponse: closingAction.callCount === 0 ? errorPayload : null,
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
const getRequestStateInfoStub = sinon
|
|
257
|
+
.stub(getRequestStateInfo, "getRequestStateInfo")
|
|
258
|
+
.returns(() => getRequestStateInfoOverride());
|
|
259
|
+
|
|
260
|
+
mount(component);
|
|
261
|
+
|
|
262
|
+
expect(closingAction, "was not called");
|
|
263
|
+
|
|
264
|
+
getRequestStateInfoStub.restore();
|
|
265
|
+
});
|
|
266
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
|
|
3
|
+
const useInfiniteScroll = (entities, pageSize, countOffset = 0) => {
|
|
4
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
5
|
+
|
|
6
|
+
const count = Math.min(entities.length, pageSize * currentPage + countOffset);
|
|
7
|
+
|
|
8
|
+
const visibleEntities = entities.slice(0, count);
|
|
9
|
+
|
|
10
|
+
const scrollEvent = useCallback(
|
|
11
|
+
evt => {
|
|
12
|
+
if (
|
|
13
|
+
evt.target.scrollHeight - (evt.target.scrollTop + evt.target.offsetHeight) < 100 &&
|
|
14
|
+
visibleEntities.length === pageSize * currentPage + countOffset
|
|
15
|
+
) {
|
|
16
|
+
setCurrentPage(currentPage + 1);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
[setCurrentPage, currentPage, visibleEntities.length, countOffset, pageSize],
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
return [visibleEntities, scrollEvent];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default useInfiniteScroll;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TestWrapper } from "./../utils/testUtils";
|
|
3
|
+
import { mount } from "enzyme";
|
|
4
|
+
import useInfiniteScroll from "./useInfiniteScroll";
|
|
5
|
+
|
|
6
|
+
describe("useInfiniteScroll", () => {
|
|
7
|
+
const entities = Array.from("AnArrayOfEntities");
|
|
8
|
+
|
|
9
|
+
const TestComp = ({ countOffset }) => {
|
|
10
|
+
const [visibleEntities, scrollEvent] = useInfiniteScroll(entities, 3, countOffset);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div>
|
|
14
|
+
<div id="entityCount">{visibleEntities.length}</div>
|
|
15
|
+
<div id="scrollIt" onClick={evt => scrollEvent(evt)} />
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
it("return the initial number of visible entities", () => {
|
|
21
|
+
const component = (
|
|
22
|
+
<TestWrapper>
|
|
23
|
+
<TestComp />
|
|
24
|
+
</TestWrapper>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const mountedComponent = mount(component);
|
|
28
|
+
|
|
29
|
+
const fieldValue = mountedComponent.find("#entityCount").prop("children");
|
|
30
|
+
|
|
31
|
+
expect(fieldValue, "to equal", 3);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("return the same number of visible entities after small scrolling", () => {
|
|
35
|
+
const component = (
|
|
36
|
+
<TestWrapper>
|
|
37
|
+
<TestComp />
|
|
38
|
+
</TestWrapper>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const mountedComponent = mount(component);
|
|
42
|
+
|
|
43
|
+
const scroller = mountedComponent.find("#scrollIt");
|
|
44
|
+
|
|
45
|
+
scroller.invoke("onClick")({ target: { scrollHeight: 1000, scrollTop: 40, offsetHeight: 100 } });
|
|
46
|
+
|
|
47
|
+
const fieldValue = mountedComponent.find("#entityCount").prop("children");
|
|
48
|
+
|
|
49
|
+
expect(fieldValue, "to equal", 3);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("return the number of visible entities after scrolling", () => {
|
|
53
|
+
const component = (
|
|
54
|
+
<TestWrapper>
|
|
55
|
+
<TestComp />
|
|
56
|
+
</TestWrapper>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const mountedComponent = mount(component);
|
|
60
|
+
|
|
61
|
+
const scroller = mountedComponent.find("#scrollIt");
|
|
62
|
+
|
|
63
|
+
scroller.invoke("onClick")({ target: { scrollHeight: 1000, scrollTop: 40, offsetHeight: 900 } });
|
|
64
|
+
|
|
65
|
+
const fieldValue = mountedComponent.find("#entityCount").prop("children");
|
|
66
|
+
|
|
67
|
+
expect(fieldValue, "to equal", 6);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("return the number of visible entities after scrolling with a count offset", () => {
|
|
71
|
+
const component = (
|
|
72
|
+
<TestWrapper>
|
|
73
|
+
<TestComp countOffset={2} />
|
|
74
|
+
</TestWrapper>
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const mountedComponent = mount(component);
|
|
78
|
+
|
|
79
|
+
const scroller = mountedComponent.find("#scrollIt");
|
|
80
|
+
|
|
81
|
+
scroller.invoke("onClick")({ target: { scrollHeight: 1000, scrollTop: 40, offsetHeight: 900 } });
|
|
82
|
+
|
|
83
|
+
const fieldValue = mountedComponent.find("#entityCount").prop("children");
|
|
84
|
+
|
|
85
|
+
expect(fieldValue, "to equal", 8);
|
|
86
|
+
});
|
|
87
|
+
});
|
package/src/hooks/useLoader.js
CHANGED
|
@@ -4,6 +4,7 @@ import { logoutSelector } from "../selectors/requests";
|
|
|
4
4
|
|
|
5
5
|
let hasWarned = false;
|
|
6
6
|
const noCutout = () => {
|
|
7
|
+
/* istanbul ignore next */
|
|
7
8
|
if (!hasWarned) {
|
|
8
9
|
console.warn("useLoader hook called without cutout selector, loader will never be dispatched.");
|
|
9
10
|
hasWarned = true;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { useIntl } from "react-intl";
|
|
2
|
+
import { useCallback, useContext } from "react";
|
|
3
|
+
import { NotificationContext } from "../components/MaterialUI/Feedback/NotificationContext";
|
|
4
|
+
import useRequestState from "./useRequestState";
|
|
5
|
+
import sharedMessages from "../sharedMessages";
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
This hook is used to handle the notification message for deletes and updates.
|
|
9
|
+
It uses useRequestState internally to know when to display messages.
|
|
10
|
+
|
|
11
|
+
This hook returns a method used to build a requestState object that is used in the meta data property of the dispatched action.
|
|
12
|
+
The expected format for the action is as follow:
|
|
13
|
+
{
|
|
14
|
+
type: 'some type',
|
|
15
|
+
... // other properties
|
|
16
|
+
meta: {
|
|
17
|
+
requestState: {
|
|
18
|
+
keys: [],
|
|
19
|
+
operation: requestStateOperations.delete
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const useNotificationRequestState = ({
|
|
26
|
+
keys,
|
|
27
|
+
operation,
|
|
28
|
+
successMessageId,
|
|
29
|
+
successMessageValues,
|
|
30
|
+
successAction,
|
|
31
|
+
errorMessageId,
|
|
32
|
+
errorMessageValues,
|
|
33
|
+
errorAction,
|
|
34
|
+
}) => {
|
|
35
|
+
const { formatMessage } = useIntl();
|
|
36
|
+
const { addNotification } = useContext(NotificationContext);
|
|
37
|
+
|
|
38
|
+
const onSuccess = useCallback(() => {
|
|
39
|
+
const message = formatMessage(successMessageId, successMessageValues);
|
|
40
|
+
addNotification(message, "success");
|
|
41
|
+
|
|
42
|
+
if (successAction) {
|
|
43
|
+
successAction();
|
|
44
|
+
}
|
|
45
|
+
// addNotification causes issues in the deps
|
|
46
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
+
}, [formatMessage, successAction, successMessageId, successMessageValues]);
|
|
48
|
+
|
|
49
|
+
const onError = useCallback(
|
|
50
|
+
errorResponse => {
|
|
51
|
+
const errorMessage = errorResponse?.response?.responseStatus?.message ?? null;
|
|
52
|
+
|
|
53
|
+
const message = formatMessage(errorMessageId, {
|
|
54
|
+
...errorMessageValues,
|
|
55
|
+
errorMessage: errorMessage ?? formatMessage(sharedMessages.errorUnknown),
|
|
56
|
+
});
|
|
57
|
+
addNotification(message, "error");
|
|
58
|
+
|
|
59
|
+
if (errorAction) {
|
|
60
|
+
errorAction(errorResponse);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
// addNotification causes issues in the deps
|
|
64
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
65
|
+
[errorAction, errorMessageId, errorMessageValues, formatMessage],
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const buildRequestState = useRequestState({
|
|
69
|
+
keys,
|
|
70
|
+
operation,
|
|
71
|
+
successAction: onSuccess,
|
|
72
|
+
errorAction: onError,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
return buildRequestState;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export default useNotificationRequestState;
|