orc-shared 1.1.0-dev.9 → 1.1.2
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 +73 -3
- package/dist/actions/makeOrcApiAction.js +2 -2
- package/dist/actions/metadata.js +295 -31
- package/dist/actions/navigation.js +3 -3
- 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 +7 -4
- package/dist/components/AppFrame/About.js +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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/List/enhanceColumnDefs.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/List.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/Notification.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/NotificationProps.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +3 -3
- 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 +3 -3
- package/dist/components/MaterialUI/Feedback/useNotification.js +1 -1
- package/dist/components/MaterialUI/Inputs/Autocomplete.js +2 -2
- 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/Select.js +2 -2
- package/dist/components/MaterialUI/Inputs/SelectProps.js +1 -1
- package/dist/components/MaterialUI/Inputs/Switch.js +3 -3
- 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 +3 -3
- 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 +13 -5
- 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 +21 -6
- 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 +3 -3
- package/dist/components/Navigation/Tab.js +1 -1
- package/dist/components/Navigation/useNavigationState.js +30 -4
- 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 +8 -6
- package/dist/components/Routing/withWaypointing.js +10 -4
- package/dist/components/Scope/ScopeNode.js +1 -1
- package/dist/components/Scope/Selector.js +1 -1
- package/dist/components/Scope/index.js +11 -3
- 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 +3 -3
- package/dist/components/Treeview/index.js +2 -2
- 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/getThemeOverrides.js +2 -2
- package/dist/hocs/withInfiniteScroll.js +1 -1
- package/dist/hocs/withUpdateHandler.js +2 -2
- package/dist/hooks/useDispatchWithModulesData.js +1 -1
- package/dist/hooks/useEditState.js +3 -3
- package/dist/hooks/useEntityLoader.js +182 -0
- package/dist/hooks/useFullEntityEditState.js +3 -3
- package/dist/hooks/useInfiniteScroll.js +104 -0
- package/dist/hooks/useLabelMessage.js +3 -3
- package/dist/hooks/useLoader.js +1 -0
- package/dist/hooks/useMultipleFieldEditState.js +2 -2
- 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 +117 -17
- 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 +2 -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/flatten.js +2 -2
- 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/setTranslation.js +27 -1
- package/dist/utils/setTranslationWithFallback.js +33 -3
- 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 +9 -3
- 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 +52 -0
- package/src/components/Routing/Segment.js +5 -2
- package/src/components/Routing/Segment.test.js +22 -1
- package/src/components/Routing/SegmentPage.js +12 -4
- 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 +90 -19
- package/src/selectors/metadata.test.js +532 -123
- package/src/selectors/requestStates.js +12 -0
- package/src/selectors/requestStates.test.js +83 -0
- package/src/selectors/scope.js +1 -1
- 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/setTranslation.js +16 -1
- package/src/utils/setTranslation.test.js +24 -0
- package/src/utils/setTranslationWithFallback.js +19 -2
- package/src/utils/setTranslationWithFallback.test.js +104 -6
- 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
|
@@ -1,88 +1,111 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { FormattedMessage } from "react-intl";
|
|
3
|
+
import sharedMessages from "../../../sharedMessages";
|
|
4
|
+
import Link from "@material-ui/core/Link";
|
|
5
|
+
import Typography from "@material-ui/core/Typography";
|
|
6
|
+
import Grid from "@material-ui/core/Grid";
|
|
7
|
+
import { makeStyles } from "@material-ui/core/styles";
|
|
8
|
+
import classNames from "classnames";
|
|
3
9
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
const useStyles = makeStyles(theme => ({
|
|
11
|
+
popperContainer: {
|
|
12
|
+
cursor: "pointer",
|
|
13
|
+
position: "relative",
|
|
14
|
+
},
|
|
15
|
+
header: {
|
|
16
|
+
borderBottom: `1px solid ${theme.palette.grey.light}`,
|
|
17
|
+
margin: theme.spacing(0),
|
|
18
|
+
padding: `${theme.spacing(1, 2)} !important`,
|
|
19
|
+
width: `calc(100% + ${theme.spacing(2)})`,
|
|
20
|
+
maxWidth: "none",
|
|
21
|
+
flexGrow: 1,
|
|
22
|
+
backgroundColor: theme.palette.grey.lighter,
|
|
23
|
+
textAlign: "center",
|
|
24
|
+
borderRadius: theme.spacing(1, 1, 0, 0),
|
|
25
|
+
},
|
|
26
|
+
content: {
|
|
27
|
+
borderRadius: theme.shape.borderRadius,
|
|
28
|
+
},
|
|
29
|
+
wrapper: {
|
|
30
|
+
backgroundColor: theme.palette.background.paper,
|
|
31
|
+
width: theme.spacing(82),
|
|
32
|
+
borderRadius: theme.spacing(1),
|
|
33
|
+
border: `1px solid ${theme.palette.grey.borders}`,
|
|
34
|
+
boxShadow: `${theme.spacing(0, 0, 2)} rgba(0,0,0,0.5)`,
|
|
35
|
+
position: "relative",
|
|
36
|
+
},
|
|
37
|
+
container: {
|
|
38
|
+
borderRadius: theme.shape.borderRadius,
|
|
39
|
+
textAlign: "center",
|
|
40
|
+
"&:hover": {
|
|
41
|
+
backgroundColor: theme.palette.grey.lighter,
|
|
42
|
+
},
|
|
43
|
+
overflow: "hidden",
|
|
44
|
+
},
|
|
45
|
+
containerSelected: {
|
|
46
|
+
boxShadow: `${theme.spacing(0, 0, 0.8)} ${theme.palette.grey.borders}`,
|
|
47
|
+
},
|
|
48
|
+
appLink: {
|
|
49
|
+
padding: theme.spacing(2),
|
|
50
|
+
display: "block",
|
|
51
|
+
},
|
|
52
|
+
headerTitle: {
|
|
53
|
+
fontSize: theme.typography.h3Size,
|
|
54
|
+
textTransform: theme.typography.button.textTransform,
|
|
55
|
+
fontFamily: theme.typography.button.fontFamily,
|
|
56
|
+
fontWeight: theme.typography.button.fontWeight,
|
|
57
|
+
},
|
|
58
|
+
label: {
|
|
59
|
+
fontSize: theme.typography.h4Size,
|
|
60
|
+
color: theme.palette.text.primary,
|
|
61
|
+
},
|
|
62
|
+
}));
|
|
15
63
|
|
|
16
|
-
export const
|
|
17
|
-
|
|
18
|
-
text-align: center;
|
|
19
|
-
height: 120px;
|
|
20
|
-
display: flex;
|
|
21
|
-
flex-flow: column nowrap;
|
|
22
|
-
align-items: center;
|
|
23
|
-
`;
|
|
24
|
-
export const Link = styled.a``;
|
|
64
|
+
export const ApplicationDialog = ({ toggle, applications, applicationId, applicationOrder }) => {
|
|
65
|
+
const classes = useStyles();
|
|
25
66
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
onClick={
|
|
70
|
-
app.name === applicationId
|
|
71
|
-
? event => {
|
|
72
|
-
event.preventDefault();
|
|
73
|
-
toggle();
|
|
74
|
-
}
|
|
75
|
-
: /* istanbul ignore next */
|
|
76
|
-
() => {}
|
|
77
|
-
}
|
|
78
|
-
>
|
|
79
|
-
<Logo src={app.iconUri} alt={app.displayName} />
|
|
80
|
-
</Link>
|
|
81
|
-
<Label>{app.displayName}</Label>
|
|
82
|
-
{app.name === applicationId ? <Indicator /> : null}
|
|
83
|
-
</Block>
|
|
84
|
-
))}
|
|
85
|
-
</List>
|
|
86
|
-
);
|
|
67
|
+
return (
|
|
68
|
+
<Grid container spacing={2} className={classes.wrapper}>
|
|
69
|
+
<Grid item xs={12} className={classes.header}>
|
|
70
|
+
<Typography
|
|
71
|
+
children={<FormattedMessage {...sharedMessages.appSelectorTitle} />}
|
|
72
|
+
className={classes.headerTitle}
|
|
73
|
+
/>
|
|
74
|
+
</Grid>
|
|
75
|
+
<Grid item container xs={12} className={classes.content}>
|
|
76
|
+
{applications.map(app => (
|
|
77
|
+
<Grid
|
|
78
|
+
className={classNames(classes.container, app.name === applicationId ? classes.containerSelected : "")}
|
|
79
|
+
item
|
|
80
|
+
key={app.name}
|
|
81
|
+
xs={6}
|
|
82
|
+
md={3}
|
|
83
|
+
>
|
|
84
|
+
<Link
|
|
85
|
+
className={classes.appLink}
|
|
86
|
+
id={app.name}
|
|
87
|
+
href={app.url}
|
|
88
|
+
target="_blank"
|
|
89
|
+
underline="none"
|
|
90
|
+
onClick={
|
|
91
|
+
app.name === applicationId
|
|
92
|
+
? event => {
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
toggle();
|
|
95
|
+
}
|
|
96
|
+
: /* istanbul ignore next */
|
|
97
|
+
() => {}
|
|
98
|
+
}
|
|
99
|
+
>
|
|
100
|
+
<img height="60" src={app.iconUri} alt={app.displayName} />
|
|
101
|
+
<br />
|
|
102
|
+
<Typography children={app.displayName} className={classes.label} />
|
|
103
|
+
</Link>
|
|
104
|
+
</Grid>
|
|
105
|
+
))}
|
|
106
|
+
</Grid>
|
|
107
|
+
</Grid>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
87
110
|
|
|
88
111
|
export default ApplicationDialog;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import sinon from "sinon";
|
|
3
|
-
import {
|
|
4
|
-
import ApplicationDialog
|
|
3
|
+
import { extractMessages, TestWrapper, createMuiTheme } from "../../../utils/testUtils";
|
|
4
|
+
import ApplicationDialog from "./ApplicationDialog";
|
|
5
|
+
import Link from "@material-ui/core/Link";
|
|
6
|
+
import Grid from "@material-ui/core/Grid";
|
|
7
|
+
import sharedMessages from "~/sharedMessages";
|
|
8
|
+
import { mount } from "enzyme";
|
|
5
9
|
|
|
10
|
+
const messages = extractMessages(sharedMessages);
|
|
6
11
|
describe("ApplicationDialog", () => {
|
|
12
|
+
const theme = createMuiTheme();
|
|
13
|
+
|
|
7
14
|
let toggle, applications;
|
|
8
15
|
beforeEach(() => {
|
|
9
16
|
toggle = sinon.spy().named("toggle");
|
|
@@ -23,30 +30,60 @@ describe("ApplicationDialog", () => {
|
|
|
23
30
|
];
|
|
24
31
|
});
|
|
25
32
|
|
|
26
|
-
it("renders a dialog structure listing applications", () =>
|
|
33
|
+
it("renders a dialog structure listing applications", () => {
|
|
34
|
+
const component = (
|
|
35
|
+
<TestWrapper intlProvider={{ messages }} stylesProvider muiThemeProvider={{ theme }}>
|
|
36
|
+
<ApplicationDialog toggle={toggle} applications={applications} applicationId="ChosenId" />
|
|
37
|
+
</TestWrapper>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const expected = (
|
|
41
|
+
<TestWrapper intlProvider={{ messages }} stylesProvider muiThemeProvider={{ theme }}>
|
|
42
|
+
<Grid>
|
|
43
|
+
<Grid>
|
|
44
|
+
<p>Orckestra Commerce Cloud Applications List</p>
|
|
45
|
+
</Grid>
|
|
46
|
+
<Grid>
|
|
47
|
+
<Grid key="ChosenId">
|
|
48
|
+
<Link href="/test/url" underline="none">
|
|
49
|
+
<img src="/url/to/img1.png" alt="Current App" />
|
|
50
|
+
<br />
|
|
51
|
+
<p>Current App</p>
|
|
52
|
+
</Link>
|
|
53
|
+
</Grid>
|
|
54
|
+
<Grid key="OtherId">
|
|
55
|
+
<Link href="/test/some/other/url" underline="none">
|
|
56
|
+
<img src="/url/to/img2.png" alt="Other App" />
|
|
57
|
+
<br />
|
|
58
|
+
<p>Other App</p>
|
|
59
|
+
</Link>
|
|
60
|
+
</Grid>
|
|
61
|
+
</Grid>
|
|
62
|
+
</Grid>
|
|
63
|
+
</TestWrapper>
|
|
64
|
+
);
|
|
65
|
+
expect(component, "when mounted", "to satisfy", expected);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("triggers toggle when the current app link is clicked", () => {
|
|
69
|
+
const component = (
|
|
70
|
+
<TestWrapper intlProvider={{ messages }} stylesProvider muiThemeProvider={{ theme }}>
|
|
71
|
+
<ApplicationDialog toggle={toggle} applications={applications} applicationId="ChosenId" />
|
|
72
|
+
</TestWrapper>
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const mountedComponent = mount(component);
|
|
76
|
+
|
|
77
|
+
const currAppLink = mountedComponent.find(Link).at(0);
|
|
78
|
+
currAppLink.simulate("click");
|
|
79
|
+
expect(toggle, "was called once");
|
|
80
|
+
});
|
|
81
|
+
/*
|
|
27
82
|
expect(
|
|
28
83
|
<ApplicationDialog toggle={toggle} applications={applications} applicationId="ChosenId" />,
|
|
29
84
|
"when mounted",
|
|
30
|
-
"with event",
|
|
31
|
-
{
|
|
32
|
-
type: "click",
|
|
33
|
-
target: getStyledClassSelector(Link) + '[href="/test/url"]',
|
|
34
|
-
},
|
|
35
85
|
"to satisfy",
|
|
36
|
-
|
|
37
|
-
<Block key="ChosenId">
|
|
38
|
-
<Link id="ChosenId" href="/test/url">
|
|
39
|
-
<Logo src="/url/to/img1.png" />
|
|
40
|
-
</Link>
|
|
41
|
-
<Label>Current App</Label>
|
|
42
|
-
<Indicator />
|
|
43
|
-
</Block>
|
|
44
|
-
<Block key="OtherId">
|
|
45
|
-
<Link id="OtherId" href="/test/some/other/url">
|
|
46
|
-
<Logo src="/url/to/img2.png" />
|
|
47
|
-
</Link>
|
|
48
|
-
<Label>Other App</Label>
|
|
49
|
-
</Block>
|
|
50
|
-
</List>,
|
|
86
|
+
,
|
|
51
87
|
).then(() => expect(toggle, "was called once")));
|
|
88
|
+
*/
|
|
52
89
|
});
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { extractMessages, TestWrapper, createMuiTheme } from "../../../utils/testUtils";
|
|
3
|
+
import ApplicationSelector from "./index";
|
|
4
|
+
import PopperedIcon from "../../MaterialUI/DataDisplay/PopperedElements/PopperedIcon";
|
|
5
|
+
import ApplicationDialog from "./ApplicationDialog";
|
|
6
|
+
import sharedMessages from "~/sharedMessages";
|
|
7
|
+
|
|
8
|
+
const messages = extractMessages(sharedMessages);
|
|
5
9
|
|
|
6
10
|
describe("ApplicationSelector", () => {
|
|
7
|
-
|
|
11
|
+
const theme = createMuiTheme();
|
|
12
|
+
|
|
13
|
+
let props, applications, thisApp;
|
|
8
14
|
beforeEach(() => {
|
|
9
15
|
thisApp = {
|
|
10
16
|
name: "current",
|
|
@@ -26,92 +32,19 @@ describe("ApplicationSelector", () => {
|
|
|
26
32
|
applications,
|
|
27
33
|
applicationId: "current",
|
|
28
34
|
};
|
|
29
|
-
modalRoot = document.createElement("div");
|
|
30
|
-
modalRoot.id = "modal";
|
|
31
|
-
document.body.appendChild(modalRoot);
|
|
32
|
-
});
|
|
33
|
-
afterEach(() => {
|
|
34
|
-
document.body.removeChild(modalRoot);
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
it("renders a
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
<
|
|
46
|
-
</
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
modalRoot,
|
|
50
|
-
"to contain",
|
|
51
|
-
<List>
|
|
52
|
-
<Block key="current">
|
|
53
|
-
<Link href="/test/url">
|
|
54
|
-
<Logo src="/url/to/img1.png" />
|
|
55
|
-
</Link>
|
|
56
|
-
<Label>Test label</Label>
|
|
57
|
-
<Indicator />
|
|
58
|
-
</Block>
|
|
59
|
-
<Block key="other">
|
|
60
|
-
<Link href="/test/elsewhere">
|
|
61
|
-
<Logo src="/url/to/img2.png" />
|
|
62
|
-
</Link>
|
|
63
|
-
<Label>Test again</Label>
|
|
64
|
-
</Block>
|
|
65
|
-
</List>,
|
|
66
|
-
),
|
|
67
|
-
));
|
|
68
|
-
|
|
69
|
-
describe("getAnchor", () => {
|
|
70
|
-
let toggle;
|
|
71
|
-
beforeEach(() => {
|
|
72
|
-
toggle = () => {};
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it("takes props and returns a header render function", () =>
|
|
76
|
-
expect(
|
|
77
|
-
getAnchor,
|
|
78
|
-
"when called with",
|
|
79
|
-
["foo", props],
|
|
80
|
-
"when called with",
|
|
81
|
-
[toggle],
|
|
82
|
-
"to equal",
|
|
83
|
-
<Header className="foo" open application={thisApp} toggle={toggle} />,
|
|
84
|
-
));
|
|
85
|
-
|
|
86
|
-
it("handles a missing app list", () => {
|
|
87
|
-
delete props.applications;
|
|
88
|
-
return expect(
|
|
89
|
-
getAnchor,
|
|
90
|
-
"when called with",
|
|
91
|
-
["foo", props],
|
|
92
|
-
"when called with",
|
|
93
|
-
[toggle],
|
|
94
|
-
"to equal",
|
|
95
|
-
<Header className="foo" open toggle={toggle} />,
|
|
96
|
-
);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
describe("getDialog", () => {
|
|
101
|
-
let toggle;
|
|
102
|
-
beforeEach(() => {
|
|
103
|
-
toggle = () => {};
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it("takes props and returns a header render function", () =>
|
|
107
|
-
expect(
|
|
108
|
-
getDialog,
|
|
109
|
-
"when called with",
|
|
110
|
-
[props],
|
|
111
|
-
"when called with",
|
|
112
|
-
[toggle],
|
|
113
|
-
"to equal",
|
|
114
|
-
<ApplicationDialog open applications={applications} applicationId={props.applicationId} toggle={toggle} />,
|
|
115
|
-
));
|
|
37
|
+
it("renders a poppered application selector dialog", () => {
|
|
38
|
+
const component = (
|
|
39
|
+
<TestWrapper intlProvider={{ messages }} stylesProvider muiThemeProvider={{ theme }}>
|
|
40
|
+
<ApplicationSelector {...props} />
|
|
41
|
+
</TestWrapper>
|
|
42
|
+
);
|
|
43
|
+
const expected = (
|
|
44
|
+
<TestWrapper intlProvider={{ messages }} stylesProvider muiThemeProvider={{ theme }}>
|
|
45
|
+
<PopperedIcon popperValue={<ApplicationDialog {...props} />} id="app-list" placement="bottom-start" />
|
|
46
|
+
</TestWrapper>
|
|
47
|
+
);
|
|
48
|
+
expect(component, "when mounted", "to satisfy", expected);
|
|
116
49
|
});
|
|
117
50
|
});
|
|
@@ -1,24 +1,43 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import Header from "./Header";
|
|
3
2
|
import ApplicationDialog from "./ApplicationDialog";
|
|
4
|
-
import
|
|
3
|
+
import PopperedIcon from "../../MaterialUI/DataDisplay/PopperedElements/PopperedIcon";
|
|
4
|
+
import { makeStyles } from "@material-ui/core/styles";
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const useStyles = makeStyles(theme => ({
|
|
7
|
+
popperContainer: {
|
|
8
|
+
cursor: "pointer",
|
|
9
|
+
position: "relative",
|
|
10
|
+
fontSize: theme.spacing(2.4),
|
|
11
|
+
padding: theme.spacing(0.5, 1.3),
|
|
12
|
+
"& svg": {
|
|
13
|
+
color: theme.palette.grey.icon,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
arrow: {
|
|
17
|
+
top: 0,
|
|
18
|
+
left: theme.spacing(1),
|
|
19
|
+
width: theme.spacing(1),
|
|
20
|
+
height: theme.spacing(1),
|
|
21
|
+
transform: "translateX(-50%) rotate(45deg)",
|
|
22
|
+
marginTop: theme.spacing(-1.5),
|
|
23
|
+
backgroundColor: theme.palette.grey.lighter,
|
|
24
|
+
border: "1px solid",
|
|
25
|
+
borderColor: `${theme.palette.grey.borders} transparent transparent ${theme.palette.grey.borders}`,
|
|
26
|
+
zIndex: 2000,
|
|
27
|
+
position: "absolute",
|
|
28
|
+
},
|
|
29
|
+
}));
|
|
7
30
|
|
|
8
|
-
|
|
9
|
-
(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
31
|
+
const ApplicationSelector = ({ className, ...props }) => {
|
|
32
|
+
const classes = useStyles();
|
|
33
|
+
return (
|
|
34
|
+
<PopperedIcon
|
|
35
|
+
popperValue={<ApplicationDialog {...props} />}
|
|
36
|
+
id="app-list"
|
|
37
|
+
classprop={classes}
|
|
38
|
+
placement="bottom-start"
|
|
15
39
|
/>
|
|
16
40
|
);
|
|
17
|
-
|
|
18
|
-
export const getDialog = props => toggle => <ApplicationDialog {...props} toggle={toggle} />;
|
|
19
|
-
|
|
20
|
-
const ApplicationSelector = ({ className, ...props }) => {
|
|
21
|
-
return <Modal anchor={getAnchor(className, props)} content={getDialog(props)} look="dark" />;
|
|
22
41
|
};
|
|
23
42
|
|
|
24
43
|
export default ApplicationSelector;
|
|
@@ -9,7 +9,7 @@ import { VIEW_STATE_SET_FIELD } from "../../actions/view";
|
|
|
9
9
|
import { SIGN_OUT_REQUEST, SIGN_OUT_SUCCESS, SIGN_OUT_FAILURE } from "../../actions/authentication";
|
|
10
10
|
import { PREFS_NAME } from "./Preferences";
|
|
11
11
|
import { ABOUT_NAME } from "./About";
|
|
12
|
-
import
|
|
12
|
+
import ApplicationSelector from "./ApplicationSelector";
|
|
13
13
|
import { Wrapper as MenuWrapper } from "../DropMenu";
|
|
14
14
|
import Topbar, { Wrapper, AppBox, CurrentApp, AppLabel, AppLogo, useMenuProps } from "./Topbar";
|
|
15
15
|
import { HelpLink } from "./Help";
|
|
@@ -79,9 +79,7 @@ describe("Topbar", () => {
|
|
|
79
79
|
"to satisfy",
|
|
80
80
|
<Wrapper onClick={clicker}>
|
|
81
81
|
<AppBox>
|
|
82
|
-
<
|
|
83
|
-
<MenuIcon />
|
|
84
|
-
</AppSelWrapper>
|
|
82
|
+
<ApplicationSelector {...props} />
|
|
85
83
|
<AppLabel>
|
|
86
84
|
<AppLogo src="/test/url" />
|
|
87
85
|
Test label
|
|
@@ -11,10 +11,13 @@ const useStyles = makeStyles(theme => ({
|
|
|
11
11
|
fontSize: theme.spacing(1.2),
|
|
12
12
|
marginBottom: theme.spacing(0.6),
|
|
13
13
|
},
|
|
14
|
-
|
|
14
|
+
listHeight: {
|
|
15
|
+
height: props => props.height && theme.spacing(props.height),
|
|
16
|
+
},
|
|
15
17
|
paper: {
|
|
18
|
+
flexGrow: 1,
|
|
19
|
+
height: "1px", // forces the container to takes 100%
|
|
16
20
|
overflow: "auto",
|
|
17
|
-
height: props => theme.spacing(props.height),
|
|
18
21
|
border: `1px solid ${theme.palette.primary.light}`,
|
|
19
22
|
borderRadius: theme.shape.borderRadius,
|
|
20
23
|
boxShadow: "none",
|
|
@@ -38,6 +41,11 @@ const useStyles = makeStyles(theme => ({
|
|
|
38
41
|
actionPanel: {
|
|
39
42
|
paddingTop: theme.spacing(2),
|
|
40
43
|
},
|
|
44
|
+
listContainer: {
|
|
45
|
+
display: "flex",
|
|
46
|
+
flexDirection: "column",
|
|
47
|
+
height: "100%",
|
|
48
|
+
},
|
|
41
49
|
}));
|
|
42
50
|
|
|
43
51
|
const defaultInfoPanelXs = 6;
|
|
@@ -74,7 +82,7 @@ const SelectionList = ({
|
|
|
74
82
|
useEffect(() => {
|
|
75
83
|
const listDataIds = listData.data.map(d => d.id);
|
|
76
84
|
const checkedFromList = listDataIds.filter(l => checked.includes(l));
|
|
77
|
-
if (defaultSelection && checkedFromList.length === 0) {
|
|
85
|
+
if (defaultSelection && checkedFromList.length === 0 && checked[0] !== defaultSelection) {
|
|
78
86
|
setChecked([defaultSelection]);
|
|
79
87
|
}
|
|
80
88
|
}, [defaultSelection, checked, listData.data]);
|
|
@@ -101,7 +109,7 @@ const SelectionList = ({
|
|
|
101
109
|
const dividerDiff = showDivider ? 1 : 0;
|
|
102
110
|
|
|
103
111
|
const listComponent = (
|
|
104
|
-
|
|
112
|
+
<div className={classes.listContainer}>
|
|
105
113
|
<div className={classes.title}>{listData.title}</div>
|
|
106
114
|
<ScrollableCustomList
|
|
107
115
|
ref={refScrollableList}
|
|
@@ -118,7 +126,7 @@ const SelectionList = ({
|
|
|
118
126
|
onChange={onChangeEvent}
|
|
119
127
|
/>
|
|
120
128
|
{actionPanel ? <div className={classes.actionPanel}>{actionPanel}</div> : null}
|
|
121
|
-
|
|
129
|
+
</div>
|
|
122
130
|
);
|
|
123
131
|
|
|
124
132
|
const dividerComponent = showDivider && (
|
|
@@ -129,7 +137,7 @@ const SelectionList = ({
|
|
|
129
137
|
|
|
130
138
|
return (
|
|
131
139
|
<Grid container spacing={2}>
|
|
132
|
-
<Grid item xs={12 - infoPanelXs - dividerDiff}>
|
|
140
|
+
<Grid item xs={12 - infoPanelXs - dividerDiff} className={classes.listHeight}>
|
|
133
141
|
{listComponent}
|
|
134
142
|
</Grid>
|
|
135
143
|
{dividerComponent}
|
|
@@ -33,8 +33,10 @@ describe("SelectionList", () => {
|
|
|
33
33
|
<TestWrapper intlProvider={{ messages }}>
|
|
34
34
|
<Grid>
|
|
35
35
|
<Grid>
|
|
36
|
-
<div>
|
|
37
|
-
|
|
36
|
+
<div>
|
|
37
|
+
<div>{listTitle}</div>
|
|
38
|
+
<ScrollableCustomList checked={[]} items={list} classes={{}} />
|
|
39
|
+
</div>
|
|
38
40
|
</Grid>
|
|
39
41
|
<Grid>
|
|
40
42
|
<div></div>
|
|
@@ -60,8 +62,10 @@ describe("SelectionList", () => {
|
|
|
60
62
|
<TestWrapper intlProvider={{ messages }}>
|
|
61
63
|
<Grid>
|
|
62
64
|
<Grid>
|
|
63
|
-
<div>
|
|
64
|
-
|
|
65
|
+
<div>
|
|
66
|
+
<div>{listTitle}</div>
|
|
67
|
+
<ScrollableCustomList checked={[]} items={list} classes={{}} />
|
|
68
|
+
</div>
|
|
65
69
|
</Grid>
|
|
66
70
|
<Grid>
|
|
67
71
|
<div></div>
|
|
@@ -86,8 +90,10 @@ describe("SelectionList", () => {
|
|
|
86
90
|
const expected = (
|
|
87
91
|
<Grid>
|
|
88
92
|
<Grid>
|
|
89
|
-
<div>
|
|
90
|
-
|
|
93
|
+
<div>
|
|
94
|
+
<div>{listTitle}</div>
|
|
95
|
+
<ScrollableCustomList checked={[]} items={list} classes={{}} />
|
|
96
|
+
</div>
|
|
91
97
|
</Grid>
|
|
92
98
|
<Grid>
|
|
93
99
|
<hr />
|
|
@@ -117,9 +123,11 @@ describe("SelectionList", () => {
|
|
|
117
123
|
const expected = (
|
|
118
124
|
<Grid>
|
|
119
125
|
<Grid>
|
|
120
|
-
<div>
|
|
121
|
-
|
|
122
|
-
|
|
126
|
+
<div>
|
|
127
|
+
<div>{listTitle}</div>
|
|
128
|
+
<ScrollableCustomList checked={[]} items={list} classes={{}} />
|
|
129
|
+
<div>{actionPanel}</div>
|
|
130
|
+
</div>
|
|
123
131
|
</Grid>
|
|
124
132
|
<Grid>
|
|
125
133
|
<hr />
|
|
@@ -145,8 +153,10 @@ describe("SelectionList", () => {
|
|
|
145
153
|
const expected = (
|
|
146
154
|
<Grid>
|
|
147
155
|
<Grid>
|
|
148
|
-
<div>
|
|
149
|
-
|
|
156
|
+
<div>
|
|
157
|
+
<div>{listTitle}</div>
|
|
158
|
+
<ScrollableCustomList checked={[]} items={list} classes={{}} />
|
|
159
|
+
</div>
|
|
150
160
|
</Grid>
|
|
151
161
|
<Grid>
|
|
152
162
|
<div>Test</div>
|