orc-shared 1.5.0-dev.1 → 1.5.0-dev.11

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.
Files changed (338) hide show
  1. package/dist/actions/applications.js +14 -52
  2. package/dist/actions/authentication.js +10 -45
  3. package/dist/actions/countries.js +6 -36
  4. package/dist/actions/locale.js +14 -54
  5. package/dist/actions/makeApiAction.js +31 -79
  6. package/dist/actions/makeOrcApiAction.js +3 -26
  7. package/dist/actions/metadata.js +65 -174
  8. package/dist/actions/modules.js +0 -26
  9. package/dist/actions/navigation.js +3 -33
  10. package/dist/actions/requestState.js +0 -18
  11. package/dist/actions/requestsApi.js +0 -17
  12. package/dist/actions/scopes.js +14 -56
  13. package/dist/actions/tasks.js +190 -0
  14. package/dist/actions/timezones.js +6 -36
  15. package/dist/actions/toasts.js +3 -23
  16. package/dist/actions/versionInfo.js +6 -39
  17. package/dist/actions/view.js +0 -38
  18. package/dist/buildStore.js +6 -54
  19. package/dist/components/AppFrame/About.js +8 -70
  20. package/dist/components/AppFrame/Anchor.js +1 -25
  21. package/dist/components/AppFrame/AppFrame.js +23 -92
  22. package/dist/components/AppFrame/ApplicationSelector/ApplicationDialog.js +4 -35
  23. package/dist/components/AppFrame/ApplicationSelector/Header.js +1 -31
  24. package/dist/components/AppFrame/ApplicationSelector/index.js +1 -30
  25. package/dist/components/AppFrame/ConnectedToastList.js +0 -31
  26. package/dist/components/AppFrame/Help.js +0 -25
  27. package/dist/components/AppFrame/MenuItem.js +17 -70
  28. package/dist/components/AppFrame/Preferences.js +17 -79
  29. package/dist/components/AppFrame/Sidebar.js +12 -61
  30. package/dist/components/AppFrame/Topbar.js +9 -65
  31. package/dist/components/AppFrame/index.js +0 -20
  32. package/dist/components/AppFrame/useApplicationHelpUrl.js +0 -22
  33. package/dist/components/ApplicationModuleLoader.js +7 -46
  34. package/dist/components/Authenticate.js +5 -48
  35. package/dist/components/Button.js +0 -24
  36. package/dist/components/CategoryList.js +27 -82
  37. package/dist/components/Checkbox.js +3 -41
  38. package/dist/components/ColumnWrapper.js +0 -19
  39. package/dist/components/Culture.js +0 -29
  40. package/dist/components/DevPages.js +0 -21
  41. package/dist/components/DropMenu/Menu.js +4 -36
  42. package/dist/components/DropMenu/index.js +12 -50
  43. package/dist/components/ErrorPlaceholder.js +3 -31
  44. package/dist/components/Form/Combination.js +3 -28
  45. package/dist/components/Form/Field.js +6 -37
  46. package/dist/components/Form/FieldElements.js +9 -41
  47. package/dist/components/Form/FieldList.js +28 -92
  48. package/dist/components/Form/Fieldset.js +1 -27
  49. package/dist/components/Form/Form.js +6 -37
  50. package/dist/components/Form/FormElement.js +1 -20
  51. package/dist/components/Form/InputField.js +17 -66
  52. package/dist/components/Form/Inputs/Button.js +5 -35
  53. package/dist/components/Form/Inputs/Date.js +2 -28
  54. package/dist/components/Form/Inputs/FieldButtons.js +0 -25
  55. package/dist/components/Form/Inputs/Number.js +7 -46
  56. package/dist/components/Form/Inputs/ReadOnly.js +0 -29
  57. package/dist/components/Form/Inputs/SmallButton.js +6 -38
  58. package/dist/components/Form/Inputs/Text.js +8 -41
  59. package/dist/components/Form/Inputs/Time.js +4 -33
  60. package/dist/components/Form/Inputs/Toggles.js +5 -39
  61. package/dist/components/Form/Inputs/Translation.js +21 -78
  62. package/dist/components/Form/Inputs/index.js +0 -28
  63. package/dist/components/Form/index.js +0 -20
  64. package/dist/components/Head.js +0 -22
  65. package/dist/components/I18n.js +0 -28
  66. package/dist/components/Icon.js +1 -27
  67. package/dist/components/IconButton.js +2 -32
  68. package/dist/components/Input.js +2 -42
  69. package/dist/components/InternetExplorerWarningMessage.js +0 -31
  70. package/dist/components/List/DataCell.js +3 -42
  71. package/dist/components/List/HeadCell.js +3 -43
  72. package/dist/components/List/HeadRow.js +2 -25
  73. package/dist/components/List/List.js +37 -107
  74. package/dist/components/List/Row.js +7 -38
  75. package/dist/components/List/enhanceColumnDefs.js +3 -29
  76. package/dist/components/List/index.js +0 -20
  77. package/dist/components/Loader.js +5 -48
  78. package/dist/components/LoadingIcon.js +0 -24
  79. package/dist/components/MaterialUI/DataDisplay/Badge.js +2 -31
  80. package/dist/components/MaterialUI/DataDisplay/Chip.js +1 -33
  81. package/dist/components/MaterialUI/DataDisplay/CollapsableList.js +7 -51
  82. package/dist/components/MaterialUI/DataDisplay/Divider.js +0 -30
  83. package/dist/components/MaterialUI/DataDisplay/Icon.js +2 -28
  84. package/dist/components/MaterialUI/DataDisplay/List.js +16 -55
  85. package/dist/components/MaterialUI/DataDisplay/Modal.js +4 -37
  86. package/dist/components/MaterialUI/DataDisplay/Notification.js +17 -69
  87. package/dist/components/MaterialUI/DataDisplay/NotificationProps.js +3 -34
  88. package/dist/components/MaterialUI/DataDisplay/PopperedElements/PopperedIcon.js +0 -22
  89. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ActionModal.js +5 -37
  90. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Address.js +1 -33
  91. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/ConfirmationModal.js +7 -28
  92. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/DiscountedPrice.js +2 -32
  93. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +17 -57
  94. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +4 -33
  95. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/SectionTitle.js +0 -25
  96. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +14 -60
  97. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +0 -29
  98. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +15 -59
  99. package/dist/components/MaterialUI/DataDisplay/SelectionList.js +23 -70
  100. package/dist/components/MaterialUI/DataDisplay/Table.js +34 -123
  101. package/dist/components/MaterialUI/DataDisplay/TableHeaderCell.js +0 -35
  102. package/dist/components/MaterialUI/DataDisplay/TableProps.js +3 -49
  103. package/dist/components/MaterialUI/DataDisplay/Timeline.js +1 -21
  104. package/dist/components/MaterialUI/DataDisplay/TimelineItem.js +4 -32
  105. package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +7 -46
  106. package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedIcon.js +3 -29
  107. package/dist/components/MaterialUI/DataDisplay/TooltippedElements/TooltippedTypography.js +0 -21
  108. package/dist/components/MaterialUI/DataDisplay/TransferList.js +32 -97
  109. package/dist/components/MaterialUI/DataDisplay/chipProps.js +3 -38
  110. package/dist/components/MaterialUI/DataDisplay/collapsableListProps.js +3 -37
  111. package/dist/components/MaterialUI/DataDisplay/dividerProps.js +3 -41
  112. package/dist/components/MaterialUI/DataDisplay/index.js +0 -33
  113. package/dist/components/MaterialUI/DataDisplay/modalProps.js +3 -36
  114. package/dist/components/MaterialUI/DataDisplay/tableHelpers.js +5 -68
  115. package/dist/components/MaterialUI/DataDisplay/useTableSelection.js +11 -48
  116. package/dist/components/MaterialUI/Feedback/NotificationContext.js +5 -40
  117. package/dist/components/MaterialUI/Feedback/loadingScreen.js +5 -44
  118. package/dist/components/MaterialUI/Feedback/useNotification.js +0 -21
  119. package/dist/components/MaterialUI/Inputs/Autocomplete.js +5 -44
  120. package/dist/components/MaterialUI/Inputs/AutocompleteProps.js +3 -37
  121. package/dist/components/MaterialUI/Inputs/Checkbox.js +3 -40
  122. package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +3 -43
  123. package/dist/components/MaterialUI/Inputs/CheckboxGroupProps.js +3 -38
  124. package/dist/components/MaterialUI/Inputs/CheckboxProps.js +3 -39
  125. package/dist/components/MaterialUI/Inputs/DatePicker.js +18 -57
  126. package/dist/components/MaterialUI/Inputs/InputBase.js +7 -56
  127. package/dist/components/MaterialUI/Inputs/InputBaseProps.js +3 -51
  128. package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +12 -65
  129. package/dist/components/MaterialUI/Inputs/PredefinedElements/TitledSelect.js +3 -31
  130. package/dist/components/MaterialUI/Inputs/Radio.js +8 -54
  131. package/dist/components/MaterialUI/Inputs/RadioProps.js +3 -41
  132. package/dist/components/MaterialUI/Inputs/Select.js +10 -72
  133. package/dist/components/MaterialUI/Inputs/SelectProps.js +3 -46
  134. package/dist/components/MaterialUI/Inputs/StandaloneRadio.js +3 -35
  135. package/dist/components/MaterialUI/Inputs/Switch.js +4 -38
  136. package/dist/components/MaterialUI/Inputs/SwitchProps.js +3 -40
  137. package/dist/components/MaterialUI/Inputs/TimePicker.js +14 -91
  138. package/dist/components/MaterialUI/Inputs/createInput.js +5 -30
  139. package/dist/components/MaterialUI/Inputs/index.js +0 -35
  140. package/dist/components/MaterialUI/Inputs/standaloneRadioProps.js +3 -41
  141. package/dist/components/MaterialUI/Navigation/DropDownMenu.js +12 -56
  142. package/dist/components/MaterialUI/Navigation/DropDownMenuProps.js +3 -33
  143. package/dist/components/MaterialUI/Navigation/ExternalLink.js +2 -27
  144. package/dist/components/MaterialUI/Navigation/PredefinedElements/ActionMenu.js +4 -31
  145. package/dist/components/MaterialUI/Navigation/TabBar.js +22 -103
  146. package/dist/components/MaterialUI/Navigation/TabLabel.js +7 -41
  147. package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +7 -42
  148. package/dist/components/MaterialUI/ScopeSelector/ScopeTreeView.js +22 -62
  149. package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +16 -68
  150. package/dist/components/MaterialUI/Surfaces/ExpansionPanel.js +15 -55
  151. package/dist/components/MaterialUI/Surfaces/Paper.js +1 -31
  152. package/dist/components/MaterialUI/Surfaces/PredefinedElements/TitledPaper.js +3 -28
  153. package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +19 -62
  154. package/dist/components/MaterialUI/Surfaces/expansionPanelProps.js +3 -55
  155. package/dist/components/MaterialUI/Surfaces/paperProps.js +3 -36
  156. package/dist/components/MaterialUI/componentProps.js +3 -29
  157. package/dist/components/MaterialUI/hocs/withDeferredPopper.js +10 -59
  158. package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +8 -44
  159. package/dist/components/MaterialUI/muiThemes.js +5 -57
  160. package/dist/components/MaterialUI/textProps.js +3 -33
  161. package/dist/components/Modal/Background.js +0 -19
  162. package/dist/components/Modal/Dialog.js +2 -26
  163. package/dist/components/Modal/Wrapper.js +0 -26
  164. package/dist/components/Modal/index.js +8 -44
  165. package/dist/components/Modules.js +21 -93
  166. package/dist/components/MultiSelector.js +21 -74
  167. package/dist/components/Navigation/Bar.js +29 -90
  168. package/dist/components/Navigation/Tab.js +22 -74
  169. package/dist/components/Navigation/index.js +2 -21
  170. package/dist/components/Navigation/useNavigationState.js +90 -173
  171. package/dist/components/Placeholder.js +5 -43
  172. package/dist/components/Provision.js +4 -36
  173. package/dist/components/Routing/FullPage.js +14 -37
  174. package/dist/components/Routing/Page.js +14 -51
  175. package/dist/components/Routing/Segment.js +5 -30
  176. package/dist/components/Routing/SegmentPage.js +26 -106
  177. package/dist/components/Routing/SubPage.js +22 -59
  178. package/dist/components/Routing/withWaypointing.js +5 -36
  179. package/dist/components/Scope/ScopeModificationConfirmationDialog.js +3 -30
  180. package/dist/components/Scope/ScopeNode.js +8 -49
  181. package/dist/components/Scope/Selector.js +8 -44
  182. package/dist/components/Scope/index.js +29 -96
  183. package/dist/components/Scope/useScopeConfirmationModalState.js +33 -100
  184. package/dist/components/Scope/useScopeData.js +0 -25
  185. package/dist/components/Scope/useScopeSelect.js +0 -26
  186. package/dist/components/Selector.js +15 -76
  187. package/dist/components/Sidepanel.js +0 -28
  188. package/dist/components/Spritesheet.js +0 -26
  189. package/dist/components/Switch.js +11 -51
  190. package/dist/components/TaskDetailsModal.js +193 -0
  191. package/dist/components/Text.js +6 -50
  192. package/dist/components/ToastList.js +5 -45
  193. package/dist/components/Toolbar.js +16 -74
  194. package/dist/components/Tooltip.js +0 -24
  195. package/dist/components/Treeview/Branch.js +0 -25
  196. package/dist/components/Treeview/Label.js +0 -29
  197. package/dist/components/Treeview/Leaf.js +0 -21
  198. package/dist/components/Treeview/Node.js +17 -55
  199. package/dist/components/Treeview/index.js +25 -66
  200. package/dist/components/Treeview/settings.js +0 -17
  201. package/dist/constants.js +21 -19
  202. package/dist/content/iconsSheet.svg +22 -0
  203. package/dist/content/orckestra-logo-white.png +0 -0
  204. package/dist/getTheme.js +0 -29
  205. package/dist/getThemeOverrides.js +3 -22
  206. package/dist/hocs/routingConnector.js +0 -21
  207. package/dist/hocs/withAuthentication.js +4 -26
  208. package/dist/hocs/withClickOutside.js +2 -28
  209. package/dist/hocs/withErrorBoundary.js +2 -37
  210. package/dist/hocs/withId.js +1 -30
  211. package/dist/hocs/withInfiniteScroll.js +15 -32
  212. package/dist/hocs/withInitialLoad.js +0 -20
  213. package/dist/hocs/withLocaleSwitch.js +0 -19
  214. package/dist/hocs/withNavigationLink.js +5 -32
  215. package/dist/hocs/withRequestActivity.js +0 -21
  216. package/dist/hocs/withScopeData.js +6 -33
  217. package/dist/hocs/withScrollBox.js +2 -31
  218. package/dist/hocs/withToggle.js +9 -37
  219. package/dist/hocs/withUpdateHandler.js +3 -23
  220. package/dist/hocs/withViewState.js +5 -32
  221. package/dist/hooks/useDispatchWithModulesData.js +0 -26
  222. package/dist/hooks/useEditState.js +10 -105
  223. package/dist/hooks/useEntityLoader.js +18 -67
  224. package/dist/hooks/useFullEntityEditState.js +9 -56
  225. package/dist/hooks/useInfiniteScroll.js +5 -33
  226. package/dist/hooks/useLabelMessage.js +3 -42
  227. package/dist/hooks/useLoader.js +0 -27
  228. package/dist/hooks/useMultipleFieldEditState.js +3 -40
  229. package/dist/hooks/useNavigationHandler.js +3 -28
  230. package/dist/hooks/useNotificationRequestState.js +17 -47
  231. package/dist/hooks/usePreviousModified.js +0 -24
  232. package/dist/hooks/useRequestState.js +8 -38
  233. package/dist/hooks/useSelectorAndUnwrap.js +0 -23
  234. package/dist/hooks/useToggle.js +5 -35
  235. package/dist/hooks/useViewState.js +0 -23
  236. package/dist/index.js +1 -2
  237. package/dist/reducers/applications.js +0 -23
  238. package/dist/reducers/authentication.js +6 -37
  239. package/dist/reducers/countries.js +0 -25
  240. package/dist/reducers/localeFactory.js +0 -30
  241. package/dist/reducers/metadata.js +3 -63
  242. package/dist/reducers/modules.js +0 -36
  243. package/dist/reducers/navigation.js +8 -47
  244. package/dist/reducers/request.js +4 -28
  245. package/dist/reducers/requestStates.js +0 -42
  246. package/dist/reducers/scopes.js +0 -28
  247. package/dist/reducers/settings.js +4 -39
  248. package/dist/reducers/tasks.js +99 -0
  249. package/dist/reducers/timezones.js +0 -25
  250. package/dist/reducers/toasts.js +0 -27
  251. package/dist/reducers/versionInfo.js +0 -24
  252. package/dist/reducers/view.js +36 -84
  253. package/dist/schemas/countries.js +0 -17
  254. package/dist/schemas/definitions.js +0 -17
  255. package/dist/schemas/metadata.js +0 -17
  256. package/dist/schemas/productDefinitions.js +0 -17
  257. package/dist/schemas/scopes.js +0 -17
  258. package/dist/schemas/timezones.js +0 -17
  259. package/dist/selectors/applications.js +0 -20
  260. package/dist/selectors/authentication.js +17 -41
  261. package/dist/selectors/countries.js +0 -22
  262. package/dist/selectors/locale.js +1 -29
  263. package/dist/selectors/metadata.js +4 -45
  264. package/dist/selectors/modules.js +3 -22
  265. package/dist/selectors/navigation.js +9 -39
  266. package/dist/selectors/requestStates.js +0 -22
  267. package/dist/selectors/requests.js +2 -22
  268. package/dist/selectors/route.js +0 -21
  269. package/dist/selectors/scope.js +0 -32
  270. package/dist/selectors/settings.js +0 -18
  271. package/dist/selectors/tasks.js +66 -0
  272. package/dist/selectors/timezones.js +0 -19
  273. package/dist/selectors/versionInfo.js +0 -18
  274. package/dist/selectors/view.js +3 -74
  275. package/dist/sharedMessages.js +17 -18
  276. package/dist/spawnerMiddleware.js +0 -24
  277. package/dist/utils/buildUrl.js +7 -38
  278. package/dist/utils/countryHelper.js +0 -18
  279. package/dist/utils/curry.js +0 -19
  280. package/dist/utils/debounce.js +1 -20
  281. package/dist/utils/displayModeHelper.js +0 -24
  282. package/dist/utils/domHelper.js +0 -17
  283. package/dist/utils/flatten.js +7 -38
  284. package/dist/utils/index.js +0 -31
  285. package/dist/utils/insertIcons.js +0 -21
  286. package/dist/utils/localizationHelper.js +0 -26
  287. package/dist/utils/logPass.js +1 -22
  288. package/dist/utils/mapHelper.js +1 -25
  289. package/dist/utils/memoize.js +0 -23
  290. package/dist/utils/modelValidationHelper.js +3 -42
  291. package/dist/utils/normalizeForSearch.js +2 -19
  292. package/dist/utils/objectHelper.js +2 -24
  293. package/dist/utils/parseHelper.js +0 -32
  294. package/dist/utils/profilerHelper.js +0 -18
  295. package/dist/utils/propertyHelper.js +36 -38
  296. package/dist/utils/propertyValidator.js +0 -25
  297. package/dist/utils/requestProcessingHelper.js +0 -24
  298. package/dist/utils/safeGet.js +0 -18
  299. package/dist/utils/setTranslation.js +1 -28
  300. package/dist/utils/setTranslationWithFallback.js +1 -33
  301. package/dist/utils/stripKey.js +1 -23
  302. package/dist/utils/styledPropFuncs.js +3 -29
  303. package/dist/utils/testUtils.js +14 -91
  304. package/dist/utils/timezoneHelper.js +8 -46
  305. package/dist/utils/unwrapImmutable.js +0 -19
  306. package/dist/utils/urlHelper.js +3 -28
  307. package/dist/whyDidYouRerender.js +0 -5
  308. package/package.json +3 -3
  309. package/src/actions/tasks.js +77 -0
  310. package/src/actions/tasks.test.js +169 -0
  311. package/src/buildStore.js +2 -0
  312. package/src/components/AppFrame/About.test.js +3 -3
  313. package/src/components/AppFrame/Sidebar.js +4 -3
  314. package/src/components/Routing/SubPage.js +17 -2
  315. package/src/components/Routing/SubPage.test.js +168 -1
  316. package/src/components/TaskDetailsModal.js +132 -0
  317. package/src/components/TaskDetailsModal.test.js +317 -0
  318. package/src/components/Text.test.js +44 -59
  319. package/src/constants.js +15 -0
  320. package/src/content/iconsSheet.svg +22 -0
  321. package/src/content/orckestra-logo-white.png +0 -0
  322. package/src/hooks/useEditState.js +12 -2
  323. package/src/hooks/useEditState.test.js +1 -1
  324. package/src/hooks/useLabelMessage.test.js +16 -10
  325. package/src/reducers/request.js +4 -0
  326. package/src/reducers/request.test.js +11 -0
  327. package/src/reducers/tasks.js +56 -0
  328. package/src/reducers/tasks.test.js +404 -0
  329. package/src/selectors/authentication.js +13 -0
  330. package/src/selectors/authentication.test.js +322 -0
  331. package/src/selectors/tasks.js +16 -0
  332. package/src/selectors/tasks.test.js +60 -0
  333. package/src/sharedMessages.js +17 -1
  334. package/src/translations/en-US.json +16 -12
  335. package/src/translations/fr-CA.json +16 -12
  336. package/src/utils/propertyHelper.js +38 -0
  337. package/src/utils/propertyHelper.test.js +160 -0
  338. package/src/utils/timezoneHelper.test.js +4 -2
@@ -2,39 +2,31 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.tryGetNewEntityIdKey = exports.resolveEntityId = exports.getValueFromUrlByKey = exports.NEW_ENTITY_URL_KEY = void 0;
5
-
6
5
  (function () {
7
6
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
8
7
  enterModule && enterModule(module);
9
8
  })();
10
-
11
9
  (function () {
12
10
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
13
11
  enterModule && enterModule(module);
14
12
  })();
15
-
16
13
  function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
17
-
18
14
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
19
-
20
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
21
-
15
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
22
16
  var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
23
17
  return a;
24
18
  };
25
-
26
19
  var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
27
20
  return a;
28
21
  };
29
-
30
22
  var getValueFromUrlByKey = function getValueFromUrlByKey(url, path, key) {
31
- var valuesFromUrl = url.split("/"); // remove the regex of the parameters, the part between parentheses (path to regex syntax)
23
+ var valuesFromUrl = url.split("/");
32
24
 
25
+ // remove the regex of the parameters, the part between parentheses (path to regex syntax)
33
26
  var keysFromPath = path.replace(/(\([^/]+?\))/g, "").split("/");
34
27
  var keyIndex = keysFromPath.indexOf(key);
35
28
  return valuesFromUrl[keyIndex];
36
29
  };
37
-
38
30
  exports.getValueFromUrlByKey = getValueFromUrlByKey;
39
31
  var NEW_ENTITY_URL_KEY = "new";
40
32
  /* expected url formats for new mode:
@@ -43,13 +35,10 @@ var NEW_ENTITY_URL_KEY = "new";
43
35
  /new{number} => new{number}
44
36
  /new{number}/section => new{number}
45
37
  */
46
-
47
38
  exports.NEW_ENTITY_URL_KEY = NEW_ENTITY_URL_KEY;
48
-
49
39
  var tryGetNewEntityIdKey = function tryGetNewEntityIdKey(url) {
50
40
  var valuesFromUrl = url.split("/");
51
41
  if (valuesFromUrl.length < 2) return;
52
-
53
42
  for (var _iterator = _createForOfIteratorHelperLoose(valuesFromUrl), _step; !(_step = _iterator()).done;) {
54
43
  var section = _step.value;
55
44
  if (section === NEW_ENTITY_URL_KEY) return section;
@@ -57,55 +46,41 @@ var tryGetNewEntityIdKey = function tryGetNewEntityIdKey(url) {
57
46
  if (match) return match[1];
58
47
  }
59
48
  };
60
-
61
49
  exports.tryGetNewEntityIdKey = tryGetNewEntityIdKey;
62
-
63
50
  var resolveEntityId = function resolveEntityId(url, path, entityIdKey) {
64
51
  var newKey = tryGetNewEntityIdKey(url);
65
52
  var key = entityIdKey === newKey ? entityIdKey : ":".concat(entityIdKey);
66
53
  return getValueFromUrlByKey(url, path, key);
67
54
  };
68
-
69
55
  exports.resolveEntityId = resolveEntityId;
70
56
  ;
71
-
72
57
  (function () {
73
58
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
74
-
75
59
  if (!reactHotLoader) {
76
60
  return;
77
61
  }
78
-
79
62
  reactHotLoader.register(getValueFromUrlByKey, "getValueFromUrlByKey", "/home/vsts/work/1/s/src/utils/urlHelper.js");
80
63
  reactHotLoader.register(NEW_ENTITY_URL_KEY, "NEW_ENTITY_URL_KEY", "/home/vsts/work/1/s/src/utils/urlHelper.js");
81
64
  reactHotLoader.register(tryGetNewEntityIdKey, "tryGetNewEntityIdKey", "/home/vsts/work/1/s/src/utils/urlHelper.js");
82
65
  reactHotLoader.register(resolveEntityId, "resolveEntityId", "/home/vsts/work/1/s/src/utils/urlHelper.js");
83
66
  })();
84
-
85
67
  ;
86
-
87
68
  (function () {
88
69
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
89
70
  leaveModule && leaveModule(module);
90
71
  })();
91
-
92
72
  ;
93
-
94
73
  (function () {
95
74
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
96
-
97
75
  if (!reactHotLoader) {
98
76
  return;
99
77
  }
100
-
101
78
  reactHotLoader.register(getValueFromUrlByKey, "getValueFromUrlByKey", "/home/vsts/work/1/s/src/utils/urlHelper.js");
102
79
  reactHotLoader.register(NEW_ENTITY_URL_KEY, "NEW_ENTITY_URL_KEY", "/home/vsts/work/1/s/src/utils/urlHelper.js");
103
80
  reactHotLoader.register(tryGetNewEntityIdKey, "tryGetNewEntityIdKey", "/home/vsts/work/1/s/src/utils/urlHelper.js");
104
81
  reactHotLoader.register(resolveEntityId, "resolveEntityId", "/home/vsts/work/1/s/src/utils/urlHelper.js");
105
82
  })();
106
-
107
83
  ;
108
-
109
84
  (function () {
110
85
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
111
86
  leaveModule && leaveModule(module);
@@ -1,21 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _react = _interopRequireDefault(require("react"));
4
-
5
4
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
-
7
5
  var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
8
6
  return a;
9
7
  };
10
-
11
8
  var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
12
9
  return a;
13
10
  };
14
-
15
11
  // If you want to investigate rerenderer of components, import that file before "react-hot-loader", usually in App.js
16
12
  if (process.env.NODE_ENV === "development") {
17
13
  var whyDidYouRender = require("@welldone-software/why-did-you-render");
18
-
19
14
  whyDidYouRender(_react.default, {
20
15
  trackAllPureComponents: true
21
16
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orc-shared",
3
- "version": "1.5.0-dev.1",
3
+ "version": "1.5.0-dev.11",
4
4
  "description": "Shared code for Orckestra applications",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
@@ -49,7 +49,7 @@
49
49
  ],
50
50
  "devDependencies": {},
51
51
  "peerDependencies": {
52
- "orc-scripts": "1.5.0-dev.2"
52
+ "orc-scripts": "1.5.0"
53
53
  },
54
54
  "sideEffects": false,
55
55
  "lint-staged": {
@@ -69,6 +69,6 @@
69
69
  }
70
70
  },
71
71
  "dependencies": {
72
- "orc-scripts": "1.5.0-dev.2"
72
+ "orc-scripts": "1.5.0"
73
73
  }
74
74
  }
@@ -0,0 +1,77 @@
1
+ import { makeActionTypes } from "./makeApiAction";
2
+ import makeOrcApiAction from "./makeOrcApiAction";
3
+ import {
4
+ deleteTaskInfoRequest,
5
+ getRequesterTasksInfoRequest,
6
+ getTaskExecutionLogsRequest,
7
+ getTaskInfoRequest,
8
+ } from "./requestsApi";
9
+
10
+ const GET_TASKINFO = "GET_TASKINFO";
11
+
12
+ export const [GET_TASKINFO_REQUEST, GET_TASKINFO_SUCCESS, GET_TASKINFO_FAILURE] = makeActionTypes(GET_TASKINFO);
13
+
14
+ export const getTaskInfo = taskId => makeOrcApiAction(GET_TASKINFO, getTaskInfoRequest.buildUrl(taskId));
15
+
16
+ export const GET_TASK_LIST = "GET_TASK_LIST";
17
+
18
+ export const ssrsDownloadFilterTaskNames = [
19
+ "Orckestra.Overture.Providers.CommerceEngine.Profiles.ProfileSchemaExportTask, Orckestra.Overture.Providers.CommerceEngine",
20
+ "Orckestra.Overture.Providers.CommerceEngine.Profiles.ProfileSchemaImportTask, Orckestra.Overture.Providers.CommerceEngine",
21
+ "Orckestra.Overture.Providers.CommerceEngine.Orders.ExportOrderSchemaTask, Orckestra.Overture.Providers.CommerceEngine",
22
+ "Orckestra.Overture.Providers.CommerceEngine.Orders.ImportOrderSchemaTask, Orckestra.Overture.Providers.CommerceEngine",
23
+ "Orckestra.Overture.Providers.CommerceEngine.Products.ImportExport.ExportProductsTask, Orckestra.Overture.Providers.CommerceEngine",
24
+ "Orckestra.Overture.Providers.CommerceEngine.Products.ImportExport.ProductSchemaExportTask, Orckestra.Overture.Providers.CommerceEngine",
25
+ "Orckestra.Overture.Providers.CommerceEngine.Products.ImportExport.ImportProductsTask, Orckestra.Overture.Providers.CommerceEngine",
26
+ "OrckestraCommerce.DataExchange.Product.Tasks.ProductExportTask, OrckestraCommerce.DataExchange",
27
+ "Orckestra.Overture.Providers.CommerceEngine.Marketing.ExportCouponCodesTask, Orckestra.Overture.Providers.CommerceEngine",
28
+ "Orckestra.Overture.Providers.CommerceEngine.Marketing.ImportCouponCodesTask, Orckestra.Overture.Providers.CommerceEngine",
29
+ "Orckestra.Overture.Providers.CommerceEngine.Marketing.GenerateCouponTask, Orckestra.Overture.Providers.CommerceEngine",
30
+ "Orckestra.Overture.Providers.CommerceEngine.Reporting.ReportExportTask, Orckestra.Overture.Providers.CommerceEngine",
31
+ ];
32
+
33
+ export const [GET_TASK_LIST_REQUEST, GET_TASK_LIST_SUCCESS, GET_TASK_LIST_FAILURE] = makeActionTypes(GET_TASK_LIST);
34
+
35
+ export const getTaskList = (requester, filterTaskNames, lastModified = null, addToActiveRequests = true) =>
36
+ makeOrcApiAction(
37
+ GET_TASK_LIST,
38
+ getRequesterTasksInfoRequest.buildUrl({
39
+ filterTaskNames: filterTaskNames,
40
+ requester: requester,
41
+ lastModified: lastModified,
42
+ }),
43
+ getRequesterTasksInfoRequest.verb,
44
+ {
45
+ meta: {
46
+ addToActiveRequests,
47
+ },
48
+ },
49
+ );
50
+
51
+ const DELETE_TASK = "DELETE_TASK";
52
+
53
+ export const [DELETE_TASK_REQUEST, DELETE_TASK_SUCCESS, DELETE_TASK_FAILURE] = makeActionTypes(DELETE_TASK);
54
+
55
+ export const deleteTask = taskId =>
56
+ makeOrcApiAction(DELETE_TASK, deleteTaskInfoRequest.buildUrl(taskId), deleteTaskInfoRequest.verb, {
57
+ meta: { taskId },
58
+ });
59
+
60
+ const GET_TASK_LOG = "GET_TASK_LOG";
61
+
62
+ export const [GET_TASK_LOG_REQUEST, GET_TASK_LOG_SUCCESS, GET_TASK_LOG_FAILURE] = makeActionTypes(GET_TASK_LOG);
63
+
64
+ export const getTaskLog = (taskId, addToActiveRequests = true) =>
65
+ makeOrcApiAction(GET_TASK_LOG, getTaskExecutionLogsRequest.buildUrl(taskId), getTaskExecutionLogsRequest.verb, {
66
+ meta: {
67
+ taskId,
68
+ addToActiveRequests,
69
+ },
70
+ });
71
+
72
+ export const CLEAR_TASK_LOG = "CLEAR_TASK_LOG";
73
+
74
+ export const clearTaskLog = taskId => ({
75
+ type: CLEAR_TASK_LOG,
76
+ meta: { taskId },
77
+ });
@@ -0,0 +1,169 @@
1
+ import { RSAA } from "redux-api-middleware";
2
+ import {
3
+ GET_TASKINFO_REQUEST,
4
+ GET_TASKINFO_SUCCESS,
5
+ GET_TASKINFO_FAILURE,
6
+ getTaskInfo,
7
+ getTaskList,
8
+ getTaskLog,
9
+ ssrsDownloadFilterTaskNames,
10
+ deleteTask,
11
+ } from "./tasks";
12
+
13
+ jest.mock("../utils/buildUrl", () => {
14
+ const modExport = {};
15
+ modExport.loadConfig = () => Promise.resolve({});
16
+ modExport.buildUrl = (path = [], params = "") => "URL: " + path.join("/") + " " + JSON.stringify(params);
17
+ return modExport;
18
+ });
19
+
20
+ describe("getTaskInfo", () => {
21
+ it("creates a RSAA to get task info", () =>
22
+ expect(getTaskInfo, "when called with", ["1234"], "to exhaustively satisfy", {
23
+ [RSAA]: {
24
+ types: [GET_TASKINFO_REQUEST, GET_TASKINFO_SUCCESS, GET_TASKINFO_FAILURE],
25
+ endpoint: 'URL: tasks/1234 ""',
26
+ method: "GET",
27
+ body: undefined,
28
+ credentials: "include",
29
+ bailout: expect.it("to be a function"),
30
+ headers: {
31
+ Accept: "application/json; charset=utf-8",
32
+ "Content-Type": "application/json",
33
+ },
34
+ options: { redirect: "follow" },
35
+ },
36
+ }));
37
+ });
38
+
39
+ describe("getTaskLog", () => {
40
+ it("creates a RSAA to get task info", () =>
41
+ expect(getTaskLog, "when called with", ["1234"], "to exhaustively satisfy", {
42
+ [RSAA]: {
43
+ types: [
44
+ { type: "GET_TASK_LOG_REQUEST", meta: { taskId: "1234", addToActiveRequests: true } },
45
+ { type: "GET_TASK_LOG_SUCCESS", meta: { taskId: "1234", addToActiveRequests: true } },
46
+ { type: "GET_TASK_LOG_FAILURE", meta: { taskId: "1234", addToActiveRequests: true } },
47
+ ],
48
+ endpoint: 'URL: tasks/1234/logs ""',
49
+ method: "GET",
50
+ body: undefined,
51
+ credentials: "include",
52
+ bailout: expect.it("to be a function"),
53
+ headers: {
54
+ Accept: "application/json; charset=utf-8",
55
+ "Content-Type": "application/json",
56
+ },
57
+ options: { redirect: "follow" },
58
+ },
59
+ }));
60
+
61
+ it("creates a RSAA to get task info with addToActiveRequests false", () =>
62
+ expect(getTaskLog, "when called with", ["1234", false], "to exhaustively satisfy", {
63
+ [RSAA]: {
64
+ types: [
65
+ { type: "GET_TASK_LOG_REQUEST", meta: { taskId: "1234", addToActiveRequests: false } },
66
+ { type: "GET_TASK_LOG_SUCCESS", meta: { taskId: "1234", addToActiveRequests: false } },
67
+ { type: "GET_TASK_LOG_FAILURE", meta: { taskId: "1234", addToActiveRequests: false } },
68
+ ],
69
+ endpoint: 'URL: tasks/1234/logs ""',
70
+ method: "GET",
71
+ body: undefined,
72
+ credentials: "include",
73
+ bailout: expect.it("to be a function"),
74
+ headers: {
75
+ Accept: "application/json; charset=utf-8",
76
+ "Content-Type": "application/json",
77
+ },
78
+ options: { redirect: "follow" },
79
+ },
80
+ }));
81
+ });
82
+
83
+ describe("getTaskList", () => {
84
+ it("creates a RSAA to get task info", () => {
85
+ const expectedParameters = {
86
+ filterTaskNames: ssrsDownloadFilterTaskNames,
87
+ requester: "freddie",
88
+ lastModified: "date value",
89
+ };
90
+
91
+ expect(
92
+ getTaskList,
93
+ "when called with",
94
+ ["freddie", ssrsDownloadFilterTaskNames, "date value", false],
95
+ "to exhaustively satisfy",
96
+ {
97
+ [RSAA]: {
98
+ types: [
99
+ { type: "GET_TASK_LIST_REQUEST", meta: { addToActiveRequests: false } },
100
+ { type: "GET_TASK_LIST_SUCCESS", meta: { addToActiveRequests: false } },
101
+ { type: "GET_TASK_LIST_FAILURE", meta: { addToActiveRequests: false } },
102
+ ],
103
+ endpoint: "URL: tasks " + JSON.stringify(expectedParameters),
104
+ method: "GET",
105
+ body: undefined,
106
+ credentials: "include",
107
+ bailout: expect.it("to be a function"),
108
+ headers: {
109
+ Accept: "application/json; charset=utf-8",
110
+ "Content-Type": "application/json",
111
+ },
112
+ options: { redirect: "follow" },
113
+ },
114
+ },
115
+ );
116
+ });
117
+
118
+ it("creates a RSAA to get task info with null lastModified and true addToActiveRequests", () => {
119
+ const expectedParameters = {
120
+ filterTaskNames: ssrsDownloadFilterTaskNames,
121
+ requester: "freddie",
122
+ lastModified: null,
123
+ };
124
+
125
+ expect(getTaskList, "when called with", ["freddie", ssrsDownloadFilterTaskNames], "to exhaustively satisfy", {
126
+ [RSAA]: {
127
+ types: [
128
+ { type: "GET_TASK_LIST_REQUEST", meta: { addToActiveRequests: true } },
129
+ { type: "GET_TASK_LIST_SUCCESS", meta: { addToActiveRequests: true } },
130
+ { type: "GET_TASK_LIST_FAILURE", meta: { addToActiveRequests: true } },
131
+ ],
132
+ endpoint: "URL: tasks " + JSON.stringify(expectedParameters),
133
+ method: "GET",
134
+ body: undefined,
135
+ credentials: "include",
136
+ bailout: expect.it("to be a function"),
137
+ headers: {
138
+ Accept: "application/json; charset=utf-8",
139
+ "Content-Type": "application/json",
140
+ },
141
+ options: { redirect: "follow" },
142
+ },
143
+ });
144
+ });
145
+ });
146
+
147
+ describe("deleteTask", () => {
148
+ it("creates a RSAA to delete a task", () => {
149
+ expect(deleteTask, "when called with", ["1234"], "to exhaustively satisfy", {
150
+ [RSAA]: {
151
+ types: [
152
+ { type: "DELETE_TASK_REQUEST", meta: { taskId: "1234" } },
153
+ { type: "DELETE_TASK_SUCCESS", meta: { taskId: "1234" } },
154
+ { type: "DELETE_TASK_FAILURE", meta: { taskId: "1234" } },
155
+ ],
156
+ endpoint: 'URL: tasks/1234 ""',
157
+ method: "DELETE",
158
+ body: undefined,
159
+ credentials: "include",
160
+ bailout: expect.it("to be a function"),
161
+ headers: {
162
+ Accept: "application/json; charset=utf-8",
163
+ "Content-Type": "application/json",
164
+ },
165
+ options: { redirect: "follow" },
166
+ },
167
+ });
168
+ });
169
+ });
package/src/buildStore.js CHANGED
@@ -20,6 +20,7 @@ import timezonesReducer from "./reducers/timezones";
20
20
  import modulesReducer from "./reducers/modules";
21
21
  import metadataReducer from "./reducers/metadata";
22
22
  import requestStatesReducer from "./reducers/requestStates";
23
+ import tasksReducer from "./reducers/tasks";
23
24
 
24
25
  window.BUILD_ID = BUILD_ID;
25
26
  window.BUILD_NUMBER = BUILD_NUMBER;
@@ -65,6 +66,7 @@ const buildStore = (reducers, devOptions = {}) => {
65
66
  modules: modulesReducer,
66
67
  metadata: metadataReducer,
67
68
  requestStates: requestStatesReducer,
69
+ tasks: tasksReducer,
68
70
  });
69
71
  const rootReducer = buildReducer(reducers);
70
72
 
@@ -79,7 +79,7 @@ describe("About", () => {
79
79
  </AboutLink>
80
80
  </AboutParagraph>
81
81
  <AboutParagraph>
82
- {stringifyWithoutQuotes(messages["orc-shared.copyright"])}
82
+ {stringifyWithoutQuotes(messages["orc-shared.copyright"]).replace("{year}", new Date().getFullYear())}
83
83
  <br />
84
84
  {stringifyWithoutQuotes(messages["orc-shared.allRightsReserved"])}
85
85
  </AboutParagraph>
@@ -130,7 +130,7 @@ describe("About", () => {
130
130
  </AboutLink>
131
131
  </AboutParagraph>
132
132
  <AboutParagraph>
133
- {stringifyWithoutQuotes(messages["orc-shared.copyright"])}
133
+ {stringifyWithoutQuotes(messages["orc-shared.copyright"]).replace("{year}", new Date().getFullYear())}
134
134
  <br />
135
135
  {stringifyWithoutQuotes(messages["orc-shared.allRightsReserved"])}
136
136
  </AboutParagraph>
@@ -165,7 +165,7 @@ describe("About", () => {
165
165
  </AboutLink>
166
166
  </AboutParagraph>
167
167
  <AboutParagraph>
168
- {stringifyWithoutQuotes(messages["orc-shared.copyright"])}
168
+ {stringifyWithoutQuotes(messages["orc-shared.copyright"]).replace("{year}", new Date().getFullYear())}
169
169
  <br />
170
170
  {stringifyWithoutQuotes(messages["orc-shared.allRightsReserved"])}
171
171
  </AboutParagraph>
@@ -60,9 +60,10 @@ const LogoSvg = styled.svg`
60
60
  `;
61
61
 
62
62
  export const Logo = () => (
63
- <LogoSvg viewBox="0 0 260 260">
64
- <path d="M1.11,125.62C1.11,74.94,40.22,39,93.72,39S186,74.94,186,125.62s-38.79,86.66-92.29,86.66S1.11,176.3,1.11,125.62Zm135.47,0c0-29.1-18.46-46.62-42.86-46.62S50.54,96.52,50.54,125.62s18.77,46.62,43.18,46.62S136.58,154.72,136.58,125.62Z" />
65
- <circle cx="227.6" cy="181.13" r="31.29" />
63
+ <LogoSvg viewBox="0 0 354 354">
64
+ <g>
65
+ <path d="M0 241.41c0-65.49 50.53-111.98 119.66-111.98s119.25 46.49 119.25 111.98c0 65.49-50.13 111.97-119.25 111.97S0 306.9 0 241.41Zm175.04 0c0-37.6-23.85-60.23-55.38-60.23s-55.79 22.64-55.79 60.23c0 37.59 24.26 60.23 55.79 60.23 31.53 0 55.38-22.64 55.38-60.23Zm178.1-76.35h-77.48c0-48.29-39.29-87.58-87.58-87.58V0c91.02 0 165.07 74.05 165.07 165.06h-.01Z" />
66
+ </g>
66
67
  </LogoSvg>
67
68
  );
68
69
 
@@ -78,9 +78,24 @@ export const SubPage = ({ config, match, location, history, root, modulePrependP
78
78
  variant={action.isPrimary ? "contained" : "outlined"}
79
79
  color={action.isPrimary ? "primary" : "default"}
80
80
  disableElevation={action.isPrimary}
81
+ disabled={action.disabled}
81
82
  onClick={e => {
82
- action.handler && action.handler(e);
83
- closeSubPage();
83
+ if (!action.handler) {
84
+ closeSubPage();
85
+ return;
86
+ }
87
+
88
+ let actionHandlerResult = action.handler(e);
89
+ if (typeof actionHandlerResult === "object") {
90
+ // promise
91
+ actionHandlerResult.then(actionResult => {
92
+ if (action.validateBeforeClose && !actionResult) return;
93
+ closeSubPage();
94
+ });
95
+ } else {
96
+ if (action.validateBeforeClose && !actionHandlerResult) return;
97
+ closeSubPage();
98
+ }
84
99
  }}
85
100
  >
86
101
  <FormattedMessage {...action.label} />
@@ -180,7 +180,6 @@ describe("SubPage", () => {
180
180
  expect(history.push, "to have calls satisfying", [{ args: ["/foo"] }]);
181
181
  expect(dispatch, "to have calls satisfying", [{ args: [mapHref("/foo", "/foo")] }]);
182
182
  });
183
-
184
183
  it("renders action panel passed from props", () => {
185
184
  const actions = () => [{ label: sharedMessages.cancel }, { label: sharedMessages.applyChanges }];
186
185
 
@@ -262,4 +261,172 @@ describe("SubPage", () => {
262
261
  expect(applyButtonClassName, "to contain", "MuiButton-containedPrimary");
263
262
  expect(someEvent, "was called");
264
263
  });
264
+
265
+ it("Do not close when clicking action button has validateBeforeClose and result is false", () => {
266
+ const applyHandler = () => false;
267
+
268
+ const actions = () => [
269
+ { label: sharedMessages.applyChanges, isPrimary: true, handler: applyHandler, validateBeforeClose: true },
270
+ ];
271
+
272
+ const component = (
273
+ <TestWrapper provider={{ store }} intlProvider={intlProvider} stylesProvider muiThemeProvider={{ theme }}>
274
+ <div>
275
+ <div id="outer" />
276
+ <Router history={history}>
277
+ <Route
278
+ path="/foo/bar"
279
+ render={route => (
280
+ <SubPage
281
+ config={{
282
+ component: InnerView,
283
+ set: true,
284
+ title: "Item Details",
285
+ componentProps: { actionPanel: actions },
286
+ }}
287
+ root="/foo"
288
+ path="/foo/bar"
289
+ {...route}
290
+ />
291
+ )}
292
+ />
293
+ </Router>
294
+ </div>
295
+ </TestWrapper>
296
+ );
297
+ const mountedComponent = mount(component);
298
+
299
+ const applyButton = mountedComponent.find("button").at(0);
300
+
301
+ applyButton.invoke("onClick")();
302
+ expect(history.push, "not to have calls satisfying", [{ args: ["/foo"] }]);
303
+ expect(dispatch, "not to have calls satisfying", [{ args: [mapHref("/foo", "/foo")] }]);
304
+ });
305
+
306
+ it("Close when clicking action button has validateBeforeClose and result is true", () => {
307
+ const applyHandler = () => true;
308
+
309
+ const actions = () => [
310
+ { label: sharedMessages.applyChanges, isPrimary: true, handler: applyHandler, validateBeforeClose: true },
311
+ ];
312
+
313
+ const component = (
314
+ <TestWrapper provider={{ store }} intlProvider={intlProvider} stylesProvider muiThemeProvider={{ theme }}>
315
+ <div>
316
+ <div id="outer" />
317
+ <Router history={history}>
318
+ <Route
319
+ path="/foo/bar"
320
+ render={route => (
321
+ <SubPage
322
+ config={{
323
+ component: InnerView,
324
+ set: true,
325
+ title: "Item Details",
326
+ componentProps: { actionPanel: actions },
327
+ }}
328
+ root="/foo"
329
+ path="/foo/bar"
330
+ {...route}
331
+ />
332
+ )}
333
+ />
334
+ </Router>
335
+ </div>
336
+ </TestWrapper>
337
+ );
338
+ const mountedComponent = mount(component);
339
+
340
+ const applyButton = mountedComponent.find("button").at(0);
341
+
342
+ applyButton.invoke("onClick")();
343
+ expect(history.push, "to have calls satisfying", [{ args: ["/foo"] }]);
344
+ expect(dispatch, "to have calls satisfying", [{ args: [mapHref("/foo", "/foo")] }]);
345
+ });
346
+
347
+ it("Close when clicking action button has validateBeforeClose and result as promise with true", () => {
348
+ const applyHandler = () => Promise.resolve(true);
349
+
350
+ const actions = () => [
351
+ { label: sharedMessages.applyChanges, isPrimary: true, handler: applyHandler, validateBeforeClose: true },
352
+ ];
353
+
354
+ const component = (
355
+ <TestWrapper provider={{ store }} intlProvider={intlProvider} stylesProvider muiThemeProvider={{ theme }}>
356
+ <div>
357
+ <div id="outer" />
358
+ <Router history={history}>
359
+ <Route
360
+ path="/foo/bar"
361
+ render={route => (
362
+ <SubPage
363
+ config={{
364
+ component: InnerView,
365
+ set: true,
366
+ title: "Item Details",
367
+ componentProps: { actionPanel: actions },
368
+ }}
369
+ root="/foo"
370
+ path="/foo/bar"
371
+ {...route}
372
+ />
373
+ )}
374
+ />
375
+ </Router>
376
+ </div>
377
+ </TestWrapper>
378
+ );
379
+ const mountedComponent = mount(component);
380
+
381
+ const applyButton = mountedComponent.find("button").at(0);
382
+
383
+ applyButton.invoke("onClick")();
384
+ setTimeout(() => {
385
+ expect(history.push, "to have calls satisfying", [{ args: ["/foo"] }]);
386
+ expect(dispatch, "to have calls satisfying", [{ args: [mapHref("/foo", "/foo")] }]);
387
+ }, 200);
388
+ });
389
+
390
+ it("Do not Close when clicking action button has validateBeforeClose and result as promise with false", () => {
391
+ const applyHandler = () => Promise.resolve(false);
392
+
393
+ const actions = () => [
394
+ { label: sharedMessages.applyChanges, isPrimary: true, handler: applyHandler, validateBeforeClose: true },
395
+ ];
396
+
397
+ const component = (
398
+ <TestWrapper provider={{ store }} intlProvider={intlProvider} stylesProvider muiThemeProvider={{ theme }}>
399
+ <div>
400
+ <div id="outer" />
401
+ <Router history={history}>
402
+ <Route
403
+ path="/foo/bar"
404
+ render={route => (
405
+ <SubPage
406
+ config={{
407
+ component: InnerView,
408
+ set: true,
409
+ title: "Item Details",
410
+ componentProps: { actionPanel: actions },
411
+ }}
412
+ root="/foo"
413
+ path="/foo/bar"
414
+ {...route}
415
+ />
416
+ )}
417
+ />
418
+ </Router>
419
+ </div>
420
+ </TestWrapper>
421
+ );
422
+ const mountedComponent = mount(component);
423
+
424
+ const applyButton = mountedComponent.find("button").at(0);
425
+
426
+ applyButton.invoke("onClick")();
427
+ setTimeout(() => {
428
+ expect(history.push, "not to have calls satisfying", [{ args: ["/foo"] }]);
429
+ expect(dispatch, "not to have calls satisfying", [{ args: [mapHref("/foo", "/foo")] }]);
430
+ }, 200);
431
+ });
265
432
  });