asab_webui_shell 27.8.4 → 28.0.0-alpha.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.js +15 -15
- package/dist/components/branding/BrandImage.js +3 -5
- package/dist/components/locationReplace.js +5 -11
- package/dist/config/ConfigReducer.js +2 -4
- package/dist/config/ConfigService.js +7 -10
- package/dist/containers/Alerts/index.js +34 -45
- package/dist/containers/Alerts/reducer.js +19 -20
- package/dist/containers/Application.js +200 -207
- package/dist/containers/FullscreenMode/reducer.js +5 -10
- package/dist/containers/Header/ApplicationScreenTitle/ApplicationScreenTitle.js +27 -32
- package/dist/containers/Header/ApplicationScreenTitle/index.js +8 -10
- package/dist/containers/Header/Help/HelpButton.js +58 -55
- package/dist/containers/Header/Help/HelpService.js +3 -4
- package/dist/containers/Header/index.js +23 -23
- package/dist/containers/Header/reducer.js +13 -15
- package/dist/containers/Navigation/index.js +4 -6
- package/dist/containers/Navigation/reducer.js +7 -11
- package/dist/containers/RouteErrorHandler/ErrorContainer.js +47 -31
- package/dist/containers/RouteErrorHandler/index.js +26 -27
- package/dist/containers/Router/ApplicationHashRouter.js +7 -8
- package/dist/containers/Router/ApplicationRouter.js +38 -38
- package/dist/containers/Router/index.js +2 -4
- package/dist/containers/Router/reducer.js +7 -11
- package/dist/containers/Sidebar/NavbarBrand.js +30 -38
- package/dist/containers/Sidebar/SidebarBottomItem.js +42 -36
- package/dist/containers/Sidebar/SidebarIcon.js +12 -9
- package/dist/containers/Sidebar/SidebarItem.js +161 -148
- package/dist/containers/Sidebar/SidebarItemRenderer.js +25 -26
- package/dist/containers/Sidebar/index.js +55 -70
- package/dist/containers/Sidebar/reducer.js +7 -11
- package/dist/containers/Sidebar/utils/sidebarRouteMatch.js +13 -16
- package/dist/containers/Sidebar/utils/sidebarRouteMatch.jsx +4 -1
- package/dist/containers/Sidepanel/Sidepanel.js +35 -40
- package/dist/containers/Toast/ToastComponent.js +21 -15
- package/dist/containers/Toast/ToastContainer.js +23 -32
- package/dist/containers/Toast/reducer.js +14 -16
- package/dist/index.js +10 -10
- package/dist/modules/about/AboutScreen.js +80 -65
- package/dist/modules/about/index.js +3 -3
- package/dist/modules/attentionrequired/attentionRequiredReducer.js +5 -10
- package/dist/modules/attentionrequired/components/OfflineIndication.js +9 -7
- package/dist/modules/attentionrequired/connectivityReducer.js +5 -10
- package/dist/modules/attentionrequired/index.js +2 -3
- package/dist/modules/attentionrequired/service.js +21 -24
- package/dist/modules/auth/actions.js +1 -1
- package/dist/modules/auth/api.js +53 -61
- package/dist/modules/auth/components/LoginLoopCard.js +24 -15
- package/dist/modules/auth/components/SessionExpirationAlert.js +26 -18
- package/dist/modules/auth/header.js +69 -62
- package/dist/modules/auth/index.js +418 -458
- package/dist/modules/auth/reducer.js +11 -14
- package/dist/modules/auth/screens/AccessControlScreen.js +71 -50
- package/dist/modules/i18n/actions.js +1 -1
- package/dist/modules/i18n/dropdown.js +52 -46
- package/dist/modules/i18n/escapeHtmlMinimal.js +2 -2
- package/dist/modules/i18n/index.js +2 -2
- package/dist/modules/i18n/reducer.js +5 -10
- package/dist/modules/i18n/service.js +52 -73
- package/dist/modules/invite/InvitationScreen.js +162 -138
- package/dist/modules/invite/index.js +5 -4
- package/dist/modules/tenant/TenantDropdown.js +52 -58
- package/dist/modules/tenant/access/AccessDeniedCard.js +52 -52
- package/dist/modules/tenant/actions.js +1 -1
- package/dist/modules/tenant/index.js +2 -2
- package/dist/modules/tenant/reducer.js +2 -4
- package/dist/modules/tenant/service.js +74 -91
- package/dist/screens/InvalidRouteScreen.js +30 -20
- package/dist/screens/SuspenseScreen.js +26 -24
- package/dist/screens/UnauthorizedAccessScreen.js +44 -33
- package/dist/screens/UnsupportedBrowserScreen.js +44 -38
- package/dist/services/BrandingService.js +16 -24
- package/dist/services/HeaderService.js +4 -7
- package/dist/services/TitleService.js +19 -20
- package/dist/theme/ThemeButton.js +18 -14
- package/dist/theme/ThemeReducer.js +3 -5
- package/dist/theme/ThemeService.js +6 -8
- package/dist/theme/actions.js +1 -1
- package/dist/utils/browserSupport.js +18 -23
- package/dist/utils/extractTenantFromUrl.js +3 -3
- package/dist/utils/jsonParseWithBigInt.js +10 -9
- package/dist/utils/pageLifecycle.js +5 -5
- package/dist/utils/statusAlerts.js +1 -1
- package/package.json +12 -12
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.types = void 0;
|
|
7
|
-
|
|
7
|
+
const types = exports.types = {
|
|
8
8
|
TENANTS_CHANGED: "asab/TenantService/CHANGED",
|
|
9
9
|
TENANT_SELECTED: "asab/TenantService/SELECT_TENANT"
|
|
10
10
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -18,7 +18,7 @@ class TenantModule extends _asab_webui_components.Module {
|
|
|
18
18
|
this.App.ReduxService.addReducer("tenant", _reducer.default);
|
|
19
19
|
}
|
|
20
20
|
initialize() {
|
|
21
|
-
|
|
21
|
+
const headerService = this.App.locateService("HeaderService");
|
|
22
22
|
headerService.addComponent({
|
|
23
23
|
component: _TenantDropdown.default,
|
|
24
24
|
order: 600
|
|
@@ -7,13 +7,11 @@ exports.default = reducer;
|
|
|
7
7
|
var _actions = require("./actions");
|
|
8
8
|
// Actions
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const initialState = {
|
|
11
11
|
tenants: [],
|
|
12
12
|
current: null
|
|
13
13
|
};
|
|
14
|
-
function reducer() {
|
|
15
|
-
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
16
|
-
var action = arguments.length > 1 ? arguments[1] : undefined;
|
|
14
|
+
function reducer(state = initialState, action) {
|
|
17
15
|
switch (action.type) {
|
|
18
16
|
case _actions.types.TENANTS_CHANGED:
|
|
19
17
|
return {
|
|
@@ -1,134 +1,117 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
7
|
var _asab_webui_components = require("asab_webui_components");
|
|
10
8
|
var _actions = require("./actions");
|
|
11
9
|
var _locationReplace = require("../../components/locationReplace");
|
|
12
10
|
var _extractTenantFromUrl = require("../../utils/extractTenantFromUrl");
|
|
13
11
|
class TenantService extends _asab_webui_components.Service {
|
|
14
|
-
constructor(app) {
|
|
15
|
-
var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'TenantService';
|
|
12
|
+
constructor(app, name = 'TenantService') {
|
|
16
13
|
super(app, name);
|
|
17
14
|
// Tenant data cache
|
|
18
15
|
this.TenantDataCache = {};
|
|
19
16
|
}
|
|
20
|
-
initialize() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
for (var i = 0; tenants[i] != undefined; i++) {
|
|
29
|
-
tenants_list.push(tenants[i]);
|
|
30
|
-
}
|
|
31
|
-
yield _this.setTenants(tenants_list);
|
|
17
|
+
async initialize() {
|
|
18
|
+
// If the tenant list is in the configuration, use it
|
|
19
|
+
// This is useful when tenants are present but auth not
|
|
20
|
+
var tenants = this.App.Config.get('tenants');
|
|
21
|
+
if (tenants != null) {
|
|
22
|
+
var tenants_list = [];
|
|
23
|
+
for (var i = 0; tenants[i] != undefined; i++) {
|
|
24
|
+
tenants_list.push(tenants[i]);
|
|
32
25
|
}
|
|
33
|
-
|
|
26
|
+
await this.setTenants(tenants_list);
|
|
27
|
+
}
|
|
34
28
|
}
|
|
35
29
|
|
|
36
30
|
/*
|
|
37
31
|
setTenants updates the current active tenant and the list of available tenants
|
|
38
32
|
and dispatches that information into the application store
|
|
39
33
|
*/
|
|
40
|
-
setTenants(availableTenants) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return (0, _asyncToGenerator2.default)(function* () {
|
|
44
|
-
var _this2$App, _this2$App$dispatch;
|
|
45
|
-
var authorizedTenant = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : undefined;
|
|
46
|
-
// Extract the current tenant from URL params
|
|
47
|
-
var tenantFromUrl = (0, _extractTenantFromUrl.extractTenantFromUrl)();
|
|
48
|
-
|
|
49
|
-
/* If tenant has not been provided in access URL, insert the authorized tenant
|
|
50
|
-
or the first available tenant into the URL and reload the application */
|
|
51
|
-
if (tenantFromUrl == null) {
|
|
52
|
-
if (authorizedTenant) {
|
|
53
|
-
yield (0, _locationReplace.locationReplace)("".concat(window.location.pathname, "?tenant=").concat(authorizedTenant).concat(window.location.hash));
|
|
54
|
-
return;
|
|
55
|
-
} else if (availableTenants && availableTenants.length > 0) {
|
|
56
|
-
yield (0, _locationReplace.locationReplace)("".concat(window.location.pathname, "?tenant=").concat(availableTenants[0]).concat(window.location.hash));
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
34
|
+
async setTenants(availableTenants, authorizedTenant = undefined) {
|
|
35
|
+
// Extract the current tenant from URL params
|
|
36
|
+
var tenantFromUrl = (0, _extractTenantFromUrl.extractTenantFromUrl)();
|
|
60
37
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
38
|
+
/* If tenant has not been provided in access URL, insert the authorized tenant
|
|
39
|
+
or the first available tenant into the URL and reload the application */
|
|
40
|
+
if (tenantFromUrl == null) {
|
|
41
|
+
if (authorizedTenant) {
|
|
42
|
+
await (0, _locationReplace.locationReplace)(`${window.location.pathname}?tenant=${authorizedTenant}${window.location.hash}`);
|
|
43
|
+
return;
|
|
44
|
+
} else if (availableTenants && availableTenants.length > 0) {
|
|
45
|
+
await (0, _locationReplace.locationReplace)(`${window.location.pathname}?tenant=${availableTenants[0]}${window.location.hash}`);
|
|
64
46
|
return;
|
|
65
47
|
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// In case the list of available tenants is empty or undefined, remove the tenant parameter from URL
|
|
51
|
+
if (!availableTenants || availableTenants.length == 0) {
|
|
52
|
+
await (0, _locationReplace.locationReplace)(window.location.pathname + window.location.hash);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
66
55
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
56
|
+
// Check if the tenant from URL is in the list of avaliable tenants
|
|
57
|
+
let currentTenant;
|
|
58
|
+
if (availableTenants) {
|
|
59
|
+
if (!availableTenants.includes(tenantFromUrl)) {
|
|
60
|
+
// Display Invalid tenant alert message only when authorization is disabled
|
|
61
|
+
if (this.App.Config.get('authorization') === 'disabled') {
|
|
62
|
+
this.App.addAlert('danger', 'ASABTenantModule|Invalid tenant', 40000, true);
|
|
75
63
|
}
|
|
76
|
-
currentTenant = tenantFromUrl;
|
|
77
|
-
// Sort available tenants
|
|
78
|
-
availableTenants.sort((a, b) => {
|
|
79
|
-
var _a$toString, _b$toString;
|
|
80
|
-
var tenantA = (a === null || a === void 0 || (_a$toString = a.toString()) === null || _a$toString === void 0 ? void 0 : _a$toString.toLowerCase()) || '';
|
|
81
|
-
var tenantB = (b === null || b === void 0 || (_b$toString = b.toString()) === null || _b$toString === void 0 ? void 0 : _b$toString.toLowerCase()) || '';
|
|
82
|
-
return tenantA.localeCompare(tenantB);
|
|
83
|
-
});
|
|
84
|
-
} else {
|
|
85
|
-
currentTenant = undefined;
|
|
86
64
|
}
|
|
87
|
-
|
|
88
|
-
//
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
65
|
+
currentTenant = tenantFromUrl;
|
|
66
|
+
// Sort available tenants
|
|
67
|
+
availableTenants.sort((a, b) => {
|
|
68
|
+
const tenantA = a?.toString()?.toLowerCase() || '';
|
|
69
|
+
const tenantB = b?.toString()?.toLowerCase() || '';
|
|
70
|
+
return tenantA.localeCompare(tenantB);
|
|
93
71
|
});
|
|
94
|
-
}
|
|
72
|
+
} else {
|
|
73
|
+
currentTenant = undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Dispatch tenants obtained from userinfo
|
|
77
|
+
this.App?.AppStore?.dispatch?.({
|
|
78
|
+
type: _actions.types.TENANTS_CHANGED,
|
|
79
|
+
tenants_list: availableTenants,
|
|
80
|
+
current: currentTenant
|
|
81
|
+
});
|
|
95
82
|
}
|
|
96
83
|
|
|
97
84
|
/*
|
|
98
85
|
getTenantData() method is used for returning the tenant data
|
|
99
86
|
It requires SeaCat Auth service
|
|
100
87
|
*/
|
|
101
|
-
getTenantData() {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
// Remove data from the TenantDataCache eventually
|
|
120
|
-
delete _this3.TenantDataCache[currentTenant];
|
|
121
|
-
}
|
|
88
|
+
async getTenantData() {
|
|
89
|
+
let currentTenant = this.getCurrentTenant();
|
|
90
|
+
// If tenant data being cached already, then return the data
|
|
91
|
+
if (this.TenantDataCache[currentTenant]) {
|
|
92
|
+
return this.TenantDataCache[currentTenant];
|
|
93
|
+
}
|
|
94
|
+
let tenantData = {};
|
|
95
|
+
if (currentTenant) {
|
|
96
|
+
const SeaCatAuthAPI = this.App.axiosCreate('seacat-auth');
|
|
97
|
+
try {
|
|
98
|
+
let response = await SeaCatAuthAPI.get(`/tenant/${currentTenant}`);
|
|
99
|
+
tenantData = response.data;
|
|
100
|
+
this.TenantDataCache[currentTenant] = tenantData;
|
|
101
|
+
} catch (e) {
|
|
102
|
+
console.warn(`Tenant service can't retrieve data for ${currentTenant}`);
|
|
103
|
+
console.error(e);
|
|
104
|
+
// Remove data from the TenantDataCache eventually
|
|
105
|
+
delete this.TenantDataCache[currentTenant];
|
|
122
106
|
}
|
|
123
|
-
|
|
124
|
-
|
|
107
|
+
}
|
|
108
|
+
return tenantData;
|
|
125
109
|
}
|
|
126
110
|
|
|
127
111
|
// getCurrentTenant() method is used for obtaining current tenant
|
|
128
112
|
getCurrentTenant() {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
var currentTenant = state === null || state === void 0 || (_state$tenant = state.tenant) === null || _state$tenant === void 0 ? void 0 : _state$tenant.current;
|
|
113
|
+
const state = this.App?.AppStore?.getState();
|
|
114
|
+
let currentTenant = state?.tenant?.current;
|
|
132
115
|
// If current tenant is not in Application store yet, get it from the URL params
|
|
133
116
|
if (!currentTenant) {
|
|
134
117
|
currentTenant = (0, _extractTenantFromUrl.extractTenantFromUrl)();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -10,24 +10,34 @@ var _reactI18next = require("react-i18next");
|
|
|
10
10
|
var _reactstrap = require("reactstrap");
|
|
11
11
|
var _asab_webui_components = require("asab_webui_components");
|
|
12
12
|
require("./InvalidRouteScreen.scss");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
14
|
function InvalidRouteScreen(props) {
|
|
14
|
-
|
|
15
|
-
t
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
15
|
+
const {
|
|
16
|
+
t
|
|
17
|
+
} = (0, _reactI18next.useTranslation)();
|
|
18
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Container, {
|
|
19
|
+
className: "invalid-route-container h-100",
|
|
20
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Card, {
|
|
21
|
+
className: "invalid-route-card",
|
|
22
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.CardBody, {
|
|
23
|
+
className: "text-center invalid-route-cardbody",
|
|
24
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Row, {
|
|
25
|
+
className: "justify-content-center",
|
|
26
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Col, {
|
|
27
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
28
|
+
className: "invalid-route-img-container",
|
|
29
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_asab_webui_components.FlowbiteIllustration, {
|
|
30
|
+
name: "error",
|
|
31
|
+
className: "pb-4",
|
|
32
|
+
title: t("InvalidRouteScreen|Nothing here")
|
|
33
|
+
})
|
|
34
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
35
|
+
className: "card-text",
|
|
36
|
+
children: t("InvalidRouteScreen|Sorry, we can't find the page you are looking for.")
|
|
37
|
+
})]
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
});
|
|
33
43
|
}
|
|
@@ -1,42 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = SuspenseScreen;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
9
|
var _reactI18next = require("react-i18next");
|
|
11
10
|
var _asab_webui_components = require("asab_webui_components");
|
|
12
11
|
var _reactstrap = require("reactstrap");
|
|
13
12
|
var _BrandImage = require("../components/branding/BrandImage");
|
|
14
13
|
require("./SuspenseScreen.scss");
|
|
15
|
-
var
|
|
16
|
-
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
15
|
function SuspenseScreen(props) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
24
|
-
t = _useTranslation.t;
|
|
16
|
+
const [brandImage, setBrandImage] = (0, _react.useState)(undefined);
|
|
17
|
+
const theme = (0, _asab_webui_components.useAppSelector)(state => state.theme);
|
|
18
|
+
const {
|
|
19
|
+
t
|
|
20
|
+
} = (0, _reactI18next.useTranslation)();
|
|
25
21
|
(0, _react.useEffect)(() => {
|
|
26
22
|
setBrandImage((0, _BrandImage.getBrandImage)(props, theme));
|
|
27
23
|
}, [theme]);
|
|
28
|
-
return /*#__PURE__*/
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Container, {
|
|
29
25
|
className: "h-100",
|
|
30
|
-
fluid: true
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
fluid: true,
|
|
27
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
28
|
+
className: "h-100 suspense-content-wrapper",
|
|
29
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Col, {
|
|
30
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Row, {
|
|
31
|
+
className: "justify-content-center mb-4",
|
|
32
|
+
children: brandImage ? /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
33
|
+
className: "suspense-img",
|
|
34
|
+
src: brandImage?.full,
|
|
35
|
+
alt: "Loading"
|
|
36
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
37
|
+
className: "text-center text-primary",
|
|
38
|
+
children: t('General|Loading')
|
|
39
|
+
})
|
|
40
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_asab_webui_components.Spinner, {})]
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
});
|
|
42
44
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -9,8 +10,7 @@ var _reactI18next = require("react-i18next");
|
|
|
9
10
|
var _asab_webui_components = require("asab_webui_components");
|
|
10
11
|
var _reactstrap = require("reactstrap");
|
|
11
12
|
require("./UnauthorizedAccessScreen.scss");
|
|
12
|
-
var
|
|
13
|
-
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
/*
|
|
15
15
|
Unauthorized Access screen can be displayed only when:
|
|
16
16
|
- AuthModule is present within the application
|
|
@@ -19,18 +19,15 @@ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e;
|
|
|
19
19
|
Unauthorized Access screen replace the content of the container by its own screen with
|
|
20
20
|
information about what resource is missing to enable the access to the desired (blocked)
|
|
21
21
|
screen.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var _state$auth;
|
|
28
|
-
return (_state$auth = state.auth) !== null && _state$auth !== void 0 && _state$auth.resources ? state.auth.resources : [];
|
|
29
|
-
});
|
|
22
|
+
*/function UnauthorizedAccessScreen(props) {
|
|
23
|
+
const {
|
|
24
|
+
t
|
|
25
|
+
} = (0, _reactI18next.useTranslation)();
|
|
26
|
+
const resources = (0, _asab_webui_components.useAppSelector)(state => state.auth?.resources ? state.auth.resources : []);
|
|
30
27
|
|
|
31
28
|
// Check if auth module is active. If not, return the original component
|
|
32
29
|
// Check for desired resource. If present or user is superuser, return the original component
|
|
33
|
-
|
|
30
|
+
const isAuthorized = props.resource === "*" || props.app.Modules.filter(obj => obj.Name === "AuthModule").length === 0 || resources.indexOf(props.resource) !== -1 || resources.indexOf("authz:superuser") !== -1;
|
|
34
31
|
(0, _react.useLayoutEffect)(() => {
|
|
35
32
|
// Determine if the component should be in print-ready or print-unauthorized state
|
|
36
33
|
if (!isAuthorized) {
|
|
@@ -50,29 +47,43 @@ function UnauthorizedAccessScreen(props) {
|
|
|
50
47
|
|
|
51
48
|
// If user is authorized, let them see the screen content
|
|
52
49
|
if (isAuthorized) {
|
|
53
|
-
return /*#__PURE__*/
|
|
50
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
51
|
+
children: props.routeComponent
|
|
52
|
+
});
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
// Else return the Not authorized screen
|
|
57
|
-
return /*#__PURE__*/
|
|
58
|
-
className: "unauthorized-container h-100"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
56
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Container, {
|
|
57
|
+
className: "unauthorized-container h-100",
|
|
58
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Card, {
|
|
59
|
+
className: "unauthorized-card",
|
|
60
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.CardBody, {
|
|
61
|
+
className: "text-center unauthorized-cardbody",
|
|
62
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Row, {
|
|
63
|
+
className: "justify-content-center",
|
|
64
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Col, {
|
|
65
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
66
|
+
className: "unauthorized-img-container",
|
|
67
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_asab_webui_components.FlowbiteIllustration, {
|
|
68
|
+
name: "unauthorized",
|
|
69
|
+
className: "pb-4",
|
|
70
|
+
title: t("UnauthorizedAccessScreen|Unauthorized access")
|
|
71
|
+
})
|
|
72
|
+
}), props.resource ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
73
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
74
|
+
className: "card-text",
|
|
75
|
+
children: [t("UnauthorizedAccessScreen|You are not authorized to access this part of the application. Please ask your application administrator for following resource"), ":"]
|
|
76
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("h5", {
|
|
77
|
+
className: "card-title",
|
|
78
|
+
children: props.resource
|
|
79
|
+
})]
|
|
80
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
81
|
+
className: "card-text",
|
|
82
|
+
children: t("UnauthorizedAccessScreen|You are not authorized to access this part of the application.")
|
|
83
|
+
})]
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
});
|
|
78
89
|
}
|
|
@@ -1,57 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.UnsupportedBrowserScreen = UnsupportedBrowserScreen;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _reactI18next = require("react-i18next");
|
|
11
10
|
var _reactstrap = require("reactstrap");
|
|
12
11
|
var _asab_webui_components = require("asab_webui_components");
|
|
13
12
|
var _browserSupport = require("../utils/browserSupport.js");
|
|
14
13
|
require("./UnsupportedBrowserScreen.scss");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
/*
|
|
16
16
|
Shown in #app-main when the browser fails to match supported browser criteria.
|
|
17
17
|
Header and Sidebar stay mounted so the user can still log out.
|
|
18
18
|
Skipped when config browserSupportCheck is set to false
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
*/function UnsupportedBrowserScreen() {
|
|
20
|
+
const {
|
|
21
|
+
t
|
|
22
|
+
} = (0, _reactI18next.useTranslation)();
|
|
23
|
+
const browser = (0, _browserSupport.getBrowserLabel)();
|
|
24
|
+
const message = browser ? t('UnsupportedBrowserScreen|We are sorry for the inconvenience. Your browser ({{browser}}) is not supported. Please upgrade to a newer version or use another modern browser (Chrome, Firefox, Edge, or Safari).', {
|
|
25
25
|
browser
|
|
26
26
|
}) : t('UnsupportedBrowserScreen|We are sorry for the inconvenience. Your browser is not supported. Please upgrade to a newer version or use another modern browser (Chrome, Firefox, Edge, or Safari).');
|
|
27
|
-
return /*#__PURE__*/
|
|
28
|
-
className: "unsupported-browser-container h-100"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
27
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Container, {
|
|
28
|
+
className: "unsupported-browser-container h-100",
|
|
29
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Card, {
|
|
30
|
+
className: "unsupported-browser-card",
|
|
31
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.CardBody, {
|
|
32
|
+
className: "text-center unsupported-browser-cardbody",
|
|
33
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Row, {
|
|
34
|
+
className: "justify-content-center",
|
|
35
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Col, {
|
|
36
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
37
|
+
className: "unsupported-browser-img-container",
|
|
38
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_asab_webui_components.FlowbiteIllustration, {
|
|
39
|
+
name: "error",
|
|
40
|
+
className: "pb-4",
|
|
41
|
+
title: t('UnsupportedBrowserScreen|Browser not supported')
|
|
42
|
+
})
|
|
43
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("h4", {
|
|
44
|
+
className: "mb-2",
|
|
45
|
+
children: t('UnsupportedBrowserScreen|Browser not supported')
|
|
46
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
47
|
+
className: "card-text mb-2",
|
|
48
|
+
children: message
|
|
49
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
50
|
+
className: "mb-1",
|
|
51
|
+
children: t('UnsupportedBrowserScreen|Minimum supported versions:')
|
|
52
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
53
|
+
className: "list-unstyled mb-0 unsupported-browser-versions",
|
|
54
|
+
children: Object.entries(_browserSupport.MIN_SUPPORTED).map(([name, version]) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
55
|
+
children: [name, " ", version, "+"]
|
|
56
|
+
}, name))
|
|
57
|
+
})]
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
});
|
|
57
63
|
}
|