orc-shared 1.7.0-dev.8 → 5.2.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/modules.js +15 -1
- package/dist/actions/navigation.js +1 -14
- package/dist/actions/scopes.js +2 -3
- package/dist/buildStore.js +1 -7
- package/dist/components/AppFrame/Sidebar.js +8 -4
- package/dist/components/MaterialUI/DataDisplay/Notification.js +0 -6
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +6 -18
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +1 -2
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +2 -4
- package/dist/components/MaterialUI/DataDisplay/tableHelpers.js +7 -7
- package/dist/components/MaterialUI/Inputs/Autocomplete.js +0 -5
- package/dist/components/MaterialUI/Inputs/DatePicker.js +8 -15
- package/dist/components/MaterialUI/Inputs/InputBase.js +16 -102
- package/dist/components/MaterialUI/Inputs/InputBaseProps.js +1 -7
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +46 -43
- package/dist/components/MaterialUI/Inputs/TimePicker.js +2 -5
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +1 -6
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +0 -1
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +1 -3
- package/dist/components/Routing/Page.js +1 -4
- package/dist/components/Routing/SegmentPage.js +1 -4
- package/dist/components/Routing/SubPage.js +8 -38
- package/dist/components/Scope/useScopeConfirmationModalState.js +3 -1
- package/dist/constants.js +2 -18
- package/dist/content/icons/hide.svg +1 -10
- package/dist/content/icons/open-in-new-tab.svg +1 -3
- package/dist/content/iconsSheet.svg +650 -117
- package/dist/content/orckestra-logo-white.png +0 -0
- package/dist/hooks/useEditState.js +2 -4
- package/dist/reducers/modules.js +3 -4
- package/dist/reducers/navigation.js +0 -16
- package/dist/reducers/request.js +1 -6
- package/dist/reducers/scopes.js +0 -3
- package/dist/reducers/view.js +1 -1
- package/dist/selectors/authentication.js +1 -15
- package/dist/selectors/metadata.js +1 -1
- package/dist/sharedMessages.js +1 -17
- package/dist/utils/propertyHelper.js +0 -33
- package/dist/utils/timezoneHelper.js +1 -23
- package/package.json +7 -10
- package/src/actions/modules.js +10 -0
- package/src/actions/modules.test.js +14 -0
- package/src/actions/navigation.js +0 -7
- package/src/actions/navigation.test.js +0 -12
- package/src/actions/scopes.js +1 -2
- package/src/actions/scopes.test.js +1 -2
- package/src/buildStore.js +0 -6
- package/src/components/AppFrame/About.test.js +3 -3
- package/src/components/AppFrame/Sidebar.js +3 -4
- package/src/components/Form/InputField.test.js +0 -18
- package/src/components/Form/Inputs/Date.test.js +0 -18
- package/src/components/MaterialUI/DataDisplay/Notification.js +0 -6
- package/src/components/MaterialUI/DataDisplay/Notification.test.js +0 -37
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +5 -23
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.test.js +0 -121
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +1 -2
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.test.js +0 -20
- package/src/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +1 -2
- package/src/components/MaterialUI/DataDisplay/tableHelpers.js +8 -8
- package/src/components/MaterialUI/DataDisplay/tableHelpers.test.js +0 -93
- package/src/components/MaterialUI/Inputs/Autocomplete.js +0 -5
- package/src/components/MaterialUI/Inputs/Autocomplete.test.js +0 -15
- package/src/components/MaterialUI/Inputs/DatePicker.js +3 -17
- package/src/components/MaterialUI/Inputs/DatePicker.test.js +1 -143
- package/src/components/MaterialUI/Inputs/InputBase.js +15 -103
- package/src/components/MaterialUI/Inputs/InputBase.test.js +1 -376
- package/src/components/MaterialUI/Inputs/InputBaseProps.js +0 -6
- package/src/components/MaterialUI/Inputs/InputBaseProps.test.js +0 -6
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +27 -39
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.test.js +34 -39
- package/src/components/MaterialUI/Inputs/TimePicker.js +1 -5
- package/src/components/MaterialUI/Navigation/DropDownMenu.js +1 -6
- package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.js +0 -1
- package/src/components/MaterialUI/hocs/withDeferredTooltip.js +1 -2
- package/src/components/MaterialUI/hocs/withDeferredTooltip.test.js +0 -52
- package/src/components/Routing/Page.js +1 -12
- package/src/components/Routing/SegmentPage.js +1 -12
- package/src/components/Routing/SubPage.js +9 -41
- package/src/components/Routing/SubPage.test.js +1 -295
- package/src/components/Scope/useScopeConfirmationModalState.js +3 -1
- package/src/components/Scope/useScopeConfirmationModalState.test.js +35 -4
- package/src/components/Text.test.js +59 -44
- package/src/constants.js +0 -15
- package/src/content/icons/hide.svg +1 -10
- package/src/content/icons/open-in-new-tab.svg +1 -3
- package/src/content/iconsSheet.svg +650 -117
- package/src/content/orckestra-logo-white.png +0 -0
- package/src/hooks/useEditState.js +2 -12
- package/src/hooks/useEditState.test.js +1 -1
- package/src/hooks/useLabelMessage.test.js +10 -16
- package/src/reducers/modules.js +4 -4
- package/src/reducers/modules.test.js +5 -5
- package/src/reducers/navigation.js +0 -24
- package/src/reducers/navigation.test.js +0 -38
- package/src/reducers/request.js +1 -6
- package/src/reducers/request.test.js +0 -34
- package/src/reducers/scopes.js +0 -3
- package/src/reducers/scopes.test.js +0 -47
- package/src/reducers/view.js +1 -1
- package/src/reducers/view.test.js +8 -1
- package/src/selectors/authentication.js +0 -13
- package/src/selectors/authentication.test.js +0 -322
- package/src/selectors/metadata.js +1 -1
- package/src/selectors/metadata.test.js +0 -12
- package/src/sharedMessages.js +1 -17
- package/src/translations/en-US.json +12 -16
- package/src/translations/fr-CA.json +12 -16
- package/src/utils/propertyHelper.js +0 -38
- package/src/utils/propertyHelper.test.js +0 -160
- package/src/utils/timezoneHelper.js +0 -18
- package/src/utils/timezoneHelper.test.js +1 -23
- package/dist/actions/globalErrorMessages.js +0 -63
- package/dist/actions/tasks.js +0 -170
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.js +0 -160
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.js +0 -88
- package/dist/components/TaskDetailsModal.js +0 -191
- package/dist/content/icons/anonymize.svg +0 -3
- package/dist/content/icons/archives.svg +0 -3
- package/dist/content/icons/clean-index.svg +0 -3
- package/dist/content/icons/date-index.svg +0 -3
- package/dist/content/icons/inventory.svg +0 -4
- package/dist/content/icons/query-tester.svg +0 -10
- package/dist/content/icons/reciprocity.svg +0 -10
- package/dist/content/icons/schema.svg +0 -11
- package/dist/content/icons/synonyms.svg +0 -3
- package/dist/content/icons/tenant.svg +0 -3
- package/dist/content/icons/time-index.svg +0 -3
- package/dist/hooks/useDispatchWithErrorHandling.js +0 -103
- package/dist/hooks/useScopeGuardLoader.js +0 -77
- package/dist/reducers/globalErrorMessages.js +0 -78
- package/dist/reducers/scopeRouteState.js +0 -83
- package/dist/reducers/tasks.js +0 -98
- package/dist/selectors/globalErrorMessages.js +0 -57
- package/dist/selectors/scopeRouteState.js +0 -53
- package/dist/selectors/tasks.js +0 -64
- package/dist/utils/responseProcessingHelper.js +0 -86
- package/src/actions/globalErrorMessages.js +0 -12
- package/src/actions/globalErrorMessages.test.js +0 -21
- package/src/actions/tasks.js +0 -77
- package/src/actions/tasks.test.js +0 -169
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.js +0 -108
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/GlobalErrorMessages.test.js +0 -468
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.js +0 -29
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/LookupDisplayValue.test.js +0 -147
- package/src/components/TaskDetailsModal.js +0 -132
- package/src/components/TaskDetailsModal.test.js +0 -317
- package/src/content/icons/anonymize.svg +0 -3
- package/src/content/icons/archives.svg +0 -3
- package/src/content/icons/clean-index.svg +0 -3
- package/src/content/icons/date-index.svg +0 -3
- package/src/content/icons/inventory.svg +0 -4
- package/src/content/icons/query-tester.svg +0 -10
- package/src/content/icons/reciprocity.svg +0 -10
- package/src/content/icons/schema.svg +0 -11
- package/src/content/icons/synonyms.svg +0 -3
- package/src/content/icons/tenant.svg +0 -3
- package/src/content/icons/time-index.svg +0 -3
- package/src/hooks/useDispatchWithErrorHandling.js +0 -57
- package/src/hooks/useDispatchWithErrorHandling.test.js +0 -230
- package/src/hooks/useScopeGuardLoader.js +0 -25
- package/src/hooks/useScopeGuardLoader.test.js +0 -187
- package/src/reducers/globalErrorMessages.js +0 -25
- package/src/reducers/globalErrorMessages.test.js +0 -66
- package/src/reducers/scopeRouteState.js +0 -29
- package/src/reducers/scopeRouteState.test.js +0 -49
- package/src/reducers/tasks.js +0 -56
- package/src/reducers/tasks.test.js +0 -404
- package/src/selectors/globalErrorMessages.js +0 -11
- package/src/selectors/globalErrorMessages.test.js +0 -25
- package/src/selectors/scopeRouteState.js +0 -5
- package/src/selectors/scopeRouteState.test.js +0 -13
- package/src/selectors/tasks.js +0 -16
- package/src/selectors/tasks.test.js +0 -60
- package/src/utils/responseProcessingHelper.js +0 -42
- package/src/utils/responseProcessingHelper.test.js +0 -218
|
Binary file
|
|
@@ -190,18 +190,8 @@ export const useDynamicEditState = (entityId, sectionName, extendedValidationRul
|
|
|
190
190
|
};
|
|
191
191
|
|
|
192
192
|
const resetEditState = (path = []) => {
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const initialFieldValue = !path.length ? initialValue : get(initialValue, pathToField);
|
|
197
|
-
|
|
198
|
-
dispatchWithModulesData(setEditModelField, [
|
|
199
|
-
fullPath,
|
|
200
|
-
initialFieldValue,
|
|
201
|
-
initialFieldValue,
|
|
202
|
-
entityId,
|
|
203
|
-
sectionName,
|
|
204
|
-
]);
|
|
193
|
+
const fullPath = !path.length ? [...keys] : [...keys, "value", ...getValidPath(path)];
|
|
194
|
+
dispatchWithModulesData(setEditModelField, [fullPath, initialValue, initialValue, entityId, sectionName]);
|
|
205
195
|
};
|
|
206
196
|
|
|
207
197
|
const isEditStateValid = (value, path = [], errorTypes = [], dependencies = {}) => {
|
|
@@ -1171,7 +1171,7 @@ describe("useDynamicEditState", () => {
|
|
|
1171
1171
|
expect(useDispatchWithModulesDataSpy, "to have a call satisfying", {
|
|
1172
1172
|
args: [
|
|
1173
1173
|
setEditModelField,
|
|
1174
|
-
[["field", "value", "c", "d"], initialFieldValue
|
|
1174
|
+
[["field", "value", "c", "d"], initialFieldValue, initialFieldValue, entityId, sectionName],
|
|
1175
1175
|
],
|
|
1176
1176
|
});
|
|
1177
1177
|
|
|
@@ -5,14 +5,12 @@ import Immutable from "immutable";
|
|
|
5
5
|
import sinon from "sinon";
|
|
6
6
|
import { messageContainsValues } from "./useLabelMessage";
|
|
7
7
|
import useLabelMessage from "./useLabelMessage";
|
|
8
|
-
import { createMuiTheme, extractMessages, TestWrapper } from "../utils/testUtils";
|
|
9
8
|
|
|
10
9
|
const TestComp = ({ message, buildMessage }) => {
|
|
11
10
|
const [msgResult, missingValues = false] = useLabelMessage(message, buildMessage);
|
|
12
11
|
|
|
13
12
|
return <div missing-values={missingValues ? 1 : 0}>{msgResult}</div>;
|
|
14
13
|
};
|
|
15
|
-
const theme = createMuiTheme();
|
|
16
14
|
|
|
17
15
|
describe("useLabelMessage", () => {
|
|
18
16
|
let store, state;
|
|
@@ -47,18 +45,12 @@ describe("useLabelMessage", () => {
|
|
|
47
45
|
values: { aValue: "testValue" },
|
|
48
46
|
};
|
|
49
47
|
|
|
50
|
-
const messages = extractMessages({ "test.msg": message });
|
|
51
|
-
|
|
52
48
|
return expect(
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
muiThemeProvider={{ theme }}
|
|
59
|
-
>
|
|
60
|
-
<TestComp message={message} />
|
|
61
|
-
</TestWrapper>,
|
|
49
|
+
<Provider store={store}>
|
|
50
|
+
<IntlProvider locale="en">
|
|
51
|
+
<TestComp message={message} />
|
|
52
|
+
</IntlProvider>
|
|
53
|
+
</Provider>,
|
|
62
54
|
"when mounted",
|
|
63
55
|
"to satisfy",
|
|
64
56
|
<div>Test message testValue</div>,
|
|
@@ -73,9 +65,11 @@ describe("useLabelMessage", () => {
|
|
|
73
65
|
};
|
|
74
66
|
|
|
75
67
|
return expect(
|
|
76
|
-
<
|
|
77
|
-
<
|
|
78
|
-
|
|
68
|
+
<Provider store={store}>
|
|
69
|
+
<IntlProvider locale="en">
|
|
70
|
+
<TestComp message={message} />
|
|
71
|
+
</IntlProvider>
|
|
72
|
+
</Provider>,
|
|
79
73
|
"when mounted",
|
|
80
74
|
"to satisfy",
|
|
81
75
|
<div missing-values={1}></div>,
|
package/src/reducers/modules.js
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
INITIALIZE_FIRST_MODULE_SCOPE,
|
|
4
4
|
SET_MODULE_AS_VISIBLE,
|
|
5
5
|
SET_MODULES_STRUCTURE,
|
|
6
|
+
SET_NEW_SCOPE_AND_MODULE_NAME,
|
|
6
7
|
SET_ROUTING_PERFORMED,
|
|
7
8
|
} from "../actions/modules";
|
|
8
9
|
import { infoBar } from "./../constants";
|
|
9
|
-
import { APPLICATION_SCOPE_HAS_CHANGED } from "../actions/scopes";
|
|
10
10
|
|
|
11
11
|
const initialState = Immutable.fromJS({
|
|
12
12
|
tree: {},
|
|
@@ -58,10 +58,10 @@ const viewStateReducer = (state = initialState, action) => {
|
|
|
58
58
|
return state.set("visibleModules", Immutable.fromJS(visibleModules));
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
case
|
|
61
|
+
case SET_NEW_SCOPE_AND_MODULE_NAME: {
|
|
62
62
|
const lastScopeAndModuleSelection = state.get("lastScopeAndModuleSelection").toJS();
|
|
63
63
|
|
|
64
|
-
if (action.payload.
|
|
64
|
+
if (action.payload.scope !== lastScopeAndModuleSelection.scope) {
|
|
65
65
|
state = state.set("visibleModules", Immutable.fromJS([]));
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -69,7 +69,7 @@ const viewStateReducer = (state = initialState, action) => {
|
|
|
69
69
|
"lastScopeAndModuleSelection",
|
|
70
70
|
Immutable.fromJS({
|
|
71
71
|
moduleName: action.payload.moduleName,
|
|
72
|
-
scope: action.payload.
|
|
72
|
+
scope: action.payload.scope,
|
|
73
73
|
routingPerformed: false,
|
|
74
74
|
}),
|
|
75
75
|
);
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
initializeFirstModuleScope,
|
|
4
4
|
setModuleAsVisible,
|
|
5
5
|
setModulesStructure,
|
|
6
|
+
setNewScopeAndModuleName,
|
|
6
7
|
setRoutingPerformed,
|
|
7
8
|
} from "../actions/modules";
|
|
8
9
|
import modulesReducer from "./modules";
|
|
9
|
-
import { applicationScopeHasChanged } from "../actions/scopes";
|
|
10
10
|
|
|
11
11
|
describe("View state reducer", () => {
|
|
12
12
|
const initialState = {
|
|
@@ -145,7 +145,7 @@ describe("View state reducer", () => {
|
|
|
145
145
|
const oldState = Immutable.fromJS({
|
|
146
146
|
...initialState,
|
|
147
147
|
lastScopeAndModuleSelection: {
|
|
148
|
-
scope: "
|
|
148
|
+
scope: "aScope",
|
|
149
149
|
moduleName: null,
|
|
150
150
|
routingPerformed: true,
|
|
151
151
|
},
|
|
@@ -154,13 +154,13 @@ describe("View state reducer", () => {
|
|
|
154
154
|
const expected = {
|
|
155
155
|
...initialState,
|
|
156
156
|
lastScopeAndModuleSelection: {
|
|
157
|
-
scope: "
|
|
157
|
+
scope: "aScope",
|
|
158
158
|
moduleName: "moduleMatrix",
|
|
159
159
|
routingPerformed: false,
|
|
160
160
|
},
|
|
161
161
|
};
|
|
162
162
|
|
|
163
|
-
const action =
|
|
163
|
+
const action = setNewScopeAndModuleName("aScope", "moduleMatrix");
|
|
164
164
|
const newState = modulesReducer(oldState, action);
|
|
165
165
|
return expect(newState, "not to be", oldState).and("to equal", Immutable.fromJS(expected));
|
|
166
166
|
});
|
|
@@ -180,7 +180,7 @@ describe("View state reducer", () => {
|
|
|
180
180
|
},
|
|
181
181
|
};
|
|
182
182
|
|
|
183
|
-
const action =
|
|
183
|
+
const action = setNewScopeAndModuleName("newScope", "moduleMatrix");
|
|
184
184
|
const newState = modulesReducer(oldState, action);
|
|
185
185
|
return expect(newState, "not to be", oldState).and("to equal", Immutable.fromJS(expected));
|
|
186
186
|
});
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
SET_HREF_CONFIG,
|
|
7
7
|
SET_CURRENT_PREPEND_PATH,
|
|
8
8
|
SET_CLOSING_TAB_HANDLER_ACTIONS,
|
|
9
|
-
REMOVE_MODULE_TABS,
|
|
10
9
|
} from "../actions/navigation";
|
|
11
10
|
import { getAllAfterPrependHref } from "../utils/parseHelper";
|
|
12
11
|
import { APPLICATION_SCOPE_HAS_CHANGED } from "../actions/scopes";
|
|
@@ -74,29 +73,6 @@ const navigationReducer = (state = initialState, action) => {
|
|
|
74
73
|
s.deleteIn(["tabIndex", remainingSection]);
|
|
75
74
|
}
|
|
76
75
|
});
|
|
77
|
-
case REMOVE_MODULE_TABS:
|
|
78
|
-
return state.withMutations(s => {
|
|
79
|
-
const { module } = action.payload;
|
|
80
|
-
|
|
81
|
-
s.deleteIn(["moduleTabs", module]);
|
|
82
|
-
s.deleteIn(["closingTabsHandlerActions", module]);
|
|
83
|
-
|
|
84
|
-
s.get("tabIndex")
|
|
85
|
-
.keySeq()
|
|
86
|
-
.forEach(key => {
|
|
87
|
-
if (key.startsWith(module)) {
|
|
88
|
-
s.deleteIn(["tabIndex", key]);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
s.get("mappedHrefs")
|
|
93
|
-
.keySeq()
|
|
94
|
-
.forEach(key => {
|
|
95
|
-
if (key.startsWith(module)) {
|
|
96
|
-
s.deleteIn(["mappedHrefs", key]);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
76
|
case SET_HREF_CONFIG:
|
|
101
77
|
return state.set("config", Immutable.fromJS(action.payload));
|
|
102
78
|
case SET_CURRENT_PREPEND_PATH:
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
setHrefConfig,
|
|
7
7
|
setCurrentPrependPath,
|
|
8
8
|
setClosingTabHandlerActions,
|
|
9
|
-
removeModuleTabs,
|
|
10
9
|
} from "../actions/navigation";
|
|
11
10
|
import reducer from "./navigation";
|
|
12
11
|
import { applicationScopeHasChanged } from "../actions/scopes";
|
|
@@ -296,43 +295,6 @@ describe("Navigation reducer", () => {
|
|
|
296
295
|
});
|
|
297
296
|
});
|
|
298
297
|
|
|
299
|
-
describe("REMOVE_MODULE_TABS", () => {
|
|
300
|
-
it("can remove module tabs", () => {
|
|
301
|
-
const oldState = Immutable.fromJS({
|
|
302
|
-
moduleTabs: { test: ["test/new", "test/old"], another: [1, 2, 3] },
|
|
303
|
-
closingTabsHandlerActions: { test: [0, 1, 2], another: [] },
|
|
304
|
-
tabIndex: { "test/old": {}, "test/new": {}, test: {}, another: {} },
|
|
305
|
-
mappedHrefs: { "test/old": {}, "test/new": {}, test: {}, another2: {} },
|
|
306
|
-
config: { prependPath: "/:scope/" },
|
|
307
|
-
});
|
|
308
|
-
const action = removeModuleTabs("test");
|
|
309
|
-
const newState = reducer(oldState, action);
|
|
310
|
-
return expect(newState, "not to be", oldState).and(
|
|
311
|
-
"to equal",
|
|
312
|
-
Immutable.fromJS({
|
|
313
|
-
moduleTabs: { another: [1, 2, 3] },
|
|
314
|
-
closingTabsHandlerActions: { another: [] },
|
|
315
|
-
tabIndex: { another: {} },
|
|
316
|
-
mappedHrefs: { another2: {} },
|
|
317
|
-
config: { prependPath: "/:scope/" },
|
|
318
|
-
}),
|
|
319
|
-
);
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
it("does nothing if the module to remove is not found", () => {
|
|
323
|
-
const oldState = Immutable.fromJS({
|
|
324
|
-
moduleTabs: { test: ["test/new", "test/old"], another: [1, 2, 3] },
|
|
325
|
-
closingTabsHandlerActions: { test: [0, 1, 2], another: [] },
|
|
326
|
-
tabIndex: { "test/old": {}, "test/new": {}, test: {}, another: {} },
|
|
327
|
-
mappedHrefs: { "test/old": {}, "test/new": {}, test: {}, another2: {} },
|
|
328
|
-
config: { prependPath: "/:scope/" },
|
|
329
|
-
});
|
|
330
|
-
const action = removeModuleTabs("unknown");
|
|
331
|
-
const newState = reducer(oldState, action);
|
|
332
|
-
return expect(newState, "to be", oldState);
|
|
333
|
-
});
|
|
334
|
-
});
|
|
335
|
-
|
|
336
298
|
describe("SET_HREF_CONFIG", () => {
|
|
337
299
|
it("update href config in navigation state", () => {
|
|
338
300
|
const oldState = Immutable.fromJS({
|
package/src/reducers/request.js
CHANGED
|
@@ -11,10 +11,6 @@ export const LOGOUT = "logout";
|
|
|
11
11
|
|
|
12
12
|
const requestReducer = (state = initialState, action) => {
|
|
13
13
|
if (action.type.endsWith("_REQUEST")) {
|
|
14
|
-
if (safeGet(action, "meta", "addToActiveRequests") === false) {
|
|
15
|
-
// this flag should only be used by requests triggered by a background process to avoid the spinner
|
|
16
|
-
return state;
|
|
17
|
-
}
|
|
18
14
|
const requestName = action.type.replace(/_REQUEST$/, "");
|
|
19
15
|
return state.setIn(["actives", requestName], true);
|
|
20
16
|
}
|
|
@@ -24,8 +20,7 @@ const requestReducer = (state = initialState, action) => {
|
|
|
24
20
|
}
|
|
25
21
|
if (action.type.endsWith("_FAILURE")) {
|
|
26
22
|
const requestName = action.type.replace(/_FAILURE$/, "");
|
|
27
|
-
|
|
28
|
-
if (status === 403 || status === 401) {
|
|
23
|
+
if (safeGet(action, "payload", "status") === 403) {
|
|
29
24
|
return state.deleteIn(["actives", requestName]).set("logout", true);
|
|
30
25
|
} else {
|
|
31
26
|
return state.deleteIn(["actives", requestName]).set("error", Immutable.fromJS(action));
|
|
@@ -28,17 +28,6 @@ describe("Request reducer", () => {
|
|
|
28
28
|
);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
it("ignore activity flag when a request is started because addToActiveRequests is false", () => {
|
|
32
|
-
const oldState = Immutable.fromJS({
|
|
33
|
-
actives: {
|
|
34
|
-
SOME_FLAG: true,
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
const action = { type: "TEST_THIS_REQUEST", meta: { addToActiveRequests: false } };
|
|
38
|
-
const newState = reducer(oldState, action);
|
|
39
|
-
expect(newState, "to be", oldState);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
31
|
it("clears activity and logout flag when a request succeeds", () => {
|
|
43
32
|
const oldState = Immutable.fromJS({
|
|
44
33
|
actives: {
|
|
@@ -125,27 +114,4 @@ describe("Request reducer", () => {
|
|
|
125
114
|
}),
|
|
126
115
|
);
|
|
127
116
|
});
|
|
128
|
-
|
|
129
|
-
it("clears activity flag and sets login flag when a request fails with status 401", () => {
|
|
130
|
-
const oldState = Immutable.fromJS({
|
|
131
|
-
actives: {
|
|
132
|
-
SOME_FLAG: true,
|
|
133
|
-
TEST_THIS: true,
|
|
134
|
-
},
|
|
135
|
-
});
|
|
136
|
-
const action = {
|
|
137
|
-
type: "TEST_THIS_FAILURE",
|
|
138
|
-
payload: { status: 401, message: "UnauthorizedAccessException" },
|
|
139
|
-
};
|
|
140
|
-
const newState = reducer(oldState, action);
|
|
141
|
-
expect(newState, "not to be", oldState).and(
|
|
142
|
-
"to equal",
|
|
143
|
-
Immutable.fromJS({
|
|
144
|
-
actives: {
|
|
145
|
-
SOME_FLAG: true,
|
|
146
|
-
},
|
|
147
|
-
[LOGOUT]: true,
|
|
148
|
-
}),
|
|
149
|
-
);
|
|
150
|
-
});
|
|
151
117
|
});
|
package/src/reducers/scopes.js
CHANGED
|
@@ -10,9 +10,6 @@ const scopeReducer = (state = initialState, action) => {
|
|
|
10
10
|
case GET_SCOPES_SUCCESS: {
|
|
11
11
|
const loadedScopes = state.toJS();
|
|
12
12
|
const normalizedScopes = normalize(action.payload, scopeSchema);
|
|
13
|
-
if (action.meta && action.meta.reset) {
|
|
14
|
-
return Immutable.fromJS(normalizedScopes.entities.scopes);
|
|
15
|
-
}
|
|
16
13
|
|
|
17
14
|
if (Object.keys(loadedScopes).length > 0) {
|
|
18
15
|
const addedScope = {};
|
|
@@ -91,51 +91,4 @@ describe("scopes", () => {
|
|
|
91
91
|
}),
|
|
92
92
|
);
|
|
93
93
|
});
|
|
94
|
-
|
|
95
|
-
it("reset option should override previous state", () => {
|
|
96
|
-
const oldState = Immutable.Map({
|
|
97
|
-
Global: {
|
|
98
|
-
id: "Global",
|
|
99
|
-
isAuthorizedScope: true,
|
|
100
|
-
children: ["Child1", "Child2", "Child3"],
|
|
101
|
-
scopePath: ["Global"],
|
|
102
|
-
},
|
|
103
|
-
Child1: { id: "Child1", isAuthorizedScope: true, scopePath: ["Global", "Child1"], children: [] },
|
|
104
|
-
Child2: { id: "Child2", isAuthorizedScope: false, scopePath: ["Global", "Child2"], children: [] },
|
|
105
|
-
ChildOld: { id: "ChildOld", isAuthorizedScope: false, scopePath: ["Global", "ChildOld"], children: [] },
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
const action = {
|
|
109
|
-
type: GET_SCOPES_SUCCESS,
|
|
110
|
-
payload: {
|
|
111
|
-
id: "Global",
|
|
112
|
-
isAuthorizedScope: true,
|
|
113
|
-
children: [
|
|
114
|
-
{ id: "Child1", isAuthorizedScope: false, children: [], parentScopeId: "Global" },
|
|
115
|
-
{ id: "Child2", isAuthorizedScope: true, children: [], parentScopeId: "Global" },
|
|
116
|
-
{ id: "Child3", isAuthorizedScope: false, children: [], parentScopeId: "Global" },
|
|
117
|
-
{ id: "Child4", isAuthorizedScope: true, children: [], parentScopeId: "Global" },
|
|
118
|
-
],
|
|
119
|
-
},
|
|
120
|
-
meta: {
|
|
121
|
-
reset: true,
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
const newState = reducer(oldState, action);
|
|
125
|
-
return expect(newState, "not to be", oldState).and(
|
|
126
|
-
"to satisfy",
|
|
127
|
-
Immutable.fromJS({
|
|
128
|
-
Global: {
|
|
129
|
-
id: "Global",
|
|
130
|
-
isAuthorizedScope: true,
|
|
131
|
-
children: ["Child1", "Child2", "Child3", "Child4"],
|
|
132
|
-
scopePath: ["Global"],
|
|
133
|
-
},
|
|
134
|
-
Child1: { id: "Child1", isAuthorizedScope: false, scopePath: ["Global", "Child1"], children: [] },
|
|
135
|
-
Child2: { id: "Child2", isAuthorizedScope: true, scopePath: ["Global", "Child2"], children: [] },
|
|
136
|
-
Child3: { id: "Child3", isAuthorizedScope: false, scopePath: ["Global", "Child3"], children: [] },
|
|
137
|
-
Child4: { id: "Child4", isAuthorizedScope: true, scopePath: ["Global", "Child4"], children: [] },
|
|
138
|
-
}),
|
|
139
|
-
);
|
|
140
|
-
});
|
|
141
94
|
});
|
package/src/reducers/view.js
CHANGED
|
@@ -522,7 +522,14 @@ describe("View state reducer", () => {
|
|
|
522
522
|
});
|
|
523
523
|
const action = applicationScopeHasChanged("oldScope", "newScope");
|
|
524
524
|
const newState = viewReducer(oldState, action);
|
|
525
|
-
return expect(newState, "not to be", oldState).and(
|
|
525
|
+
return expect(newState, "not to be", oldState).and(
|
|
526
|
+
"to exhaustively satisfy",
|
|
527
|
+
Immutable.fromJS({
|
|
528
|
+
anotherKey: {
|
|
529
|
+
id: "ThisValueShouldRemain",
|
|
530
|
+
},
|
|
531
|
+
}),
|
|
532
|
+
);
|
|
526
533
|
});
|
|
527
534
|
|
|
528
535
|
it("Removes edit model field correctly", () => {
|
|
@@ -42,19 +42,6 @@ export const hasEditorPermissionsForScope = (scope, roleGroup) =>
|
|
|
42
42
|
hasRolePermissions(appRolesClaims, scope, platformRoles.Editor, scopes),
|
|
43
43
|
);
|
|
44
44
|
|
|
45
|
-
export const hasPermissionsForRole = (roleGroup, role) =>
|
|
46
|
-
createSelector(
|
|
47
|
-
selectGroupRolesClaims(roleGroup),
|
|
48
|
-
getCurrentScope,
|
|
49
|
-
getScopesSelector,
|
|
50
|
-
(appRolesClaims, currentScope, scopes) => hasRolePermissions(appRolesClaims, currentScope, role, scopes),
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
export const hasPermissionsForRoleAndScope = (scope, roleGroup, role) =>
|
|
54
|
-
createSelector(selectGroupRolesClaims(roleGroup), getScopesSelector, (appRolesClaims, scopes) =>
|
|
55
|
-
hasRolePermissions(appRolesClaims, scope, role, scopes),
|
|
56
|
-
);
|
|
57
|
-
|
|
58
45
|
export const hasAdministratorPermissions = roleGroup =>
|
|
59
46
|
createSelector(
|
|
60
47
|
selectGroupRolesClaims(roleGroup),
|