orc-shared 1.5.0-dev.9 → 1.6.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/navigation.js +16 -1
- package/dist/actions/requestsApi.js +1 -0
- package/dist/actions/tasks.js +190 -0
- package/dist/buildStore.js +3 -1
- package/dist/components/AppFrame/Sidebar.js +4 -8
- package/dist/components/CategoryList.js +6 -0
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/DiscountedPrice.js +1 -0
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +13 -5
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +4 -2
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +43 -46
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +3 -2
- package/dist/components/Navigation/index.js +0 -1
- package/dist/components/Routing/withWaypointing.js +1 -1
- package/dist/components/TaskDetailsModal.js +193 -0
- package/dist/constants.js +16 -1
- package/dist/reducers/navigation.js +16 -0
- package/dist/reducers/request.js +4 -0
- package/dist/reducers/tasks.js +99 -0
- package/dist/selectors/authentication.js +17 -1
- package/dist/selectors/tasks.js +66 -0
- package/dist/sharedMessages.js +17 -1
- package/dist/utils/propertyHelper.js +35 -0
- package/dist/whyDidYouRerender.js +1 -0
- package/package.json +5 -5
- package/src/actions/navigation.js +7 -0
- package/src/actions/navigation.test.js +12 -0
- package/src/actions/tasks.js +77 -0
- package/src/actions/tasks.test.js +169 -0
- package/src/buildStore.js +2 -0
- package/src/components/AppFrame/About.test.js +3 -3
- package/src/components/AppFrame/Sidebar.js +4 -3
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.js +15 -3
- package/src/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +2 -1
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +39 -27
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.test.js +39 -34
- package/src/components/MaterialUI/hocs/withDeferredTooltip.js +2 -1
- package/src/components/MaterialUI/hocs/withDeferredTooltip.test.js +52 -0
- package/src/components/TaskDetailsModal.js +132 -0
- package/src/components/TaskDetailsModal.test.js +317 -0
- package/src/components/Text.test.js +44 -59
- package/src/constants.js +13 -0
- package/src/hooks/useLabelMessage.test.js +16 -10
- package/src/reducers/navigation.js +24 -0
- package/src/reducers/navigation.test.js +38 -0
- package/src/reducers/request.js +4 -0
- package/src/reducers/request.test.js +11 -0
- package/src/reducers/tasks.js +56 -0
- package/src/reducers/tasks.test.js +404 -0
- package/src/selectors/authentication.js +13 -0
- package/src/selectors/authentication.test.js +322 -0
- package/src/selectors/tasks.js +16 -0
- package/src/selectors/tasks.test.js +60 -0
- package/src/sharedMessages.js +17 -1
- package/src/translations/en-US.json +16 -12
- package/src/translations/fr-CA.json +16 -12
- package/src/utils/propertyHelper.js +38 -0
- package/src/utils/propertyHelper.test.js +160 -0
- package/src/utils/timezoneHelper.test.js +4 -2
|
@@ -5,12 +5,14 @@ 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";
|
|
8
9
|
|
|
9
10
|
const TestComp = ({ message, buildMessage }) => {
|
|
10
11
|
const [msgResult, missingValues = false] = useLabelMessage(message, buildMessage);
|
|
11
12
|
|
|
12
13
|
return <div missing-values={missingValues ? 1 : 0}>{msgResult}</div>;
|
|
13
14
|
};
|
|
15
|
+
const theme = createMuiTheme();
|
|
14
16
|
|
|
15
17
|
describe("useLabelMessage", () => {
|
|
16
18
|
let store, state;
|
|
@@ -45,12 +47,18 @@ describe("useLabelMessage", () => {
|
|
|
45
47
|
values: { aValue: "testValue" },
|
|
46
48
|
};
|
|
47
49
|
|
|
50
|
+
const messages = extractMessages({ "test.msg": message });
|
|
51
|
+
|
|
48
52
|
return expect(
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
<TestWrapper
|
|
54
|
+
provider={{ store }}
|
|
55
|
+
intlProvider={{ messages }}
|
|
56
|
+
memoryRouter
|
|
57
|
+
stylesProvider
|
|
58
|
+
muiThemeProvider={{ theme }}
|
|
59
|
+
>
|
|
60
|
+
<TestComp message={message} />
|
|
61
|
+
</TestWrapper>,
|
|
54
62
|
"when mounted",
|
|
55
63
|
"to satisfy",
|
|
56
64
|
<div>Test message testValue</div>,
|
|
@@ -65,11 +73,9 @@ describe("useLabelMessage", () => {
|
|
|
65
73
|
};
|
|
66
74
|
|
|
67
75
|
return expect(
|
|
68
|
-
<
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
</IntlProvider>
|
|
72
|
-
</Provider>,
|
|
76
|
+
<TestWrapper provider={{ store }} intlProvider memoryRouter stylesProvider muiThemeProvider={{ theme }}>
|
|
77
|
+
<TestComp message={message} />
|
|
78
|
+
</TestWrapper>,
|
|
73
79
|
"when mounted",
|
|
74
80
|
"to satisfy",
|
|
75
81
|
<div missing-values={1}></div>,
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
SET_HREF_CONFIG,
|
|
7
7
|
SET_CURRENT_PREPEND_PATH,
|
|
8
8
|
SET_CLOSING_TAB_HANDLER_ACTIONS,
|
|
9
|
+
REMOVE_MODULE_TABS,
|
|
9
10
|
} from "../actions/navigation";
|
|
10
11
|
import { getAllAfterPrependHref } from "../utils/parseHelper";
|
|
11
12
|
import { APPLICATION_SCOPE_HAS_CHANGED } from "../actions/scopes";
|
|
@@ -73,6 +74,29 @@ const navigationReducer = (state = initialState, action) => {
|
|
|
73
74
|
s.deleteIn(["tabIndex", remainingSection]);
|
|
74
75
|
}
|
|
75
76
|
});
|
|
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
|
+
});
|
|
76
100
|
case SET_HREF_CONFIG:
|
|
77
101
|
return state.set("config", Immutable.fromJS(action.payload));
|
|
78
102
|
case SET_CURRENT_PREPEND_PATH:
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
setHrefConfig,
|
|
7
7
|
setCurrentPrependPath,
|
|
8
8
|
setClosingTabHandlerActions,
|
|
9
|
+
removeModuleTabs,
|
|
9
10
|
} from "../actions/navigation";
|
|
10
11
|
import reducer from "./navigation";
|
|
11
12
|
import { applicationScopeHasChanged } from "../actions/scopes";
|
|
@@ -295,6 +296,43 @@ describe("Navigation reducer", () => {
|
|
|
295
296
|
});
|
|
296
297
|
});
|
|
297
298
|
|
|
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
|
+
|
|
298
336
|
describe("SET_HREF_CONFIG", () => {
|
|
299
337
|
it("update href config in navigation state", () => {
|
|
300
338
|
const oldState = Immutable.fromJS({
|
package/src/reducers/request.js
CHANGED
|
@@ -11,6 +11,10 @@ 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
|
+
}
|
|
14
18
|
const requestName = action.type.replace(/_REQUEST$/, "");
|
|
15
19
|
return state.setIn(["actives", requestName], true);
|
|
16
20
|
}
|
|
@@ -28,6 +28,17 @@ 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
|
+
|
|
31
42
|
it("clears activity and logout flag when a request succeeds", () => {
|
|
32
43
|
const oldState = Immutable.fromJS({
|
|
33
44
|
actives: {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import Immutable from "immutable";
|
|
2
|
+
import { safeGet } from "../utils";
|
|
3
|
+
import {
|
|
4
|
+
GET_TASK_LIST_SUCCESS,
|
|
5
|
+
DELETE_TASK_REQUEST,
|
|
6
|
+
GET_TASK_LOG_SUCCESS,
|
|
7
|
+
CLEAR_TASK_LOG,
|
|
8
|
+
GET_TASKINFO_SUCCESS,
|
|
9
|
+
} from "../actions/tasks";
|
|
10
|
+
import { compareObjectProperty } from "../utils/propertyHelper";
|
|
11
|
+
|
|
12
|
+
const initialState = Immutable.fromJS({
|
|
13
|
+
tasks: [],
|
|
14
|
+
taskInfos: {},
|
|
15
|
+
logs: {},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const tasks = (state = initialState, action) => {
|
|
19
|
+
switch (action.type) {
|
|
20
|
+
case GET_TASKINFO_SUCCESS:
|
|
21
|
+
return state.setIn(["taskInfos", action.payload.taskId], Immutable.fromJS(action.payload));
|
|
22
|
+
case GET_TASK_LIST_SUCCESS:
|
|
23
|
+
return state.set(
|
|
24
|
+
"tasks",
|
|
25
|
+
Immutable.fromJS(action.payload.sort((a, b) => compareObjectProperty(a, b, "created"))),
|
|
26
|
+
);
|
|
27
|
+
case DELETE_TASK_REQUEST:
|
|
28
|
+
const deleteTaskId = safeGet(action, "meta", "taskId");
|
|
29
|
+
|
|
30
|
+
return state.withMutations(s => {
|
|
31
|
+
s.set(
|
|
32
|
+
"tasks",
|
|
33
|
+
s.get("tasks").filter(task => task.get("taskId") !== deleteTaskId),
|
|
34
|
+
);
|
|
35
|
+
s.deleteIn(["logs", deleteTaskId]);
|
|
36
|
+
s.deleteIn(["taskInfos", deleteTaskId]);
|
|
37
|
+
});
|
|
38
|
+
case GET_TASK_LOG_SUCCESS:
|
|
39
|
+
const logTaskId = safeGet(action, "meta", "taskId");
|
|
40
|
+
if (action.payload?.length > 0) {
|
|
41
|
+
return state.setIn(
|
|
42
|
+
["logs", logTaskId],
|
|
43
|
+
Immutable.fromJS(action.payload.sort((a, b) => compareObjectProperty(a, b, "executionTime"))),
|
|
44
|
+
);
|
|
45
|
+
} else {
|
|
46
|
+
return state.deleteIn(["logs", logTaskId]);
|
|
47
|
+
}
|
|
48
|
+
case CLEAR_TASK_LOG:
|
|
49
|
+
const taskId = safeGet(action, "meta", "taskId");
|
|
50
|
+
return state.deleteIn(["logs", taskId]);
|
|
51
|
+
default:
|
|
52
|
+
return state;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default tasks;
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import Immutable from "immutable";
|
|
2
|
+
import { GET_TASK_LIST_SUCCESS, GET_TASK_LOG_SUCCESS, clearTaskLog, GET_TASKINFO_SUCCESS } from "actions/tasks";
|
|
3
|
+
import reducer from "./tasks";
|
|
4
|
+
import { DELETE_TASK_REQUEST } from "../actions/tasks";
|
|
5
|
+
|
|
6
|
+
describe("reports", () => {
|
|
7
|
+
it("behaves as a reducer should", () =>
|
|
8
|
+
expect(reducer, "to be a reducer with initial state", {
|
|
9
|
+
taskInfos: {},
|
|
10
|
+
tasks: [],
|
|
11
|
+
logs: {},
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
describe("load task info", () => {
|
|
15
|
+
it("stores task info from the server", () => {
|
|
16
|
+
const oldState = Immutable.fromJS({
|
|
17
|
+
new: false,
|
|
18
|
+
taskInfos: {
|
|
19
|
+
"8908517403b84b44832e99f5c59eb4eb": {
|
|
20
|
+
taskId: "8908517403b84b44832e99f5c59eb4eb",
|
|
21
|
+
name: "Report export (Report Export)",
|
|
22
|
+
created: "2023-03-24T15:26:32.9986622Z",
|
|
23
|
+
status: "RanToCompletion",
|
|
24
|
+
resultBlobUrl: "packages/Report_20190430_11324479637592.xlsx",
|
|
25
|
+
type: "Orckestra.Overture.Providers.CommerceEngine.Reporting.ReportExportTask, Orckestra.Overture.Providers.CommerceEngine",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
const action = {
|
|
30
|
+
type: GET_TASKINFO_SUCCESS,
|
|
31
|
+
payload: {
|
|
32
|
+
taskId: "5cb96f72f9bb47fc9e4feb5f9817772e",
|
|
33
|
+
created: "2023-03-14T15:26:32.9986622Z",
|
|
34
|
+
name: "Report export (Customer Extract)",
|
|
35
|
+
type: "Orckestra.Overture.Providers.CommerceEngine.Reporting.ReportExportTask, Orckestra.Overture.Providers.CommerceEngine",
|
|
36
|
+
status: "Faulted",
|
|
37
|
+
requester: "gert.sonderby@orckestra.com",
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
const newState = reducer(oldState, action);
|
|
41
|
+
return expect(newState, "not to be", oldState).and(
|
|
42
|
+
"value at",
|
|
43
|
+
"taskInfos",
|
|
44
|
+
"to equal",
|
|
45
|
+
Immutable.fromJS({
|
|
46
|
+
"8908517403b84b44832e99f5c59eb4eb": {
|
|
47
|
+
taskId: "8908517403b84b44832e99f5c59eb4eb",
|
|
48
|
+
created: "2023-03-24T15:26:32.9986622Z",
|
|
49
|
+
name: "Report export (Report Export)",
|
|
50
|
+
status: "RanToCompletion",
|
|
51
|
+
resultBlobUrl: "packages/Report_20190430_11324479637592.xlsx",
|
|
52
|
+
type: "Orckestra.Overture.Providers.CommerceEngine.Reporting.ReportExportTask, Orckestra.Overture.Providers.CommerceEngine",
|
|
53
|
+
},
|
|
54
|
+
"5cb96f72f9bb47fc9e4feb5f9817772e": {
|
|
55
|
+
taskId: "5cb96f72f9bb47fc9e4feb5f9817772e",
|
|
56
|
+
created: "2023-03-14T15:26:32.9986622Z",
|
|
57
|
+
name: "Report export (Customer Extract)",
|
|
58
|
+
type: "Orckestra.Overture.Providers.CommerceEngine.Reporting.ReportExportTask, Orckestra.Overture.Providers.CommerceEngine",
|
|
59
|
+
status: "Faulted",
|
|
60
|
+
requester: "gert.sonderby@orckestra.com",
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe("load task list", () => {
|
|
68
|
+
it("stores new tasks as loaded from the server", () => {
|
|
69
|
+
const oldState = Immutable.fromJS({
|
|
70
|
+
new: false,
|
|
71
|
+
tasks: [
|
|
72
|
+
{
|
|
73
|
+
taskId: "8908517403b84b44832e99f5c59eb4eb",
|
|
74
|
+
name: "Report export (Report Export)",
|
|
75
|
+
status: "RanToCompletion",
|
|
76
|
+
resultBlobUrl: "packages/Report_20190430_11324479637592.xlsx",
|
|
77
|
+
type: "Orckestra.Overture.Providers.CommerceEngine.Reporting.ReportExportTask, Orckestra.Overture.Providers.CommerceEngine",
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
});
|
|
81
|
+
const action = {
|
|
82
|
+
type: GET_TASK_LIST_SUCCESS,
|
|
83
|
+
payload: [
|
|
84
|
+
{
|
|
85
|
+
taskId: "8908517403b84b44832e99f5c59eb4eb",
|
|
86
|
+
created: "2023-03-24T15:26:32.9986622Z",
|
|
87
|
+
name: "Report export (Report Export)",
|
|
88
|
+
status: "RanToCompletion",
|
|
89
|
+
resultBlobUrl: "packages/Report_20190430_11324479637592.xlsx",
|
|
90
|
+
type: "Orckestra.Overture.Providers.CommerceEngine.Reporting.ReportExportTask, Orckestra.Overture.Providers.CommerceEngine",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
taskId: "5cb96f72f9bb47fc9e4feb5f9817772e",
|
|
94
|
+
created: "2023-03-14T15:26:32.9986622Z",
|
|
95
|
+
name: "Report export (Customer Extract)",
|
|
96
|
+
type: "Orckestra.Overture.Providers.CommerceEngine.Reporting.ReportExportTask, Orckestra.Overture.Providers.CommerceEngine",
|
|
97
|
+
status: "Faulted",
|
|
98
|
+
requester: "gert.sonderby@orckestra.com",
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
const newState = reducer(oldState, action);
|
|
103
|
+
return expect(newState, "not to be", oldState).and(
|
|
104
|
+
"value at",
|
|
105
|
+
"tasks",
|
|
106
|
+
"to equal",
|
|
107
|
+
Immutable.fromJS([
|
|
108
|
+
{
|
|
109
|
+
taskId: "5cb96f72f9bb47fc9e4feb5f9817772e",
|
|
110
|
+
created: "2023-03-14T15:26:32.9986622Z",
|
|
111
|
+
name: "Report export (Customer Extract)",
|
|
112
|
+
type: "Orckestra.Overture.Providers.CommerceEngine.Reporting.ReportExportTask, Orckestra.Overture.Providers.CommerceEngine",
|
|
113
|
+
status: "Faulted",
|
|
114
|
+
requester: "gert.sonderby@orckestra.com",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
taskId: "8908517403b84b44832e99f5c59eb4eb",
|
|
118
|
+
created: "2023-03-24T15:26:32.9986622Z",
|
|
119
|
+
name: "Report export (Report Export)",
|
|
120
|
+
status: "RanToCompletion",
|
|
121
|
+
resultBlobUrl: "packages/Report_20190430_11324479637592.xlsx",
|
|
122
|
+
type: "Orckestra.Overture.Providers.CommerceEngine.Reporting.ReportExportTask, Orckestra.Overture.Providers.CommerceEngine",
|
|
123
|
+
},
|
|
124
|
+
]),
|
|
125
|
+
);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
describe("removes a task from the list", () => {
|
|
130
|
+
it("removes a task from the list", () => {
|
|
131
|
+
const oldState = Immutable.fromJS({
|
|
132
|
+
new: false,
|
|
133
|
+
taskInfos: {
|
|
134
|
+
"5cb96f72f9bb47fc9e4feb5f9817772e": {},
|
|
135
|
+
"8908517403b84b44832e99f5c59eb4eb": {},
|
|
136
|
+
},
|
|
137
|
+
tasks: [
|
|
138
|
+
{
|
|
139
|
+
taskId: "8908517403b84b44832e99f5c59eb4eb",
|
|
140
|
+
name: "Report export (Report Export)",
|
|
141
|
+
status: "RanToCompletion",
|
|
142
|
+
resultBlobUrl: "packages/Report_20190430_11324479637592.xlsx",
|
|
143
|
+
type: "Orckestra.Overture.Providers.CommerceEngine.Reporting.ReportExportTask, Orckestra.Overture.Providers.CommerceEngine",
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
taskId: "5cb96f72f9bb47fc9e4feb5f9817772e",
|
|
147
|
+
name: "Report export (Customer Extract)",
|
|
148
|
+
type: "Orckestra.Overture.Providers.CommerceEngine.Reporting.ReportExportTask, Orckestra.Overture.Providers.CommerceEngine",
|
|
149
|
+
status: "Faulted",
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
logs: {
|
|
153
|
+
"8908517403b84b44832e99f5c59eb4eb": ["a"],
|
|
154
|
+
"5cb96f72f9bb47fc9e4feb5f9817772e": ["b"],
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
const action = {
|
|
158
|
+
type: DELETE_TASK_REQUEST,
|
|
159
|
+
meta: { taskId: "8908517403b84b44832e99f5c59eb4eb" },
|
|
160
|
+
};
|
|
161
|
+
const newState = reducer(oldState, action);
|
|
162
|
+
return expect(newState, "not to be", oldState)
|
|
163
|
+
.and(
|
|
164
|
+
"value at",
|
|
165
|
+
"tasks",
|
|
166
|
+
"to equal",
|
|
167
|
+
Immutable.fromJS([
|
|
168
|
+
{
|
|
169
|
+
taskId: "5cb96f72f9bb47fc9e4feb5f9817772e",
|
|
170
|
+
name: "Report export (Customer Extract)",
|
|
171
|
+
type: "Orckestra.Overture.Providers.CommerceEngine.Reporting.ReportExportTask, Orckestra.Overture.Providers.CommerceEngine",
|
|
172
|
+
status: "Faulted",
|
|
173
|
+
},
|
|
174
|
+
]),
|
|
175
|
+
)
|
|
176
|
+
.and(
|
|
177
|
+
"value at",
|
|
178
|
+
"logs",
|
|
179
|
+
"to equal",
|
|
180
|
+
Immutable.fromJS({
|
|
181
|
+
"5cb96f72f9bb47fc9e4feb5f9817772e": ["b"],
|
|
182
|
+
}),
|
|
183
|
+
)
|
|
184
|
+
.and(
|
|
185
|
+
"value at",
|
|
186
|
+
"taskInfos",
|
|
187
|
+
"to equal",
|
|
188
|
+
Immutable.fromJS({
|
|
189
|
+
"5cb96f72f9bb47fc9e4feb5f9817772e": {},
|
|
190
|
+
}),
|
|
191
|
+
);
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
describe("load task log", () => {
|
|
196
|
+
it("stores a log loaded from server", () => {
|
|
197
|
+
const oldState = Immutable.fromJS({
|
|
198
|
+
logs: {
|
|
199
|
+
"5cb96f72f9bb47fc9e4feb5f9817772e": [{ id: "1" }, { id: "2" }],
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
const action = {
|
|
203
|
+
type: GET_TASK_LOG_SUCCESS,
|
|
204
|
+
meta: { taskId: "641b80e5-2bad-454b-b9c2-18753348d121" },
|
|
205
|
+
payload: [
|
|
206
|
+
{
|
|
207
|
+
id: "41debbd4-c229-449b-96b4-4c3a98d53fc3",
|
|
208
|
+
taskId: "641b80e5-2bad-454b-b9c2-18753348d121",
|
|
209
|
+
logLevel: "Info",
|
|
210
|
+
message: "[Information] Exported report to path: packages/Report_20190515_07045925463191.pdf\r\n",
|
|
211
|
+
executionTime: "2019-05-15T07:04:59.3641552Z",
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
id: "80b42d72-6bf2-44ce-beb4-a75cd3867d9d",
|
|
215
|
+
taskId: "641b80e5-2bad-454b-b9c2-18753348d121",
|
|
216
|
+
logLevel: "Info",
|
|
217
|
+
message:
|
|
218
|
+
"[Information] Parameters used for the export:\nName: Scope\nValue: BetterRetail\n\r\nName: StartDate\nValue: 05/15/2014 00:00:00\n\r\nName: EndDate\nValue: 05/15/2019 00:00:00\n\r\n\r\n",
|
|
219
|
+
executionTime: "2019-05-10T07:04:57.8172100Z",
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
id: "2955e65f-744e-4225-beb1-d298a8fd02f6",
|
|
223
|
+
taskId: "641b80e5-2bad-454b-b9c2-18753348d121",
|
|
224
|
+
logLevel: "Info",
|
|
225
|
+
message: '[Information] Starting report export: Report Export. Export as "Pdf"\r\n',
|
|
226
|
+
executionTime: "2019-05-19T07:04:57.8016097Z",
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
};
|
|
230
|
+
const newState = reducer(oldState, action);
|
|
231
|
+
return expect(newState, "not to be", oldState).and(
|
|
232
|
+
"value at",
|
|
233
|
+
"logs",
|
|
234
|
+
"to equal",
|
|
235
|
+
Immutable.fromJS({
|
|
236
|
+
"5cb96f72f9bb47fc9e4feb5f9817772e": [{ id: "1" }, { id: "2" }],
|
|
237
|
+
"641b80e5-2bad-454b-b9c2-18753348d121": [
|
|
238
|
+
{
|
|
239
|
+
id: "80b42d72-6bf2-44ce-beb4-a75cd3867d9d",
|
|
240
|
+
taskId: "641b80e5-2bad-454b-b9c2-18753348d121",
|
|
241
|
+
logLevel: "Info",
|
|
242
|
+
message:
|
|
243
|
+
"[Information] Parameters used for the export:\nName: Scope\nValue: BetterRetail\n\r\nName: StartDate\nValue: 05/15/2014 00:00:00\n\r\nName: EndDate\nValue: 05/15/2019 00:00:00\n\r\n\r\n",
|
|
244
|
+
executionTime: "2019-05-10T07:04:57.8172100Z",
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
id: "41debbd4-c229-449b-96b4-4c3a98d53fc3",
|
|
248
|
+
taskId: "641b80e5-2bad-454b-b9c2-18753348d121",
|
|
249
|
+
logLevel: "Info",
|
|
250
|
+
message: "[Information] Exported report to path: packages/Report_20190515_07045925463191.pdf\r\n",
|
|
251
|
+
executionTime: "2019-05-15T07:04:59.3641552Z",
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
id: "2955e65f-744e-4225-beb1-d298a8fd02f6",
|
|
255
|
+
taskId: "641b80e5-2bad-454b-b9c2-18753348d121",
|
|
256
|
+
logLevel: "Info",
|
|
257
|
+
message: '[Information] Starting report export: Report Export. Export as "Pdf"\r\n',
|
|
258
|
+
executionTime: "2019-05-19T07:04:57.8016097Z",
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
}),
|
|
262
|
+
);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
it("log is replaced", () => {
|
|
266
|
+
const oldState = Immutable.fromJS({
|
|
267
|
+
logs: {
|
|
268
|
+
"5cb96f72f9bb47fc9e4feb5f9817772e": [{ id: "1" }, { id: "2" }],
|
|
269
|
+
"641b80e5-2bad-454b-b9c2-18753348d121": [{ id: "1" }, { id: "2" }],
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
const action = {
|
|
273
|
+
type: GET_TASK_LOG_SUCCESS,
|
|
274
|
+
meta: { taskId: "641b80e5-2bad-454b-b9c2-18753348d121" },
|
|
275
|
+
payload: [
|
|
276
|
+
{
|
|
277
|
+
id: "41debbd4-c229-449b-96b4-4c3a98d53fc3",
|
|
278
|
+
taskId: "641b80e5-2bad-454b-b9c2-18753348d121",
|
|
279
|
+
logLevel: "Info",
|
|
280
|
+
message: "[Information] Exported report to path: packages/Report_20190515_07045925463191.pdf\r\n",
|
|
281
|
+
executionTime: "2019-05-15T07:04:59.3641552Z",
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
id: "80b42d72-6bf2-44ce-beb4-a75cd3867d9d",
|
|
285
|
+
taskId: "641b80e5-2bad-454b-b9c2-18753348d121",
|
|
286
|
+
logLevel: "Info",
|
|
287
|
+
message:
|
|
288
|
+
"[Information] Parameters used for the export:\nName: Scope\nValue: BetterRetail\n\r\nName: StartDate\nValue: 05/15/2014 00:00:00\n\r\nName: EndDate\nValue: 05/15/2019 00:00:00\n\r\n\r\n",
|
|
289
|
+
executionTime: "2019-05-10T07:04:57.8172100Z",
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
id: "2955e65f-744e-4225-beb1-d298a8fd02f6",
|
|
293
|
+
taskId: "641b80e5-2bad-454b-b9c2-18753348d121",
|
|
294
|
+
logLevel: "Info",
|
|
295
|
+
message: '[Information] Starting report export: Report Export. Export as "Pdf"\r\n',
|
|
296
|
+
executionTime: "2019-05-19T07:04:57.8016097Z",
|
|
297
|
+
},
|
|
298
|
+
],
|
|
299
|
+
};
|
|
300
|
+
const newState = reducer(oldState, action);
|
|
301
|
+
return expect(newState, "not to be", oldState).and(
|
|
302
|
+
"value at",
|
|
303
|
+
"logs",
|
|
304
|
+
"to equal",
|
|
305
|
+
Immutable.fromJS({
|
|
306
|
+
"5cb96f72f9bb47fc9e4feb5f9817772e": [{ id: "1" }, { id: "2" }],
|
|
307
|
+
"641b80e5-2bad-454b-b9c2-18753348d121": [
|
|
308
|
+
{
|
|
309
|
+
id: "80b42d72-6bf2-44ce-beb4-a75cd3867d9d",
|
|
310
|
+
taskId: "641b80e5-2bad-454b-b9c2-18753348d121",
|
|
311
|
+
logLevel: "Info",
|
|
312
|
+
message:
|
|
313
|
+
"[Information] Parameters used for the export:\nName: Scope\nValue: BetterRetail\n\r\nName: StartDate\nValue: 05/15/2014 00:00:00\n\r\nName: EndDate\nValue: 05/15/2019 00:00:00\n\r\n\r\n",
|
|
314
|
+
executionTime: "2019-05-10T07:04:57.8172100Z",
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
id: "41debbd4-c229-449b-96b4-4c3a98d53fc3",
|
|
318
|
+
taskId: "641b80e5-2bad-454b-b9c2-18753348d121",
|
|
319
|
+
logLevel: "Info",
|
|
320
|
+
message: "[Information] Exported report to path: packages/Report_20190515_07045925463191.pdf\r\n",
|
|
321
|
+
executionTime: "2019-05-15T07:04:59.3641552Z",
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
id: "2955e65f-744e-4225-beb1-d298a8fd02f6",
|
|
325
|
+
taskId: "641b80e5-2bad-454b-b9c2-18753348d121",
|
|
326
|
+
logLevel: "Info",
|
|
327
|
+
message: '[Information] Starting report export: Report Export. Export as "Pdf"\r\n',
|
|
328
|
+
executionTime: "2019-05-19T07:04:57.8016097Z",
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
}),
|
|
332
|
+
);
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
it("log is removed because of empty list", () => {
|
|
336
|
+
const oldState = Immutable.fromJS({
|
|
337
|
+
logs: {
|
|
338
|
+
"5cb96f72f9bb47fc9e4feb5f9817772e": [{ id: "1" }, { id: "2" }],
|
|
339
|
+
"641b80e5-2bad-454b-b9c2-18753348d121": [{ id: "1" }, { id: "2" }],
|
|
340
|
+
},
|
|
341
|
+
});
|
|
342
|
+
const action = {
|
|
343
|
+
type: GET_TASK_LOG_SUCCESS,
|
|
344
|
+
meta: { taskId: "641b80e5-2bad-454b-b9c2-18753348d121" },
|
|
345
|
+
payload: [],
|
|
346
|
+
};
|
|
347
|
+
const newState = reducer(oldState, action);
|
|
348
|
+
return expect(newState, "not to be", oldState).and(
|
|
349
|
+
"value at",
|
|
350
|
+
"logs",
|
|
351
|
+
"to equal",
|
|
352
|
+
Immutable.fromJS({
|
|
353
|
+
"5cb96f72f9bb47fc9e4feb5f9817772e": [{ id: "1" }, { id: "2" }],
|
|
354
|
+
}),
|
|
355
|
+
);
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
describe("clear task log", () => {
|
|
360
|
+
it("deletes the task log", () => {
|
|
361
|
+
const oldState = Immutable.fromJS({
|
|
362
|
+
logs: {
|
|
363
|
+
"5cb96f72f9bb47fc9e4feb5f9817772e": [{ id: "1" }, { id: "2" }],
|
|
364
|
+
FFb96f72f9bb47fc9e4feb5f981777FF: [{ id: "3" }, { id: "4" }],
|
|
365
|
+
"641b80e5-2bad-454b-b9c2-18753348d121": [
|
|
366
|
+
{
|
|
367
|
+
id: "80b42d72-6bf2-44ce-beb4-a75cd3867d9d",
|
|
368
|
+
taskId: "641b80e5-2bad-454b-b9c2-18753348d121",
|
|
369
|
+
logLevel: "Info",
|
|
370
|
+
message:
|
|
371
|
+
"[Information] Parameters used for the export:\nName: Scope\nValue: BetterRetail\n\r\nName: StartDate\nValue: 05/15/2014 00:00:00\n\r\nName: EndDate\nValue: 05/15/2019 00:00:00\n\r\n\r\n",
|
|
372
|
+
executionTime: "2019-05-10T07:04:57.8172100Z",
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
id: "41debbd4-c229-449b-96b4-4c3a98d53fc3",
|
|
376
|
+
taskId: "641b80e5-2bad-454b-b9c2-18753348d121",
|
|
377
|
+
logLevel: "Info",
|
|
378
|
+
message: "[Information] Exported report to path: packages/Report_20190515_07045925463191.pdf\r\n",
|
|
379
|
+
executionTime: "2019-05-15T07:04:59.3641552Z",
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
id: "2955e65f-744e-4225-beb1-d298a8fd02f6",
|
|
383
|
+
taskId: "641b80e5-2bad-454b-b9c2-18753348d121",
|
|
384
|
+
logLevel: "Info",
|
|
385
|
+
message: '[Information] Starting report export: Report Export. Export as "Pdf"\r\n',
|
|
386
|
+
executionTime: "2019-05-19T07:04:57.8016097Z",
|
|
387
|
+
},
|
|
388
|
+
],
|
|
389
|
+
},
|
|
390
|
+
});
|
|
391
|
+
const action = clearTaskLog("641b80e5-2bad-454b-b9c2-18753348d121");
|
|
392
|
+
const newState = reducer(oldState, action);
|
|
393
|
+
return expect(newState, "not to be", oldState).and(
|
|
394
|
+
"value at",
|
|
395
|
+
"logs",
|
|
396
|
+
"to equal",
|
|
397
|
+
Immutable.fromJS({
|
|
398
|
+
"5cb96f72f9bb47fc9e4feb5f9817772e": [{ id: "1" }, { id: "2" }],
|
|
399
|
+
FFb96f72f9bb47fc9e4feb5f981777FF: [{ id: "3" }, { id: "4" }],
|
|
400
|
+
}),
|
|
401
|
+
);
|
|
402
|
+
});
|
|
403
|
+
});
|
|
404
|
+
});
|
|
@@ -42,6 +42,19 @@ 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
|
+
|
|
45
58
|
export const hasAdministratorPermissions = roleGroup =>
|
|
46
59
|
createSelector(
|
|
47
60
|
selectGroupRolesClaims(roleGroup),
|