@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
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { Log, UserManager } from "oidc-client";
|
|
2
|
+
import { UserManagerMock } from "./UserManagerMock.js";
|
|
3
|
+
import { setShowAuthenticationRouterLogin, setLoggedUser, setLogoutError, setUnauthorizedUserInfo, setUserValidationError, resetAuthenticationRouterError, setSignInCallbackError } from "./actions.js";
|
|
4
|
+
import jwtDecode from "jwt-decode";
|
|
5
|
+
window.OIDCLog = Log;
|
|
6
|
+
const hackAuthorityKey = "oidc.hack.authority";
|
|
7
|
+
const oidcHackReloadedKey = "gridsuite-oidc-hack-reloaded";
|
|
8
|
+
const pathKey = "powsybl-gridsuite-current-path";
|
|
9
|
+
function isIssuerErrorForCodeFlow(error) {
|
|
10
|
+
return error.message.includes("Invalid issuer in token");
|
|
11
|
+
}
|
|
12
|
+
function extractIssuerToSessionStorage(error) {
|
|
13
|
+
const issuer = error.message.split(" ").pop();
|
|
14
|
+
sessionStorage.setItem(hackAuthorityKey, issuer);
|
|
15
|
+
}
|
|
16
|
+
function reload() {
|
|
17
|
+
if (!sessionStorage.getItem(oidcHackReloadedKey)) {
|
|
18
|
+
sessionStorage.setItem(oidcHackReloadedKey, true);
|
|
19
|
+
console.log("Hack oidc, reload page to make login work");
|
|
20
|
+
window.location.reload();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function reloadTimerOnExpiresIn(user, userManager, expiresIn) {
|
|
24
|
+
user.expires_in = expiresIn;
|
|
25
|
+
userManager.storeUser(user).then(() => {
|
|
26
|
+
userManager.getUser();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function handleSigninSilent(dispatch, userManager) {
|
|
30
|
+
userManager.getUser().then((user) => {
|
|
31
|
+
if (user == null || getIdTokenExpiresIn(user) < 0) {
|
|
32
|
+
return userManager.signinSilent().catch((error) => {
|
|
33
|
+
dispatch(setShowAuthenticationRouterLogin(true));
|
|
34
|
+
const errorIssuerCodeFlow = isIssuerErrorForCodeFlow(error);
|
|
35
|
+
const errorIssuerImplicitFlow = error.message === "authority mismatch on settings vs. signin state";
|
|
36
|
+
if (errorIssuerCodeFlow) {
|
|
37
|
+
extractIssuerToSessionStorage(error);
|
|
38
|
+
}
|
|
39
|
+
if (errorIssuerCodeFlow || errorIssuerImplicitFlow) {
|
|
40
|
+
reload();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function initializeAuthenticationDev(dispatch, isSilentRenew, validateUser, isSigninCallback) {
|
|
47
|
+
let userManager = new UserManagerMock({});
|
|
48
|
+
if (!isSilentRenew) {
|
|
49
|
+
handleUser(dispatch, userManager, validateUser);
|
|
50
|
+
if (!isSigninCallback) {
|
|
51
|
+
handleSigninSilent(dispatch, userManager);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return Promise.resolve(userManager);
|
|
55
|
+
}
|
|
56
|
+
const accessTokenExpiringNotificationTime = 60;
|
|
57
|
+
function initializeAuthenticationProd(dispatch, isSilentRenew, idpSettings, validateUser, authorizationCodeFlowEnabled, isSigninCallback) {
|
|
58
|
+
return idpSettings.then((r) => r.json()).then((idpSettings2) => {
|
|
59
|
+
const regextoken = /id_token=[^&]*/;
|
|
60
|
+
const regexstate = /state=[^&]*/;
|
|
61
|
+
const regexexpires = /expires_in=[^&]*/;
|
|
62
|
+
let authority;
|
|
63
|
+
if (window.location.hash) {
|
|
64
|
+
const matched_id_token = window.location.hash.match(regextoken);
|
|
65
|
+
const matched_state = window.location.hash.match(regexstate);
|
|
66
|
+
if (matched_id_token != null && matched_state != null) {
|
|
67
|
+
const id_token = matched_id_token[0].split("=")[1];
|
|
68
|
+
const state = matched_state[0].split("=")[1];
|
|
69
|
+
const strState = localStorage.getItem("oidc." + state);
|
|
70
|
+
if (strState != null) {
|
|
71
|
+
const decoded = jwtDecode(id_token);
|
|
72
|
+
authority = decoded.iss;
|
|
73
|
+
const storedState = JSON.parse(strState);
|
|
74
|
+
console.debug(
|
|
75
|
+
"Replacing authority in storedState. Before: ",
|
|
76
|
+
storedState.authority,
|
|
77
|
+
"after: ",
|
|
78
|
+
authority
|
|
79
|
+
);
|
|
80
|
+
storedState.authority = authority;
|
|
81
|
+
localStorage.setItem(
|
|
82
|
+
"oidc." + state,
|
|
83
|
+
JSON.stringify(storedState)
|
|
84
|
+
);
|
|
85
|
+
sessionStorage.setItem(hackAuthorityKey, authority);
|
|
86
|
+
const matched_expires = window.location.hash.match(regexexpires);
|
|
87
|
+
if (matched_expires != null) {
|
|
88
|
+
const expires_in = parseInt(
|
|
89
|
+
matched_expires[0].split("=")[1]
|
|
90
|
+
);
|
|
91
|
+
window.location.hash = window.location.hash.replace(
|
|
92
|
+
matched_expires[0],
|
|
93
|
+
"expires_in=" + computeMinExpiresIn(
|
|
94
|
+
expires_in,
|
|
95
|
+
id_token,
|
|
96
|
+
idpSettings2.maxExpiresIn
|
|
97
|
+
)
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
authority = authority || sessionStorage.getItem(hackAuthorityKey) || idpSettings2.authority;
|
|
104
|
+
const responseSettings = authorizationCodeFlowEnabled ? { response_type: "code" } : {
|
|
105
|
+
response_type: "id_token token",
|
|
106
|
+
response_mode: "fragment"
|
|
107
|
+
};
|
|
108
|
+
const settings = {
|
|
109
|
+
authority,
|
|
110
|
+
client_id: idpSettings2.client_id,
|
|
111
|
+
redirect_uri: idpSettings2.redirect_uri,
|
|
112
|
+
post_logout_redirect_uri: idpSettings2.post_logout_redirect_uri,
|
|
113
|
+
silent_redirect_uri: idpSettings2.silent_redirect_uri,
|
|
114
|
+
scope: idpSettings2.scope,
|
|
115
|
+
automaticSilentRenew: !isSilentRenew,
|
|
116
|
+
accessTokenExpiringNotificationTime,
|
|
117
|
+
...responseSettings
|
|
118
|
+
};
|
|
119
|
+
let userManager = new UserManager(settings);
|
|
120
|
+
userManager.idpSettings = idpSettings2;
|
|
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((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
|
+
const now = parseInt(Date.now() / 1e3);
|
|
137
|
+
const exp = jwtDecode(idToken).exp;
|
|
138
|
+
const idTokenExpiresIn = exp - now;
|
|
139
|
+
let newExpiresIn = expiresIn;
|
|
140
|
+
let newExpiresInReplaceReason;
|
|
141
|
+
if (expiresIn === void 0 || 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(
|
|
151
|
+
"Replacing expiresIn in user to " + newExpiresIn + " because " + newExpiresInReplaceReason + ". ",
|
|
152
|
+
"debug:",
|
|
153
|
+
"original expires_in: " + expiresIn + ", ",
|
|
154
|
+
"idTokenExpiresIn: " + idTokenExpiresIn + ", idpSettings maxExpiresIn: " + maxExpiresIn
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
return newExpiresIn;
|
|
158
|
+
}
|
|
159
|
+
function login(location, userManagerInstance) {
|
|
160
|
+
sessionStorage.setItem(pathKey, location.pathname + location.search);
|
|
161
|
+
return userManagerInstance.signinRedirect().then(() => console.debug("login"));
|
|
162
|
+
}
|
|
163
|
+
function logout(dispatch, userManagerInstance) {
|
|
164
|
+
sessionStorage.removeItem(hackAuthorityKey);
|
|
165
|
+
return userManagerInstance.getUser().then((user) => {
|
|
166
|
+
if (user) {
|
|
167
|
+
return userManagerInstance.signoutRedirect({
|
|
168
|
+
extraQueryParams: {
|
|
169
|
+
TargetResource: userManagerInstance.settings.post_logout_redirect_uri
|
|
170
|
+
}
|
|
171
|
+
}).then(() => {
|
|
172
|
+
console.debug("logged out, window is closing...");
|
|
173
|
+
}).catch((e) => {
|
|
174
|
+
var _a;
|
|
175
|
+
console.log("Error during logout :", e);
|
|
176
|
+
dispatch(setLoggedUser(null));
|
|
177
|
+
dispatch(setLogoutError((_a = user == null ? void 0 : user.profile) == null ? void 0 : _a.name, { error: e }));
|
|
178
|
+
});
|
|
179
|
+
} else {
|
|
180
|
+
console.log("Error nobody to logout ");
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
function getIdTokenExpiresIn(user) {
|
|
185
|
+
const now = parseInt(Date.now() / 1e3);
|
|
186
|
+
const exp = jwtDecode(user.id_token).exp;
|
|
187
|
+
return exp - now;
|
|
188
|
+
}
|
|
189
|
+
function dispatchUser(dispatch, userManagerInstance, validateUser) {
|
|
190
|
+
return userManagerInstance.getUser().then((user) => {
|
|
191
|
+
if (user) {
|
|
192
|
+
if (getIdTokenExpiresIn(user) < 0) {
|
|
193
|
+
console.debug(
|
|
194
|
+
"User token is expired and will not be dispatched"
|
|
195
|
+
);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
let validateUserPromise = validateUser && validateUser(user) || Promise.resolve(true);
|
|
199
|
+
return validateUserPromise.then((valid) => {
|
|
200
|
+
var _a;
|
|
201
|
+
if (!valid) {
|
|
202
|
+
console.debug(
|
|
203
|
+
"User isn't authorized to log in and will not be dispatched"
|
|
204
|
+
);
|
|
205
|
+
return dispatch(
|
|
206
|
+
setUnauthorizedUserInfo((_a = user == null ? void 0 : user.profile) == null ? void 0 : _a.name, {})
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
console.debug(
|
|
210
|
+
"User has been successfully loaded from store."
|
|
211
|
+
);
|
|
212
|
+
if (userManagerInstance.authorizationCodeFlowEnabled) {
|
|
213
|
+
reloadTimerOnExpiresIn(
|
|
214
|
+
user,
|
|
215
|
+
userManagerInstance,
|
|
216
|
+
computeMinExpiresIn(
|
|
217
|
+
user.expires_in,
|
|
218
|
+
user.id_token,
|
|
219
|
+
userManagerInstance.idpSettings.maxExpiresIn
|
|
220
|
+
)
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
return dispatch(setLoggedUser(user));
|
|
224
|
+
}).catch((e) => {
|
|
225
|
+
var _a;
|
|
226
|
+
console.log("Error in dispatchUser", e);
|
|
227
|
+
return dispatch(
|
|
228
|
+
setUserValidationError((_a = user == null ? void 0 : user.profile) == null ? void 0 : _a.name, {
|
|
229
|
+
error: e
|
|
230
|
+
})
|
|
231
|
+
);
|
|
232
|
+
});
|
|
233
|
+
} else {
|
|
234
|
+
console.debug("You are not logged in.");
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function getPreLoginPath() {
|
|
239
|
+
return sessionStorage.getItem(pathKey);
|
|
240
|
+
}
|
|
241
|
+
function navigateToPreLoginPath(navigate) {
|
|
242
|
+
const previousPath = getPreLoginPath();
|
|
243
|
+
navigate(previousPath);
|
|
244
|
+
}
|
|
245
|
+
function handleSigninCallback(dispatch, navigate, userManagerInstance) {
|
|
246
|
+
let reloadAfterNavigate = false;
|
|
247
|
+
userManagerInstance.signinRedirectCallback().catch(function(e) {
|
|
248
|
+
if (isIssuerErrorForCodeFlow(e)) {
|
|
249
|
+
extractIssuerToSessionStorage(e);
|
|
250
|
+
reloadAfterNavigate = true;
|
|
251
|
+
} else {
|
|
252
|
+
throw e;
|
|
253
|
+
}
|
|
254
|
+
}).then(function() {
|
|
255
|
+
dispatch(setSignInCallbackError(null));
|
|
256
|
+
navigateToPreLoginPath(navigate);
|
|
257
|
+
if (reloadAfterNavigate) {
|
|
258
|
+
reload();
|
|
259
|
+
}
|
|
260
|
+
}).catch(function(e) {
|
|
261
|
+
dispatch(setSignInCallbackError(e));
|
|
262
|
+
console.error(e);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
function handleSilentRenewCallback(userManagerInstance) {
|
|
266
|
+
userManagerInstance.signinSilentCallback();
|
|
267
|
+
}
|
|
268
|
+
function handleUser(dispatch, userManager, validateUser) {
|
|
269
|
+
userManager.events.addUserLoaded((user) => {
|
|
270
|
+
console.debug("user loaded", user);
|
|
271
|
+
dispatchUser(dispatch, userManager, validateUser);
|
|
272
|
+
});
|
|
273
|
+
userManager.events.addSilentRenewError((error) => {
|
|
274
|
+
console.debug(error);
|
|
275
|
+
window.setTimeout(() => {
|
|
276
|
+
userManager.getUser().then((user) => {
|
|
277
|
+
if (!user) {
|
|
278
|
+
console.error(
|
|
279
|
+
"user is null at silent renew error, it shouldn't happen."
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
const idTokenExpiresIn = getIdTokenExpiresIn(user);
|
|
283
|
+
if (idTokenExpiresIn < 0) {
|
|
284
|
+
console.log(
|
|
285
|
+
"Error in silent renew, idtoken expired: " + idTokenExpiresIn + " => Logging out.",
|
|
286
|
+
error
|
|
287
|
+
);
|
|
288
|
+
dispatch(setShowAuthenticationRouterLogin(true));
|
|
289
|
+
dispatch(resetAuthenticationRouterError());
|
|
290
|
+
return dispatch(setLoggedUser(null));
|
|
291
|
+
} else if (userManager.idpSettings.maxExpiresIn) {
|
|
292
|
+
if (idTokenExpiresIn < userManager.idpSettings.maxExpiresIn) {
|
|
293
|
+
console.log(
|
|
294
|
+
"Error in silent renew, but idtoken ALMOST expiring (expiring in" + idTokenExpiresIn + ") => last chance, next error will logout",
|
|
295
|
+
"maxExpiresIn = " + userManager.idpSettings.maxExpiresIn,
|
|
296
|
+
"last renew attempt in " + idTokenExpiresIn - accessTokenExpiringNotificationTime + "seconds",
|
|
297
|
+
error
|
|
298
|
+
);
|
|
299
|
+
reloadTimerOnExpiresIn(
|
|
300
|
+
user,
|
|
301
|
+
userManager,
|
|
302
|
+
idTokenExpiresIn
|
|
303
|
+
);
|
|
304
|
+
} else {
|
|
305
|
+
console.log(
|
|
306
|
+
"Error in silent renew, but idtoken NOT expiring (expiring in" + idTokenExpiresIn + ") => postponing expiration to" + userManager.idpSettings.maxExpiresIn,
|
|
307
|
+
error
|
|
308
|
+
);
|
|
309
|
+
reloadTimerOnExpiresIn(
|
|
310
|
+
user,
|
|
311
|
+
userManager,
|
|
312
|
+
userManager.idpSettings.maxExpiresIn
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
} else {
|
|
316
|
+
console.log(
|
|
317
|
+
"Error in silent renew, unsupported configuration: token still valid for " + idTokenExpiresIn + " but maxExpiresIn is not configured:" + userManager.idpSettings.maxExpiresIn,
|
|
318
|
+
error
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
}, accessTokenExpiringNotificationTime * 1e3);
|
|
323
|
+
});
|
|
324
|
+
console.debug("dispatch user");
|
|
325
|
+
dispatchUser(dispatch, userManager, validateUser);
|
|
326
|
+
}
|
|
327
|
+
export {
|
|
328
|
+
dispatchUser,
|
|
329
|
+
getPreLoginPath,
|
|
330
|
+
handleSigninCallback,
|
|
331
|
+
handleSilentRenewCallback,
|
|
332
|
+
initializeAuthenticationDev,
|
|
333
|
+
initializeAuthenticationProd,
|
|
334
|
+
login,
|
|
335
|
+
logout
|
|
336
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function getFileIcon(type: any, style: any): import("react/jsx-runtime").JSX.Element | undefined;
|
|
2
|
+
export namespace elementType {
|
|
3
|
+
const DIRECTORY: string;
|
|
4
|
+
const STUDY: string;
|
|
5
|
+
const CASE: string;
|
|
6
|
+
const FILTER: string;
|
|
7
|
+
const MODIFICATION: string;
|
|
8
|
+
const CONTINGENCY_LIST: string;
|
|
9
|
+
const VOLTAGE_INIT_PARAMETERS: string;
|
|
10
|
+
const SECURITY_ANALYSIS_PARAMETERS: string;
|
|
11
|
+
const LOADFLOW_PARAMETERS: string;
|
|
12
|
+
const SENSITIVITY_PARAMETERS: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Settings, Article, NoteAlt, OfflineBolt, Photo, PhotoLibrary } from "@mui/icons-material";
|
|
4
|
+
const elementType = {
|
|
5
|
+
DIRECTORY: "DIRECTORY",
|
|
6
|
+
STUDY: "STUDY",
|
|
7
|
+
CASE: "CASE",
|
|
8
|
+
FILTER: "FILTER",
|
|
9
|
+
MODIFICATION: "MODIFICATION",
|
|
10
|
+
CONTINGENCY_LIST: "CONTINGENCY_LIST",
|
|
11
|
+
VOLTAGE_INIT_PARAMETERS: "VOLTAGE_INIT_PARAMETERS",
|
|
12
|
+
SECURITY_ANALYSIS_PARAMETERS: "SECURITY_ANALYSIS_PARAMETERS",
|
|
13
|
+
LOADFLOW_PARAMETERS: "LOADFLOW_PARAMETERS",
|
|
14
|
+
SENSITIVITY_PARAMETERS: "SENSITIVITY_PARAMETERS"
|
|
15
|
+
};
|
|
16
|
+
function getFileIcon(type, style) {
|
|
17
|
+
switch (type) {
|
|
18
|
+
case elementType.STUDY:
|
|
19
|
+
return /* @__PURE__ */ jsx(PhotoLibrary, { sx: style });
|
|
20
|
+
case elementType.CASE:
|
|
21
|
+
return /* @__PURE__ */ jsx(Photo, { sx: style });
|
|
22
|
+
case elementType.CONTINGENCY_LIST:
|
|
23
|
+
return /* @__PURE__ */ jsx(OfflineBolt, { sx: style });
|
|
24
|
+
case elementType.MODIFICATION:
|
|
25
|
+
return /* @__PURE__ */ jsx(NoteAlt, { sx: style });
|
|
26
|
+
case elementType.FILTER:
|
|
27
|
+
return /* @__PURE__ */ jsx(Article, { sx: style });
|
|
28
|
+
case elementType.VOLTAGE_INIT_PARAMETERS:
|
|
29
|
+
case elementType.SECURITY_ANALYSIS_PARAMETERS:
|
|
30
|
+
case elementType.LOADFLOW_PARAMETERS:
|
|
31
|
+
case elementType.SENSITIVITY_PARAMETERS:
|
|
32
|
+
return /* @__PURE__ */ jsx(Settings, { sx: style });
|
|
33
|
+
case elementType.DIRECTORY:
|
|
34
|
+
return;
|
|
35
|
+
default:
|
|
36
|
+
console.warn("unknown type [" + type + "]");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
elementType,
|
|
41
|
+
getFileIcon
|
|
42
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
export const TYPE_TAG_MAX_SIZE: "90px";
|
|
2
|
+
export const VL_TAG_MAX_SIZE: "100px";
|
|
3
|
+
export namespace equipmentStyles {
|
|
4
|
+
namespace equipmentOption {
|
|
5
|
+
const display: string;
|
|
6
|
+
const gap: string;
|
|
7
|
+
const width: string;
|
|
8
|
+
const margin: string;
|
|
9
|
+
const padding: string;
|
|
10
|
+
const alignItems: string;
|
|
11
|
+
const justifyContent: string;
|
|
12
|
+
}
|
|
13
|
+
function equipmentTag(theme: any): {
|
|
14
|
+
borderRadius: string;
|
|
15
|
+
padding: string;
|
|
16
|
+
fontSize: string;
|
|
17
|
+
textAlign: string;
|
|
18
|
+
color: string;
|
|
19
|
+
};
|
|
20
|
+
namespace equipmentTypeTag {
|
|
21
|
+
export { TYPE_TAG_MAX_SIZE as minWidth };
|
|
22
|
+
export { TYPE_TAG_MAX_SIZE as maxWidth };
|
|
23
|
+
export const background: string;
|
|
24
|
+
}
|
|
25
|
+
namespace equipmentVlTag {
|
|
26
|
+
export { VL_TAG_MAX_SIZE as width };
|
|
27
|
+
export { VL_TAG_MAX_SIZE as minWidth };
|
|
28
|
+
export { VL_TAG_MAX_SIZE as maxWidth };
|
|
29
|
+
const background_1: string;
|
|
30
|
+
export { background_1 as background };
|
|
31
|
+
export const fontStyle: string;
|
|
32
|
+
}
|
|
33
|
+
namespace result {
|
|
34
|
+
const width_1: string;
|
|
35
|
+
export { width_1 as width };
|
|
36
|
+
const padding_1: string;
|
|
37
|
+
export { padding_1 as padding };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export namespace EQUIPMENT_TYPE {
|
|
41
|
+
namespace SUBSTATION {
|
|
42
|
+
const name: string;
|
|
43
|
+
const tagLabel: string;
|
|
44
|
+
}
|
|
45
|
+
namespace VOLTAGE_LEVEL {
|
|
46
|
+
const name_1: string;
|
|
47
|
+
export { name_1 as name };
|
|
48
|
+
const tagLabel_1: string;
|
|
49
|
+
export { tagLabel_1 as tagLabel };
|
|
50
|
+
}
|
|
51
|
+
namespace LINE {
|
|
52
|
+
const name_2: string;
|
|
53
|
+
export { name_2 as name };
|
|
54
|
+
const tagLabel_2: string;
|
|
55
|
+
export { tagLabel_2 as tagLabel };
|
|
56
|
+
}
|
|
57
|
+
namespace TWO_WINDINGS_TRANSFORMER {
|
|
58
|
+
const name_3: string;
|
|
59
|
+
export { name_3 as name };
|
|
60
|
+
const tagLabel_3: string;
|
|
61
|
+
export { tagLabel_3 as tagLabel };
|
|
62
|
+
}
|
|
63
|
+
namespace THREE_WINDINGS_TRANSFORMER {
|
|
64
|
+
const name_4: string;
|
|
65
|
+
export { name_4 as name };
|
|
66
|
+
const tagLabel_4: string;
|
|
67
|
+
export { tagLabel_4 as tagLabel };
|
|
68
|
+
}
|
|
69
|
+
namespace HVDC_LINE {
|
|
70
|
+
const name_5: string;
|
|
71
|
+
export { name_5 as name };
|
|
72
|
+
const tagLabel_5: string;
|
|
73
|
+
export { tagLabel_5 as tagLabel };
|
|
74
|
+
}
|
|
75
|
+
namespace GENERATOR {
|
|
76
|
+
const name_6: string;
|
|
77
|
+
export { name_6 as name };
|
|
78
|
+
const tagLabel_6: string;
|
|
79
|
+
export { tagLabel_6 as tagLabel };
|
|
80
|
+
}
|
|
81
|
+
namespace BATTERY {
|
|
82
|
+
const name_7: string;
|
|
83
|
+
export { name_7 as name };
|
|
84
|
+
const tagLabel_7: string;
|
|
85
|
+
export { tagLabel_7 as tagLabel };
|
|
86
|
+
}
|
|
87
|
+
namespace LOAD {
|
|
88
|
+
const name_8: string;
|
|
89
|
+
export { name_8 as name };
|
|
90
|
+
const tagLabel_8: string;
|
|
91
|
+
export { tagLabel_8 as tagLabel };
|
|
92
|
+
}
|
|
93
|
+
namespace SHUNT_COMPENSATOR {
|
|
94
|
+
const name_9: string;
|
|
95
|
+
export { name_9 as name };
|
|
96
|
+
const tagLabel_9: string;
|
|
97
|
+
export { tagLabel_9 as tagLabel };
|
|
98
|
+
}
|
|
99
|
+
namespace DANGLING_LINE {
|
|
100
|
+
const name_10: string;
|
|
101
|
+
export { name_10 as name };
|
|
102
|
+
const tagLabel_10: string;
|
|
103
|
+
export { tagLabel_10 as tagLabel };
|
|
104
|
+
}
|
|
105
|
+
namespace STATIC_VAR_COMPENSATOR {
|
|
106
|
+
const name_11: string;
|
|
107
|
+
export { name_11 as name };
|
|
108
|
+
const tagLabel_11: string;
|
|
109
|
+
export { tagLabel_11 as tagLabel };
|
|
110
|
+
}
|
|
111
|
+
namespace HVDC_CONVERTER_STATION {
|
|
112
|
+
const name_12: string;
|
|
113
|
+
export { name_12 as name };
|
|
114
|
+
const tagLabel_12: string;
|
|
115
|
+
export { tagLabel_12 as tagLabel };
|
|
116
|
+
}
|
|
117
|
+
namespace BUSBAR_SECTION {
|
|
118
|
+
const name_13: string;
|
|
119
|
+
export { name_13 as name };
|
|
120
|
+
const tagLabel_13: string;
|
|
121
|
+
export { tagLabel_13 as tagLabel };
|
|
122
|
+
}
|
|
123
|
+
namespace BUS {
|
|
124
|
+
const name_14: string;
|
|
125
|
+
export { name_14 as name };
|
|
126
|
+
const tagLabel_14: string;
|
|
127
|
+
export { tagLabel_14 as tagLabel };
|
|
128
|
+
}
|
|
129
|
+
namespace SWITCH {
|
|
130
|
+
const name_15: string;
|
|
131
|
+
export { name_15 as name };
|
|
132
|
+
const tagLabel_15: string;
|
|
133
|
+
export { tagLabel_15 as tagLabel };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
export function getEquipmentsInfosForSearchBar(equipmentsInfos: any, getNameOrId: any): any;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { LIGHT_THEME } from "../components/TopBar/TopBar.js";
|
|
2
|
+
const TYPE_TAG_MAX_SIZE = "90px";
|
|
3
|
+
const VL_TAG_MAX_SIZE = "100px";
|
|
4
|
+
const equipmentStyles = {
|
|
5
|
+
equipmentOption: {
|
|
6
|
+
display: "flex",
|
|
7
|
+
gap: "20px",
|
|
8
|
+
width: "100%",
|
|
9
|
+
margin: "0px",
|
|
10
|
+
padding: "0px",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
justifyContent: "space-between"
|
|
13
|
+
},
|
|
14
|
+
equipmentTag: (theme) => ({
|
|
15
|
+
borderRadius: "10px",
|
|
16
|
+
padding: "4px",
|
|
17
|
+
fontSize: "x-small",
|
|
18
|
+
textAlign: "center",
|
|
19
|
+
color: theme === LIGHT_THEME ? "inherit" : "black"
|
|
20
|
+
}),
|
|
21
|
+
equipmentTypeTag: {
|
|
22
|
+
minWidth: TYPE_TAG_MAX_SIZE,
|
|
23
|
+
maxWidth: TYPE_TAG_MAX_SIZE,
|
|
24
|
+
background: "lightblue"
|
|
25
|
+
},
|
|
26
|
+
equipmentVlTag: {
|
|
27
|
+
width: VL_TAG_MAX_SIZE,
|
|
28
|
+
minWidth: VL_TAG_MAX_SIZE,
|
|
29
|
+
maxWidth: VL_TAG_MAX_SIZE,
|
|
30
|
+
background: "lightgray",
|
|
31
|
+
fontStyle: "italic"
|
|
32
|
+
},
|
|
33
|
+
result: {
|
|
34
|
+
width: "100%",
|
|
35
|
+
padding: "2px"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const EQUIPMENT_TYPE = {
|
|
39
|
+
SUBSTATION: {
|
|
40
|
+
name: "SUBSTATION",
|
|
41
|
+
tagLabel: "equipment_search/substationTag"
|
|
42
|
+
},
|
|
43
|
+
VOLTAGE_LEVEL: {
|
|
44
|
+
name: "VOLTAGE_LEVEL",
|
|
45
|
+
tagLabel: "equipment_search/voltageLevelTag"
|
|
46
|
+
},
|
|
47
|
+
LINE: {
|
|
48
|
+
name: "LINE",
|
|
49
|
+
tagLabel: "equipment_search/lineTag"
|
|
50
|
+
},
|
|
51
|
+
TWO_WINDINGS_TRANSFORMER: {
|
|
52
|
+
name: "TWO_WINDINGS_TRANSFORMER",
|
|
53
|
+
tagLabel: "equipment_search/2wtTag"
|
|
54
|
+
},
|
|
55
|
+
THREE_WINDINGS_TRANSFORMER: {
|
|
56
|
+
name: "THREE_WINDINGS_TRANSFORMER",
|
|
57
|
+
tagLabel: "equipment_search/3wtTag"
|
|
58
|
+
},
|
|
59
|
+
HVDC_LINE: {
|
|
60
|
+
name: "HVDC_LINE",
|
|
61
|
+
tagLabel: "equipment_search/hvdcLineTag"
|
|
62
|
+
},
|
|
63
|
+
GENERATOR: {
|
|
64
|
+
name: "GENERATOR",
|
|
65
|
+
tagLabel: "equipment_search/generatorTag"
|
|
66
|
+
},
|
|
67
|
+
BATTERY: {
|
|
68
|
+
name: "BATTERY",
|
|
69
|
+
tagLabel: "equipment_search/batteryTag"
|
|
70
|
+
},
|
|
71
|
+
LOAD: {
|
|
72
|
+
name: "LOAD",
|
|
73
|
+
tagLabel: "equipment_search/loadTag"
|
|
74
|
+
},
|
|
75
|
+
SHUNT_COMPENSATOR: {
|
|
76
|
+
name: "SHUNT_COMPENSATOR",
|
|
77
|
+
tagLabel: "equipment_search/shuntTag"
|
|
78
|
+
},
|
|
79
|
+
DANGLING_LINE: {
|
|
80
|
+
name: "DANGLING_LINE",
|
|
81
|
+
tagLabel: "equipment_search/lineTag"
|
|
82
|
+
},
|
|
83
|
+
STATIC_VAR_COMPENSATOR: {
|
|
84
|
+
name: "STATIC_VAR_COMPENSATOR",
|
|
85
|
+
tagLabel: "equipment_search/svcTag"
|
|
86
|
+
},
|
|
87
|
+
HVDC_CONVERTER_STATION: {
|
|
88
|
+
name: "HVDC_CONVERTER_STATION",
|
|
89
|
+
tagLabel: "equipment_search/hvdcStationTag"
|
|
90
|
+
},
|
|
91
|
+
BUSBAR_SECTION: {
|
|
92
|
+
name: "BUSBAR_SECTION",
|
|
93
|
+
tagLabel: "equipment_search/busbarSectionTag"
|
|
94
|
+
},
|
|
95
|
+
BUS: {
|
|
96
|
+
name: "BUS",
|
|
97
|
+
tagLabel: "equipment_search/busTag"
|
|
98
|
+
},
|
|
99
|
+
SWITCH: {
|
|
100
|
+
name: "SWITCH",
|
|
101
|
+
tagLabel: "equipment_search/switchTag"
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const getEquipmentsInfosForSearchBar = (equipmentsInfos, getNameOrId) => {
|
|
105
|
+
return equipmentsInfos.flatMap((e) => {
|
|
106
|
+
let label = getNameOrId(e);
|
|
107
|
+
return e.type === "SUBSTATION" ? [
|
|
108
|
+
{
|
|
109
|
+
label,
|
|
110
|
+
id: e.id,
|
|
111
|
+
key: e.id,
|
|
112
|
+
type: e.type
|
|
113
|
+
}
|
|
114
|
+
] : e.voltageLevels.map((vli) => {
|
|
115
|
+
return {
|
|
116
|
+
label,
|
|
117
|
+
id: e.id,
|
|
118
|
+
key: e.id + "_" + vli.id,
|
|
119
|
+
type: e.type,
|
|
120
|
+
voltageLevelLabel: getNameOrId(vli),
|
|
121
|
+
voltageLevelId: vli.id
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
export {
|
|
127
|
+
EQUIPMENT_TYPE,
|
|
128
|
+
TYPE_TAG_MAX_SIZE,
|
|
129
|
+
VL_TAG_MAX_SIZE,
|
|
130
|
+
equipmentStyles,
|
|
131
|
+
getEquipmentsInfosForSearchBar
|
|
132
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export class UserManagerMock {
|
|
2
|
+
constructor(settings: any);
|
|
3
|
+
settings: any;
|
|
4
|
+
events: Events;
|
|
5
|
+
user: {
|
|
6
|
+
profile: {
|
|
7
|
+
name: string;
|
|
8
|
+
email: string;
|
|
9
|
+
};
|
|
10
|
+
id_token: string;
|
|
11
|
+
session_state: string;
|
|
12
|
+
access_token: string;
|
|
13
|
+
token_type: string;
|
|
14
|
+
scope: string;
|
|
15
|
+
};
|
|
16
|
+
getUser(): Promise<any>;
|
|
17
|
+
signinSilent(): Promise<any>;
|
|
18
|
+
signinSilentCallback(): Promise<never>;
|
|
19
|
+
signinRedirect(): Promise<null>;
|
|
20
|
+
signoutRedirect(): Promise<null>;
|
|
21
|
+
signinRedirectCallback(): Promise<string>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Copyright (c) 2020, RTE (http://www.rte-france.com)
|
|
25
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
26
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
27
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
28
|
+
*/
|
|
29
|
+
declare class Events {
|
|
30
|
+
userLoadedCallbacks: any[];
|
|
31
|
+
addUserLoaded(callback: any): void;
|
|
32
|
+
addSilentRenewError(callback: any): void;
|
|
33
|
+
}
|
|
34
|
+
export {};
|