orc-shared 1.2.0-dev.3 → 1.2.0-dev.7
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/makeApiAction.js +2 -2
- package/dist/actions/makeOrcApiAction.js +2 -2
- package/dist/actions/metadata.js +2 -2
- package/dist/actions/navigation.js +2 -2
- package/dist/actions/scopes.js +4 -2
- package/dist/buildStore.js +2 -2
- package/dist/components/AppFrame/About.js +2 -2
- package/dist/components/AppFrame/Preferences.js +2 -2
- package/dist/components/ApplicationModuleLoader.js +7 -8
- package/dist/components/Form/FieldList.js +2 -2
- package/dist/components/Form/Inputs/Translation.js +2 -2
- package/dist/components/List/enhanceColumnDefs.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/Notification.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Translations.js +2 -2
- package/dist/components/MaterialUI/DataDisplay/useTableSelection.js +2 -2
- package/dist/components/MaterialUI/Inputs/Autocomplete.js +2 -2
- package/dist/components/MaterialUI/Inputs/Select.js +2 -2
- package/dist/components/MaterialUI/Inputs/Switch.js +2 -2
- package/dist/components/MaterialUI/Inputs/createInput.js +2 -2
- package/dist/components/MaterialUI/Navigation/ExternalLink.js +113 -0
- package/dist/components/MaterialUI/muiThemes.js +7 -2
- package/dist/components/Navigation/Bar.js +2 -2
- package/dist/components/Navigation/useNavigationState.js +2 -2
- package/dist/components/Routing/withWaypointing.js +2 -2
- package/dist/components/Scope/index.js +2 -2
- package/dist/components/Treeview/Node.js +2 -2
- package/dist/components/Treeview/index.js +2 -2
- package/dist/content/iconsSheet.svg +3 -0
- package/dist/getThemeOverrides.js +2 -2
- package/dist/hocs/withUpdateHandler.js +2 -2
- package/dist/hooks/useEditState.js +2 -2
- package/dist/hooks/useEntityLoader.js +2 -2
- package/dist/hooks/useFullEntityEditState.js +2 -2
- package/dist/hooks/useLabelMessage.js +2 -2
- package/dist/hooks/useMultipleFieldEditState.js +2 -2
- package/dist/hooks/useNotificationRequestState.js +2 -2
- package/dist/reducers/settings.js +16 -3
- package/dist/selectors/metadata.js +2 -2
- package/dist/selectors/modules.js +2 -2
- package/dist/utils/flatten.js +2 -2
- package/package.json +1 -1
- package/src/actions/scopes.js +18 -7
- package/src/actions/scopes.test.js +38 -0
- package/src/components/ApplicationModuleLoader.js +8 -9
- package/src/components/ApplicationModuleLoader.test.js +61 -22
- package/src/components/MaterialUI/Navigation/ExternalLink.js +25 -0
- package/src/components/MaterialUI/Navigation/ExternalLink.test.js +26 -0
- package/src/components/MaterialUI/muiThemes.js +5 -0
- package/src/content/iconsSheet.svg +3 -0
- package/src/reducers/settings.js +19 -5
- package/src/reducers/settings.test.js +39 -2
|
@@ -15,9 +15,9 @@ var _recompose = require("recompose");
|
|
|
15
15
|
enterModule && enterModule(module);
|
|
16
16
|
})();
|
|
17
17
|
|
|
18
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
19
|
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
21
|
|
|
22
22
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
23
|
|
|
@@ -31,9 +31,9 @@ var _mapHelper = require("../utils/mapHelper");
|
|
|
31
31
|
enterModule && enterModule(module);
|
|
32
32
|
})();
|
|
33
33
|
|
|
34
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
34
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
35
35
|
|
|
36
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
36
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
37
37
|
|
|
38
38
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
39
39
|
|
|
@@ -33,9 +33,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
33
33
|
enterModule && enterModule(module);
|
|
34
34
|
})();
|
|
35
35
|
|
|
36
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
36
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
37
37
|
|
|
38
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
38
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
39
39
|
|
|
40
40
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
41
41
|
|
|
@@ -37,9 +37,9 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
37
37
|
|
|
38
38
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
39
|
|
|
40
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
40
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
41
|
|
|
42
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
42
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
43
43
|
|
|
44
44
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
45
45
|
|
|
@@ -27,9 +27,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
27
27
|
enterModule && enterModule(module);
|
|
28
28
|
})();
|
|
29
29
|
|
|
30
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
30
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
31
|
|
|
32
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
32
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
33
33
|
|
|
34
34
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
35
35
|
|
|
@@ -23,9 +23,9 @@ var _useDispatchWithModulesData = require("./../hooks/useDispatchWithModulesData
|
|
|
23
23
|
enterModule && enterModule(module);
|
|
24
24
|
})();
|
|
25
25
|
|
|
26
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
27
|
|
|
28
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
29
|
|
|
30
30
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
31
|
|
|
@@ -25,9 +25,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
25
25
|
enterModule && enterModule(module);
|
|
26
26
|
})();
|
|
27
27
|
|
|
28
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
29
|
|
|
30
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
31
31
|
|
|
32
32
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
33
33
|
|
|
@@ -42,6 +42,12 @@ var initialState = _immutable.default.fromJS({
|
|
|
42
42
|
modules: []
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
+
var setLoadedModulesScope = function setLoadedModulesScope(state, module) {
|
|
46
|
+
var loadedModulesScope = state.get("loadedModulesScope").toJS();
|
|
47
|
+
loadedModulesScope.push(module);
|
|
48
|
+
return state.set("loadedModulesScope", _immutable.default.fromJS(loadedModulesScope));
|
|
49
|
+
};
|
|
50
|
+
|
|
45
51
|
var settingsReducer = function settingsReducer(state, action) {
|
|
46
52
|
if (state === void 0) {
|
|
47
53
|
state = initialState;
|
|
@@ -60,10 +66,15 @@ var settingsReducer = function settingsReducer(state, action) {
|
|
|
60
66
|
return state.set("defaultApp", action.meta.appId);
|
|
61
67
|
|
|
62
68
|
case _scopes.GET_SCOPES_SUCCESS:
|
|
69
|
+
return setLoadedModulesScope(state, action.meta.module);
|
|
70
|
+
|
|
71
|
+
case _scopes.GET_SCOPES_FAILURE:
|
|
63
72
|
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
if (action.payload.status === 500) {
|
|
74
|
+
state = setLoadedModulesScope(state, action.meta.module);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return state;
|
|
67
78
|
}
|
|
68
79
|
|
|
69
80
|
case _scopes.GET_MY_SCOPE_SUCCESS:
|
|
@@ -95,6 +106,7 @@ exports.default = _default3;
|
|
|
95
106
|
}
|
|
96
107
|
|
|
97
108
|
reactHotLoader.register(initialState, "initialState", "/home/vsts/work/1/s/src/reducers/settings.js");
|
|
109
|
+
reactHotLoader.register(setLoadedModulesScope, "setLoadedModulesScope", "/home/vsts/work/1/s/src/reducers/settings.js");
|
|
98
110
|
reactHotLoader.register(settingsReducer, "settingsReducer", "/home/vsts/work/1/s/src/reducers/settings.js");
|
|
99
111
|
reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/reducers/settings.js");
|
|
100
112
|
})();
|
|
@@ -116,6 +128,7 @@ exports.default = _default3;
|
|
|
116
128
|
}
|
|
117
129
|
|
|
118
130
|
reactHotLoader.register(initialState, "initialState", "/home/vsts/work/1/s/src/reducers/settings.js");
|
|
131
|
+
reactHotLoader.register(setLoadedModulesScope, "setLoadedModulesScope", "/home/vsts/work/1/s/src/reducers/settings.js");
|
|
119
132
|
reactHotLoader.register(settingsReducer, "settingsReducer", "/home/vsts/work/1/s/src/reducers/settings.js");
|
|
120
133
|
reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/reducers/settings.js");
|
|
121
134
|
})();
|
|
@@ -35,9 +35,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
35
35
|
enterModule && enterModule(module);
|
|
36
36
|
})();
|
|
37
37
|
|
|
38
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
38
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
39
39
|
|
|
40
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
40
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
41
41
|
|
|
42
42
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
43
43
|
|
|
@@ -15,9 +15,9 @@ var _reselect = require("reselect");
|
|
|
15
15
|
enterModule && enterModule(module);
|
|
16
16
|
})();
|
|
17
17
|
|
|
18
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
19
|
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
21
|
|
|
22
22
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
23
|
|
package/dist/utils/flatten.js
CHANGED
|
@@ -13,9 +13,9 @@ exports.flattenObj = exports.flatten = void 0;
|
|
|
13
13
|
enterModule && enterModule(module);
|
|
14
14
|
})();
|
|
15
15
|
|
|
16
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
17
|
|
|
18
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
19
|
|
|
20
20
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
21
|
|
package/package.json
CHANGED
package/src/actions/scopes.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { makeActionTypes } from "./makeApiAction";
|
|
2
2
|
import makeOrcApiAction from "./makeOrcApiAction";
|
|
3
3
|
import { getApplicationModules, getUserScopeRequest, getUserScopeTreeRequest } from "./requestsApi";
|
|
4
|
+
import { overtureModule } from "../constants";
|
|
4
5
|
|
|
5
6
|
export const validateOvertureApplication = () => {
|
|
6
7
|
if (!OVERTURE_APPLICATION) {
|
|
@@ -23,19 +24,29 @@ export const GET_SCOPES = "GET_SCOPES";
|
|
|
23
24
|
export const [GET_SCOPES_REQUEST, GET_SCOPES_SUCCESS, GET_SCOPES_FAILURE] = makeActionTypes(GET_SCOPES);
|
|
24
25
|
|
|
25
26
|
export const getScopes = module =>
|
|
26
|
-
makeOrcApiAction(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
+
);
|
|
30
36
|
|
|
31
37
|
export const GET_MY_SCOPE = "GET_MY_SCOPE";
|
|
32
38
|
|
|
33
39
|
export const [GET_MY_SCOPE_REQUEST, GET_MY_SCOPE_SUCCESS, GET_MY_SCOPE_FAILURE] = makeActionTypes(GET_MY_SCOPE);
|
|
34
40
|
|
|
35
41
|
export const getDefaultScope = module =>
|
|
36
|
-
makeOrcApiAction(
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
makeOrcApiAction(
|
|
43
|
+
GET_MY_SCOPE,
|
|
44
|
+
getUserScopeRequest.buildUrl(module === overtureModule.System ? overtureModule.Orders : module),
|
|
45
|
+
getUserScopeRequest.verb,
|
|
46
|
+
{
|
|
47
|
+
bailout: false,
|
|
48
|
+
},
|
|
49
|
+
);
|
|
39
50
|
|
|
40
51
|
export const APPLICATION_SCOPE_HAS_CHANGED = "APPLICATION_SCOPE_HAS_CHANGED";
|
|
41
52
|
|
|
@@ -73,6 +73,27 @@ describe("getScopes", () => {
|
|
|
73
73
|
},
|
|
74
74
|
}));
|
|
75
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,
|
|
89
|
+
headers: {
|
|
90
|
+
Accept: "application/json; charset=utf-8",
|
|
91
|
+
"Content-Type": "application/json",
|
|
92
|
+
},
|
|
93
|
+
options: { redirect: "follow" },
|
|
94
|
+
},
|
|
95
|
+
}));
|
|
96
|
+
|
|
76
97
|
it("creates a RSAA to fetch default user scope", () =>
|
|
77
98
|
expect(getDefaultScope, "when called with", ["aModule"], "to exhaustively satisfy", {
|
|
78
99
|
[RSAA]: {
|
|
@@ -90,6 +111,23 @@ describe("getScopes", () => {
|
|
|
90
111
|
},
|
|
91
112
|
}));
|
|
92
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,
|
|
123
|
+
headers: {
|
|
124
|
+
Accept: "application/json; charset=utf-8",
|
|
125
|
+
"Content-Type": "application/json",
|
|
126
|
+
},
|
|
127
|
+
options: { redirect: "follow" },
|
|
128
|
+
},
|
|
129
|
+
}));
|
|
130
|
+
|
|
93
131
|
it("throws an error if no class found on DOM element", () => {
|
|
94
132
|
global.OVERTURE_APPLICATION = "";
|
|
95
133
|
expect(
|
|
@@ -23,15 +23,15 @@ const ApplicationModuleLoader = ({ children }) => {
|
|
|
23
23
|
if (applicationModules.length > 0 && scopesLoaded === false) {
|
|
24
24
|
if (applicationModules.includes(overtureModule.System)) {
|
|
25
25
|
dispatch(initializeFirstModuleScope(scopeTypes.global));
|
|
26
|
-
} else {
|
|
27
|
-
applicationModules.forEach(x => {
|
|
28
|
-
// For the default scope, the latest that will be returned will be the chosen one
|
|
29
|
-
dispatch(getDefaultScope(x));
|
|
30
|
-
// For scopes, they need to be merged
|
|
31
|
-
dispatch(getScopes(x));
|
|
32
|
-
});
|
|
33
26
|
}
|
|
34
27
|
|
|
28
|
+
applicationModules.forEach(x => {
|
|
29
|
+
// For the default scope, the latest that will be returned will be the chosen one
|
|
30
|
+
dispatch(getDefaultScope(x));
|
|
31
|
+
// For scopes, they need to be merged
|
|
32
|
+
dispatch(getScopes(x));
|
|
33
|
+
});
|
|
34
|
+
|
|
35
35
|
setScopesLoaded(true);
|
|
36
36
|
}
|
|
37
37
|
}, [dispatch, applicationModules, scopesLoaded]);
|
|
@@ -40,8 +40,7 @@ const ApplicationModuleLoader = ({ children }) => {
|
|
|
40
40
|
applicationModules.length > 0 &&
|
|
41
41
|
applicationModules.reduce((prev, current) => prev && loadedModules.includes(current), true);
|
|
42
42
|
|
|
43
|
-
const applicationModuleReady =
|
|
44
|
-
(scopeLoadedFromAllModules && defaultScope != null) || applicationModules.includes(overtureModule.System);
|
|
43
|
+
const applicationModuleReady = scopeLoadedFromAllModules && defaultScope != null;
|
|
45
44
|
|
|
46
45
|
if (!applicationModuleReady) {
|
|
47
46
|
return <Loader />;
|
|
@@ -2,9 +2,13 @@ import React from "react";
|
|
|
2
2
|
import Immutable from "immutable";
|
|
3
3
|
import { Provider } from "react-redux";
|
|
4
4
|
import { ThemeProvider } from "styled-components";
|
|
5
|
-
import
|
|
5
|
+
import { Loader } from "./Authenticate";
|
|
6
6
|
import ApplicationModuleLoader from "./ApplicationModuleLoader";
|
|
7
|
-
import {
|
|
7
|
+
import { mount } from "enzyme";
|
|
8
|
+
import { getDefaultScope, getScopes } from "../actions/scopes";
|
|
9
|
+
import sinon from "sinon";
|
|
10
|
+
import { initializeFirstModuleScope } from "../actions/modules";
|
|
11
|
+
import { scopeTypes } from "../constants";
|
|
8
12
|
|
|
9
13
|
const TestComp = () => {
|
|
10
14
|
return <div className="test" />;
|
|
@@ -13,7 +17,7 @@ const TestComp = () => {
|
|
|
13
17
|
jest.mock("../utils/buildUrl", () => {
|
|
14
18
|
const modExport = {};
|
|
15
19
|
modExport.loadConfig = () => Promise.resolve({});
|
|
16
|
-
modExport.buildUrl = () => "URL";
|
|
20
|
+
modExport.buildUrl = (path = [], params = "") => "URL: " + path.join("/") + " " + JSON.stringify(params);
|
|
17
21
|
return modExport;
|
|
18
22
|
});
|
|
19
23
|
|
|
@@ -42,7 +46,7 @@ describe("ApplicationModuleLoader", () => {
|
|
|
42
46
|
store = state => ({
|
|
43
47
|
subscribe: () => {},
|
|
44
48
|
getState: () => state,
|
|
45
|
-
dispatch: ()
|
|
49
|
+
dispatch: sinon.spy().named("dispatch"),
|
|
46
50
|
});
|
|
47
51
|
});
|
|
48
52
|
|
|
@@ -58,28 +62,14 @@ describe("ApplicationModuleLoader", () => {
|
|
|
58
62
|
<TestComp />,
|
|
59
63
|
));
|
|
60
64
|
|
|
61
|
-
it("shows the component when System is part of the application modules", () => {
|
|
62
|
-
state = state.setIn(["settings", "modules"], Immutable.fromJS(["moduleA", overtureModule.System]));
|
|
63
|
-
expect(
|
|
64
|
-
<Provider store={store(state)}>
|
|
65
|
-
<ApplicationModuleLoader>
|
|
66
|
-
<TestComp />
|
|
67
|
-
</ApplicationModuleLoader>
|
|
68
|
-
</Provider>,
|
|
69
|
-
"when mounted",
|
|
70
|
-
"to exhaustively satisfy",
|
|
71
|
-
<TestComp />,
|
|
72
|
-
);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
65
|
it("shows a load indicator component when default scope is still unknown", () => {
|
|
76
66
|
state = state.setIn(["settings", "defaultScope"], null);
|
|
77
67
|
return expect(
|
|
78
68
|
<Provider store={store(state)}>
|
|
79
69
|
<ThemeProvider theme={{}}>
|
|
80
|
-
<
|
|
70
|
+
<ApplicationModuleLoader>
|
|
81
71
|
<TestComp />
|
|
82
|
-
</
|
|
72
|
+
</ApplicationModuleLoader>
|
|
83
73
|
</ThemeProvider>
|
|
84
74
|
</Provider>,
|
|
85
75
|
"when mounted",
|
|
@@ -95,9 +85,9 @@ describe("ApplicationModuleLoader", () => {
|
|
|
95
85
|
return expect(
|
|
96
86
|
<Provider store={store(state)}>
|
|
97
87
|
<ThemeProvider theme={{}}>
|
|
98
|
-
<
|
|
88
|
+
<ApplicationModuleLoader>
|
|
99
89
|
<TestComp />
|
|
100
|
-
</
|
|
90
|
+
</ApplicationModuleLoader>
|
|
101
91
|
</ThemeProvider>
|
|
102
92
|
</Provider>,
|
|
103
93
|
"when mounted",
|
|
@@ -107,4 +97,53 @@ describe("ApplicationModuleLoader", () => {
|
|
|
107
97
|
</ThemeProvider>,
|
|
108
98
|
);
|
|
109
99
|
});
|
|
100
|
+
|
|
101
|
+
it("scopes tree and default scope should be loaded when rendering the component", () => {
|
|
102
|
+
const theStore = store(state);
|
|
103
|
+
|
|
104
|
+
const component = (
|
|
105
|
+
<Provider store={theStore}>
|
|
106
|
+
<ThemeProvider theme={{}}>
|
|
107
|
+
<ApplicationModuleLoader>
|
|
108
|
+
<TestComp />
|
|
109
|
+
</ApplicationModuleLoader>
|
|
110
|
+
</ThemeProvider>
|
|
111
|
+
</Provider>
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
mount(component);
|
|
115
|
+
|
|
116
|
+
expect(theStore.dispatch, "to have calls satisfying", [
|
|
117
|
+
{ args: [getDefaultScope("moduleA")] },
|
|
118
|
+
{ args: [getScopes("moduleA")] },
|
|
119
|
+
{ args: [getDefaultScope("moduleB")] },
|
|
120
|
+
{ args: [getScopes("moduleB")] },
|
|
121
|
+
]);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it("First module scope should be initialized when System is part application modules", () => {
|
|
125
|
+
state = state.setIn(["settings", "modules"], Immutable.fromJS(["moduleA", "System"]));
|
|
126
|
+
|
|
127
|
+
const theStore = store(state);
|
|
128
|
+
|
|
129
|
+
const component = (
|
|
130
|
+
<Provider store={theStore}>
|
|
131
|
+
<ThemeProvider theme={{}}>
|
|
132
|
+
<ApplicationModuleLoader>
|
|
133
|
+
<TestComp />
|
|
134
|
+
</ApplicationModuleLoader>
|
|
135
|
+
</ThemeProvider>
|
|
136
|
+
</Provider>
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
mount(component);
|
|
140
|
+
|
|
141
|
+
expect(theStore.dispatch, "to have calls satisfying", [
|
|
142
|
+
{ args: [initializeFirstModuleScope(scopeTypes.global)] },
|
|
143
|
+
{ args: [getDefaultScope("moduleA")] },
|
|
144
|
+
{ args: [getScopes("moduleA")] },
|
|
145
|
+
{ args: [getDefaultScope("System")] },
|
|
146
|
+
{ args: [getScopes("System")] },
|
|
147
|
+
]);
|
|
148
|
+
});
|
|
110
149
|
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Link from "@material-ui/core/Link";
|
|
3
|
+
import Icon from "../DataDisplay/Icon";
|
|
4
|
+
import { makeStyles } from "@material-ui/core/styles";
|
|
5
|
+
|
|
6
|
+
const useStyles = makeStyles(theme => ({
|
|
7
|
+
icon: {
|
|
8
|
+
paddingLeft: theme.spacing(1),
|
|
9
|
+
width: theme.spacing(1.2),
|
|
10
|
+
color: theme.palette.primary.main,
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
const ExternalLink = ({ id, url, children }) => {
|
|
15
|
+
const classes = useStyles();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Link id={id} href={url} rel="noreferrer" target="_blank" underline="always">
|
|
19
|
+
{children}
|
|
20
|
+
<Icon id="open-in-new-tab" className={classes.icon} />
|
|
21
|
+
</Link>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default ExternalLink;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Link from "@material-ui/core/Link";
|
|
3
|
+
import Icon from "../DataDisplay/Icon";
|
|
4
|
+
import ExternalLink from "./ExternalLink";
|
|
5
|
+
|
|
6
|
+
describe("ExternalLink", () => {
|
|
7
|
+
it("render ExternalLink without errors", () => {
|
|
8
|
+
const children = <div>a div element</div>;
|
|
9
|
+
|
|
10
|
+
expect(
|
|
11
|
+
<ExternalLink id="an_Id" url="https://www.npmjs.com/package/orc-shared" children={children} />,
|
|
12
|
+
"when mounted",
|
|
13
|
+
"to satisfy",
|
|
14
|
+
<Link
|
|
15
|
+
id="an_Id"
|
|
16
|
+
href="https://www.npmjs.com/package/orc-shared"
|
|
17
|
+
rel="noreferrer"
|
|
18
|
+
target="_blank"
|
|
19
|
+
underline="always"
|
|
20
|
+
>
|
|
21
|
+
{children}
|
|
22
|
+
<Icon id="open-in-new-tab" />
|
|
23
|
+
</Link>,
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -122,6 +122,9 @@
|
|
|
122
122
|
<symbol id="icon-dropdown-chevron-down" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
|
|
123
123
|
<polyline fill="none" stroke-linecap="round" stroke-linejoin="round" points="9 3 5 7 1 3"/>
|
|
124
124
|
</symbol>
|
|
125
|
+
<symbol id="icon-open-in-new-tab" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
|
|
126
|
+
<path stroke="none" fill-rule="evenodd" d="M8.4375,6.25 L7.8125,6.25 C7.63991102,6.25 7.5,6.38991102 7.5,6.5625 L7.5,8.75 L1.25,8.75 L1.25,2.5 L4.0625,2.5 C4.23508898,2.5 4.375,2.36008898 4.375,2.1875 L4.375,1.5625 C4.375,1.38991102 4.23508898,1.25 4.0625,1.25 L0.9375,1.25 C0.419733047,1.25 0,1.66973305 0,2.1875 L0,9.0625 C0,9.58026695 0.419733047,10 0.9375,10 L7.8125,10 C8.33026695,10 8.75,9.58026695 8.75,9.0625 L8.75,6.5625 C8.75,6.38991102 8.61008898,6.25 8.4375,6.25 Z M9.53125,0 L7.03125,0 C6.61386719,0 6.40527344,0.506054688 6.69921875,0.80078125 L7.39707031,1.49863281 L2.63671875,6.25722656 C2.54845882,6.34518057 2.49884911,6.46465556 2.49884911,6.58925781 C2.49884911,6.71386007 2.54845882,6.83333506 2.63671875,6.92128906 L3.07949219,7.36328125 C3.16744619,7.45154118 3.28692118,7.50115089 3.41152344,7.50115089 C3.53612569,7.50115089 3.65560068,7.45154118 3.74355469,7.36328125 L8.5015625,2.60390625 L9.19921875,3.30078125 C9.4921875,3.59375 10,3.38867188 10,2.96875 L10,0.46875 C10,0.209866524 9.79013348,0 9.53125,0 Z"/>
|
|
127
|
+
</symbol>
|
|
125
128
|
<symbol id="icon-dropdown-chevron-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
|
|
126
129
|
<polyline fill="none" stroke-linecap="round" stroke-linejoin="round" points="9 3 5 7 1 3" transform="rotate(-90 5 5)"/>
|
|
127
130
|
</symbol>
|
package/src/reducers/settings.js
CHANGED
|
@@ -3,7 +3,12 @@ import addSpawner from "../spawnerMiddleware";
|
|
|
3
3
|
import { changeLocale } from "../actions/locale";
|
|
4
4
|
import { GET_MY_CULTURE_SUCCESS } from "../actions/locale";
|
|
5
5
|
import { GET_MY_APPLICATION_SUCCESS, SET_MY_APPLICATION_SUCCESS } from "../actions/applications";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
GET_APPLICATION_MODULES_SUCCESS,
|
|
8
|
+
GET_MY_SCOPE_SUCCESS,
|
|
9
|
+
GET_SCOPES_FAILURE,
|
|
10
|
+
GET_SCOPES_SUCCESS,
|
|
11
|
+
} from "../actions/scopes";
|
|
7
12
|
import { overtureModule } from "../constants";
|
|
8
13
|
|
|
9
14
|
const initialState = Immutable.fromJS({
|
|
@@ -13,6 +18,12 @@ const initialState = Immutable.fromJS({
|
|
|
13
18
|
modules: [],
|
|
14
19
|
});
|
|
15
20
|
|
|
21
|
+
const setLoadedModulesScope = (state, module) => {
|
|
22
|
+
const loadedModulesScope = state.get("loadedModulesScope").toJS();
|
|
23
|
+
loadedModulesScope.push(module);
|
|
24
|
+
return state.set("loadedModulesScope", Immutable.fromJS(loadedModulesScope));
|
|
25
|
+
};
|
|
26
|
+
|
|
16
27
|
const settingsReducer = (state = initialState, action) => {
|
|
17
28
|
switch (action.type) {
|
|
18
29
|
case GET_APPLICATION_MODULES_SUCCESS:
|
|
@@ -21,10 +32,13 @@ const settingsReducer = (state = initialState, action) => {
|
|
|
21
32
|
return state.set("defaultApp", action.payload.id);
|
|
22
33
|
case SET_MY_APPLICATION_SUCCESS:
|
|
23
34
|
return state.set("defaultApp", action.meta.appId);
|
|
24
|
-
case GET_SCOPES_SUCCESS:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
case GET_SCOPES_SUCCESS:
|
|
36
|
+
return setLoadedModulesScope(state, action.meta.module);
|
|
37
|
+
case GET_SCOPES_FAILURE: {
|
|
38
|
+
if (action.payload.status === 500) {
|
|
39
|
+
state = setLoadedModulesScope(state, action.meta.module);
|
|
40
|
+
}
|
|
41
|
+
return state;
|
|
28
42
|
}
|
|
29
43
|
case GET_MY_SCOPE_SUCCESS:
|
|
30
44
|
return state.set("defaultScope", action.payload.id);
|