orc-shared 1.7.0-dev.8 → 5.2.0-dev.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/dist/actions/modules.js +15 -1
- package/dist/actions/navigation.js +1 -14
- package/dist/actions/scopes.js +2 -3
- package/dist/buildStore.js +1 -7
- package/dist/components/AppFrame/Sidebar.js +8 -4
- package/dist/components/MaterialUI/DataDisplay/Notification.js +0 -6
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +6 -18
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +1 -2
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +2 -4
- package/dist/components/MaterialUI/DataDisplay/tableHelpers.js +7 -7
- package/dist/components/MaterialUI/Inputs/Autocomplete.js +0 -5
- package/dist/components/MaterialUI/Inputs/DatePicker.js +8 -15
- package/dist/components/MaterialUI/Inputs/InputBase.js +16 -102
- package/dist/components/MaterialUI/Inputs/InputBaseProps.js +1 -7
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +46 -43
- package/dist/components/MaterialUI/Inputs/TimePicker.js +2 -5
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +1 -6
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +0 -1
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +1 -3
- package/dist/components/Routing/Page.js +1 -4
- package/dist/components/Routing/SegmentPage.js +1 -4
- package/dist/components/Routing/SubPage.js +8 -38
- package/dist/components/Scope/useScopeConfirmationModalState.js +3 -1
- package/dist/constants.js +2 -18
- package/dist/content/icons/hide.svg +1 -10
- package/dist/content/icons/open-in-new-tab.svg +1 -3
- package/dist/content/iconsSheet.svg +650 -117
- package/dist/content/orckestra-logo-white.png +0 -0
- package/dist/hooks/useEditState.js +2 -4
- package/dist/reducers/modules.js +3 -4
- package/dist/reducers/navigation.js +0 -16
- package/dist/reducers/request.js +1 -6
- package/dist/reducers/scopes.js +0 -3
- package/dist/reducers/view.js +1 -1
- package/dist/selectors/authentication.js +1 -15
- package/dist/selectors/metadata.js +1 -1
- package/dist/sharedMessages.js +1 -17
- package/dist/utils/propertyHelper.js +0 -33
- package/dist/utils/timezoneHelper.js +1 -23
- package/package.json +7 -10
- package/src/actions/modules.js +10 -0
- package/src/actions/modules.test.js +14 -0
- package/src/actions/navigation.js +0 -7
- package/src/actions/navigation.test.js +0 -12
- package/src/actions/scopes.js +1 -2
- package/src/actions/scopes.test.js +1 -2
- package/src/buildStore.js +0 -6
- package/src/components/AppFrame/About.test.js +3 -3
- package/src/components/AppFrame/Sidebar.js +3 -4
- package/src/components/Form/InputField.test.js +0 -18
- package/src/components/Form/Inputs/Date.test.js +0 -18
- package/src/components/MaterialUI/DataDisplay/Notification.js +0 -6
- package/src/components/MaterialUI/DataDisplay/Notification.test.js +0 -37
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +5 -23
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.test.js +0 -121
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +1 -2
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.test.js +0 -20
- package/src/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +1 -2
- package/src/components/MaterialUI/DataDisplay/tableHelpers.js +8 -8
- package/src/components/MaterialUI/DataDisplay/tableHelpers.test.js +0 -93
- package/src/components/MaterialUI/Inputs/Autocomplete.js +0 -5
- package/src/components/MaterialUI/Inputs/Autocomplete.test.js +0 -15
- package/src/components/MaterialUI/Inputs/DatePicker.js +3 -17
- package/src/components/MaterialUI/Inputs/DatePicker.test.js +1 -143
- package/src/components/MaterialUI/Inputs/InputBase.js +15 -103
- package/src/components/MaterialUI/Inputs/InputBase.test.js +1 -376
- package/src/components/MaterialUI/Inputs/InputBaseProps.js +0 -6
- package/src/components/MaterialUI/Inputs/InputBaseProps.test.js +0 -6
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +27 -39
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.test.js +34 -39
- package/src/components/MaterialUI/Inputs/TimePicker.js +1 -5
- package/src/components/MaterialUI/Navigation/DropDownMenu.js +1 -6
- package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.js +0 -1
- package/src/components/MaterialUI/hocs/withDeferredTooltip.js +1 -2
- package/src/components/MaterialUI/hocs/withDeferredTooltip.test.js +0 -52
- package/src/components/Routing/Page.js +1 -12
- package/src/components/Routing/SegmentPage.js +1 -12
- package/src/components/Routing/SubPage.js +9 -41
- package/src/components/Routing/SubPage.test.js +1 -295
- package/src/components/Scope/useScopeConfirmationModalState.js +3 -1
- package/src/components/Scope/useScopeConfirmationModalState.test.js +35 -4
- package/src/components/Text.test.js +59 -44
- package/src/constants.js +0 -15
- package/src/content/icons/hide.svg +1 -10
- package/src/content/icons/open-in-new-tab.svg +1 -3
- package/src/content/iconsSheet.svg +650 -117
- package/src/content/orckestra-logo-white.png +0 -0
- package/src/hooks/useEditState.js +2 -12
- package/src/hooks/useEditState.test.js +1 -1
- package/src/hooks/useLabelMessage.test.js +10 -16
- package/src/reducers/modules.js +4 -4
- package/src/reducers/modules.test.js +5 -5
- package/src/reducers/navigation.js +0 -24
- package/src/reducers/navigation.test.js +0 -38
- package/src/reducers/request.js +1 -6
- package/src/reducers/request.test.js +0 -34
- package/src/reducers/scopes.js +0 -3
- package/src/reducers/scopes.test.js +0 -47
- package/src/reducers/view.js +1 -1
- package/src/reducers/view.test.js +8 -1
- package/src/selectors/authentication.js +0 -13
- package/src/selectors/authentication.test.js +0 -322
- package/src/selectors/metadata.js +1 -1
- package/src/selectors/metadata.test.js +0 -12
- package/src/sharedMessages.js +1 -17
- package/src/translations/en-US.json +12 -16
- package/src/translations/fr-CA.json +12 -16
- package/src/utils/propertyHelper.js +0 -38
- package/src/utils/propertyHelper.test.js +0 -160
- package/src/utils/timezoneHelper.js +0 -18
- package/src/utils/timezoneHelper.test.js +1 -23
- package/dist/actions/globalErrorMessages.js +0 -63
- package/dist/actions/tasks.js +0 -170
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.js +0 -160
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.js +0 -88
- package/dist/components/TaskDetailsModal.js +0 -191
- package/dist/content/icons/anonymize.svg +0 -3
- package/dist/content/icons/archives.svg +0 -3
- package/dist/content/icons/clean-index.svg +0 -3
- package/dist/content/icons/date-index.svg +0 -3
- package/dist/content/icons/inventory.svg +0 -4
- package/dist/content/icons/query-tester.svg +0 -10
- package/dist/content/icons/reciprocity.svg +0 -10
- package/dist/content/icons/schema.svg +0 -11
- package/dist/content/icons/synonyms.svg +0 -3
- package/dist/content/icons/tenant.svg +0 -3
- package/dist/content/icons/time-index.svg +0 -3
- package/dist/hooks/useDispatchWithErrorHandling.js +0 -103
- package/dist/hooks/useScopeGuardLoader.js +0 -77
- package/dist/reducers/globalErrorMessages.js +0 -78
- package/dist/reducers/scopeRouteState.js +0 -83
- package/dist/reducers/tasks.js +0 -98
- package/dist/selectors/globalErrorMessages.js +0 -57
- package/dist/selectors/scopeRouteState.js +0 -53
- package/dist/selectors/tasks.js +0 -64
- package/dist/utils/responseProcessingHelper.js +0 -86
- package/src/actions/globalErrorMessages.js +0 -12
- package/src/actions/globalErrorMessages.test.js +0 -21
- package/src/actions/tasks.js +0 -77
- package/src/actions/tasks.test.js +0 -169
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.js +0 -108
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.test.js +0 -468
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.js +0 -29
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.test.js +0 -147
- package/src/components/TaskDetailsModal.js +0 -132
- package/src/components/TaskDetailsModal.test.js +0 -317
- package/src/content/icons/anonymize.svg +0 -3
- package/src/content/icons/archives.svg +0 -3
- package/src/content/icons/clean-index.svg +0 -3
- package/src/content/icons/date-index.svg +0 -3
- package/src/content/icons/inventory.svg +0 -4
- package/src/content/icons/query-tester.svg +0 -10
- package/src/content/icons/reciprocity.svg +0 -10
- package/src/content/icons/schema.svg +0 -11
- package/src/content/icons/synonyms.svg +0 -3
- package/src/content/icons/tenant.svg +0 -3
- package/src/content/icons/time-index.svg +0 -3
- package/src/hooks/useDispatchWithErrorHandling.js +0 -57
- package/src/hooks/useDispatchWithErrorHandling.test.js +0 -230
- package/src/hooks/useScopeGuardLoader.js +0 -25
- package/src/hooks/useScopeGuardLoader.test.js +0 -187
- package/src/reducers/globalErrorMessages.js +0 -25
- package/src/reducers/globalErrorMessages.test.js +0 -66
- package/src/reducers/scopeRouteState.js +0 -29
- package/src/reducers/scopeRouteState.test.js +0 -49
- package/src/reducers/tasks.js +0 -56
- package/src/reducers/tasks.test.js +0 -404
- package/src/selectors/globalErrorMessages.js +0 -11
- package/src/selectors/globalErrorMessages.test.js +0 -25
- package/src/selectors/scopeRouteState.js +0 -5
- package/src/selectors/scopeRouteState.test.js +0 -13
- package/src/selectors/tasks.js +0 -16
- package/src/selectors/tasks.test.js +0 -60
- package/src/utils/responseProcessingHelper.js +0 -42
- package/src/utils/responseProcessingHelper.test.js +0 -218
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { makeStyles } from "@material-ui/core/styles";
|
|
3
3
|
import Select from "./Select";
|
|
4
4
|
import SelectProps from "./SelectProps";
|
|
@@ -180,10 +180,6 @@ const TimePicker = ({ value, onChange, showTimeZone, showAMPM, requestedTimeZone
|
|
|
180
180
|
showAMPM = showAMPM ?? isBrowserUsingAMPM();
|
|
181
181
|
const [time, setTime] = useState(parseTime(value || "00:00"));
|
|
182
182
|
|
|
183
|
-
useEffect(() => {
|
|
184
|
-
setTime(parseTime(value || "00:00"));
|
|
185
|
-
}, [value, setTime]);
|
|
186
|
-
|
|
187
183
|
const userTimeZone = getTimeZoneName();
|
|
188
184
|
const localizedTimeZoneName = useSelector(namedLookupLocalizedSelector("customer", "TimeZone", userTimeZone, null));
|
|
189
185
|
|
|
@@ -12,16 +12,11 @@ const useStyles = makeStyles(theme => ({
|
|
|
12
12
|
textTransform: "none",
|
|
13
13
|
color: theme.palette.text.primary,
|
|
14
14
|
borderRadius: 0,
|
|
15
|
-
"&:hover": {
|
|
15
|
+
"&:hover, &:focus": {
|
|
16
16
|
borderRadius: 0,
|
|
17
17
|
boxShadow: "none",
|
|
18
18
|
backgroundColor: theme.palette.primary.light,
|
|
19
19
|
},
|
|
20
|
-
"&:focus, &:active, &.Mui-focusVisible": {
|
|
21
|
-
borderRadius: 0,
|
|
22
|
-
boxShadow: "none",
|
|
23
|
-
outline: "none",
|
|
24
|
-
},
|
|
25
20
|
},
|
|
26
21
|
menu: {
|
|
27
22
|
border: `${theme.spacing(0.1)} solid ${theme.palette.grey.borders}`,
|
|
@@ -8,7 +8,7 @@ import { isString, isObject, isStringNullOrWhitespace, isReactComponent } from "
|
|
|
8
8
|
|
|
9
9
|
const withDeferredTooltip =
|
|
10
10
|
Comp =>
|
|
11
|
-
({ titleValue, alwaysDisplay,
|
|
11
|
+
({ titleValue, alwaysDisplay, ...props }) => {
|
|
12
12
|
const [shouldBeTooltipped, setShouldBeTooltipped] = useState(false);
|
|
13
13
|
|
|
14
14
|
const defaultComponent = <Comp onMouseEnter={event => makeComponentTooltipped(event)} {...props} />;
|
|
@@ -32,7 +32,6 @@ const withDeferredTooltip =
|
|
|
32
32
|
return (
|
|
33
33
|
<MuiTooltip
|
|
34
34
|
arrow
|
|
35
|
-
classes={tooltipClasses ?? null}
|
|
36
35
|
title={titleValue}
|
|
37
36
|
disableHoverListener={false}
|
|
38
37
|
disableFocusListener={true}
|
|
@@ -155,56 +155,4 @@ describe("withDeferredTooltip", () => {
|
|
|
155
155
|
|
|
156
156
|
expect(wrapper.prop("onMouseEnter"), "to be", undefined);
|
|
157
157
|
});
|
|
158
|
-
|
|
159
|
-
it("Always displays passed title in tooltip with tooltip classes when specified", () => {
|
|
160
|
-
const Wrapper = props => <ComponentToBeTooltipped {...props} />;
|
|
161
|
-
|
|
162
|
-
const TooltippedCompponent = withDeferredTooltip(Wrapper);
|
|
163
|
-
|
|
164
|
-
const mountedTooltippedComponent = shallow(
|
|
165
|
-
<TooltippedCompponent alwaysDisplay titleValue="test" tooltipClasses={{ classTest: "testMyMojo" }} />,
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
const event = {
|
|
169
|
-
target: {
|
|
170
|
-
offsetWidth: 100,
|
|
171
|
-
scrollWidth: 100,
|
|
172
|
-
},
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
mountedTooltippedComponent.find(Wrapper).invoke("onMouseEnter")(event);
|
|
176
|
-
|
|
177
|
-
let expected = (
|
|
178
|
-
<MuiTooltip title="test" classes={{ classTest: "testMyMojo" }}>
|
|
179
|
-
<Wrapper />
|
|
180
|
-
</MuiTooltip>
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
expect(mountedTooltippedComponent.containsMatchingElement(expected), "to be true");
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
it("Always displays passed title in tooltip without tooltip classes when not specified", () => {
|
|
187
|
-
const Wrapper = props => <ComponentToBeTooltipped {...props} />;
|
|
188
|
-
|
|
189
|
-
const TooltippedCompponent = withDeferredTooltip(Wrapper);
|
|
190
|
-
|
|
191
|
-
const mountedTooltippedComponent = shallow(<TooltippedCompponent alwaysDisplay titleValue="test" />);
|
|
192
|
-
|
|
193
|
-
const event = {
|
|
194
|
-
target: {
|
|
195
|
-
offsetWidth: 100,
|
|
196
|
-
scrollWidth: 100,
|
|
197
|
-
},
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
mountedTooltippedComponent.find(Wrapper).invoke("onMouseEnter")(event);
|
|
201
|
-
|
|
202
|
-
let expected = (
|
|
203
|
-
<MuiTooltip title="test" classes={null}>
|
|
204
|
-
<Wrapper />
|
|
205
|
-
</MuiTooltip>
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
expect(mountedTooltippedComponent.containsMatchingElement(expected), "to be true");
|
|
209
|
-
});
|
|
210
158
|
});
|
|
@@ -4,12 +4,9 @@ import withErrorBoundary from "../../hocs/withErrorBoundary";
|
|
|
4
4
|
import FullPage from "./FullPage";
|
|
5
5
|
import SubPage from "./SubPage";
|
|
6
6
|
import withWaypointing from "./withWaypointing";
|
|
7
|
-
import UrlPattern from "url-pattern";
|
|
8
7
|
|
|
9
8
|
const Page = ({ component: View, path, pages = {}, subpages = {}, modulePrependPath, isVisible = true }) => {
|
|
10
9
|
const WrappedView = useMemo(() => withErrorBoundary(path)(withWaypointing(View, isVisible)), [path, View, isVisible]);
|
|
11
|
-
const parentUrlPattern = new UrlPattern(path);
|
|
12
|
-
|
|
13
10
|
return (
|
|
14
11
|
<React.Fragment>
|
|
15
12
|
<Switch>
|
|
@@ -41,15 +38,7 @@ const Page = ({ component: View, path, pages = {}, subpages = {}, modulePrependP
|
|
|
41
38
|
<Route
|
|
42
39
|
key={subpath}
|
|
43
40
|
path={path + subpath}
|
|
44
|
-
render={route =>
|
|
45
|
-
<SubPage
|
|
46
|
-
root={path}
|
|
47
|
-
config={config}
|
|
48
|
-
parentUrlPattern={parentUrlPattern}
|
|
49
|
-
{...route}
|
|
50
|
-
modulePrependPath={modulePrependPath}
|
|
51
|
-
/>
|
|
52
|
-
)}
|
|
41
|
+
render={route => <SubPage root={path} config={config} {...route} modulePrependPath={modulePrependPath} />}
|
|
53
42
|
/>
|
|
54
43
|
))}
|
|
55
44
|
</Switch>
|
|
@@ -197,9 +197,6 @@ const SegmentPage = ({
|
|
|
197
197
|
);
|
|
198
198
|
}
|
|
199
199
|
if (config.subpages) {
|
|
200
|
-
const parentUrl = path + segpath;
|
|
201
|
-
const parentUrlPattern = new UrlPattern(parentUrl);
|
|
202
|
-
|
|
203
200
|
subpages.push(
|
|
204
201
|
...Object.entries(config.subpages).map(([subpath, config]) => {
|
|
205
202
|
const pagePath = segpath + subpath;
|
|
@@ -207,15 +204,7 @@ const SegmentPage = ({
|
|
|
207
204
|
<Route
|
|
208
205
|
key={pagePath}
|
|
209
206
|
path={path + pagePath}
|
|
210
|
-
render={route =>
|
|
211
|
-
<SubPage
|
|
212
|
-
root={path}
|
|
213
|
-
config={config}
|
|
214
|
-
parentUrlPattern={parentUrlPattern}
|
|
215
|
-
{...route}
|
|
216
|
-
modulePrependPath={modulePrependPath}
|
|
217
|
-
/>
|
|
218
|
-
)}
|
|
207
|
+
render={route => <SubPage root={path} config={config} {...route} modulePrependPath={modulePrependPath} />}
|
|
219
208
|
/>
|
|
220
209
|
);
|
|
221
210
|
}),
|
|
@@ -20,19 +20,22 @@ const useStyles = makeStyles(theme => ({
|
|
|
20
20
|
},
|
|
21
21
|
}));
|
|
22
22
|
|
|
23
|
-
export const SubPage = ({ config, match, location, history, root, modulePrependPath
|
|
23
|
+
export const SubPage = ({ config, match, location, history, root, modulePrependPath }) => {
|
|
24
24
|
const classes = useStyles();
|
|
25
25
|
const dispatch = useDispatch();
|
|
26
26
|
let { component: View, ...props } = config;
|
|
27
27
|
const pattern = new UrlPattern(root);
|
|
28
28
|
const baseHref = pattern.stringify(match.params);
|
|
29
|
+
|
|
29
30
|
const path = location.pathname;
|
|
30
31
|
|
|
32
|
+
const basePathArr = path.split("/");
|
|
33
|
+
basePathArr.pop();
|
|
34
|
+
const basePath = basePathArr.join("/");
|
|
31
35
|
const WrappedView = useMemo(() => withErrorBoundary(path)(withWaypointing(View)), [path, View]);
|
|
32
36
|
const closeSubPage = () => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
dispatch(mapHref(parentHref, parentHref));
|
|
37
|
+
history.push(basePath);
|
|
38
|
+
dispatch(mapHref(basePath, basePath));
|
|
36
39
|
};
|
|
37
40
|
|
|
38
41
|
const message = (
|
|
@@ -56,8 +59,9 @@ export const SubPage = ({ config, match, location, history, root, modulePrependP
|
|
|
56
59
|
modalProps.set(ModalProps.propNames.title, titleComponent);
|
|
57
60
|
modalProps.set(ModalProps.propNames.open, true);
|
|
58
61
|
modalProps.set(ModalProps.propNames.type, "fullwidth");
|
|
62
|
+
modalProps.set(ModalProps.propNames.backdropClickCallback, closeSubPage);
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
const actionPanel = (
|
|
61
65
|
<div className={classes.actionPanel}>
|
|
62
66
|
<Button variant="contained" color="primary" disableElevation onClick={closeSubPage}>
|
|
63
67
|
<FormattedMessage {...sharedMessages.close} />
|
|
@@ -65,42 +69,6 @@ export const SubPage = ({ config, match, location, history, root, modulePrependP
|
|
|
65
69
|
</div>
|
|
66
70
|
);
|
|
67
71
|
|
|
68
|
-
if (props.componentProps?.actionPanel()?.length > 0) {
|
|
69
|
-
actionPanel = (
|
|
70
|
-
<div className={classes.actionPanel}>
|
|
71
|
-
{props.componentProps?.actionPanel().map(action => (
|
|
72
|
-
<Button
|
|
73
|
-
key={action.label?.id}
|
|
74
|
-
variant={action.isPrimary ? "contained" : "outlined"}
|
|
75
|
-
color={action.isPrimary ? "primary" : "default"}
|
|
76
|
-
disableElevation={action.isPrimary}
|
|
77
|
-
disabled={action.disabled}
|
|
78
|
-
onClick={e => {
|
|
79
|
-
if (!action.handler) {
|
|
80
|
-
closeSubPage();
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
let actionHandlerResult = action.handler(e);
|
|
85
|
-
if (typeof actionHandlerResult === "object") {
|
|
86
|
-
// promise
|
|
87
|
-
actionHandlerResult.then(actionResult => {
|
|
88
|
-
if (action.validateBeforeClose && !actionResult) return;
|
|
89
|
-
closeSubPage();
|
|
90
|
-
});
|
|
91
|
-
} else {
|
|
92
|
-
if (action.validateBeforeClose && !actionHandlerResult) return;
|
|
93
|
-
closeSubPage();
|
|
94
|
-
}
|
|
95
|
-
}}
|
|
96
|
-
>
|
|
97
|
-
<FormattedMessage {...action.label} />
|
|
98
|
-
</Button>
|
|
99
|
-
))}
|
|
100
|
-
</div>
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
72
|
modalProps.set(ModalProps.propNames.actionPanel, actionPanel);
|
|
105
73
|
|
|
106
74
|
return <Modal message={message} modalProps={modalProps} />;
|
|
@@ -11,9 +11,9 @@ import Modal from "../MaterialUI/DataDisplay/Modal";
|
|
|
11
11
|
import ModalProps from "../MaterialUI/DataDisplay/modalProps";
|
|
12
12
|
import Button from "@material-ui/core/Button";
|
|
13
13
|
import translations from "~/translations/en-US.json";
|
|
14
|
+
|
|
14
15
|
import { TestWrapper, createMuiTheme } from "../../utils/testUtils";
|
|
15
16
|
import sharedMessages from "../../sharedMessages";
|
|
16
|
-
import UrlPattern from "url-pattern";
|
|
17
17
|
|
|
18
18
|
const InnerView = ({ theme, pathname, search, mapFrom, match, location, routeIsAligned, set }) => (
|
|
19
19
|
<PropStruct
|
|
@@ -93,7 +93,6 @@ describe("SubPage", () => {
|
|
|
93
93
|
config={{ component: InnerView, set: true, title: "Item Details" }}
|
|
94
94
|
root="/foo"
|
|
95
95
|
path="/foo/bar"
|
|
96
|
-
parentUrlPattern={new UrlPattern("/foo")}
|
|
97
96
|
{...route}
|
|
98
97
|
/>
|
|
99
98
|
)}
|
|
@@ -142,7 +141,6 @@ describe("SubPage", () => {
|
|
|
142
141
|
config={{ component: InnerView, set: true, title: sharedMessages.confirmation }}
|
|
143
142
|
root="/foo"
|
|
144
143
|
path="/foo/bar"
|
|
145
|
-
parentUrlPattern={new UrlPattern("/foo")}
|
|
146
144
|
{...route}
|
|
147
145
|
/>
|
|
148
146
|
)}
|
|
@@ -167,42 +165,6 @@ describe("SubPage", () => {
|
|
|
167
165
|
config={{ component: InnerView, set: true, title: "Item Details" }}
|
|
168
166
|
root="/foo"
|
|
169
167
|
path="/foo/bar"
|
|
170
|
-
parentUrlPattern={new UrlPattern("/foo")}
|
|
171
|
-
{...route}
|
|
172
|
-
/>
|
|
173
|
-
)}
|
|
174
|
-
/>
|
|
175
|
-
</Router>
|
|
176
|
-
</div>
|
|
177
|
-
</TestWrapper>
|
|
178
|
-
);
|
|
179
|
-
const mountedComponent = mount(component);
|
|
180
|
-
|
|
181
|
-
const closeButton = mountedComponent.find("button").at(0);
|
|
182
|
-
|
|
183
|
-
closeButton.invoke("onClick")();
|
|
184
|
-
expect(history.push, "to have calls satisfying", [{ args: ["/foo"] }]);
|
|
185
|
-
expect(dispatch, "to have calls satisfying", [{ args: [mapHref("/foo", "/foo")] }]);
|
|
186
|
-
});
|
|
187
|
-
it("closing the dialog navigate to the parentUrlPattern with parameters", () => {
|
|
188
|
-
history = createMemoryHistory({ initialEntries: ["/foo/bar/123/456"] });
|
|
189
|
-
sinon.spy(history, "push");
|
|
190
|
-
history.push.named("history.push");
|
|
191
|
-
dispatch.resetHistory();
|
|
192
|
-
|
|
193
|
-
const component = (
|
|
194
|
-
<TestWrapper provider={{ store }} intlProvider={intlProvider} stylesProvider muiThemeProvider={{ theme }}>
|
|
195
|
-
<div>
|
|
196
|
-
<div id="outer" />
|
|
197
|
-
<Router history={history}>
|
|
198
|
-
<Route
|
|
199
|
-
path="/foo/bar/:parentId/:id"
|
|
200
|
-
render={route => (
|
|
201
|
-
<SubPage
|
|
202
|
-
config={{ component: InnerView, set: true, title: "Item Details" }}
|
|
203
|
-
root="/foo/bar/:parentId/:id"
|
|
204
|
-
path="/foo/bar/123/456"
|
|
205
|
-
parentUrlPattern={new UrlPattern("/foo/bar/:parentId")}
|
|
206
168
|
{...route}
|
|
207
169
|
/>
|
|
208
170
|
)}
|
|
@@ -216,263 +178,7 @@ describe("SubPage", () => {
|
|
|
216
178
|
const closeButton = mountedComponent.find("button").at(0);
|
|
217
179
|
|
|
218
180
|
closeButton.invoke("onClick")();
|
|
219
|
-
expect(history.push, "to have calls satisfying", [{ args: ["/foo/bar/123"] }]);
|
|
220
|
-
expect(dispatch, "to have a call satisfying", { args: [mapHref("/foo/bar/123", "/foo/bar/123")] });
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
it("renders action panel passed from props", () => {
|
|
224
|
-
const actions = () => [{ label: sharedMessages.cancel }, { label: sharedMessages.applyChanges }];
|
|
225
|
-
|
|
226
|
-
const component = (
|
|
227
|
-
<TestWrapper provider={{ store }} intlProvider={intlProvider} stylesProvider muiThemeProvider={{ theme }}>
|
|
228
|
-
<div>
|
|
229
|
-
<div id="outer" />
|
|
230
|
-
<Router history={history}>
|
|
231
|
-
<Route
|
|
232
|
-
path="/foo/bar"
|
|
233
|
-
render={route => (
|
|
234
|
-
<SubPage
|
|
235
|
-
config={{
|
|
236
|
-
component: InnerView,
|
|
237
|
-
set: true,
|
|
238
|
-
title: "Item Details",
|
|
239
|
-
componentProps: { actionPanel: actions },
|
|
240
|
-
}}
|
|
241
|
-
root="/foo"
|
|
242
|
-
path="/foo/bar"
|
|
243
|
-
parentUrlPattern={new UrlPattern("/foo")}
|
|
244
|
-
{...route}
|
|
245
|
-
/>
|
|
246
|
-
)}
|
|
247
|
-
/>
|
|
248
|
-
</Router>
|
|
249
|
-
</div>
|
|
250
|
-
</TestWrapper>
|
|
251
|
-
);
|
|
252
|
-
const mountedComponent = mount(component);
|
|
253
|
-
|
|
254
|
-
const closeButton = mountedComponent.find("button").at(0);
|
|
255
|
-
const applyButton = mountedComponent.find("button").at(1);
|
|
256
|
-
|
|
257
|
-
closeButton.invoke("onClick")();
|
|
258
|
-
|
|
259
|
-
expect(applyButton, "not to be", null);
|
|
260
|
-
expect(history.push, "to have calls satisfying", [{ args: ["/foo"] }]);
|
|
261
|
-
expect(dispatch, "to have calls satisfying", [{ args: [mapHref("/foo", "/foo")] }]);
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
it("Executes handler from button received from props", () => {
|
|
265
|
-
const someEvent = sinon.spy().named("someEvent");
|
|
266
|
-
|
|
267
|
-
const actions = () => [{ label: sharedMessages.applyChanges, isPrimary: true, handler: someEvent }];
|
|
268
|
-
|
|
269
|
-
const component = (
|
|
270
|
-
<TestWrapper provider={{ store }} intlProvider={intlProvider} stylesProvider muiThemeProvider={{ theme }}>
|
|
271
|
-
<div>
|
|
272
|
-
<div id="outer" />
|
|
273
|
-
<Router history={history}>
|
|
274
|
-
<Route
|
|
275
|
-
path="/foo/bar"
|
|
276
|
-
render={route => (
|
|
277
|
-
<SubPage
|
|
278
|
-
config={{
|
|
279
|
-
component: InnerView,
|
|
280
|
-
set: true,
|
|
281
|
-
title: "Item Details",
|
|
282
|
-
componentProps: { actionPanel: actions },
|
|
283
|
-
}}
|
|
284
|
-
root="/foo"
|
|
285
|
-
path="/foo/bar"
|
|
286
|
-
parentUrlPattern={new UrlPattern("/foo")}
|
|
287
|
-
{...route}
|
|
288
|
-
/>
|
|
289
|
-
)}
|
|
290
|
-
/>
|
|
291
|
-
</Router>
|
|
292
|
-
</div>
|
|
293
|
-
</TestWrapper>
|
|
294
|
-
);
|
|
295
|
-
const mountedComponent = mount(component);
|
|
296
|
-
|
|
297
|
-
const applyButton = mountedComponent.find("button").at(0);
|
|
298
|
-
|
|
299
|
-
applyButton.invoke("onClick")();
|
|
300
|
-
|
|
301
|
-
const applyButtonClassName = applyButton.props().className;
|
|
302
|
-
expect(applyButtonClassName, "to contain", "MuiButton-contained");
|
|
303
|
-
expect(applyButtonClassName, "to contain", "MuiButton-containedPrimary");
|
|
304
|
-
expect(someEvent, "was called");
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
it("Do not close when clicking action button has validateBeforeClose and result is false", () => {
|
|
308
|
-
const applyHandler = () => false;
|
|
309
|
-
|
|
310
|
-
const actions = () => [
|
|
311
|
-
{ label: sharedMessages.applyChanges, isPrimary: true, handler: applyHandler, validateBeforeClose: true },
|
|
312
|
-
];
|
|
313
|
-
|
|
314
|
-
const component = (
|
|
315
|
-
<TestWrapper provider={{ store }} intlProvider={intlProvider} stylesProvider muiThemeProvider={{ theme }}>
|
|
316
|
-
<div>
|
|
317
|
-
<div id="outer" />
|
|
318
|
-
<Router history={history}>
|
|
319
|
-
<Route
|
|
320
|
-
path="/foo/bar"
|
|
321
|
-
render={route => (
|
|
322
|
-
<SubPage
|
|
323
|
-
config={{
|
|
324
|
-
component: InnerView,
|
|
325
|
-
set: true,
|
|
326
|
-
title: "Item Details",
|
|
327
|
-
componentProps: { actionPanel: actions },
|
|
328
|
-
}}
|
|
329
|
-
root="/foo"
|
|
330
|
-
path="/foo/bar"
|
|
331
|
-
parentUrlPattern={new UrlPattern("/foo")}
|
|
332
|
-
{...route}
|
|
333
|
-
/>
|
|
334
|
-
)}
|
|
335
|
-
/>
|
|
336
|
-
</Router>
|
|
337
|
-
</div>
|
|
338
|
-
</TestWrapper>
|
|
339
|
-
);
|
|
340
|
-
const mountedComponent = mount(component);
|
|
341
|
-
|
|
342
|
-
const applyButton = mountedComponent.find("button").at(0);
|
|
343
|
-
|
|
344
|
-
applyButton.invoke("onClick")();
|
|
345
|
-
expect(history.push, "not to have calls satisfying", [{ args: ["/foo"] }]);
|
|
346
|
-
expect(dispatch, "not to have calls satisfying", [{ args: [mapHref("/foo", "/foo")] }]);
|
|
347
|
-
});
|
|
348
|
-
|
|
349
|
-
it("Close when clicking action button has validateBeforeClose and result is true", () => {
|
|
350
|
-
const applyHandler = () => true;
|
|
351
|
-
|
|
352
|
-
const actions = () => [
|
|
353
|
-
{ label: sharedMessages.applyChanges, isPrimary: true, handler: applyHandler, validateBeforeClose: true },
|
|
354
|
-
];
|
|
355
|
-
|
|
356
|
-
const component = (
|
|
357
|
-
<TestWrapper provider={{ store }} intlProvider={intlProvider} stylesProvider muiThemeProvider={{ theme }}>
|
|
358
|
-
<div>
|
|
359
|
-
<div id="outer" />
|
|
360
|
-
<Router history={history}>
|
|
361
|
-
<Route
|
|
362
|
-
path="/foo/bar"
|
|
363
|
-
render={route => (
|
|
364
|
-
<SubPage
|
|
365
|
-
config={{
|
|
366
|
-
component: InnerView,
|
|
367
|
-
set: true,
|
|
368
|
-
title: "Item Details",
|
|
369
|
-
componentProps: { actionPanel: actions },
|
|
370
|
-
}}
|
|
371
|
-
root="/foo"
|
|
372
|
-
path="/foo/bar"
|
|
373
|
-
parentUrlPattern={new UrlPattern("/foo")}
|
|
374
|
-
{...route}
|
|
375
|
-
/>
|
|
376
|
-
)}
|
|
377
|
-
/>
|
|
378
|
-
</Router>
|
|
379
|
-
</div>
|
|
380
|
-
</TestWrapper>
|
|
381
|
-
);
|
|
382
|
-
const mountedComponent = mount(component);
|
|
383
|
-
|
|
384
|
-
const applyButton = mountedComponent.find("button").at(0);
|
|
385
|
-
|
|
386
|
-
applyButton.invoke("onClick")();
|
|
387
181
|
expect(history.push, "to have calls satisfying", [{ args: ["/foo"] }]);
|
|
388
182
|
expect(dispatch, "to have calls satisfying", [{ args: [mapHref("/foo", "/foo")] }]);
|
|
389
183
|
});
|
|
390
|
-
|
|
391
|
-
it("Close when clicking action button has validateBeforeClose and result as promise with true", () => {
|
|
392
|
-
const applyHandler = () => Promise.resolve(true);
|
|
393
|
-
|
|
394
|
-
const actions = () => [
|
|
395
|
-
{ label: sharedMessages.applyChanges, isPrimary: true, handler: applyHandler, validateBeforeClose: true },
|
|
396
|
-
];
|
|
397
|
-
|
|
398
|
-
const component = (
|
|
399
|
-
<TestWrapper provider={{ store }} intlProvider={intlProvider} stylesProvider muiThemeProvider={{ theme }}>
|
|
400
|
-
<div>
|
|
401
|
-
<div id="outer" />
|
|
402
|
-
<Router history={history}>
|
|
403
|
-
<Route
|
|
404
|
-
path="/foo/bar"
|
|
405
|
-
render={route => (
|
|
406
|
-
<SubPage
|
|
407
|
-
config={{
|
|
408
|
-
component: InnerView,
|
|
409
|
-
set: true,
|
|
410
|
-
title: "Item Details",
|
|
411
|
-
componentProps: { actionPanel: actions },
|
|
412
|
-
}}
|
|
413
|
-
root="/foo"
|
|
414
|
-
path="/foo/bar"
|
|
415
|
-
parentUrlPattern={new UrlPattern("/foo")}
|
|
416
|
-
{...route}
|
|
417
|
-
/>
|
|
418
|
-
)}
|
|
419
|
-
/>
|
|
420
|
-
</Router>
|
|
421
|
-
</div>
|
|
422
|
-
</TestWrapper>
|
|
423
|
-
);
|
|
424
|
-
const mountedComponent = mount(component);
|
|
425
|
-
|
|
426
|
-
const applyButton = mountedComponent.find("button").at(0);
|
|
427
|
-
|
|
428
|
-
applyButton.invoke("onClick")();
|
|
429
|
-
setTimeout(() => {
|
|
430
|
-
expect(history.push, "to have calls satisfying", [{ args: ["/foo"] }]);
|
|
431
|
-
expect(dispatch, "to have calls satisfying", [{ args: [mapHref("/foo", "/foo")] }]);
|
|
432
|
-
}, 200);
|
|
433
|
-
});
|
|
434
|
-
|
|
435
|
-
it("Do not Close when clicking action button has validateBeforeClose and result as promise with false", () => {
|
|
436
|
-
const applyHandler = () => Promise.resolve(false);
|
|
437
|
-
|
|
438
|
-
const actions = () => [
|
|
439
|
-
{ label: sharedMessages.applyChanges, isPrimary: true, handler: applyHandler, validateBeforeClose: true },
|
|
440
|
-
];
|
|
441
|
-
|
|
442
|
-
const component = (
|
|
443
|
-
<TestWrapper provider={{ store }} intlProvider={intlProvider} stylesProvider muiThemeProvider={{ theme }}>
|
|
444
|
-
<div>
|
|
445
|
-
<div id="outer" />
|
|
446
|
-
<Router history={history}>
|
|
447
|
-
<Route
|
|
448
|
-
path="/foo/bar"
|
|
449
|
-
render={route => (
|
|
450
|
-
<SubPage
|
|
451
|
-
config={{
|
|
452
|
-
component: InnerView,
|
|
453
|
-
set: true,
|
|
454
|
-
title: "Item Details",
|
|
455
|
-
componentProps: { actionPanel: actions },
|
|
456
|
-
}}
|
|
457
|
-
root="/foo"
|
|
458
|
-
path="/foo/bar"
|
|
459
|
-
parentUrlPattern={new UrlPattern("/foo")}
|
|
460
|
-
{...route}
|
|
461
|
-
/>
|
|
462
|
-
)}
|
|
463
|
-
/>
|
|
464
|
-
</Router>
|
|
465
|
-
</div>
|
|
466
|
-
</TestWrapper>
|
|
467
|
-
);
|
|
468
|
-
const mountedComponent = mount(component);
|
|
469
|
-
|
|
470
|
-
const applyButton = mountedComponent.find("button").at(0);
|
|
471
|
-
|
|
472
|
-
applyButton.invoke("onClick")();
|
|
473
|
-
setTimeout(() => {
|
|
474
|
-
expect(history.push, "not to have calls satisfying", [{ args: ["/foo"] }]);
|
|
475
|
-
expect(dispatch, "not to have calls satisfying", [{ args: [mapHref("/foo", "/foo")] }]);
|
|
476
|
-
}, 200);
|
|
477
|
-
});
|
|
478
184
|
});
|
|
@@ -6,6 +6,7 @@ import { applicationScopeHasChanged } from "../../actions/scopes";
|
|
|
6
6
|
import useScopeData from "./useScopeData";
|
|
7
7
|
import { hasUnsavedDataSelector } from "../../selectors/view";
|
|
8
8
|
import { scopeConfirmationDialogTypes } from "../../constants";
|
|
9
|
+
import { setNewScopeAndModuleName } from "../../actions/modules";
|
|
9
10
|
|
|
10
11
|
const ExecuteClosingTabHandlerActions = async closingTabHandlerActions => {
|
|
11
12
|
if (closingTabHandlerActions.length <= 0) return Promise.resolve();
|
|
@@ -21,7 +22,8 @@ const useApplicationScopeChanger = closingTabHandlerActions => {
|
|
|
21
22
|
|
|
22
23
|
return (previousScope, newScope) => {
|
|
23
24
|
ExecuteClosingTabHandlerActions(closingTabHandlerActions).then(() => {
|
|
24
|
-
dispatch(
|
|
25
|
+
dispatch(setNewScopeAndModuleName(newScope, moduleName));
|
|
26
|
+
dispatch(applicationScopeHasChanged(previousScope, newScope));
|
|
25
27
|
});
|
|
26
28
|
};
|
|
27
29
|
};
|
|
@@ -5,6 +5,7 @@ import { TestWrapper } from "../../utils/testUtils";
|
|
|
5
5
|
import useScopeConfirmationModalState from "./useScopeConfirmationModalState";
|
|
6
6
|
import { mount } from "enzyme";
|
|
7
7
|
import { APPLICATION_SCOPE_HAS_CHANGED } from "../../actions/scopes";
|
|
8
|
+
import { SET_NEW_SCOPE_AND_MODULE_NAME } from "../../actions/modules";
|
|
8
9
|
|
|
9
10
|
jest.mock("../../utils/buildUrl", () => {
|
|
10
11
|
const modExport = {};
|
|
@@ -179,6 +180,17 @@ describe("useScopeConfirmationModalState", () => {
|
|
|
179
180
|
await new Promise(resolve => setTimeout(resolve, 10));
|
|
180
181
|
|
|
181
182
|
expect(store.dispatch, "to have calls satisfying", [
|
|
183
|
+
{
|
|
184
|
+
args: [
|
|
185
|
+
{
|
|
186
|
+
type: SET_NEW_SCOPE_AND_MODULE_NAME,
|
|
187
|
+
payload: {
|
|
188
|
+
scope: "newScope",
|
|
189
|
+
moduleName: "TheModuleName",
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
},
|
|
182
194
|
{
|
|
183
195
|
args: [
|
|
184
196
|
{
|
|
@@ -186,7 +198,6 @@ describe("useScopeConfirmationModalState", () => {
|
|
|
186
198
|
payload: {
|
|
187
199
|
previousScope: "TheOldScope",
|
|
188
200
|
newScope: "newScope",
|
|
189
|
-
moduleName: "TheModuleName",
|
|
190
201
|
},
|
|
191
202
|
},
|
|
192
203
|
],
|
|
@@ -244,6 +255,17 @@ describe("useScopeConfirmationModalState", () => {
|
|
|
244
255
|
expect(isModalOpened, "to equal", "false");
|
|
245
256
|
|
|
246
257
|
expect(store.dispatch, "to have calls satisfying", [
|
|
258
|
+
{
|
|
259
|
+
args: [
|
|
260
|
+
{
|
|
261
|
+
type: SET_NEW_SCOPE_AND_MODULE_NAME,
|
|
262
|
+
payload: {
|
|
263
|
+
scope: "newScope",
|
|
264
|
+
moduleName: "TheModuleName",
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
},
|
|
247
269
|
{
|
|
248
270
|
args: [
|
|
249
271
|
{
|
|
@@ -251,7 +273,6 @@ describe("useScopeConfirmationModalState", () => {
|
|
|
251
273
|
payload: {
|
|
252
274
|
previousScope: "TheOldScope",
|
|
253
275
|
newScope: "newScope",
|
|
254
|
-
moduleName: "TheModuleName",
|
|
255
276
|
},
|
|
256
277
|
},
|
|
257
278
|
],
|
|
@@ -304,8 +325,19 @@ describe("useScopeConfirmationModalState", () => {
|
|
|
304
325
|
{ args: [null, true] },
|
|
305
326
|
]);
|
|
306
327
|
|
|
307
|
-
expect(store.dispatch.callCount, "to be",
|
|
328
|
+
expect(store.dispatch.callCount, "to be", 2);
|
|
308
329
|
expect(store.dispatch, "to have calls satisfying", [
|
|
330
|
+
{
|
|
331
|
+
args: [
|
|
332
|
+
{
|
|
333
|
+
type: SET_NEW_SCOPE_AND_MODULE_NAME,
|
|
334
|
+
payload: {
|
|
335
|
+
scope: "newScope",
|
|
336
|
+
moduleName: "TheModuleName",
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
],
|
|
340
|
+
},
|
|
309
341
|
{
|
|
310
342
|
args: [
|
|
311
343
|
{
|
|
@@ -313,7 +345,6 @@ describe("useScopeConfirmationModalState", () => {
|
|
|
313
345
|
payload: {
|
|
314
346
|
previousScope: "TheOldScope",
|
|
315
347
|
newScope: "newScope",
|
|
316
|
-
moduleName: "TheModuleName",
|
|
317
348
|
},
|
|
318
349
|
},
|
|
319
350
|
],
|