@gridsuite/commons-ui 0.46.0 → 0.48.0
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/README.md +0 -17
- package/dist/components/AuthenticationRouter/AuthenticationRouter.d.ts +10 -0
- package/dist/components/AuthenticationRouter/AuthenticationRouter.js +147 -0
- package/dist/components/AuthenticationRouter/index.d.ts +1 -0
- package/dist/components/CardErrorBoundary/card-error-boundary.d.ts +18 -0
- package/dist/components/CardErrorBoundary/card-error-boundary.js +110 -0
- package/dist/components/CardErrorBoundary/index.d.ts +1 -0
- package/dist/components/DirectoryItemSelector/directory-item-selector.d.ts +22 -0
- package/dist/components/DirectoryItemSelector/directory-item-selector.js +254 -0
- package/dist/components/ElementSearchDialog/element-search-dialog.d.ts +16 -0
- package/dist/components/ElementSearchDialog/element-search-dialog.js +139 -0
- package/dist/components/ElementSearchDialog/equipment-item.d.ts +16 -0
- package/dist/components/ElementSearchDialog/equipment-item.js +77 -0
- package/dist/components/ElementSearchDialog/index.d.ts +2 -0
- package/dist/components/ElementSearchDialog/tag-renderer.d.ts +11 -0
- package/dist/components/ElementSearchDialog/tag-renderer.js +34 -0
- package/dist/components/FlatParameters/FlatParameters.d.ts +10 -0
- package/dist/components/FlatParameters/FlatParameters.js +411 -0
- package/dist/components/FlatParameters/index.d.ts +1 -0
- package/dist/components/Login/Login.d.ts +5 -0
- package/dist/components/Login/Login.js +78 -0
- package/dist/components/Login/Logout.d.ts +5 -0
- package/dist/components/Login/Logout.js +69 -0
- package/dist/components/Login/index.d.ts +1 -0
- package/dist/components/MuiVirtualizedTable/ColumnHeader.d.ts +4 -0
- package/dist/components/MuiVirtualizedTable/ColumnHeader.js +127 -0
- package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.d.ts +104 -0
- package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +548 -0
- package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.d.ts +131 -0
- package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +790 -0
- package/dist/components/MuiVirtualizedTable/index.d.ts +2 -0
- package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.d.ts +10 -0
- package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +87 -0
- package/dist/components/MultipleSelectionDialog/index.d.ts +1 -0
- package/dist/components/OverflowableText/index.d.ts +1 -0
- package/dist/components/OverflowableText/overflowable-text.d.ts +2 -0
- package/dist/components/OverflowableText/overflowable-text.js +87 -0
- package/dist/components/ReportViewer/filter-button.d.ts +1 -0
- package/dist/components/ReportViewer/filter-button.js +64 -0
- package/dist/components/ReportViewer/index.d.ts +1 -0
- package/dist/components/ReportViewer/log-report-item.d.ts +68 -0
- package/dist/components/ReportViewer/log-report-item.js +95 -0
- package/dist/components/ReportViewer/log-report.d.ts +21 -0
- package/dist/components/ReportViewer/log-report.js +49 -0
- package/dist/components/ReportViewer/log-table.d.ts +8 -0
- package/dist/components/ReportViewer/log-table.js +131 -0
- package/dist/components/ReportViewer/multi-select-list.d.ts +1 -0
- package/dist/components/ReportViewer/multi-select-list.js +40 -0
- package/dist/components/ReportViewer/report-item.d.ts +13 -0
- package/dist/components/ReportViewer/report-item.js +112 -0
- package/dist/components/ReportViewer/report-tree-view-context.d.ts +2 -0
- package/dist/components/ReportViewer/report-tree-view-context.js +8 -0
- package/dist/components/ReportViewer/report-viewer.d.ts +4 -0
- package/dist/components/ReportViewer/report-viewer.js +158 -0
- package/dist/components/ReportViewerDialog/index.d.ts +1 -0
- package/dist/components/ReportViewerDialog/report-viewer-dialog.d.ts +1 -0
- package/dist/components/ReportViewerDialog/report-viewer-dialog.js +61 -0
- package/dist/components/SignInCallbackHandler/SignInCallbackHandler.d.ts +5 -0
- package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +13 -0
- package/dist/components/SignInCallbackHandler/index.d.ts +1 -0
- package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.d.ts +5 -0
- package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +16 -0
- package/dist/components/SilentRenewCallbackHandler/index.d.ts +1 -0
- package/dist/components/SnackbarProvider/SnackbarProvider.d.ts +3 -0
- package/dist/components/SnackbarProvider/SnackbarProvider.js +28 -0
- package/dist/components/SnackbarProvider/index.d.ts +1 -0
- package/dist/components/TopBar/AboutDialog.d.ts +24 -0
- package/dist/components/TopBar/AboutDialog.js +467 -0
- package/dist/components/TopBar/GridLogo.d.ts +34 -0
- package/dist/components/TopBar/GridLogo.js +71 -0
- package/dist/components/TopBar/TopBar.d.ts +53 -0
- package/dist/components/TopBar/TopBar.js +679 -0
- package/dist/components/TopBar/index.d.ts +3 -0
- package/dist/components/TreeViewFinder/TreeViewFinder.d.ts +57 -0
- package/dist/components/TreeViewFinder/TreeViewFinder.js +288 -0
- package/dist/components/TreeViewFinder/index.d.ts +1 -0
- package/dist/components/react-hook-form/autocomplete-input.d.ts +30 -0
- package/dist/components/react-hook-form/autocomplete-input.js +96 -0
- package/dist/components/react-hook-form/booleans/boolean-input.d.ts +16 -0
- package/dist/components/react-hook-form/booleans/boolean-input.js +49 -0
- package/dist/components/react-hook-form/booleans/checkbox-input.d.ts +14 -0
- package/dist/components/react-hook-form/booleans/checkbox-input.js +24 -0
- package/dist/components/react-hook-form/booleans/switch-input.d.ts +14 -0
- package/dist/components/react-hook-form/booleans/switch-input.js +24 -0
- package/dist/components/react-hook-form/directory-items-input.d.ts +28 -0
- package/dist/components/react-hook-form/directory-items-input.js +185 -0
- package/dist/components/react-hook-form/error-management/error-input.d.ts +5 -0
- package/dist/components/react-hook-form/error-management/error-input.js +42 -0
- package/dist/components/react-hook-form/error-management/field-error-alert.d.ts +4 -0
- package/dist/components/react-hook-form/error-management/field-error-alert.js +9 -0
- package/dist/components/react-hook-form/error-management/mid-form-error.d.ts +4 -0
- package/dist/components/react-hook-form/error-management/mid-form-error.js +20 -0
- package/dist/components/react-hook-form/numbers/float-input.d.ts +18 -0
- package/dist/components/react-hook-form/numbers/float-input.js +51 -0
- package/dist/components/react-hook-form/numbers/integer-input.d.ts +18 -0
- package/dist/components/react-hook-form/numbers/integer-input.js +36 -0
- package/dist/components/react-hook-form/numbers/utils.d.ts +2 -0
- package/dist/components/react-hook-form/numbers/utils.js +10 -0
- package/dist/components/react-hook-form/radio-input.d.ts +18 -0
- package/dist/components/react-hook-form/radio-input.js +44 -0
- package/{es/components/MultipleSelectionDialog/index.js → dist/components/react-hook-form/raw-read-only-input.d.ts} +3 -2
- package/dist/components/react-hook-form/raw-read-only-input.js +10 -0
- package/dist/components/react-hook-form/select-input.d.ts +17 -0
- package/dist/components/react-hook-form/select-input.js +31 -0
- package/dist/components/react-hook-form/slider-input.d.ts +21 -0
- package/dist/components/react-hook-form/slider-input.js +43 -0
- package/dist/components/react-hook-form/text-input.d.ts +33 -0
- package/dist/components/react-hook-form/text-input.js +94 -0
- package/dist/components/react-hook-form/utils/cancel-button.d.ts +10 -0
- package/dist/components/react-hook-form/utils/cancel-button.js +16 -0
- package/dist/components/react-hook-form/utils/field-label.d.ts +6 -0
- package/dist/components/react-hook-form/utils/field-label.js +12 -0
- package/dist/components/react-hook-form/utils/functions.d.ts +11 -0
- package/dist/components/react-hook-form/utils/functions.js +41 -0
- package/dist/components/react-hook-form/utils/submit-button.d.ts +10 -0
- package/dist/components/react-hook-form/utils/submit-button.js +23 -0
- package/dist/components/react-hook-form/utils/text-field-with-adornment.d.ts +12 -0
- package/dist/components/react-hook-form/utils/text-field-with-adornment.js +96 -0
- package/{es/components/translations/report-viewer-fr.js → dist/components/translations/card-error-boundary-en.d.ts} +5 -6
- package/dist/components/translations/card-error-boundary-en.js +8 -0
- package/dist/components/translations/card-error-boundary-fr.d.ts +12 -0
- package/dist/components/translations/card-error-boundary-fr.js +8 -0
- package/dist/components/translations/common-button-en.d.ts +5 -0
- package/dist/components/translations/common-button-en.js +7 -0
- package/dist/components/translations/common-button-fr.d.ts +5 -0
- package/dist/components/translations/common-button-fr.js +7 -0
- package/{es/components/translations/element-search-en.js → dist/components/translations/element-search-en.d.ts} +4 -5
- package/dist/components/translations/element-search-en.js +7 -0
- package/dist/components/translations/element-search-fr.d.ts +11 -0
- package/dist/components/translations/element-search-fr.js +7 -0
- package/dist/components/translations/equipment-search-en.d.ts +25 -0
- package/dist/components/translations/equipment-search-en.js +21 -0
- package/dist/components/translations/equipment-search-fr.d.ts +25 -0
- package/dist/components/translations/equipment-search-fr.js +21 -0
- package/{es/components/translations/flat-parameters-en.js → dist/components/translations/flat-parameters-en.d.ts} +5 -6
- package/dist/components/translations/flat-parameters-en.js +8 -0
- package/{es/components/translations/common-button-en.js → dist/components/translations/flat-parameters-fr.d.ts} +5 -5
- package/dist/components/translations/flat-parameters-fr.js +8 -0
- package/dist/components/translations/login-en.d.ts +18 -0
- package/dist/components/translations/login-en.js +14 -0
- package/dist/components/translations/login-fr.d.ts +18 -0
- package/dist/components/translations/login-fr.js +14 -0
- package/{es/components/translations/flat-parameters-fr.js → dist/components/translations/multiple-selection-dialog-en.d.ts} +5 -6
- package/dist/components/translations/multiple-selection-dialog-en.js +8 -0
- package/{es/components/translations/common-button-fr.js → dist/components/translations/multiple-selection-dialog-fr.d.ts} +5 -5
- package/dist/components/translations/multiple-selection-dialog-fr.js +8 -0
- package/{es/components/translations/report-viewer-en.js → dist/components/translations/report-viewer-en.d.ts} +5 -6
- package/dist/components/translations/report-viewer-en.js +8 -0
- package/{es/components/translations/element-search-fr.js → dist/components/translations/report-viewer-fr.d.ts} +5 -5
- package/dist/components/translations/report-viewer-fr.js +8 -0
- package/{es/components/translations/table-en.js → dist/components/translations/table-en.d.ts} +3 -4
- package/dist/components/translations/table-en.js +6 -0
- package/{es/components/translations/table-fr.js → dist/components/translations/table-fr.d.ts} +3 -4
- package/dist/components/translations/table-fr.js +6 -0
- package/dist/components/translations/top-bar-en.d.ts +31 -0
- package/dist/components/translations/top-bar-en.js +27 -0
- package/dist/components/translations/top-bar-fr.d.ts +31 -0
- package/dist/components/translations/top-bar-fr.js +27 -0
- package/dist/components/translations/treeview-finder-en.d.ts +16 -0
- package/dist/components/translations/treeview-finder-en.js +12 -0
- package/dist/components/translations/treeview-finder-fr.d.ts +16 -0
- package/dist/components/translations/treeview-finder-fr.js +12 -0
- package/dist/hooks/useDebounce.d.ts +1 -0
- package/dist/hooks/useDebounce.js +17 -0
- package/{es/components/ElementSearchDialog/index.js → dist/hooks/useIntlRef.d.ts} +2 -2
- package/dist/hooks/useIntlRef.js +13 -0
- package/dist/hooks/useSnackMessage.d.ts +5 -0
- package/dist/hooks/useSnackMessage.js +81 -0
- package/dist/index.d.ts +234 -0
- package/dist/index.js +158 -0
- package/dist/utils/AuthService.d.ts +9 -0
- package/dist/utils/AuthService.js +336 -0
- package/dist/utils/ElementType.d.ts +13 -0
- package/dist/utils/ElementType.js +42 -0
- package/dist/utils/EquipmentType.d.ts +136 -0
- package/dist/utils/EquipmentType.js +132 -0
- package/dist/utils/UserManagerMock.d.ts +34 -0
- package/dist/utils/UserManagerMock.js +85 -0
- package/dist/utils/actions.d.ts +50 -0
- package/dist/utils/actions.js +71 -0
- package/{es/components/CardErrorBoundary/index.js → dist/utils/algos.d.ts} +1 -1
- package/dist/utils/algos.js +24 -0
- package/dist/utils/styles.d.ts +5 -0
- package/dist/utils/styles.js +13 -0
- package/package.json +36 -21
- package/es/components/AuthenticationRouter/AuthenticationRouter.js +0 -102
- package/es/components/AuthenticationRouter/index.js +0 -7
- package/es/components/CardErrorBoundary/card-error-boundary.js +0 -138
- package/es/components/ElementSearchDialog/element-search-dialog.js +0 -153
- package/es/components/ElementSearchDialog/equipment-item.js +0 -63
- package/es/components/ElementSearchDialog/tag-renderer.js +0 -29
- package/es/components/FlatParameters/FlatParameters.js +0 -448
- package/es/components/FlatParameters/index.js +0 -8
- package/es/components/Login/Login.js +0 -79
- package/es/components/Login/Logout.js +0 -78
- package/es/components/Login/index.js +0 -7
- package/es/components/MuiVirtualizedTable/ColumnHeader.js +0 -125
- package/es/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +0 -619
- package/es/components/MuiVirtualizedTable/MuiVirtualizedTable.js +0 -780
- package/es/components/MuiVirtualizedTable/index.js +0 -9
- package/es/components/MultipleSelectionDialog/MultipleSelectionDialog.js +0 -95
- package/es/components/OverflowableText/index.js +0 -7
- package/es/components/OverflowableText/overflowable-text.js +0 -81
- package/es/components/ReportViewer/filter-button.js +0 -77
- package/es/components/ReportViewer/index.js +0 -7
- package/es/components/ReportViewer/log-report-item.js +0 -97
- package/es/components/ReportViewer/log-report.js +0 -63
- package/es/components/ReportViewer/log-table.js +0 -130
- package/es/components/ReportViewer/multi-select-list.js +0 -56
- package/es/components/ReportViewer/report-item.js +0 -131
- package/es/components/ReportViewer/report-tree-view-context.js +0 -13
- package/es/components/ReportViewer/report-viewer.js +0 -167
- package/es/components/ReportViewerDialog/index.js +0 -7
- package/es/components/ReportViewerDialog/report-viewer-dialog.js +0 -67
- package/es/components/SignInCallbackHandler/SignInCallbackHandler.js +0 -19
- package/es/components/SignInCallbackHandler/index.js +0 -7
- package/es/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +0 -19
- package/es/components/SilentRenewCallbackHandler/index.js +0 -7
- package/es/components/SnackbarProvider/SnackbarProvider.js +0 -39
- package/es/components/SnackbarProvider/index.js +0 -7
- package/es/components/TopBar/AboutDialog.js +0 -456
- package/es/components/TopBar/GridLogo.js +0 -73
- package/es/components/TopBar/TopBar.js +0 -487
- package/es/components/TopBar/index.js +0 -9
- package/es/components/TreeViewFinder/TreeViewFinder.js +0 -341
- package/es/components/TreeViewFinder/index.js +0 -7
- package/es/components/images/powsybl_logo.svg +0 -35
- package/es/components/react-hook-form/autocomplete-input.js +0 -110
- package/es/components/react-hook-form/booleans/boolean-input.js +0 -56
- package/es/components/react-hook-form/booleans/checkbox-input.js +0 -28
- package/es/components/react-hook-form/booleans/switch-input.js +0 -28
- package/es/components/react-hook-form/error-management/error-input.js +0 -50
- package/es/components/react-hook-form/error-management/field-error-alert.js +0 -22
- package/es/components/react-hook-form/error-management/mid-form-error.js +0 -25
- package/es/components/react-hook-form/numbers/float-input.js +0 -105
- package/es/components/react-hook-form/numbers/integer-input.js +0 -35
- package/es/components/react-hook-form/numbers/utils.js +0 -6
- package/es/components/react-hook-form/radio-input.js +0 -55
- package/es/components/react-hook-form/select-input.js +0 -40
- package/es/components/react-hook-form/slider-input.js +0 -48
- package/es/components/react-hook-form/text-input.js +0 -100
- package/es/components/react-hook-form/utils/cancel-button.js +0 -28
- package/es/components/react-hook-form/utils/field-label.js +0 -15
- package/es/components/react-hook-form/utils/functions.js +0 -42
- package/es/components/react-hook-form/utils/submit-button.js +0 -29
- package/es/components/react-hook-form/utils/text-field-with-adornment.js +0 -92
- package/es/components/translations/card-error-boundary-en.js +0 -13
- package/es/components/translations/card-error-boundary-fr.js +0 -13
- package/es/components/translations/equipment-search-en.js +0 -26
- package/es/components/translations/equipment-search-fr.js +0 -26
- package/es/components/translations/inputs-en.js +0 -25
- package/es/components/translations/inputs-fr.js +0 -25
- package/es/components/translations/login-en.js +0 -19
- package/es/components/translations/login-fr.js +0 -19
- package/es/components/translations/multiple-selection-dialog-en.js +0 -13
- package/es/components/translations/multiple-selection-dialog-fr.js +0 -13
- package/es/components/translations/top-bar-en.js +0 -32
- package/es/components/translations/top-bar-fr.js +0 -32
- package/es/components/translations/treeview-finder-en.js +0 -17
- package/es/components/translations/treeview-finder-fr.js +0 -17
- package/es/hooks/useDebounce.js +0 -26
- package/es/hooks/useIntlRef.js +0 -22
- package/es/hooks/useSnackMessage.js +0 -81
- package/es/index.js +0 -71
- package/es/utils/AuthService.js +0 -312
- package/es/utils/ElementType.js +0 -53
- package/es/utils/EquipmentType.js +0 -133
- package/es/utils/UserManagerMock.js +0 -81
- package/es/utils/actions.js +0 -65
- package/es/utils/algos.js +0 -29
- package/es/utils/styles.js +0 -35
package/es/utils/AuthService.js
DELETED
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2020, RTE (http://www.rte-france.com)
|
|
4
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
6
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
7
|
-
*/
|
|
8
|
-
import { Log, UserManager } from 'oidc-client';
|
|
9
|
-
import { UserManagerMock } from './UserManagerMock';
|
|
10
|
-
import { setLoggedUser, setSignInCallbackError, setUnauthorizedUserInfo, setLogoutError, setUserValidationError, resetAuthenticationRouterError, setShowAuthenticationRouterLogin } from './actions';
|
|
11
|
-
import jwtDecode from 'jwt-decode';
|
|
12
|
-
|
|
13
|
-
// set as a global variable to allow log level configuration at runtime
|
|
14
|
-
window.OIDCLog = Log;
|
|
15
|
-
var hackAuthorityKey = 'oidc.hack.authority';
|
|
16
|
-
var oidcHackReloadedKey = 'gridsuite-oidc-hack-reloaded';
|
|
17
|
-
var pathKey = 'powsybl-gridsuite-current-path';
|
|
18
|
-
function isIssuerErrorForCodeFlow(error) {
|
|
19
|
-
return error.message.includes('Invalid issuer in token');
|
|
20
|
-
}
|
|
21
|
-
function extractIssuerToSessionStorage(error) {
|
|
22
|
-
var issuer = error.message.split(' ').pop();
|
|
23
|
-
sessionStorage.setItem(hackAuthorityKey, issuer);
|
|
24
|
-
}
|
|
25
|
-
function reload() {
|
|
26
|
-
if (!sessionStorage.getItem(oidcHackReloadedKey)) {
|
|
27
|
-
sessionStorage.setItem(oidcHackReloadedKey, true);
|
|
28
|
-
console.log('Hack oidc, reload page to make login work');
|
|
29
|
-
window.location.reload();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function reloadTimerOnExpiresIn(user, userManager, expiresIn) {
|
|
33
|
-
// TODO: Can we stop doing it in the hash for implicit flow ? To make it common for both flows
|
|
34
|
-
user.expires_in = expiresIn;
|
|
35
|
-
userManager.storeUser(user).then(function () {
|
|
36
|
-
userManager.getUser();
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function handleSigninSilent(dispatch, userManager) {
|
|
40
|
-
userManager.getUser().then(function (user) {
|
|
41
|
-
if (user == null || getIdTokenExpiresIn(user) < 0) {
|
|
42
|
-
return userManager.signinSilent()["catch"](function (error) {
|
|
43
|
-
dispatch(setShowAuthenticationRouterLogin(true));
|
|
44
|
-
var errorIssuerCodeFlow = isIssuerErrorForCodeFlow(error);
|
|
45
|
-
var errorIssuerImplicitFlow = error.message === 'authority mismatch on settings vs. signin state';
|
|
46
|
-
if (errorIssuerCodeFlow) {
|
|
47
|
-
// Replacing authority for code flow only because it's done in the hash for implicit flow
|
|
48
|
-
// TODO: Can we stop doing it in the hash for implicit flow ? To make it common here for both flows
|
|
49
|
-
extractIssuerToSessionStorage(error);
|
|
50
|
-
}
|
|
51
|
-
if (errorIssuerCodeFlow || errorIssuerImplicitFlow) {
|
|
52
|
-
reload();
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
function initializeAuthenticationDev(dispatch, isSilentRenew, validateUser, isSigninCallback) {
|
|
59
|
-
var userManager = new UserManagerMock({});
|
|
60
|
-
if (!isSilentRenew) {
|
|
61
|
-
handleUser(dispatch, userManager, validateUser);
|
|
62
|
-
if (!isSigninCallback) {
|
|
63
|
-
handleSigninSilent(dispatch, userManager);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return Promise.resolve(userManager);
|
|
67
|
-
}
|
|
68
|
-
var accessTokenExpiringNotificationTime = 60; // seconds
|
|
69
|
-
|
|
70
|
-
function initializeAuthenticationProd(dispatch, isSilentRenew, idpSettings, validateUser, authorizationCodeFlowEnabled, isSigninCallback) {
|
|
71
|
-
return idpSettings.then(function (r) {
|
|
72
|
-
return r.json();
|
|
73
|
-
}).then(function (idpSettings) {
|
|
74
|
-
/* hack to ignore the iss check. XXX TODO to remove */
|
|
75
|
-
var regextoken = /id_token=[^&]*/;
|
|
76
|
-
var regexstate = /state=[^&]*/;
|
|
77
|
-
var regexexpires = /expires_in=[^&]*/;
|
|
78
|
-
var authority;
|
|
79
|
-
if (window.location.hash) {
|
|
80
|
-
var matched_id_token = window.location.hash.match(regextoken);
|
|
81
|
-
var matched_state = window.location.hash.match(regexstate);
|
|
82
|
-
if (matched_id_token != null && matched_state != null) {
|
|
83
|
-
var id_token = matched_id_token[0].split('=')[1];
|
|
84
|
-
var state = matched_state[0].split('=')[1];
|
|
85
|
-
var strState = localStorage.getItem('oidc.' + state);
|
|
86
|
-
if (strState != null) {
|
|
87
|
-
var decoded = jwtDecode(id_token);
|
|
88
|
-
authority = decoded.iss;
|
|
89
|
-
var storedState = JSON.parse(strState);
|
|
90
|
-
console.debug('Replacing authority in storedState. Before: ', storedState.authority, 'after: ', authority);
|
|
91
|
-
storedState.authority = authority;
|
|
92
|
-
localStorage.setItem('oidc.' + state, JSON.stringify(storedState));
|
|
93
|
-
sessionStorage.setItem(hackAuthorityKey, authority);
|
|
94
|
-
var matched_expires = window.location.hash.match(regexexpires);
|
|
95
|
-
if (matched_expires != null) {
|
|
96
|
-
var expires_in = parseInt(matched_expires[0].split('=')[1]);
|
|
97
|
-
window.location.hash = window.location.hash.replace(matched_expires[0], 'expires_in=' + computeMinExpiresIn(expires_in, id_token, idpSettings.maxExpiresIn));
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
authority = authority || sessionStorage.getItem(hackAuthorityKey) || idpSettings.authority;
|
|
103
|
-
var responseSettings = authorizationCodeFlowEnabled ? {
|
|
104
|
-
response_type: 'code'
|
|
105
|
-
} : {
|
|
106
|
-
response_type: 'id_token token',
|
|
107
|
-
response_mode: 'fragment'
|
|
108
|
-
};
|
|
109
|
-
var settings = _extends({
|
|
110
|
-
authority: authority,
|
|
111
|
-
client_id: idpSettings.client_id,
|
|
112
|
-
redirect_uri: idpSettings.redirect_uri,
|
|
113
|
-
post_logout_redirect_uri: idpSettings.post_logout_redirect_uri,
|
|
114
|
-
silent_redirect_uri: idpSettings.silent_redirect_uri,
|
|
115
|
-
scope: idpSettings.scope,
|
|
116
|
-
automaticSilentRenew: !isSilentRenew,
|
|
117
|
-
accessTokenExpiringNotificationTime: accessTokenExpiringNotificationTime
|
|
118
|
-
}, responseSettings);
|
|
119
|
-
var userManager = new UserManager(settings);
|
|
120
|
-
userManager.idpSettings = idpSettings; //store our settings in there as well to use it later
|
|
121
|
-
userManager.authorizationCodeFlowEnabled = authorizationCodeFlowEnabled;
|
|
122
|
-
if (!isSilentRenew) {
|
|
123
|
-
handleUser(dispatch, userManager, validateUser);
|
|
124
|
-
if (!isSigninCallback) {
|
|
125
|
-
handleSigninSilent(dispatch, userManager);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return userManager;
|
|
129
|
-
})["catch"](function (error) {
|
|
130
|
-
console.debug('error when importing the idp settings', error);
|
|
131
|
-
dispatch(setShowAuthenticationRouterLogin(true));
|
|
132
|
-
throw error;
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
function computeMinExpiresIn(expiresIn, idToken, maxExpiresIn) {
|
|
136
|
-
var now = parseInt(Date.now() / 1000);
|
|
137
|
-
var exp = jwtDecode(idToken).exp;
|
|
138
|
-
var idTokenExpiresIn = exp - now;
|
|
139
|
-
var newExpiresIn = expiresIn;
|
|
140
|
-
var newExpiresInReplaceReason;
|
|
141
|
-
if (expiresIn === undefined || idTokenExpiresIn < newExpiresIn) {
|
|
142
|
-
newExpiresIn = idTokenExpiresIn;
|
|
143
|
-
newExpiresInReplaceReason = 'idtoken.exp is earlier';
|
|
144
|
-
}
|
|
145
|
-
if (maxExpiresIn && maxExpiresIn < newExpiresIn) {
|
|
146
|
-
newExpiresIn = maxExpiresIn;
|
|
147
|
-
newExpiresInReplaceReason = 'idpSettings.maxExpiresIn is smaller';
|
|
148
|
-
}
|
|
149
|
-
if (newExpiresInReplaceReason) {
|
|
150
|
-
console.debug('Replacing expiresIn in user to ' + newExpiresIn + ' because ' + newExpiresInReplaceReason + '. ', 'debug:', 'original expires_in: ' + expiresIn + ', ', 'idTokenExpiresIn: ' + idTokenExpiresIn + ', idpSettings maxExpiresIn: ' + maxExpiresIn);
|
|
151
|
-
}
|
|
152
|
-
return newExpiresIn;
|
|
153
|
-
}
|
|
154
|
-
function login(location, userManagerInstance) {
|
|
155
|
-
sessionStorage.setItem(pathKey, location.pathname + location.search);
|
|
156
|
-
return userManagerInstance.signinRedirect().then(function () {
|
|
157
|
-
return console.debug('login');
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
function logout(dispatch, userManagerInstance) {
|
|
161
|
-
sessionStorage.removeItem(hackAuthorityKey); //To remove when hack is removed
|
|
162
|
-
return userManagerInstance.getUser().then(function (user) {
|
|
163
|
-
if (user) {
|
|
164
|
-
// We don't need to check if token is valid at this point
|
|
165
|
-
return userManagerInstance.signoutRedirect({
|
|
166
|
-
extraQueryParams: {
|
|
167
|
-
TargetResource: userManagerInstance.settings.post_logout_redirect_uri
|
|
168
|
-
}
|
|
169
|
-
}).then(function () {
|
|
170
|
-
console.debug('logged out, window is closing...');
|
|
171
|
-
})["catch"](function (e) {
|
|
172
|
-
var _user$profile;
|
|
173
|
-
console.log('Error during logout :', e);
|
|
174
|
-
// An error occured, window may not be closed, reset the user state
|
|
175
|
-
dispatch(setLoggedUser(null));
|
|
176
|
-
dispatch(setLogoutError(user === null || user === void 0 ? void 0 : (_user$profile = user.profile) === null || _user$profile === void 0 ? void 0 : _user$profile.name, {
|
|
177
|
-
error: e
|
|
178
|
-
}));
|
|
179
|
-
});
|
|
180
|
-
} else {
|
|
181
|
-
console.log('Error nobody to logout ');
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
function getIdTokenExpiresIn(user) {
|
|
186
|
-
var now = parseInt(Date.now() / 1000);
|
|
187
|
-
var exp = jwtDecode(user.id_token).exp;
|
|
188
|
-
return exp - now;
|
|
189
|
-
}
|
|
190
|
-
function dispatchUser(dispatch, userManagerInstance, validateUser) {
|
|
191
|
-
return userManagerInstance.getUser().then(function (user) {
|
|
192
|
-
if (user) {
|
|
193
|
-
// If session storage contains a expired token at initialization
|
|
194
|
-
// We do not dispatch the user
|
|
195
|
-
// Our explicit SigninSilent will attempt to connect once
|
|
196
|
-
if (getIdTokenExpiresIn(user) < 0) {
|
|
197
|
-
console.debug('User token is expired and will not be dispatched');
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
// without validateUser defined, valid user by default
|
|
201
|
-
var validateUserPromise = validateUser && validateUser(user) || Promise.resolve(true);
|
|
202
|
-
return validateUserPromise.then(function (valid) {
|
|
203
|
-
if (!valid) {
|
|
204
|
-
var _user$profile2;
|
|
205
|
-
console.debug("User isn't authorized to log in and will not be dispatched");
|
|
206
|
-
return dispatch(setUnauthorizedUserInfo(user === null || user === void 0 ? void 0 : (_user$profile2 = user.profile) === null || _user$profile2 === void 0 ? void 0 : _user$profile2.name, {}));
|
|
207
|
-
}
|
|
208
|
-
console.debug('User has been successfully loaded from store.');
|
|
209
|
-
|
|
210
|
-
// In authorization code flow we have to make the oidc-client lib re-evaluate the date of the token renewal timers
|
|
211
|
-
// because it is not hacked at page loading on the fragment before oidc-client lib initialization
|
|
212
|
-
if (userManagerInstance.authorizationCodeFlowEnabled) {
|
|
213
|
-
reloadTimerOnExpiresIn(user, userManagerInstance, computeMinExpiresIn(user.expires_in, user.id_token, userManagerInstance.idpSettings.maxExpiresIn));
|
|
214
|
-
}
|
|
215
|
-
return dispatch(setLoggedUser(user));
|
|
216
|
-
})["catch"](function (e) {
|
|
217
|
-
var _user$profile3;
|
|
218
|
-
console.log('Error in dispatchUser', e);
|
|
219
|
-
return dispatch(setUserValidationError(user === null || user === void 0 ? void 0 : (_user$profile3 = user.profile) === null || _user$profile3 === void 0 ? void 0 : _user$profile3.name, {
|
|
220
|
-
error: e
|
|
221
|
-
}));
|
|
222
|
-
});
|
|
223
|
-
} else {
|
|
224
|
-
console.debug('You are not logged in.');
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
function getPreLoginPath() {
|
|
229
|
-
return sessionStorage.getItem(pathKey);
|
|
230
|
-
}
|
|
231
|
-
function navigateToPreLoginPath(navigate) {
|
|
232
|
-
var previousPath = getPreLoginPath();
|
|
233
|
-
navigate(previousPath);
|
|
234
|
-
}
|
|
235
|
-
function handleSigninCallback(dispatch, navigate, userManagerInstance) {
|
|
236
|
-
var reloadAfterNavigate = false;
|
|
237
|
-
userManagerInstance.signinRedirectCallback()["catch"](function (e) {
|
|
238
|
-
if (isIssuerErrorForCodeFlow(e)) {
|
|
239
|
-
// Replacing authority for code flow only because it's done in the hash for implicit flow
|
|
240
|
-
// TODO: Can we also do it here for the implicit flow ? To make it common here for both flows
|
|
241
|
-
extractIssuerToSessionStorage(e);
|
|
242
|
-
// After navigate, location will be out of a redirection route (sign-in-silent or sign-in-callback) so reloading the page will attempt a silent signin
|
|
243
|
-
// It will reload the user manager based on hacked authority at initialization with the new authority
|
|
244
|
-
// We do this because on Azure we only get to know the issuer of the user in the idtoken and so signingredirectcallback will always fail
|
|
245
|
-
// We could restart the whole login process from signin redirect with the correct issuer, but instead we just rely on the silent login after the reload which will work
|
|
246
|
-
reloadAfterNavigate = true;
|
|
247
|
-
} else {
|
|
248
|
-
throw e;
|
|
249
|
-
}
|
|
250
|
-
}).then(function () {
|
|
251
|
-
dispatch(setSignInCallbackError(null));
|
|
252
|
-
navigateToPreLoginPath(navigate);
|
|
253
|
-
if (reloadAfterNavigate) {
|
|
254
|
-
reload();
|
|
255
|
-
}
|
|
256
|
-
})["catch"](function (e) {
|
|
257
|
-
dispatch(setSignInCallbackError(e));
|
|
258
|
-
console.error(e);
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
function handleSilentRenewCallback(userManagerInstance) {
|
|
262
|
-
userManagerInstance.signinSilentCallback();
|
|
263
|
-
}
|
|
264
|
-
function handleUser(dispatch, userManager, validateUser) {
|
|
265
|
-
userManager.events.addUserLoaded(function (user) {
|
|
266
|
-
console.debug('user loaded', user);
|
|
267
|
-
dispatchUser(dispatch, userManager, validateUser);
|
|
268
|
-
});
|
|
269
|
-
userManager.events.addSilentRenewError(function (error) {
|
|
270
|
-
console.debug(error);
|
|
271
|
-
// Wait for accessTokenExpiringNotificationTime so that the user is expired and not between expiring and expired
|
|
272
|
-
// otherwise the library will fire AccessTokenExpiring everytime we do getUser()
|
|
273
|
-
// Indeed, getUSer() => loadUser() => load() on events => if it's already expiring it will be init and triggerred again
|
|
274
|
-
window.setTimeout(function () {
|
|
275
|
-
userManager.getUser().then(function (user) {
|
|
276
|
-
if (!user) {
|
|
277
|
-
console.error("user is null at silent renew error, it shouldn't happen.");
|
|
278
|
-
}
|
|
279
|
-
var idTokenExpiresIn = getIdTokenExpiresIn(user);
|
|
280
|
-
if (idTokenExpiresIn < 0) {
|
|
281
|
-
console.log('Error in silent renew, idtoken expired: ' + idTokenExpiresIn + ' => Logging out.', error);
|
|
282
|
-
// remove the user from our app, but don't sso logout on all other apps
|
|
283
|
-
dispatch(setShowAuthenticationRouterLogin(true));
|
|
284
|
-
// logout during token expiration, show login without errors
|
|
285
|
-
dispatch(resetAuthenticationRouterError());
|
|
286
|
-
return dispatch(setLoggedUser(null));
|
|
287
|
-
} else if (userManager.idpSettings.maxExpiresIn) {
|
|
288
|
-
if (idTokenExpiresIn < userManager.idpSettings.maxExpiresIn) {
|
|
289
|
-
// TODO here attempt last chance login ? snackbar to notify the user ? Popup ?
|
|
290
|
-
// for now we do the same thing as in the else block
|
|
291
|
-
console.log('Error in silent renew, but idtoken ALMOST expiring (expiring in' + idTokenExpiresIn + ') => last chance, next error will logout', 'maxExpiresIn = ' + userManager.idpSettings.maxExpiresIn, 'last renew attempt in ' + idTokenExpiresIn - accessTokenExpiringNotificationTime + 'seconds', error);
|
|
292
|
-
reloadTimerOnExpiresIn(user, userManager, idTokenExpiresIn);
|
|
293
|
-
} else {
|
|
294
|
-
console.log('Error in silent renew, but idtoken NOT expiring (expiring in' + idTokenExpiresIn + ') => postponing expiration to' + userManager.idpSettings.maxExpiresIn, error);
|
|
295
|
-
reloadTimerOnExpiresIn(user, userManager, userManager.idpSettings.maxExpiresIn);
|
|
296
|
-
}
|
|
297
|
-
} else {
|
|
298
|
-
console.log('Error in silent renew, unsupported configuration: token still valid for ' + idTokenExpiresIn + ' but maxExpiresIn is not configured:' + userManager.idpSettings.maxExpiresIn, error);
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
}, accessTokenExpiringNotificationTime * 1000);
|
|
302
|
-
// Should be min(accessTokenExpiringNotificationTime * 1000, idTokenExpiresIn) to avoid rare case
|
|
303
|
-
// when user connection is dying and you refresh the page between expiring and expired.
|
|
304
|
-
// but gateway has a DEFAULT_MAX_CLOCK_SKEW = 60s then the token is still valid for this time
|
|
305
|
-
// even if expired
|
|
306
|
-
// We accept to not manage this case further
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
console.debug('dispatch user');
|
|
310
|
-
dispatchUser(dispatch, userManager, validateUser);
|
|
311
|
-
}
|
|
312
|
-
export { initializeAuthenticationDev, initializeAuthenticationProd, handleSilentRenewCallback, login, logout, dispatchUser, handleSigninCallback, getPreLoginPath };
|
package/es/utils/ElementType.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2021, RTE (http://www.rte-france.com)
|
|
3
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
-
*/
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import LibraryBooksOutlinedIcon from '@mui/icons-material/LibraryBooksOutlined';
|
|
9
|
-
import OfflineBoltIcon from '@mui/icons-material/OfflineBolt';
|
|
10
|
-
import NoteAltIcon from '@mui/icons-material/NoteAlt';
|
|
11
|
-
import ArticleIcon from '@mui/icons-material/Article';
|
|
12
|
-
import SettingsIcon from '@mui/icons-material/Settings';
|
|
13
|
-
export var elementType = {
|
|
14
|
-
DIRECTORY: 'DIRECTORY',
|
|
15
|
-
STUDY: 'STUDY',
|
|
16
|
-
FILTER: 'FILTER',
|
|
17
|
-
MODIFICATION: 'MODIFICATION',
|
|
18
|
-
CONTINGENCY_LIST: 'CONTINGENCY_LIST',
|
|
19
|
-
VOLTAGE_INIT_PARAMETERS: 'VOLTAGE_INIT_PARAMETERS',
|
|
20
|
-
SECURITY_ANALYSIS_PARAMETERS: 'SECURITY_ANALYSIS_PARAMETERS',
|
|
21
|
-
LOADFLOW_PARAMETERS: 'LOADFLOW_PARAMETERS'
|
|
22
|
-
};
|
|
23
|
-
export function getFileIcon(type, style) {
|
|
24
|
-
switch (type) {
|
|
25
|
-
case elementType.STUDY:
|
|
26
|
-
return /*#__PURE__*/React.createElement(LibraryBooksOutlinedIcon, {
|
|
27
|
-
sx: style
|
|
28
|
-
});
|
|
29
|
-
case elementType.CONTINGENCY_LIST:
|
|
30
|
-
return /*#__PURE__*/React.createElement(OfflineBoltIcon, {
|
|
31
|
-
sx: style
|
|
32
|
-
});
|
|
33
|
-
case elementType.MODIFICATION:
|
|
34
|
-
return /*#__PURE__*/React.createElement(NoteAltIcon, {
|
|
35
|
-
sx: style
|
|
36
|
-
});
|
|
37
|
-
case elementType.FILTER:
|
|
38
|
-
return /*#__PURE__*/React.createElement(ArticleIcon, {
|
|
39
|
-
sx: style
|
|
40
|
-
});
|
|
41
|
-
case elementType.VOLTAGE_INIT_PARAMETERS:
|
|
42
|
-
case elementType.SECURITY_ANALYSIS_PARAMETERS:
|
|
43
|
-
case elementType.LOADFLOW_PARAMETERS:
|
|
44
|
-
return /*#__PURE__*/React.createElement(SettingsIcon, {
|
|
45
|
-
sx: style
|
|
46
|
-
});
|
|
47
|
-
case elementType.DIRECTORY:
|
|
48
|
-
// to easily use in TreeView we do not give icons for directories
|
|
49
|
-
return;
|
|
50
|
-
default:
|
|
51
|
-
console.warn('unknown type [' + type + ']');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2021, RTE (http://www.rte-france.com)
|
|
3
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
-
*/
|
|
7
|
-
import { LIGHT_THEME } from '../components/TopBar/TopBar';
|
|
8
|
-
export var TYPE_TAG_MAX_SIZE = '90px';
|
|
9
|
-
export var VL_TAG_MAX_SIZE = '100px';
|
|
10
|
-
export var equipmentStyles = {
|
|
11
|
-
equipmentOption: {
|
|
12
|
-
display: 'flex',
|
|
13
|
-
gap: '20px',
|
|
14
|
-
width: '100%',
|
|
15
|
-
margin: '0px',
|
|
16
|
-
padding: '0px',
|
|
17
|
-
alignItems: 'center',
|
|
18
|
-
justifyContent: 'space-between'
|
|
19
|
-
},
|
|
20
|
-
equipmentTag: function equipmentTag(theme) {
|
|
21
|
-
return {
|
|
22
|
-
borderRadius: '10px',
|
|
23
|
-
padding: '4px',
|
|
24
|
-
fontSize: 'x-small',
|
|
25
|
-
textAlign: 'center',
|
|
26
|
-
color: theme === LIGHT_THEME ? 'inherit' : 'black'
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
equipmentTypeTag: {
|
|
30
|
-
minWidth: TYPE_TAG_MAX_SIZE,
|
|
31
|
-
maxWidth: TYPE_TAG_MAX_SIZE,
|
|
32
|
-
background: 'lightblue'
|
|
33
|
-
},
|
|
34
|
-
equipmentVlTag: {
|
|
35
|
-
width: VL_TAG_MAX_SIZE,
|
|
36
|
-
minWidth: VL_TAG_MAX_SIZE,
|
|
37
|
-
maxWidth: VL_TAG_MAX_SIZE,
|
|
38
|
-
background: 'lightgray',
|
|
39
|
-
fontStyle: 'italic'
|
|
40
|
-
},
|
|
41
|
-
result: {
|
|
42
|
-
width: '100%',
|
|
43
|
-
padding: '2px'
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// Must be equivalent as the back enum
|
|
48
|
-
export var EQUIPMENT_TYPE = {
|
|
49
|
-
SUBSTATION: {
|
|
50
|
-
name: 'SUBSTATION',
|
|
51
|
-
tagLabel: 'equipment_search/substationTag'
|
|
52
|
-
},
|
|
53
|
-
VOLTAGE_LEVEL: {
|
|
54
|
-
name: 'VOLTAGE_LEVEL',
|
|
55
|
-
tagLabel: 'equipment_search/voltageLevelTag'
|
|
56
|
-
},
|
|
57
|
-
LINE: {
|
|
58
|
-
name: 'LINE',
|
|
59
|
-
tagLabel: 'equipment_search/lineTag'
|
|
60
|
-
},
|
|
61
|
-
TWO_WINDINGS_TRANSFORMER: {
|
|
62
|
-
name: 'TWO_WINDINGS_TRANSFORMER',
|
|
63
|
-
tagLabel: 'equipment_search/2wtTag'
|
|
64
|
-
},
|
|
65
|
-
THREE_WINDINGS_TRANSFORMER: {
|
|
66
|
-
name: 'THREE_WINDINGS_TRANSFORMER',
|
|
67
|
-
tagLabel: 'equipment_search/3wtTag'
|
|
68
|
-
},
|
|
69
|
-
HVDC_LINE: {
|
|
70
|
-
name: 'HVDC_LINE',
|
|
71
|
-
tagLabel: 'equipment_search/hvdcLineTag'
|
|
72
|
-
},
|
|
73
|
-
GENERATOR: {
|
|
74
|
-
name: 'GENERATOR',
|
|
75
|
-
tagLabel: 'equipment_search/generatorTag'
|
|
76
|
-
},
|
|
77
|
-
BATTERY: {
|
|
78
|
-
name: 'BATTERY',
|
|
79
|
-
tagLabel: 'equipment_search/batteryTag'
|
|
80
|
-
},
|
|
81
|
-
LOAD: {
|
|
82
|
-
name: 'LOAD',
|
|
83
|
-
tagLabel: 'equipment_search/loadTag'
|
|
84
|
-
},
|
|
85
|
-
SHUNT_COMPENSATOR: {
|
|
86
|
-
name: 'SHUNT_COMPENSATOR',
|
|
87
|
-
tagLabel: 'equipment_search/shuntTag'
|
|
88
|
-
},
|
|
89
|
-
DANGLING_LINE: {
|
|
90
|
-
name: 'DANGLING_LINE',
|
|
91
|
-
tagLabel: 'equipment_search/lineTag'
|
|
92
|
-
},
|
|
93
|
-
STATIC_VAR_COMPENSATOR: {
|
|
94
|
-
name: 'STATIC_VAR_COMPENSATOR',
|
|
95
|
-
tagLabel: 'equipment_search/svcTag'
|
|
96
|
-
},
|
|
97
|
-
HVDC_CONVERTER_STATION: {
|
|
98
|
-
name: 'HVDC_CONVERTER_STATION',
|
|
99
|
-
tagLabel: 'equipment_search/hvdcStationTag'
|
|
100
|
-
},
|
|
101
|
-
BUSBAR_SECTION: {
|
|
102
|
-
name: 'BUSBAR_SECTION',
|
|
103
|
-
tagLabel: 'equipment_search/busbarSectionTag'
|
|
104
|
-
},
|
|
105
|
-
BUS: {
|
|
106
|
-
name: 'BUS',
|
|
107
|
-
tagLabel: 'equipment_search/busTag'
|
|
108
|
-
},
|
|
109
|
-
SWITCH: {
|
|
110
|
-
name: 'SWITCH',
|
|
111
|
-
tagLabel: 'equipment_search/switchTag'
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
export var getEquipmentsInfosForSearchBar = function getEquipmentsInfosForSearchBar(equipmentsInfos, getNameOrId) {
|
|
115
|
-
return equipmentsInfos.flatMap(function (e) {
|
|
116
|
-
var label = getNameOrId(e);
|
|
117
|
-
return e.type === 'SUBSTATION' ? [{
|
|
118
|
-
label: label,
|
|
119
|
-
id: e.id,
|
|
120
|
-
key: e.id,
|
|
121
|
-
type: e.type
|
|
122
|
-
}] : e.voltageLevels.map(function (vli) {
|
|
123
|
-
return {
|
|
124
|
-
label: label,
|
|
125
|
-
id: e.id,
|
|
126
|
-
key: e.id + '_' + vli.id,
|
|
127
|
-
type: e.type,
|
|
128
|
-
voltageLevelLabel: getNameOrId(vli),
|
|
129
|
-
voltageLevelId: vli.id
|
|
130
|
-
};
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
-
/**
|
|
5
|
-
* Copyright (c) 2020, RTE (http://www.rte-france.com)
|
|
6
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
7
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
8
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
9
|
-
*/
|
|
10
|
-
var Events = /*#__PURE__*/function () {
|
|
11
|
-
function Events() {
|
|
12
|
-
_defineProperty(this, "userLoadedCallbacks", []);
|
|
13
|
-
}
|
|
14
|
-
var _proto = Events.prototype;
|
|
15
|
-
_proto.addUserLoaded = function addUserLoaded(callback) {
|
|
16
|
-
this.userLoadedCallbacks.push(callback);
|
|
17
|
-
};
|
|
18
|
-
_proto.addSilentRenewError = function addSilentRenewError(callback) {
|
|
19
|
-
// Nothing to do
|
|
20
|
-
};
|
|
21
|
-
return Events;
|
|
22
|
-
}();
|
|
23
|
-
export var UserManagerMock = /*#__PURE__*/function () {
|
|
24
|
-
function UserManagerMock(settings) {
|
|
25
|
-
_defineProperty(this, "settings", void 0);
|
|
26
|
-
_defineProperty(this, "events", void 0);
|
|
27
|
-
_defineProperty(this, "user", {
|
|
28
|
-
profile: {
|
|
29
|
-
name: 'John Doe',
|
|
30
|
-
email: 'Jhon.Doe@rte-france.com'
|
|
31
|
-
},
|
|
32
|
-
id_token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiI5YzQwMjQ2MS1iMmFiLTQ3NjctOWRiMy02Njg1OWJiMGZjZDAiLCJpc3MiOiJodHRwczovL2' + 'xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vNzUwMmRhZDUtZDY0Yy00NmM3LTlkNDctYjE2ZjU4MGZjZmE5L3YyLjAiLCJpYXQiOjE1ODUzMzEyNDksIm5iZiI6MTU4NTMzMTI0OSwiZXhwIjoyNTg1MzM1MTQ5LCJhaW8iOiJBV1FB' + 'bS84UEFBQUF3Q0xyTDRIUEUvTnVjOU9OdHN0SUV4cVpyMUlqa1FGbXJvUW5EUzJBaksyWnpneUhQTldPdkE3bitveHkvRzgxWElsb1A0TitsQjZINFJteElwakhNYVArTjIyTzVnMUFaR04yc1d6VHA5T3JWMDIvOXhndXJBMjZrdU' + 'NXbGg2RSIsImF0X2hhc2giOiJJaWRYdGRHdzVkbjlOZDFQblVvbDh3IiwiaWRwIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvOTE4ODA0MGQtNmM2Ny00YzViLWIxMTItMzZhMzA0YjY2ZGFkLyIsIm5vbmNlIjoiMjkzZTcxNzhm' + 'OWE5NGZlNjg1ZWY3MjdlZTg5MTYxYjEiLCJzdWIiOiJyTnZjWXJMSXJSN25iSDJPQlhoOFkzU05wZEtPc3dfTUNkX3F3NF9vNDRJIiwidGlkIjoiNzUwMmRhZDUtZDY0Yy00NmM3LTlkNDctYjE2ZjU4MGZjZmE5IiwidXRpIjoiUF' + 'BYdkw1UWxDMG1oMGp2N3NaNGJBQSIsInZlciI6IjIuMCJ9.dPAh24KTfsqmDaRoBtMLcayAWnDqVtydQ97P1a99dg93JsDu4Jhxju9vlzvjd6Ro5a1RZdrKFKB_pgC2DkQ3wSeYjpdSNyBAlW1_ryq65JkTJVMp33OsM_7SdjaRIiJ' + 'fPiJ3U9jRBSyj7ofoHCLUjD_Uu-XreKxpMGhFHOQIO72UfXg8TBpsapjkEv9Dyz2UqMa2BQvO5mxKw93LNg5BI6j2a5LhbMEmmRWqfxWGITJ9TWfHjYdFkrXKcmvWZ9D2b4tsw_5NorDxkuzVFhA89M_0ASzOXoj1Yb6LgdkzWXDim' + 'ssvyyz5Oe4V3gdkAe8Jj7Uwz-9AR-MO2kNkH7ytHA',
|
|
33
|
-
session_state: 'session state',
|
|
34
|
-
access_token: 'eyJ0eXAiOiJKV1QiLCJub25jZSI6InhKWHlQeXVrU1paQ3BOeEcxZUQway1lVDF0YzZtQ01ZVkZKcnBDOTJxc28iLCJhbGciOiJSUzI1NiIsIng1dCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSIsImtpZC' + 'I6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTAwMDAtYzAwMC0wMDAwMDAwMDAwMDAiLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC83NTAyZGFkNS1kNjRjLTQ2YzctOWQ' + '0Ny1iMTZmNTgwZmNmYTkvIiwiaWF0IjoxNTg1MzMxMjQ5LCJuYmYiOjE1ODUzMzEyNDksImV4cCI6MTU4NTMzNTE0OSwiYWNjdCI6MCwiYWNyIjoiMSIsImFpbyI6IkFVUUF1LzhQQUFBQXdwc3RYMlVkY2VDQWx4dU9tVHpIY0R3R' + 'lhTWUtYanIvZUNTSi9PdTRqbTJyUVBCUml0U1dWMThmNldCVEdNdnQ5ZGx0Ry9lTXB1VXZqaTN2NCtzanh3PT0iLCJhbHRzZWNpZCI6IjE6bGl2ZS5jb206MDAwMzQwMDExOUZEOTIxMiIsImFtciI6WyJwd2QiXSwiYXBwX2Rpc3B' + 'sYXluYW1lIjoic3BhIiwiYXBwaWQiOiI5YzQwMjQ2MS1iMmFiLTQ3NjctOWRiMy02Njg1OWJiMGZjZDAiLCJhcHBpZGFjciI6IjAiLCJlbWFpbCI6ImNoYW1zZWRkaW5lLmJlbmhhbWVkQGVuc2ktdW1hLnRuIiwiZmFtaWx5X25hb' + 'WUiOiJCRU5IQU1FRCIsImdpdmVuX25hbWUiOiJDaGFtc2VkZGluZSIsImlkcCI6ImxpdmUuY29tIiwiaXBhZGRyIjoiNzcuMjA0LjE0Ni4xNTkiLCJuYW1lIjoiQ2hhbXNlZGRpbmUgQkVOSEFNRUQiLCJvaWQiOiIzNTIzYmQ3OC0' + 'yZjIxLTQ3ZjYtODhlOC1hYWIzYjZmMjdmNjAiLCJwbGF0ZiI6IjE0IiwicHVpZCI6IjEwMDMyMDAwOURFMDg1NkEiLCJzY3AiOiJVc2VyLlJlYWQgcHJvZmlsZSBvcGVuaWQgZW1haWwiLCJzdWIiOiJjVEd5LVlfV3FLR2x1cmRUV' + 'DdSUVlfY3FjSDJoVHpEdllZTmotQ3hONXA4IiwidGlkIjoiNzUwMmRhZDUtZDY0Yy00NmM3LTlkNDctYjE2ZjU4MGZjZmE5IiwidW5pcXVlX25hbWUiOiJsaXZlLmNvbSNjaGFtc2VkZGluZS5iZW5oYW1lZEBlbnNpLXVtYS50biI' + 'sInV0aSI6IlBQWHZMNVFsQzBtaDBqdjdzWjRiQUEiLCJ2ZXIiOiIxLjAiLCJ4bXNfc3QiOnsic3ViIjoick52Y1lyTElyUjduYkgyT0JYaDhZM1NOcGRLT3N3X01DZF9xdzRfbzQ0SSJ9LCJ4bXNfdGNkdCI6MTU4MjgyMDM1Mn0.W_' + 'ccOGW_AGdg37KSMi7LWHtvm3Mw5p1dHjgDIrUaXduKF2iLS4dCaPw7yeo4VjAcOyV6C0h6ABLDCtkwVt8BSDTIIU7DaT8k2bRbMCCq69BmeiYPsbp-yX6ywGCx5DHsnOLqI2oHbBQktA2Nmv9Va651Pbm3OpSPuGPdVimkFCcnisiGl' + 'UOej1ZMNwyVT6386O2pERPtxmFUt_D1dKLxBXxBNxLVUG5BG3bI7wMpBOHEUA5CbaBzYXmGrLMXVVbrj9OsF-WQ6aNoqsm9cicX6pJB60lFz1dxLeSgcFO7Zh2K3PFe4FnXCqAvNPadQMz_kJEO9_phlDV85c2MPqeXbA',
|
|
35
|
-
token_type: 'Bearer',
|
|
36
|
-
scope: 'scopes'
|
|
37
|
-
});
|
|
38
|
-
this.settings = settings;
|
|
39
|
-
this.events = new Events();
|
|
40
|
-
}
|
|
41
|
-
var _proto2 = UserManagerMock.prototype;
|
|
42
|
-
_proto2.getUser = function getUser() {
|
|
43
|
-
return Promise.resolve(JSON.parse(sessionStorage.getItem('powsybl-gridsuite-mock-user')));
|
|
44
|
-
};
|
|
45
|
-
_proto2.signinSilent = function signinSilent() {
|
|
46
|
-
console.info('signinSilent..............');
|
|
47
|
-
var localStorageUser = JSON.parse(localStorage.getItem('powsybl-gridsuite-mock-user'));
|
|
48
|
-
if (localStorageUser === null) {
|
|
49
|
-
return Promise.reject(new Error('End-User authentication required'));
|
|
50
|
-
}
|
|
51
|
-
sessionStorage.setItem('powsybl-gridsuite-mock-user', JSON.stringify(localStorageUser));
|
|
52
|
-
this.events.userLoadedCallbacks.forEach(function (c) {
|
|
53
|
-
return c(localStorageUser);
|
|
54
|
-
});
|
|
55
|
-
return Promise.resolve(localStorageUser);
|
|
56
|
-
};
|
|
57
|
-
_proto2.signinSilentCallback = function signinSilentCallback() {
|
|
58
|
-
console.error('Unsupported, iframe signinSilentCallback in UserManagerMock (dev mode)');
|
|
59
|
-
return Promise.reject();
|
|
60
|
-
};
|
|
61
|
-
_proto2.signinRedirect = function signinRedirect() {
|
|
62
|
-
localStorage.setItem('powsybl-gridsuite-mock-user', JSON.stringify(this.user));
|
|
63
|
-
window.location = './sign-in-callback';
|
|
64
|
-
return Promise.resolve(null);
|
|
65
|
-
};
|
|
66
|
-
_proto2.signoutRedirect = function signoutRedirect() {
|
|
67
|
-
sessionStorage.removeItem('powsybl-gridsuite-mock-user');
|
|
68
|
-
localStorage.removeItem('powsybl-gridsuite-mock-user');
|
|
69
|
-
window.location = '.';
|
|
70
|
-
return Promise.resolve(null);
|
|
71
|
-
};
|
|
72
|
-
_proto2.signinRedirectCallback = function signinRedirectCallback() {
|
|
73
|
-
var _this = this;
|
|
74
|
-
sessionStorage.setItem('powsybl-gridsuite-mock-user', JSON.stringify(this.user));
|
|
75
|
-
this.events.userLoadedCallbacks.forEach(function (c) {
|
|
76
|
-
return c(_this.user);
|
|
77
|
-
});
|
|
78
|
-
return Promise.resolve('');
|
|
79
|
-
};
|
|
80
|
-
return UserManagerMock;
|
|
81
|
-
}();
|
package/es/utils/actions.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020, RTE (http://www.rte-france.com)
|
|
3
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export var USER = 'USER';
|
|
9
|
-
export function setLoggedUser(user) {
|
|
10
|
-
return {
|
|
11
|
-
type: USER,
|
|
12
|
-
user: user
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export var SIGNIN_CALLBACK_ERROR = 'SIGNIN_CALLBACK_ERROR';
|
|
16
|
-
export function setSignInCallbackError(signInCallbackError) {
|
|
17
|
-
return {
|
|
18
|
-
type: SIGNIN_CALLBACK_ERROR,
|
|
19
|
-
signInCallbackError: signInCallbackError
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export var UNAUTHORIZED_USER_INFO = 'UNAUTHORIZED_USER_INFO';
|
|
23
|
-
export function setUnauthorizedUserInfo(userName, unauthorizedUserInfo) {
|
|
24
|
-
return {
|
|
25
|
-
type: UNAUTHORIZED_USER_INFO,
|
|
26
|
-
authenticationRouterError: {
|
|
27
|
-
userName: userName,
|
|
28
|
-
unauthorizedUserInfo: unauthorizedUserInfo
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export var LOGOUT_ERROR = 'LOGOUT_ERROR';
|
|
33
|
-
export function setLogoutError(userName, logoutError) {
|
|
34
|
-
return {
|
|
35
|
-
type: LOGOUT_ERROR,
|
|
36
|
-
authenticationRouterError: {
|
|
37
|
-
userName: userName,
|
|
38
|
-
logoutError: logoutError
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
export var USER_VALIDATION_ERROR = 'USER_VALIDATION_ERROR';
|
|
43
|
-
export function setUserValidationError(userName, userValidationError) {
|
|
44
|
-
return {
|
|
45
|
-
type: USER_VALIDATION_ERROR,
|
|
46
|
-
authenticationRouterError: {
|
|
47
|
-
userName: userName,
|
|
48
|
-
userValidationError: userValidationError
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
export var RESET_AUTHENTICATION_ROUTER_ERROR = 'RESET_AUTHENTICATION_ROUTER_ERROR';
|
|
53
|
-
export function resetAuthenticationRouterError() {
|
|
54
|
-
return {
|
|
55
|
-
type: RESET_AUTHENTICATION_ROUTER_ERROR,
|
|
56
|
-
authenticationRouterError: null
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
export var SHOW_AUTH_INFO_LOGIN = 'SHOW_AUTH_INFO_LOGIN';
|
|
60
|
-
export function setShowAuthenticationRouterLogin(showAuthenticationRouterLogin) {
|
|
61
|
-
return {
|
|
62
|
-
type: SHOW_AUTH_INFO_LOGIN,
|
|
63
|
-
showAuthenticationRouterLogin: showAuthenticationRouterLogin
|
|
64
|
-
};
|
|
65
|
-
}
|
package/es/utils/algos.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2022, RTE (http://www.rte-france.com)
|
|
3
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export function equalsArray(a, b) {
|
|
9
|
-
if (b === a) {
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
if (!b || !a) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
if (a.length !== b.length) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
for (var i = 0, l = a.length; i < l; i++) {
|
|
19
|
-
if (a[i] instanceof Array && b[i] instanceof Array) {
|
|
20
|
-
if (!equalsArray(a[i], b[i])) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
} else if (a[i] !== b[i]) {
|
|
24
|
-
// Warning - two different object instances will never be equal: {x:20} != {x:20}
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return true;
|
|
29
|
-
}
|