orc-shared 1.1.0-dev.9 → 1.2.0-dev.10
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/modules.js +63 -1
- 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 +59 -22
- 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 +6 -5
- package/dist/components/AppFrame/ApplicationSelector/ApplicationDialog.js +115 -62
- package/dist/components/AppFrame/ApplicationSelector/index.js +45 -47
- package/dist/components/AppFrame/MenuItem.js +6 -15
- package/dist/components/AppFrame/Preferences.js +3 -3
- package/dist/components/AppFrame/Sidebar.js +20 -9
- package/dist/components/AppFrame/Topbar.js +1 -1
- package/dist/components/ApplicationModuleLoader.js +143 -0
- package/dist/components/Authenticate.js +13 -13
- 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/ExternalLink.js +113 -0
- 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 +26 -6
- package/dist/components/MaterialUI/textProps.js +1 -1
- package/dist/components/Modules.js +132 -25
- 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 +5 -1
- package/dist/components/Routing/Page.js +5 -3
- package/dist/components/Routing/Segment.js +4 -3
- package/dist/components/Routing/SegmentPage.js +8 -6
- package/dist/components/Routing/withWaypointing.js +14 -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/useScopeConfirmationModalState.js +7 -16
- package/dist/components/Scope/useScopeData.js +4 -13
- 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 +44 -2
- package/dist/content/icons/html-templates.svg +3 -0
- package/dist/content/icons/lock.svg +3 -0
- package/dist/content/icons/orckestra-icon.svg +5 -0
- package/dist/content/icons/unlock.svg +3 -0
- package/dist/content/iconsSheet.svg +14 -0
- package/dist/content/orckestra-logo-white.png +0 -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/modules.js +39 -1
- package/dist/reducers/requestStates.js +181 -0
- package/dist/reducers/scopes.js +27 -0
- package/dist/reducers/settings.js +31 -2
- 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 +57 -19
- package/dist/selectors/countries.js +1 -1
- package/dist/selectors/locale.js +1 -1
- package/dist/selectors/metadata.js +104 -14
- package/dist/selectors/modules.js +15 -1
- 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 +7 -1
- package/dist/selectors/settings.js +13 -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/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 +6 -9
- 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/modules.js +30 -0
- package/src/actions/modules.test.js +50 -1
- package/src/actions/requestState.js +8 -0
- package/src/actions/requestState.test.js +14 -0
- package/src/actions/requestsApi.js +30 -0
- package/src/actions/scopes.js +33 -7
- package/src/actions/scopes.test.js +84 -14
- package/src/buildStore.js +2 -0
- package/src/components/AppFrame/About.js +2 -2
- package/src/components/AppFrame/AppFrame.test.js +15 -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/MenuItem.js +3 -5
- package/src/components/AppFrame/MenuItem.test.js +2 -24
- package/src/components/AppFrame/Sidebar.js +11 -12
- package/src/components/AppFrame/Sidebar.test.js +18 -0
- package/src/components/AppFrame/Topbar.test.js +2 -4
- package/src/components/ApplicationModuleLoader.js +52 -0
- package/src/components/ApplicationModuleLoader.test.js +149 -0
- package/src/components/Authenticate.js +5 -4
- package/src/components/Authenticate.test.js +23 -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/ExternalLink.js +25 -0
- package/src/components/MaterialUI/Navigation/ExternalLink.test.js +26 -0
- 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 +23 -3
- package/src/components/Modules.js +108 -13
- package/src/components/Modules.test.js +431 -12
- 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/Provision.test.js +34 -0
- package/src/components/Routing/FullPage.js +4 -2
- package/src/components/Routing/FullPage.test.js +75 -0
- package/src/components/Routing/Page.js +2 -2
- package/src/components/Routing/Page.test.js +20 -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 +81 -3
- package/src/components/Scope/Scope.test.js +117 -0
- package/src/components/Scope/index.js +6 -10
- package/src/components/Scope/useScopeConfirmationModalState.js +5 -16
- package/src/components/Scope/useScopeConfirmationModalState.test.js +39 -13
- package/src/components/Scope/useScopeData.js +0 -3
- package/src/components/Scope/useScopeData.test.js +0 -27
- package/src/components/Sidepanel.js +0 -1
- package/src/components/Sidepanel.test.js +0 -3
- package/src/constants.js +33 -0
- package/src/content/icons/html-templates.svg +3 -0
- package/src/content/icons/lock.svg +3 -0
- package/src/content/icons/orckestra-icon.svg +5 -0
- package/src/content/icons/unlock.svg +3 -0
- package/src/content/iconsSheet.svg +14 -0
- package/src/content/orckestra-logo-white.png +0 -0
- package/src/hocs/withScopeData.test.js +0 -31
- 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/modules.js +48 -2
- package/src/reducers/modules.test.js +117 -2
- package/src/reducers/requestStates.js +98 -0
- package/src/reducers/requestStates.test.js +399 -0
- package/src/reducers/scopes.js +30 -0
- package/src/reducers/scopes.test.js +45 -1
- package/src/reducers/settings.js +26 -2
- package/src/reducers/settings.test.js +74 -6
- package/src/selectors/authentication.js +53 -28
- package/src/selectors/authentication.test.js +600 -12
- 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/modules.js +7 -0
- package/src/selectors/modules.test.js +16 -1
- package/src/selectors/requestStates.js +12 -0
- package/src/selectors/requestStates.test.js +83 -0
- package/src/selectors/scope.js +2 -0
- package/src/selectors/scope.test.js +5 -0
- package/src/selectors/settings.js +6 -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
|
@@ -575,6 +575,12 @@ export const createCustomRoleRequest = {
|
|
|
575
575
|
verb: "POST",
|
|
576
576
|
};
|
|
577
577
|
|
|
578
|
+
export const createCustomerLookupTypeDefinitionRequest = {
|
|
579
|
+
name: "createCustomerLookupTypeDefinitionRequest",
|
|
580
|
+
buildUrl: lookupName => buildUrl(["metadata", "lookups", "customer", lookupName]),
|
|
581
|
+
verb: "POST",
|
|
582
|
+
};
|
|
583
|
+
|
|
578
584
|
export const createCustomerMembershipRequest = {
|
|
579
585
|
name: "createCustomerMembershipRequest",
|
|
580
586
|
buildUrl: scopeId => buildUrl(["membership", scopeId]),
|
|
@@ -587,6 +593,12 @@ export const createCustomerRequest = {
|
|
|
587
593
|
verb: "POST",
|
|
588
594
|
};
|
|
589
595
|
|
|
596
|
+
export const updateEntityTypeRequest = {
|
|
597
|
+
name: "updateEntityTypeRequest",
|
|
598
|
+
buildUrl: entityTypeName => buildUrl(["metadata", "EntityType", entityTypeName]),
|
|
599
|
+
verb: "PUT",
|
|
600
|
+
};
|
|
601
|
+
|
|
590
602
|
export const createEntityTypeRequest = {
|
|
591
603
|
name: "createEntityTypeRequest",
|
|
592
604
|
buildUrl: entityTypeName => buildUrl(["metadata", "EntityType", entityTypeName]),
|
|
@@ -705,6 +717,12 @@ export const createOrderDraftPaymentVaultProfileRequest = {
|
|
|
705
717
|
verb: "POST",
|
|
706
718
|
};
|
|
707
719
|
|
|
720
|
+
export const createOrderLookupTypeDefinitionRequest = {
|
|
721
|
+
name: "createOrderLookupTypeDefinitionRequest",
|
|
722
|
+
buildUrl: lookupName => buildUrl(["metadata", "lookups", "order", lookupName]),
|
|
723
|
+
verb: "POST",
|
|
724
|
+
};
|
|
725
|
+
|
|
708
726
|
export const createOrderRequest = {
|
|
709
727
|
name: "createOrderRequest",
|
|
710
728
|
buildUrl: () => buildUrl(["orders"]),
|
|
@@ -3992,6 +4010,12 @@ export const updateCustomerAddressRequest = {
|
|
|
3992
4010
|
verb: "PUT",
|
|
3993
4011
|
};
|
|
3994
4012
|
|
|
4013
|
+
export const updateCustomerLookupTypeDefinitionRequest = {
|
|
4014
|
+
name: "updateCustomerLookupTypeDefinitionRequest",
|
|
4015
|
+
buildUrl: lookupName => buildUrl(["metadata", "lookups", "customer", lookupName]),
|
|
4016
|
+
verb: "PUT",
|
|
4017
|
+
};
|
|
4018
|
+
|
|
3995
4019
|
export const updateCustomerPaymentProfileRequest = {
|
|
3996
4020
|
name: "updateCustomerPaymentProfileRequest",
|
|
3997
4021
|
buildUrl: (scopeId, customerId, paymentProviderName) =>
|
|
@@ -4085,6 +4109,12 @@ export const updateOrderDraftPaymentRequest = {
|
|
|
4085
4109
|
verb: "POST",
|
|
4086
4110
|
};
|
|
4087
4111
|
|
|
4112
|
+
export const updateOrderLookupTypeDefinitionRequest = {
|
|
4113
|
+
name: "updateOrderLookupTypeDefinitionRequest",
|
|
4114
|
+
buildUrl: lookupName => buildUrl(["metadata", "lookups", "order", lookupName]),
|
|
4115
|
+
verb: "PUT",
|
|
4116
|
+
};
|
|
4117
|
+
|
|
4088
4118
|
export const updateOrderSettingsRequest = {
|
|
4089
4119
|
name: "updateOrderSettingsRequest",
|
|
4090
4120
|
buildUrl: () => buildUrl(["orders", "settings"]),
|
package/src/actions/scopes.js
CHANGED
|
@@ -1,26 +1,52 @@
|
|
|
1
1
|
import { makeActionTypes } from "./makeApiAction";
|
|
2
2
|
import makeOrcApiAction from "./makeOrcApiAction";
|
|
3
|
-
import { getUserScopeRequest, getUserScopeTreeRequest } from "./requestsApi";
|
|
3
|
+
import { getApplicationModules, getUserScopeRequest, getUserScopeTreeRequest } from "./requestsApi";
|
|
4
|
+
import { overtureModule } from "../constants";
|
|
4
5
|
|
|
5
|
-
export const
|
|
6
|
-
if (!
|
|
7
|
-
throw new Error('"
|
|
6
|
+
export const validateOvertureApplication = () => {
|
|
7
|
+
if (!OVERTURE_APPLICATION) {
|
|
8
|
+
throw new Error('"overtureApplication.name" is missing in the configuration.');
|
|
8
9
|
}
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
validateOvertureApplication();
|
|
13
|
+
|
|
14
|
+
export const GET_APPLICATION_MODULES = "GET_APPLICATION_MODULES";
|
|
15
|
+
|
|
16
|
+
export const [GET_APPLICATION_MODULES_REQUEST, GET_APPLICATION_MODULES_SUCCESS, GET_APPLICATION_MODULES_FAILURE] =
|
|
17
|
+
makeActionTypes(GET_APPLICATION_MODULES);
|
|
18
|
+
|
|
19
|
+
export const getAppModules = () =>
|
|
20
|
+
makeOrcApiAction(GET_APPLICATION_MODULES, getApplicationModules.buildUrl(OVERTURE_APPLICATION));
|
|
12
21
|
|
|
13
22
|
export const GET_SCOPES = "GET_SCOPES";
|
|
14
23
|
|
|
15
24
|
export const [GET_SCOPES_REQUEST, GET_SCOPES_SUCCESS, GET_SCOPES_FAILURE] = makeActionTypes(GET_SCOPES);
|
|
16
25
|
|
|
17
|
-
export const getScopes =
|
|
26
|
+
export const getScopes = module =>
|
|
27
|
+
makeOrcApiAction(
|
|
28
|
+
GET_SCOPES,
|
|
29
|
+
getUserScopeTreeRequest.buildUrl(module === overtureModule.System ? overtureModule.Orders : module, {}),
|
|
30
|
+
getUserScopeTreeRequest.verb,
|
|
31
|
+
{
|
|
32
|
+
bailout: false,
|
|
33
|
+
meta: { module },
|
|
34
|
+
},
|
|
35
|
+
);
|
|
18
36
|
|
|
19
37
|
export const GET_MY_SCOPE = "GET_MY_SCOPE";
|
|
20
38
|
|
|
21
39
|
export const [GET_MY_SCOPE_REQUEST, GET_MY_SCOPE_SUCCESS, GET_MY_SCOPE_FAILURE] = makeActionTypes(GET_MY_SCOPE);
|
|
22
40
|
|
|
23
|
-
export const getDefaultScope =
|
|
41
|
+
export const getDefaultScope = module =>
|
|
42
|
+
makeOrcApiAction(
|
|
43
|
+
GET_MY_SCOPE,
|
|
44
|
+
getUserScopeRequest.buildUrl(module === overtureModule.System ? overtureModule.Orders : module),
|
|
45
|
+
getUserScopeRequest.verb,
|
|
46
|
+
{
|
|
47
|
+
bailout: false,
|
|
48
|
+
},
|
|
49
|
+
);
|
|
24
50
|
|
|
25
51
|
export const APPLICATION_SCOPE_HAS_CHANGED = "APPLICATION_SCOPE_HAS_CHANGED";
|
|
26
52
|
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { RSAA } from "redux-api-middleware";
|
|
2
2
|
import {
|
|
3
|
-
GET_SCOPES_REQUEST,
|
|
4
|
-
GET_SCOPES_SUCCESS,
|
|
5
|
-
GET_SCOPES_FAILURE,
|
|
6
3
|
getScopes,
|
|
7
4
|
GET_MY_SCOPE_REQUEST,
|
|
8
5
|
GET_MY_SCOPE_SUCCESS,
|
|
9
6
|
GET_MY_SCOPE_FAILURE,
|
|
10
7
|
getDefaultScope,
|
|
11
|
-
|
|
8
|
+
validateOvertureApplication,
|
|
12
9
|
APPLICATION_SCOPE_HAS_CHANGED,
|
|
13
10
|
applicationScopeHasChanged,
|
|
11
|
+
getAppModules,
|
|
12
|
+
GET_APPLICATION_MODULES_REQUEST,
|
|
13
|
+
GET_APPLICATION_MODULES_SUCCESS,
|
|
14
|
+
GET_APPLICATION_MODULES_FAILURE,
|
|
14
15
|
} from "./scopes";
|
|
15
16
|
|
|
16
17
|
jest.mock("../utils/buildUrl", () => {
|
|
@@ -20,19 +21,71 @@ jest.mock("../utils/buildUrl", () => {
|
|
|
20
21
|
return modExport;
|
|
21
22
|
});
|
|
22
23
|
|
|
24
|
+
describe("getAppModules", () => {
|
|
25
|
+
it("creates a RSAA to fetch application modules", () => {
|
|
26
|
+
expect(getAppModules, "when called", "to exhaustively satisfy", {
|
|
27
|
+
[RSAA]: {
|
|
28
|
+
types: [GET_APPLICATION_MODULES_REQUEST, GET_APPLICATION_MODULES_SUCCESS, GET_APPLICATION_MODULES_FAILURE],
|
|
29
|
+
endpoint: 'URL: modules/byApplicationName/anApplication ""',
|
|
30
|
+
method: "GET",
|
|
31
|
+
body: undefined,
|
|
32
|
+
credentials: "include",
|
|
33
|
+
bailout: expect.it("to be a function"),
|
|
34
|
+
headers: {
|
|
35
|
+
Accept: "application/json; charset=utf-8",
|
|
36
|
+
"Content-Type": "application/json",
|
|
37
|
+
},
|
|
38
|
+
options: { redirect: "follow" },
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
23
44
|
describe("getScopes", () => {
|
|
24
|
-
|
|
25
|
-
|
|
45
|
+
let originalApplication;
|
|
46
|
+
|
|
47
|
+
beforeEach(() => {
|
|
48
|
+
originalApplication = global.OVERTURE_APPLICATION;
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
afterEach(() => {
|
|
52
|
+
global.OVERTURE_APPLICATION = originalApplication;
|
|
53
|
+
});
|
|
26
54
|
|
|
27
55
|
it("creates a RSAA to fetch authorized scope tree", () =>
|
|
28
|
-
expect(getScopes, "when called", "to exhaustively satisfy", {
|
|
56
|
+
expect(getScopes, "when called with", ["aModule"], "to exhaustively satisfy", {
|
|
29
57
|
[RSAA]: {
|
|
30
|
-
types: [
|
|
58
|
+
types: [
|
|
59
|
+
{ type: "GET_SCOPES_REQUEST", meta: { module: "aModule" } },
|
|
60
|
+
{ type: "GET_SCOPES_SUCCESS", meta: { module: "aModule" } },
|
|
61
|
+
{ type: "GET_SCOPES_FAILURE", meta: { module: "aModule" } },
|
|
62
|
+
],
|
|
31
63
|
endpoint: "URL: my/scope/aModule/tree {}",
|
|
32
64
|
method: "GET",
|
|
33
65
|
body: undefined,
|
|
34
66
|
credentials: "include",
|
|
35
|
-
bailout:
|
|
67
|
+
bailout: false,
|
|
68
|
+
headers: {
|
|
69
|
+
Accept: "application/json; charset=utf-8",
|
|
70
|
+
"Content-Type": "application/json",
|
|
71
|
+
},
|
|
72
|
+
options: { redirect: "follow" },
|
|
73
|
+
},
|
|
74
|
+
}));
|
|
75
|
+
|
|
76
|
+
it("creates a RSAA to fetch authorized scope tree for system module", () =>
|
|
77
|
+
expect(getScopes, "when called with", ["System"], "to exhaustively satisfy", {
|
|
78
|
+
[RSAA]: {
|
|
79
|
+
types: [
|
|
80
|
+
{ type: "GET_SCOPES_REQUEST", meta: { module: "System" } },
|
|
81
|
+
{ type: "GET_SCOPES_SUCCESS", meta: { module: "System" } },
|
|
82
|
+
{ type: "GET_SCOPES_FAILURE", meta: { module: "System" } },
|
|
83
|
+
],
|
|
84
|
+
endpoint: "URL: my/scope/Order/tree {}",
|
|
85
|
+
method: "GET",
|
|
86
|
+
body: undefined,
|
|
87
|
+
credentials: "include",
|
|
88
|
+
bailout: false,
|
|
36
89
|
headers: {
|
|
37
90
|
Accept: "application/json; charset=utf-8",
|
|
38
91
|
"Content-Type": "application/json",
|
|
@@ -42,14 +95,31 @@ describe("getScopes", () => {
|
|
|
42
95
|
}));
|
|
43
96
|
|
|
44
97
|
it("creates a RSAA to fetch default user scope", () =>
|
|
45
|
-
expect(getDefaultScope, "when called", "to exhaustively satisfy", {
|
|
98
|
+
expect(getDefaultScope, "when called with", ["aModule"], "to exhaustively satisfy", {
|
|
46
99
|
[RSAA]: {
|
|
47
100
|
types: [GET_MY_SCOPE_REQUEST, GET_MY_SCOPE_SUCCESS, GET_MY_SCOPE_FAILURE],
|
|
48
101
|
endpoint: 'URL: my/scope/aModule ""',
|
|
49
102
|
method: "GET",
|
|
50
103
|
body: undefined,
|
|
51
104
|
credentials: "include",
|
|
52
|
-
bailout:
|
|
105
|
+
bailout: false,
|
|
106
|
+
headers: {
|
|
107
|
+
Accept: "application/json; charset=utf-8",
|
|
108
|
+
"Content-Type": "application/json",
|
|
109
|
+
},
|
|
110
|
+
options: { redirect: "follow" },
|
|
111
|
+
},
|
|
112
|
+
}));
|
|
113
|
+
|
|
114
|
+
it("creates a RSAA to fetch default user scope for System module", () =>
|
|
115
|
+
expect(getDefaultScope, "when called with", ["System"], "to exhaustively satisfy", {
|
|
116
|
+
[RSAA]: {
|
|
117
|
+
types: [GET_MY_SCOPE_REQUEST, GET_MY_SCOPE_SUCCESS, GET_MY_SCOPE_FAILURE],
|
|
118
|
+
endpoint: 'URL: my/scope/Order ""',
|
|
119
|
+
method: "GET",
|
|
120
|
+
body: undefined,
|
|
121
|
+
credentials: "include",
|
|
122
|
+
bailout: false,
|
|
53
123
|
headers: {
|
|
54
124
|
Accept: "application/json; charset=utf-8",
|
|
55
125
|
"Content-Type": "application/json",
|
|
@@ -59,11 +129,11 @@ describe("getScopes", () => {
|
|
|
59
129
|
}));
|
|
60
130
|
|
|
61
131
|
it("throws an error if no class found on DOM element", () => {
|
|
62
|
-
global.
|
|
132
|
+
global.OVERTURE_APPLICATION = "";
|
|
63
133
|
expect(
|
|
64
|
-
() => expect(
|
|
134
|
+
() => expect(validateOvertureApplication, "when called with", []),
|
|
65
135
|
"to throw",
|
|
66
|
-
'"
|
|
136
|
+
'"overtureApplication.name" is missing in the configuration.',
|
|
67
137
|
);
|
|
68
138
|
});
|
|
69
139
|
});
|
package/src/buildStore.js
CHANGED
|
@@ -19,6 +19,7 @@ import countriesReducer from "./reducers/countries";
|
|
|
19
19
|
import timezonesReducer from "./reducers/timezones";
|
|
20
20
|
import modulesReducer from "./reducers/modules";
|
|
21
21
|
import metadataReducer from "./reducers/metadata";
|
|
22
|
+
import requestStatesReducer from "./reducers/requestStates";
|
|
22
23
|
|
|
23
24
|
window.BUILD_ID = BUILD_ID;
|
|
24
25
|
window.BUILD_NUMBER = BUILD_NUMBER;
|
|
@@ -63,6 +64,7 @@ const buildStore = (reducers, devOptions = {}) => {
|
|
|
63
64
|
timezones: timezonesReducer,
|
|
64
65
|
modules: modulesReducer,
|
|
65
66
|
metadata: metadataReducer,
|
|
67
|
+
requestStates: requestStatesReducer,
|
|
66
68
|
});
|
|
67
69
|
const rootReducer = buildReducer(reducers);
|
|
68
70
|
|
|
@@ -8,7 +8,7 @@ import Text from "../Text";
|
|
|
8
8
|
import withClickOutside from "../../hocs/withClickOutside";
|
|
9
9
|
import useViewState from "../../hooks/useViewState";
|
|
10
10
|
import bgImage from "../../content/aboutBackground.png";
|
|
11
|
-
import logoImage from "../../content/
|
|
11
|
+
import logoImage from "../../content/orckestra-logo-white.png";
|
|
12
12
|
import close from "../../content/close.png";
|
|
13
13
|
import { getVersionSelector } from "../../selectors/versionInfo";
|
|
14
14
|
import { currentLocaleOrDefault } from "../../selectors/locale";
|
|
@@ -101,7 +101,7 @@ export const About = ({ currentApplication }) => {
|
|
|
101
101
|
<CloseButton onClick={closeAboutBox}>
|
|
102
102
|
<img src={close} alt="X" />
|
|
103
103
|
</CloseButton>
|
|
104
|
-
<img src={logoImage} alt="Orckestra" />
|
|
104
|
+
<img src={logoImage} width="250" alt="Orckestra" />
|
|
105
105
|
<AboutParagraph>
|
|
106
106
|
<Text
|
|
107
107
|
message={{
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "../../actions/applications";
|
|
18
18
|
import { ScopeBar, Bar as BarWrapper } from "../Scope";
|
|
19
19
|
import AppFrame, { Base, ViewPort } from "./AppFrame";
|
|
20
|
-
import
|
|
20
|
+
import ApplicationSelector from "./ApplicationSelector";
|
|
21
21
|
import { Wrapper as MenuWrapper } from "../DropMenu";
|
|
22
22
|
import { Wrapper, AppBox, AppLabel, AppLogo } from "./Topbar";
|
|
23
23
|
import { Bar as SideBar, MenuToggle, Logo } from "./Sidebar";
|
|
@@ -202,6 +202,15 @@ describe("AppFrame", () => {
|
|
|
202
202
|
bar: true,
|
|
203
203
|
},
|
|
204
204
|
},
|
|
205
|
+
modules: {
|
|
206
|
+
tree: "modulesTree",
|
|
207
|
+
visibleModules: ["a", "module123", "test1", "test2", "test3"],
|
|
208
|
+
lastScopeAndModuleSelection: {
|
|
209
|
+
scope: "Norway",
|
|
210
|
+
moduleName: "Profiles",
|
|
211
|
+
routingPerformed: false,
|
|
212
|
+
},
|
|
213
|
+
},
|
|
205
214
|
settings: { defaultScope: "myScope", defaultApp: "12" },
|
|
206
215
|
versionInfo: { version: "4.2", defaultHelpUrl: "help_url", moduleHelpUrls: [] },
|
|
207
216
|
view: { scopeSelector: { filter: "1" }, __prefsDialog: { show: false } },
|
|
@@ -250,9 +259,7 @@ describe("AppFrame", () => {
|
|
|
250
259
|
<Base>
|
|
251
260
|
<Wrapper>
|
|
252
261
|
<AppBox>
|
|
253
|
-
<
|
|
254
|
-
<MenuIcon />
|
|
255
|
-
</AppSelWrapper>
|
|
262
|
+
<ApplicationSelector {...props} />
|
|
256
263
|
<AppLabel>
|
|
257
264
|
<AppLogo />
|
|
258
265
|
Marketing Legacy
|
|
@@ -312,9 +319,7 @@ describe("AppFrame", () => {
|
|
|
312
319
|
<Base>
|
|
313
320
|
<Wrapper>
|
|
314
321
|
<AppBox>
|
|
315
|
-
<
|
|
316
|
-
<MenuIcon />
|
|
317
|
-
</AppSelWrapper>
|
|
322
|
+
<ApplicationSelector {...props} />
|
|
318
323
|
<AppLabel>
|
|
319
324
|
<AppLogo />
|
|
320
325
|
</AppLabel>
|
|
@@ -374,9 +379,7 @@ describe("AppFrame", () => {
|
|
|
374
379
|
<Base>
|
|
375
380
|
<Wrapper>
|
|
376
381
|
<AppBox>
|
|
377
|
-
<
|
|
378
|
-
<MenuIcon />
|
|
379
|
-
</AppSelWrapper>
|
|
382
|
+
<ApplicationSelector {...props} />
|
|
380
383
|
<AppLabel>
|
|
381
384
|
<AppLogo />
|
|
382
385
|
</AppLabel>
|
|
@@ -435,9 +438,7 @@ describe("AppFrame", () => {
|
|
|
435
438
|
<Base>
|
|
436
439
|
<Wrapper>
|
|
437
440
|
<AppBox>
|
|
438
|
-
<
|
|
439
|
-
<MenuIcon />
|
|
440
|
-
</AppSelWrapper>
|
|
441
|
+
<ApplicationSelector {...props} />
|
|
441
442
|
<AppLabel>
|
|
442
443
|
<AppLogo />
|
|
443
444
|
Marketing Legacy
|
|
@@ -725,9 +726,7 @@ describe("AppFrame", () => {
|
|
|
725
726
|
<ActionModal open={true} title={title} message={message} actions={actions} />
|
|
726
727
|
<Wrapper>
|
|
727
728
|
<AppBox>
|
|
728
|
-
<
|
|
729
|
-
<MenuIcon />
|
|
730
|
-
</AppSelWrapper>
|
|
729
|
+
<ApplicationSelector {...props} />
|
|
731
730
|
<AppLabel>
|
|
732
731
|
<AppLogo />
|
|
733
732
|
Marketing Legacy
|
|
@@ -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
|
});
|