orc-shared 1.5.0-dev.13 → 1.5.0-dev.14
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.setRoute = exports.setHrefConfig = exports.setCurrentPrependPath = exports.setClosingTabHandlerActions = exports.removeTab = exports.mapHref = exports.SET_ROUTE = exports.SET_HREF_CONFIG = exports.SET_CURRENT_PREPEND_PATH = exports.SET_CLOSING_TAB_HANDLER_ACTIONS = exports.REMOVE_TAB = exports.MAP_HREF = void 0;
|
|
4
|
+
exports.setRoute = exports.setHrefConfig = exports.setCurrentPrependPath = exports.setClosingTabHandlerActions = exports.removeTab = exports.removeModuleTabs = exports.mapHref = exports.SET_ROUTE = exports.SET_HREF_CONFIG = exports.SET_CURRENT_PREPEND_PATH = exports.SET_CLOSING_TAB_HANDLER_ACTIONS = exports.REMOVE_TAB = exports.REMOVE_MODULE_TABS = exports.MAP_HREF = void 0;
|
|
5
5
|
(function () {
|
|
6
6
|
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
7
7
|
enterModule && enterModule(module);
|
|
@@ -57,6 +57,17 @@ var removeTab = function removeTab(module, path) {
|
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
59
|
exports.removeTab = removeTab;
|
|
60
|
+
var REMOVE_MODULE_TABS = "REMOVE_MODULE_TABS";
|
|
61
|
+
exports.REMOVE_MODULE_TABS = REMOVE_MODULE_TABS;
|
|
62
|
+
var removeModuleTabs = function removeModuleTabs(module) {
|
|
63
|
+
return {
|
|
64
|
+
type: REMOVE_MODULE_TABS,
|
|
65
|
+
payload: {
|
|
66
|
+
module: module
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
exports.removeModuleTabs = removeModuleTabs;
|
|
60
71
|
var SET_HREF_CONFIG = "SET_HREF_CONFIG";
|
|
61
72
|
exports.SET_HREF_CONFIG = SET_HREF_CONFIG;
|
|
62
73
|
var setHrefConfig = function setHrefConfig(prependPath, prependHref, otherConfigs) {
|
|
@@ -105,6 +116,8 @@ exports.setClosingTabHandlerActions = setClosingTabHandlerActions;
|
|
|
105
116
|
reactHotLoader.register(mapHref, "mapHref", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
106
117
|
reactHotLoader.register(REMOVE_TAB, "REMOVE_TAB", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
107
118
|
reactHotLoader.register(removeTab, "removeTab", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
119
|
+
reactHotLoader.register(REMOVE_MODULE_TABS, "REMOVE_MODULE_TABS", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
120
|
+
reactHotLoader.register(removeModuleTabs, "removeModuleTabs", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
108
121
|
reactHotLoader.register(SET_HREF_CONFIG, "SET_HREF_CONFIG", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
109
122
|
reactHotLoader.register(setHrefConfig, "setHrefConfig", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
110
123
|
reactHotLoader.register(SET_CURRENT_PREPEND_PATH, "SET_CURRENT_PREPEND_PATH", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
@@ -129,6 +142,8 @@ exports.setClosingTabHandlerActions = setClosingTabHandlerActions;
|
|
|
129
142
|
reactHotLoader.register(mapHref, "mapHref", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
130
143
|
reactHotLoader.register(REMOVE_TAB, "REMOVE_TAB", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
131
144
|
reactHotLoader.register(removeTab, "removeTab", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
145
|
+
reactHotLoader.register(REMOVE_MODULE_TABS, "REMOVE_MODULE_TABS", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
146
|
+
reactHotLoader.register(removeModuleTabs, "removeModuleTabs", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
132
147
|
reactHotLoader.register(SET_HREF_CONFIG, "SET_HREF_CONFIG", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
133
148
|
reactHotLoader.register(setHrefConfig, "setHrefConfig", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
134
149
|
reactHotLoader.register(SET_CURRENT_PREPEND_PATH, "SET_CURRENT_PREPEND_PATH", "/home/vsts/work/1/s/src/actions/navigation.js");
|
|
@@ -83,6 +83,22 @@ var navigationReducer = function navigationReducer(state, action) {
|
|
|
83
83
|
s.deleteIn(["tabIndex", remainingSection]);
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
|
+
case _navigation.REMOVE_MODULE_TABS:
|
|
87
|
+
return state.withMutations(function (s) {
|
|
88
|
+
var module = action.payload.module;
|
|
89
|
+
s.deleteIn(["moduleTabs", module]);
|
|
90
|
+
s.deleteIn(["closingTabsHandlerActions", module]);
|
|
91
|
+
s.get("tabIndex").keySeq().forEach(function (key) {
|
|
92
|
+
if (key.startsWith(module)) {
|
|
93
|
+
s.deleteIn(["tabIndex", key]);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
s.get("mappedHrefs").keySeq().forEach(function (key) {
|
|
97
|
+
if (key.startsWith(module)) {
|
|
98
|
+
s.deleteIn(["mappedHrefs", key]);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
86
102
|
case _navigation.SET_HREF_CONFIG:
|
|
87
103
|
return state.set("config", _immutable.default.fromJS(action.payload));
|
|
88
104
|
case _navigation.SET_CURRENT_PREPEND_PATH:
|
package/package.json
CHANGED
|
@@ -25,6 +25,13 @@ export const removeTab = (module, path) => ({
|
|
|
25
25
|
payload: { module, path },
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
+
export const REMOVE_MODULE_TABS = "REMOVE_MODULE_TABS";
|
|
29
|
+
|
|
30
|
+
export const removeModuleTabs = module => ({
|
|
31
|
+
type: REMOVE_MODULE_TABS,
|
|
32
|
+
payload: { module },
|
|
33
|
+
});
|
|
34
|
+
|
|
28
35
|
export const SET_HREF_CONFIG = "SET_HREF_CONFIG";
|
|
29
36
|
|
|
30
37
|
export const setHrefConfig = (prependPath, prependHref, otherConfigs = {}) => ({
|
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
SET_HREF_CONFIG,
|
|
6
6
|
setClosingTabHandlerActions,
|
|
7
7
|
SET_CLOSING_TAB_HANDLER_ACTIONS,
|
|
8
|
+
removeModuleTabs,
|
|
9
|
+
REMOVE_MODULE_TABS,
|
|
8
10
|
} from "./navigation";
|
|
9
11
|
|
|
10
12
|
describe("removeTab", () => {
|
|
@@ -18,6 +20,16 @@ describe("removeTab", () => {
|
|
|
18
20
|
}));
|
|
19
21
|
});
|
|
20
22
|
|
|
23
|
+
describe("removeModuleTabs", () => {
|
|
24
|
+
it("creates a remove module tabs action", () =>
|
|
25
|
+
expect(removeModuleTabs, "when called with", ["module"], "to equal", {
|
|
26
|
+
type: REMOVE_MODULE_TABS,
|
|
27
|
+
payload: {
|
|
28
|
+
module: "module",
|
|
29
|
+
},
|
|
30
|
+
}));
|
|
31
|
+
});
|
|
32
|
+
|
|
21
33
|
describe("setHrefConfig", () => {
|
|
22
34
|
it("set href config action", () =>
|
|
23
35
|
expect(setHrefConfig, "when called with", ["/:scope/", "/scope/"], "to equal", {
|
|
@@ -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({
|