asab_webui_shell 25.1.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.
Files changed (90) hide show
  1. package/CHANGELOG.md +218 -0
  2. package/LICENSE +28 -0
  3. package/README.md +3 -0
  4. package/dist/actions.js +22 -0
  5. package/dist/components/branding/BrandImage.js +72 -0
  6. package/dist/components/locationReplace.js +51 -0
  7. package/dist/config/ConfigReducer.js +22 -0
  8. package/dist/config/ConfigService.js +169 -0
  9. package/dist/containers/AdvancedMode/reducer.js +28 -0
  10. package/dist/containers/Alerts/alerts.scss +9 -0
  11. package/dist/containers/Alerts/index.js +81 -0
  12. package/dist/containers/Alerts/reducer.js +68 -0
  13. package/dist/containers/Application.js +773 -0
  14. package/dist/containers/Application.scss +104 -0
  15. package/dist/containers/AttentionRequired/reducer.js +30 -0
  16. package/dist/containers/FullscreenMode/reducer.js +28 -0
  17. package/dist/containers/Header/ApplicationScreenTitle/ApplicationScreenTitle.js +47 -0
  18. package/dist/containers/Header/ApplicationScreenTitle/ApplicationScreenTitle.scss +8 -0
  19. package/dist/containers/Header/ApplicationScreenTitle/index.js +31 -0
  20. package/dist/containers/Header/Help/HelpButton.js +58 -0
  21. package/dist/containers/Header/Help/HelpButton.scss +15 -0
  22. package/dist/containers/Header/Help/HelpService.js +34 -0
  23. package/dist/containers/Header/Preview/PreviewFlag.js +34 -0
  24. package/dist/containers/Header/Preview/PreviewService.js +34 -0
  25. package/dist/containers/Header/header.scss +24 -0
  26. package/dist/containers/Header/index.js +39 -0
  27. package/dist/containers/Header/reducer.js +53 -0
  28. package/dist/containers/Navigation/index.js +66 -0
  29. package/dist/containers/Navigation/reducer.js +56 -0
  30. package/dist/containers/RouteErrorHandler/ErrorContainer.js +46 -0
  31. package/dist/containers/RouteErrorHandler/index.js +80 -0
  32. package/dist/containers/Router/ApplicationRouter.js +78 -0
  33. package/dist/containers/Router/index.js +50 -0
  34. package/dist/containers/Router/reducer.js +28 -0
  35. package/dist/containers/Sidebar/NavbarBrand.js +59 -0
  36. package/dist/containers/Sidebar/SidebarBottomItem.js +55 -0
  37. package/dist/containers/Sidebar/SidebarIcon.js +21 -0
  38. package/dist/containers/Sidebar/SidebarItem.js +209 -0
  39. package/dist/containers/Sidebar/SidebarItemRenderer.js +30 -0
  40. package/dist/containers/Sidebar/index.js +86 -0
  41. package/dist/containers/Sidebar/reducer.js +35 -0
  42. package/dist/containers/Sidebar/sidebar.scss +176 -0
  43. package/dist/containers/Sidepanel/Sidepanel.js +60 -0
  44. package/dist/containers/Sidepanel/Sidepanel.scss +20 -0
  45. package/dist/containers/Toast/ToastComponent.js +31 -0
  46. package/dist/containers/Toast/ToastComponent.jsx +28 -0
  47. package/dist/containers/Toast/ToastContainer.js +80 -0
  48. package/dist/containers/Toast/ToastContainer.jsx +59 -0
  49. package/dist/containers/Toast/reducer.js +55 -0
  50. package/dist/containers/Toast/reducer.jsx +45 -0
  51. package/dist/index.js +48 -0
  52. package/dist/modules/about/AboutScreen.js +84 -0
  53. package/dist/modules/about/index.js +41 -0
  54. package/dist/modules/auth/actions.js +11 -0
  55. package/dist/modules/auth/api.js +214 -0
  56. package/dist/modules/auth/components/SessionExpirationAlert.js +35 -0
  57. package/dist/modules/auth/header.js +109 -0
  58. package/dist/modules/auth/header.scss +9 -0
  59. package/dist/modules/auth/index.js +761 -0
  60. package/dist/modules/auth/reducer.js +36 -0
  61. package/dist/modules/auth/screens/AccessControlScreen.js +78 -0
  62. package/dist/modules/auth/screens/InvitationScreen.js +161 -0
  63. package/dist/modules/i18n/actions.js +7 -0
  64. package/dist/modules/i18n/dropdown.js +77 -0
  65. package/dist/modules/i18n/index.js +44 -0
  66. package/dist/modules/i18n/reducer.js +26 -0
  67. package/dist/modules/i18n/service.js +158 -0
  68. package/dist/modules/tenant/TenantDropdown.js +53 -0
  69. package/dist/modules/tenant/access/AccessDeniedCard.js +107 -0
  70. package/dist/modules/tenant/access/AccessDeniedCard.scss +6 -0
  71. package/dist/modules/tenant/actions.js +10 -0
  72. package/dist/modules/tenant/index.js +41 -0
  73. package/dist/modules/tenant/reducer.js +26 -0
  74. package/dist/modules/tenant/service.js +228 -0
  75. package/dist/screens/InvalidRouteScreen.js +30 -0
  76. package/dist/screens/InvalidRouteScreen.scss +19 -0
  77. package/dist/screens/SuspenseScreen.js +43 -0
  78. package/dist/screens/SuspenseScreen.scss +9 -0
  79. package/dist/screens/UnauthorizedAccessScreen.js +79 -0
  80. package/dist/screens/UnauthorizedAccessScreen.scss +19 -0
  81. package/dist/services/AttentionRequiredService.js +169 -0
  82. package/dist/services/BrandingService.js +104 -0
  83. package/dist/services/HeaderService.js +84 -0
  84. package/dist/services/ReduxService.js +25 -0
  85. package/dist/services/TitleService.js +45 -0
  86. package/dist/theme/ThemeButton.js +39 -0
  87. package/dist/theme/ThemeReducer.js +20 -0
  88. package/dist/theme/ThemeService.js +52 -0
  89. package/dist/theme/actions.js +7 -0
  90. package/package.json +41 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,218 @@
1
+ # CHANGELOG for ASAB WebUI Shell
2
+
3
+ ## v24.47
4
+
5
+ ### Releases
6
+
7
+ - v24.47-alpha36
8
+ - v24.47-alpha34
9
+ - v24.47-alpha16
10
+ - v24.47-alpha6
11
+
12
+ ### Breaking changes
13
+
14
+ - A tenant was added to a beacon websocket path, thus WebUI version `v24.47-alpha16` and higher must be aligned with `asab-remote-control` service `v24.48-alpha` and higher.
15
+ - `X-Tenant` was removed from Request headers and `tenant_` was removed from websocket Sec-Websocket-Protocol in `v24.47-alpha6` WebUI version.
16
+
17
+ ### Bugfix
18
+
19
+ - Fix session expiration handling (fixed the issues with idle mode, refactored the strucutre) and the session expiration info alert message (!463, INDIGO Sprint 250122, v24.47-alpha36)
20
+ - Do not include dummy secret in auth token request (!498, PLUM Sprint 241213, v24.47-alpha34)
21
+
22
+ ### Refactor
23
+
24
+ - Add a tenant to beacon websocket connection path, this must be aligned with `asab-remote-control` service `v24.48-alpha` and higher (!467, INDIGO Sprint 241122, v24.47-alpha16)
25
+ - Remove `X-Tenant` from request headers, remove `tenant_` from websocket subprotocols (!458, INDIGO Sprint 241108, v24.47-alpha6)
26
+
27
+ ## v24.43
28
+
29
+ ### Releases
30
+
31
+ - v24.43-alpha5
32
+
33
+ ### Refactor
34
+
35
+ - Refactor (lowercase) `X-Request-ID` header to `X-Request-Id` (!440, INDIGO Sprint 241030, v24.43-alpha5)
36
+
37
+ ## v24.38
38
+
39
+ ### Releases
40
+
41
+ - v24.38-alpha16
42
+ - v24.38-alpha9
43
+ - v24.38-alpha4
44
+ - v24.38-alpha2
45
+
46
+ ### Refactor
47
+
48
+ - Implement sorting for available tenants (!412, INDIGO Sprint 240913, v24.38-alpha9)
49
+
50
+ ### Features
51
+
52
+ - Implement `X-App: "webui"` and `X-Request-ID: <uid>` API request headers and `app_webui` and `request_id_<uid>` subprotocols to every request call to the service (!420, INDIGO Sprint 240913, v24.38-alpha16)
53
+ - Implement attention required service with Beacons and Toasts (!390, INDIGO Sprint 240913, v24.38-alpha2)
54
+
55
+ ### Bugfix
56
+
57
+ - Fix issue on user trying to log in to the application without a assigned tenant, resulting in the infinite loop. (!413, INDIGO Sprint 240913, v24.38-alpha4)
58
+
59
+ ## v24.28
60
+
61
+ ### Releases
62
+
63
+ - v24.28-alpha33
64
+ - v24.28-alpha30
65
+ - v24.28-alpha8
66
+
67
+ ### Breaking changes
68
+
69
+ - Added special attributes to work correctly to generate `pdf/png` exports for superuser. Recommended not to be combined with the `asab-pyppeteer` service of versions **lower** than `v24.32-alpha3`.
70
+
71
+ ### Features
72
+
73
+ - Implement `print-ready` and `print-unauthorized` attribute for `UnauthorizedAccessScreen` (!375, INDIGO Sprint 240802, v24.28-alpha30)
74
+ - Add interceptors for injecting tenant into the request headers for API (`X-Tenant`) and websocket (`tenant_`) calls. (!348, INDIGO Sprint 240621, v24.28-alpha8)
75
+
76
+ ### Bugfix
77
+
78
+ - Fix on implementation of `print-ready` and `print-unauthorized` attribute for `UnauthorizedAccessScreen` which was causing the application crashes (!386, INDIGO Sprint 240802, v24.28-alpha33)
79
+
80
+ ## v24.19
81
+
82
+ ### Releases
83
+
84
+ - v24.19-alpha30
85
+ - v24.19-alpha27
86
+ - v24.19-alpha23
87
+ - v24.19-alpha19
88
+ - v24.19-alpha15
89
+ - v24.19-alpha14
90
+ - v24.19-alpha12
91
+ - v24.19-alpha11
92
+ - v24.19-alpha9
93
+ - v24.19-alpha1
94
+
95
+ ### Breaking changes
96
+
97
+ - User invitation path has been updated. Requires Seacat Auth `v24.17-beta1` or later.
98
+
99
+ ### Features
100
+
101
+ - Update user invitation path (!332, PLUM Sprint 240531, v24.19-alpha19)
102
+ - Implement Application sidepanel feature (!310, INDIGO Sprint 240527, v24.19-alpha14)
103
+ - Change color and icon of username if the user is logged in as a superuser (!321, INDIGO Sprint 240527, v24.19-alpha11)
104
+ - Implement FullScreen mode (!252, INDIGO Sprint 240527, v24.19-alpha9)
105
+ - Add sorting to the Navigation item children (!305, INDIGO Sprint 240510, v24.19-alpha1)
106
+
107
+ ### Refactor
108
+
109
+ - Updated info alert for Fullscreen mode. (!342, INDIGO Sprint 240621, v24.19-alpha30)
110
+ - Rename ErrorHandler component to RouteErrorHandler (!339, INDIGO Sprint 240621, v24.19-alpha27)
111
+ - Change svg chevron in sidebar bottom to bootstrap icon (!329, INDIGO Sprint 240607, v24.19-alpha23)
112
+ - Refactor `addAlertFromException`. Added new condition for checking new format of errors (!299, INDIGO Sprint 240527, v24.19-alpha12)
113
+
114
+ ### Bugfix
115
+
116
+ - Change color of the caret in the DropdownToggle of the username (when user is logged in as superuser) (!328, INDIGO Sprint 240527, v24.19-alpha15)
117
+
118
+ ## v24.08
119
+
120
+ - v24.08-alpha51
121
+ - v24.08-alpha49
122
+ - v24.08-alpha40
123
+ - v24.08-alpha33
124
+ - v24.08-alpha28
125
+ - v24.08-alpha27
126
+ - v24.08-alpha21
127
+ - v24.08-alpha14
128
+ - v24.08-alpha13
129
+ - v24.08-alpha10
130
+
131
+ ### Breaking changes
132
+
133
+ - The option to hide sidebar items via configuration has been removed from `v24.08-alpha13`. Therefore the configuration schema needs to be updated accordingly.
134
+
135
+ ### Features
136
+
137
+ - Log into last authorized tenant (!301, PLUM Sprint 240503, v24.08-alpha51)
138
+ - Implement cancel button for invitations (!285, INDIGO Sprint 240430, v24.08-alpha49)
139
+ - Implement PubSub messaging (!244, INDIGO Sprint 240411, v24.08-alpha40)
140
+ - Update auth header to use Seacat Account UI (!148, INDIGO Sprint 240301, v24.08-alpha21)
141
+ - Implement `removeComponent` method for `HeaderService` (!205, INDIGO Sprint 240301, v24.08-alpha14)
142
+
143
+ ### Refactor
144
+
145
+ - Display the resources in the access control screen in alphabetical order (!254, INDIGO Sprint 240402, v24.08-alpha28)
146
+ - Remove the option to hide sidebar items using configuration (!232, INDIGO Sprint 240301, v24.08-alpha13)
147
+ - Change height of ResultCard and remove top margin to prevent scrolling (!122, INDIGO Sprint 240216, v24.08-alpha10)
148
+
149
+ ### Bugfix
150
+
151
+ - Redirect URI in authorization request and token request must match (!255, INDIGO Sprint 240402, v24.08-alpha27)
152
+
153
+ ### Hotfix
154
+
155
+ - Fix title service causing application crash due to render issues caused by useEffect in the Title service (!260, INDIGO Sprint 240411, v24.08-alpha33)
156
+
157
+ ## v24.03
158
+
159
+ ### Releases
160
+
161
+ - v24.03-alpha3
162
+
163
+ ### Features
164
+
165
+ - Add ResultCard, which will be displayed after un/successfully inviting other users (!163, INDIGO Sprint 240105, v24.03-alpha3)
166
+
167
+ ## v23.48
168
+
169
+ ### Releases
170
+
171
+ - v23.48-alpha30
172
+ - v23.48-alpha28
173
+ - v23.48-alpha23
174
+ - v23.48-alpha22
175
+ - v23.48-alpha17
176
+ - v23.48-alpha6
177
+
178
+ ### Features
179
+
180
+ - Add a "asab" websocket subprotocol to enable working of websocket connection with Chrome/Safari/... browsers. These browsers requires Sec-Websocket-Accept response header which this change should allow (!170, INDIGO Sprint 240105, v23.48-alpha28)
181
+ - Add "batman" to OAuth scope to enable authorized communication with ElasticSearch (!166, INDIGO Sprint 231208, v23.48-alpha22)
182
+
183
+
184
+ ### Refactor
185
+
186
+ - Refactor handling of the Help button content in the header and make it more performant (!161, INDIGO Sprint 231208, v23.48-alpha17)
187
+ - Refactor sidebar styling and collapse behaviour and fixing :active state when clicking inside screens (!105, INDIGO Sprint 231110, v23.48-alpha6)
188
+ - Refactor sidebar modal and fixing behaviour of nav items so they will stay active on the correct item in library (!154, INDIGO Sprint 231124, v23.48-alpha23)
189
+
190
+ ### Bugfix
191
+
192
+ - Fix displaying sidebar in the print, replace bootstrap styles form jsx to scss file (!172, INDIGO Sprint 240105, v23.48-alpha30)
193
+
194
+ ## v23.45
195
+
196
+ ### Releases
197
+
198
+ - v23.45-alpha6
199
+ - v23.45-alpha1
200
+
201
+ ### Breaking changes
202
+
203
+ - After migration from react-router-dom v5 to react-router-dom v6, some of the routing components are not being supported. For more info, please see https://reactrouter.com/en/main/upgrading/v5
204
+
205
+ ### Features
206
+
207
+ - Implement addAlertFromException method to render additional information from exceptions in Alert message (!106, INDIGO Sprint 231110, v23.45-alpha6)
208
+ - Migrate react-router-dom from v5 to v6 (!98, INDIGO Sprint 231027, v23.45-alpha1)
209
+
210
+ ## v23.44
211
+
212
+ ### Releases
213
+
214
+ - v23.44-alpha3
215
+
216
+ ### Refactoring
217
+
218
+ - Rename `asab_webui_state` used for capturing the application state to `oauth2_state_<state>` and made a string instead of object from it to avoid race conditions (!116, INDIGO Sprint 231027, v23.44-alpha3)
package/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2025, TeskaLabs
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Asab Webui Shell Lib
2
+
3
+ Shell library of ASAB used in WebUI projects.
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SET_SUBTITLE = exports.SET_ROUTES = exports.SET_NAVIGATION_ITEMS = exports.SET_HELP_PATH = exports.SET_HEADER_NAVIGATION_ITEMS = exports.SET_FULLSCREEN_MODE = exports.SET_FLAG = exports.SET_ATTENTION_REQUIRED_BEACON = exports.SET_ADVANCED_MODE = exports.DEL_TOAST = exports.DEL_ALERT = exports.COLLAPSE_SIDEBAR = exports.CHANGE_CONFIG = exports.ADD_TOAST = exports.ADD_ALERT = exports.ACK_ALERT = void 0;
7
+ var ADD_ALERT = exports.ADD_ALERT = "asab/addAlert";
8
+ var ACK_ALERT = exports.ACK_ALERT = "asab/ackAlert";
9
+ var DEL_ALERT = exports.DEL_ALERT = "asab/delAlert";
10
+ var ADD_TOAST = exports.ADD_TOAST = "asab/addToast";
11
+ var DEL_TOAST = exports.DEL_TOAST = "asab/delToast";
12
+ var SET_HELP_PATH = exports.SET_HELP_PATH = "asab/setHelpContent";
13
+ var SET_SUBTITLE = exports.SET_SUBTITLE = "asab/setSubtitle";
14
+ var SET_FLAG = exports.SET_FLAG = "asab/setFlag";
15
+ var SET_ADVANCED_MODE = exports.SET_ADVANCED_MODE = "asab/setAdvancedMode";
16
+ var SET_FULLSCREEN_MODE = exports.SET_FULLSCREEN_MODE = "asab/setFullscreenMode";
17
+ var CHANGE_CONFIG = exports.CHANGE_CONFIG = "asab/changeConfig";
18
+ var COLLAPSE_SIDEBAR = exports.COLLAPSE_SIDEBAR = "asab/collapseSidebar";
19
+ var SET_NAVIGATION_ITEMS = exports.SET_NAVIGATION_ITEMS = "asab/setNavigationItems";
20
+ var SET_ROUTES = exports.SET_ROUTES = "asab/setRoutes";
21
+ var SET_HEADER_NAVIGATION_ITEMS = exports.SET_HEADER_NAVIGATION_ITEMS = "asab/setHeaderNavigationItems";
22
+ var SET_ATTENTION_REQUIRED_BEACON = exports.SET_ATTENTION_REQUIRED_BEACON = "asab/setAttentionRequiredBeacon";
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getBrandImage = getBrandImage;
7
+ /* Using getBrandImage
8
+
9
+ - GetBrandImage function returns a brandImage object, based on theme.
10
+
11
+ - Under the hood, the function uses BrandingService. This service determines correct configuration tu use (dynamic, static, or default).
12
+ Then, if selected configuration's brand image is not complete (e.g. minimized variation is missing), it substitutes missing variations.
13
+
14
+ `getBrandImage(props, theme, type);`
15
+ params:
16
+ * props
17
+ * theme ('light' || 'dark')
18
+ * type (optional, default is 'brandImage') - determines content - either for brand Image (in header) or for company branding in the bottom of the sidebar
19
+
20
+ return example
21
+ `{
22
+ full: 'path/to/logo-light-full',
23
+ minimized: 'path/to/logo-light-minimized',
24
+ href: '/subpath'
25
+ }`
26
+
27
+ Example:
28
+
29
+ ```javascript
30
+ import { useState, useEffect } from 'react';
31
+ import { getBrandImage } from 'asab_webui_shell';
32
+ import { useSelector } from 'react-redux';
33
+
34
+ const YourCode = (props) => {
35
+ const [ brandImage, setBrandImage ] = useState({});
36
+ const theme = useSelector(state => state.theme);
37
+
38
+ useEffect(() => {
39
+ setBrandImage(getBrandImage(props, theme));
40
+ }, [theme]);
41
+
42
+ ...
43
+
44
+ return (
45
+ <>
46
+
47
+ ...
48
+
49
+ <img src={brandImage?.full}/>
50
+
51
+ ...
52
+
53
+ </>
54
+ )
55
+ };
56
+
57
+ export default YourCode
58
+
59
+ ```
60
+ */
61
+
62
+ function getBrandImage(props) {
63
+ var theme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'light';
64
+ var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "brandImage";
65
+ var BrandingService = props.app.Services.BrandingService;
66
+ var brandImage;
67
+ if (BrandingService && theme) {
68
+ brandImage = BrandingService.getLogo(theme, type);
69
+ }
70
+ return brandImage;
71
+ }
72
+ ;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.locationReplace = void 0;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
+ /*
11
+
12
+ Use only within async functions as per example below.
13
+ locationReplace function help to avoid unintended async actions
14
+ before window.location.replace has finished.
15
+
16
+
17
+ ```
18
+ import { locationReplace } from '../../components/locationReplace';
19
+
20
+ const myFunc = async () => {
21
+ ...
22
+
23
+ const url = "url/to/replace";
24
+ await locationReplace(url);
25
+ ...
26
+ }
27
+
28
+ ```
29
+
30
+ */
31
+
32
+ var locationReplace = exports.locationReplace = /*#__PURE__*/function () {
33
+ var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(url) {
34
+ return _regenerator["default"].wrap(function _callee$(_context) {
35
+ while (1) switch (_context.prev = _context.next) {
36
+ case 0:
37
+ window.location.replace(url.toString());
38
+ _context.next = 3;
39
+ return new Promise(function (r) {
40
+ return setTimeout(r, 3600 * 1000);
41
+ });
42
+ case 3:
43
+ case "end":
44
+ return _context.stop();
45
+ }
46
+ }, _callee);
47
+ }));
48
+ return function locationReplace(_x) {
49
+ return _ref.apply(this, arguments);
50
+ };
51
+ }();
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = ConfigReducer;
7
+ var _actions = require("../actions");
8
+ // Actions
9
+
10
+ var initialState = {};
11
+ function ConfigReducer() {
12
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
13
+ var action = arguments.length > 1 ? arguments[1] : undefined;
14
+ switch (action.type) {
15
+ case _actions.CHANGE_CONFIG:
16
+ {
17
+ return action.config;
18
+ }
19
+ default:
20
+ return state;
21
+ }
22
+ }
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
13
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
+ var _asab_webui_components = require("asab_webui_components");
15
+ var _ConfigReducer = _interopRequireDefault(require("./ConfigReducer"));
16
+ var _actions = require("../actions");
17
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
18
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
19
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
20
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
21
+ var ConfigService = exports["default"] = /*#__PURE__*/function (_Service) {
22
+ function ConfigService(app) {
23
+ var _this;
24
+ var serviceName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "ConfigService";
25
+ (0, _classCallCheck2["default"])(this, ConfigService);
26
+ _this = _callSuper(this, ConfigService, [app, serviceName]);
27
+ app.ReduxService.addReducer("config", _ConfigReducer["default"]);
28
+ _this.Config = new Config();
29
+ return _this;
30
+ }
31
+ (0, _inherits2["default"])(ConfigService, _Service);
32
+ return (0, _createClass2["default"])(ConfigService, [{
33
+ key: "initialize",
34
+ value: function initialize() {
35
+ var _document$getElements, _document$getElements2, _document$getElements3, _document$getElements4, _document$getElements5, _document$getElements6;
36
+ // Initialization of dynamic configuration
37
+ var headerLogoFull = (_document$getElements = document.getElementsByName('header-logo-full')[0]) === null || _document$getElements === void 0 ? void 0 : _document$getElements.content;
38
+ var headerLogoMini = (_document$getElements2 = document.getElementsByName('header-logo-minimized')[0]) === null || _document$getElements2 === void 0 ? void 0 : _document$getElements2.content;
39
+ var headerLogoFullDark = (_document$getElements3 = document.getElementsByName('header-logo-full-dark')[0]) === null || _document$getElements3 === void 0 ? void 0 : _document$getElements3.content;
40
+ var headerLogoMiniDark = (_document$getElements4 = document.getElementsByName('header-logo-minimized-dark')[0]) === null || _document$getElements4 === void 0 ? void 0 : _document$getElements4.content;
41
+ var title = (_document$getElements5 = document.getElementsByName('title')[0]) === null || _document$getElements5 === void 0 ? void 0 : _document$getElements5.content;
42
+ var customCSS = (_document$getElements6 = document.getElementsByName('custom-css-file')[0]) === null || _document$getElements6 === void 0 ? void 0 : _document$getElements6.content;
43
+ var dynamicConfig = {};
44
+ // determine if any logos have been dynamically configured and assign brandImage property as an empty object
45
+ if (headerLogoFull != undefined && headerLogoFull != "" || headerLogoFullDark != undefined && headerLogoFullDark != "" || headerLogoMini != undefined && headerLogoMini != "" || headerLogoMiniDark != undefined && headerLogoMiniDark != "") {
46
+ dynamicConfig.brandImage = {};
47
+ }
48
+ // If header's full light logo has been configured, add it to dynamic config object
49
+ if (headerLogoFull != undefined && headerLogoFull != "") {
50
+ Object.assign(dynamicConfig.brandImage, {
51
+ "light": {
52
+ "full": headerLogoFull
53
+ }
54
+ });
55
+ }
56
+ // If header's full dark logo has been configured, extend/add it to dynamic config's brandImage property
57
+ if (headerLogoFullDark != undefined && headerLogoFullDark != "") {
58
+ Object.assign(dynamicConfig.brandImage, {
59
+ "dark": {
60
+ "full": headerLogoFullDark
61
+ }
62
+ });
63
+ }
64
+ // If header's minimized light logo has been configured, extend/add it to dynamic config brandImage property
65
+ if (headerLogoMini != undefined && headerLogoMini != "") {
66
+ var _dynamicConfig$brandI;
67
+ Object.assign(dynamicConfig.brandImage, _objectSpread(_objectSpread({}, dynamicConfig.brandImage), {}, {
68
+ "light": _objectSpread(_objectSpread({}, (_dynamicConfig$brandI = dynamicConfig.brandImage) === null || _dynamicConfig$brandI === void 0 ? void 0 : _dynamicConfig$brandI.light), {}, {
69
+ "minimized": headerLogoMini
70
+ })
71
+ }));
72
+ }
73
+ // If header's minimized dark logo has been configured, extend/add it to dynamic config brandImage property
74
+ if (headerLogoMiniDark != undefined && headerLogoMiniDark != "") {
75
+ var _dynamicConfig$brandI2;
76
+ Object.assign(dynamicConfig.brandImage, _objectSpread(_objectSpread({}, dynamicConfig.brandImage), {}, {
77
+ "dark": _objectSpread(_objectSpread({}, (_dynamicConfig$brandI2 = dynamicConfig.brandImage) === null || _dynamicConfig$brandI2 === void 0 ? void 0 : _dynamicConfig$brandI2.dark), {}, {
78
+ "minimized": headerLogoMiniDark
79
+ })
80
+ }));
81
+ }
82
+
83
+ // Add custom title
84
+ if (title != undefined && title != "") {
85
+ dynamicConfig["title"] = title;
86
+ }
87
+ // Add custom CSS
88
+ if (customCSS != undefined && customCSS != "") {
89
+ var link = document.createElement('link');
90
+ link.setAttribute('rel', 'stylesheet');
91
+ link.setAttribute('href', customCSS);
92
+ // Append to the `head` element
93
+ document.head.appendChild(link);
94
+ }
95
+
96
+ // Dispatch customs to config store
97
+ if (Object.keys(dynamicConfig).length > 0) {
98
+ this.Config._dynamic_config = dynamicConfig;
99
+ if (this.App.Store !== undefined) {
100
+ this.Config.dispatch(this.App.Store);
101
+ } else {
102
+ console.warn('Dynamic configuration has not been dispatched to application store');
103
+ }
104
+ }
105
+ }
106
+ }, {
107
+ key: "addDefaults",
108
+ value: function addDefaults(defaults, override) {
109
+ if (defaults === undefined) return;
110
+ if (defaults === null) return;
111
+ if (override === false) {
112
+ for (var key in defaults) {
113
+ if (this.Config._defaults[key] === undefined) {
114
+ this.Config._defaults[key] = defaults[key];
115
+ }
116
+ }
117
+ } else {
118
+ for (var key in defaults) {
119
+ this.Config._defaults[key] = defaults[key];
120
+ }
121
+ }
122
+ this.Config.dispatch(this.App.Store);
123
+ }
124
+ }]);
125
+ }(_asab_webui_components.Service);
126
+ var Config = /*#__PURE__*/function () {
127
+ function Config(app) {
128
+ (0, _classCallCheck2["default"])(this, Config);
129
+ this._dynamic_config = {};
130
+ this._defaults = {};
131
+ if (typeof LOCAL_CONFIG !== 'undefined') {
132
+ this._local_config = LOCAL_CONFIG;
133
+ } else {
134
+ this._local_config = {};
135
+ }
136
+ }
137
+ return (0, _createClass2["default"])(Config, [{
138
+ key: "get",
139
+ value: function get(key) {
140
+ // First check the remote config
141
+ if (this._dynamic_config[key] != undefined) {
142
+ return this._dynamic_config[key];
143
+ }
144
+ ;
145
+
146
+ // Then check the local config
147
+ if (this._local_config[key] != undefined) {
148
+ this._local_config[key];
149
+ }
150
+ ;
151
+
152
+ // And finally, check defaults
153
+ if (this._defaults[key] != undefined) {
154
+ return this._defaults[key];
155
+ }
156
+ ;
157
+ return undefined;
158
+ }
159
+ }, {
160
+ key: "dispatch",
161
+ value: function dispatch(store) {
162
+ var config = Object.assign({}, this._defaults, this._local_config, this._dynamic_config);
163
+ store.dispatch({
164
+ type: _actions.CHANGE_CONFIG,
165
+ config: config
166
+ });
167
+ }
168
+ }]);
169
+ }();
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = advancedModeReducer;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _actions = require("../../actions");
10
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
+ var initialState = {
13
+ enabled: false
14
+ };
15
+ function advancedModeReducer() {
16
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
17
+ var action = arguments.length > 1 ? arguments[1] : undefined;
18
+ switch (action.type) {
19
+ case _actions.SET_ADVANCED_MODE:
20
+ {
21
+ return _objectSpread(_objectSpread({}, state), {}, {
22
+ enabled: action.enabled
23
+ });
24
+ }
25
+ default:
26
+ return state;
27
+ }
28
+ }
@@ -0,0 +1,9 @@
1
+ #alerts {
2
+ position: fixed;
3
+ z-index: 1500;
4
+ top: 40px;
5
+
6
+ width: 80%;
7
+ margin-left: 10%;
8
+ margin-right: 10%;
9
+ }