@gridsuite/commons-ui 0.140.0 → 0.142.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/dist/components/cardErrorBoundary/CardErrorBoundary.d.ts +1 -1
- package/dist/components/csvDownloader/csv-export.d.ts +1 -0
- package/dist/components/customAGGrid/cell-renderers.d.ts +26 -0
- package/dist/components/customAGGrid/cell-renderers.js +199 -0
- package/dist/components/customAGGrid/index.d.ts +1 -0
- package/dist/components/customAGGrid/index.js +9 -0
- package/dist/components/dialogs/customMuiDialog/CustomMuiDialog.js +2 -2
- package/dist/components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.d.ts +1 -1
- package/dist/components/dialogs/modifyElementSelection/ModifyElementSelection.js +3 -0
- package/dist/components/directoryItemSelector/DirectoryItemSelector.js +5 -2
- package/dist/components/directoryItemSelector/utils.js +2 -1
- package/dist/components/dnd-table/dnd-table.type.d.ts +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +15 -0
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +2 -1
- package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +44 -55
- package/dist/components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js +1 -0
- package/dist/components/inputs/reactQueryBuilder/ElementValueEditor.js +1 -1
- package/dist/components/muiTable/OverflowableTableCell.d.ts +3 -0
- package/dist/components/muiTable/OverflowableTableCell.js +10 -0
- package/dist/components/muiTable/OverflowableTableCellWithCheckbox.d.ts +6 -0
- package/dist/components/muiTable/OverflowableTableCellWithCheckbox.js +16 -0
- package/dist/components/muiTable/index.d.ts +8 -0
- package/dist/components/muiTable/index.js +6 -0
- package/dist/components/overflowableText/OverflowableText.js +1 -1
- package/dist/components/parameters/common/parameters-creation-dialog.js +1 -1
- package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +1 -1
- package/dist/components/parameters/network-visualizations/use-network-visualizations-parameters-form.js +1 -1
- package/dist/components/parameters/sensi/use-sensitivity-analysis-parameters.js +1 -1
- package/dist/components/parameters/short-circuit/use-short-circuit-parameters-form.js +1 -1
- package/dist/components/parameters/voltage-init/use-voltage-init-parameters-form.js +1 -1
- package/dist/components/resizablePanels/ResizeHandle.d.ts +8 -0
- package/dist/components/resizablePanels/ResizeHandle.js +32 -0
- package/dist/components/resizablePanels/index.d.ts +7 -0
- package/dist/components/resizablePanels/index.js +4 -0
- package/dist/components/topBar/GridLogo.d.ts +4 -2
- package/dist/components/topBar/GridLogo.js +39 -21
- package/dist/components/topBar/TopBar.d.ts +2 -1
- package/dist/components/topBar/TopBar.js +81 -65
- package/dist/hooks/useIntlRef.d.ts +1 -1
- package/dist/hooks/usePrevious.js +1 -1
- package/dist/index.js +24 -5
- package/dist/services/appsMetadata.d.ts +2 -1
- package/dist/services/appsMetadata.js +9 -2
- package/dist/services/config.d.ts +10 -0
- package/dist/services/config.js +34 -0
- package/dist/services/directory.d.ts +6 -4
- package/dist/services/directory.js +17 -32
- package/dist/services/index.d.ts +5 -4
- package/dist/services/index.js +9 -5
- package/dist/utils/types/metadata.d.ts +14 -0
- package/package.json +8 -7
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import { useCsvExport } from "./components/csvDownloader/use-csv-export.js";
|
|
|
21
21
|
import { CUSTOM_AGGRID_THEME, styles } from "./components/customAGGrid/customAggrid.style.js";
|
|
22
22
|
import { CustomAGGrid } from "./components/customAGGrid/customAggrid.js";
|
|
23
23
|
import { SeparatorCellRenderer } from "./components/customAGGrid/separatorCellRenderer.js";
|
|
24
|
+
import { BooleanCellRenderer, BooleanNullableCellRenderer, ContingencyCellRenderer, DefaultCellRenderer, ErrorCellRenderer, MessageLogCellRenderer, NetworkModificationNameCellRenderer, NumericCellRenderer } from "./components/customAGGrid/cell-renderers.js";
|
|
24
25
|
import { CustomMuiDialog, unscrollableDialogStyles } from "./components/dialogs/customMuiDialog/CustomMuiDialog.js";
|
|
25
26
|
import { DescriptionModificationDialog } from "./components/dialogs/descriptionModificationDialog/DescriptionModificationDialog.js";
|
|
26
27
|
import { ElementSaveDialog } from "./components/dialogs/elementSaveDialog/ElementSaveDialog.js";
|
|
@@ -173,6 +174,9 @@ import { SensitivityAnalysisParametersDialog } from "./components/parameters/sen
|
|
|
173
174
|
import { COLUMNS_DEFINITIONS_HVDCS, COLUMNS_DEFINITIONS_INJECTIONS, COLUMNS_DEFINITIONS_INJECTIONS_SET, COLUMNS_DEFINITIONS_NODES, COLUMNS_DEFINITIONS_PSTS, EQUIPMENTS_IN_VOLTAGE_REGULATION_TYPES, HVDC_EQUIPMENT_TYPES, INJECTIONS_EQUIPMENT_TYPES, INJECTION_DISTRIBUTION_TYPES, MONITORED_BRANCHES_EQUIPMENT_TYPES, MONITORED_VOLTAGE_LEVELS_EQUIPMENT_TYPES, PSTS_EQUIPMENT_TYPES, SENSITIVITY_TYPES, SensiBranchesTabValues, SensiHvdcs, SensiInjection, SensiInjectionsSet, SensiNodes, SensiPsts, SensiTabValues } from "./components/parameters/sensi/columns-definitions.js";
|
|
174
175
|
import { SensitivityTable } from "./components/parameters/sensi/sensitivity-table.js";
|
|
175
176
|
import { CustomMenuItem, CustomNestedMenuItem } from "./components/menus/custom-nested-menu.js";
|
|
177
|
+
import { OverflowableTableCell } from "./components/muiTable/OverflowableTableCell.js";
|
|
178
|
+
import { OverflowableTableCellWithCheckbox } from "./components/muiTable/OverflowableTableCellWithCheckbox.js";
|
|
179
|
+
import { ResizeHandle } from "./components/resizablePanels/ResizeHandle.js";
|
|
176
180
|
import { useStateBoolean } from "./hooks/customStates/useStateBoolean.js";
|
|
177
181
|
import { useStateNumber } from "./hooks/customStates/useStateNumber.js";
|
|
178
182
|
import { useModificationLabelComputer } from "./hooks/useModificationLabelComputer.js";
|
|
@@ -189,17 +193,18 @@ import { OptionalServicesStatus, useParametersBackend } from "./hooks/use-parame
|
|
|
189
193
|
import { useCreateRowDataSensi } from "./hooks/use-create-row-data-sensi.js";
|
|
190
194
|
import { LOGOUT_ERROR, RESET_AUTHENTICATION_ROUTER_ERROR, SHOW_AUTH_INFO_LOGIN, SIGNIN_CALLBACK_ERROR, UNAUTHORIZED_USER_INFO, USER, USER_VALIDATION_ERROR, resetAuthenticationRouterError, setLoggedUser, setLogoutError, setShowAuthenticationRouterLogin, setSignInCallbackError, setUnauthorizedUserInfo, setUserValidationError } from "./redux/actions/authActions.js";
|
|
191
195
|
import { getUserToken, setCommonStore } from "./redux/commonStore.js";
|
|
192
|
-
import {
|
|
196
|
+
import { fetchAppsMetadata, fetchBaseVoltages, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./services/appsMetadata.js";
|
|
197
|
+
import { fetchConfigParameter, fetchConfigParameters, getAppName, updateConfigParameter } from "./services/config.js";
|
|
198
|
+
import { PermissionType, elementAlreadyExists, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders, hasElementPermission } from "./services/directory.js";
|
|
193
199
|
import { createFilter, createParameter, fetchElementsInfos, saveFilter, updateParameter } from "./services/explore.js";
|
|
194
|
-
import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./services/appsMetadata.js";
|
|
195
|
-
import { elementAlreadyExists, fetchConfigParameter, fetchConfigParameters, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders, getAppName, updateConfigParameter } from "./services/directory.js";
|
|
196
200
|
import { PREFIX_STUDY_QUERIES, fetchLoadFlowParameters, getDefaultLoadFlowProvider, getLoadFlowDefaultLimitReductions, getLoadFlowProviders, getLoadFlowSpecificParametersDescription, getLoadFlowUrl, setLoadFlowParameters } from "./services/loadflow.js";
|
|
201
|
+
import { getPccMinStudyParameters, updatePccMinParameters } from "./services/pcc-min.js";
|
|
202
|
+
import { fetchDefaultSecurityAnalysisProvider, fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSecurityAnalysisDefaultLimitReductions, getSecurityAnalysisParameters, getStudyUrl, safeEncodeURIComponent, setSecurityAnalysisParameters, updateSecurityAnalysisParameters, updateSecurityAnalysisProvider } from "./services/security-analysis.js";
|
|
197
203
|
import { exportFilter, getAvailableComponentLibraries, getStudyNetworkVisualizationsParameters, getStudyShortCircuitParameters, invalidateStudyShortCircuitStatus, setStudyNetworkVisualizationParameters, setStudyShortCircuitParameters, updateVoltageInitParameters } from "./services/study.js";
|
|
198
204
|
import { getNetworkVisualizationsParameters } from "./services/study-config.js";
|
|
199
205
|
import { fetchCurrentAnnouncement, fetchUserDetails } from "./services/userAdmin.js";
|
|
206
|
+
import { NetworkTimeoutError, backendFetch, backendFetchFile, backendFetchJson, backendFetchText, getRequestParamFromList } from "./services/utils.js";
|
|
200
207
|
import { getVoltageInitParameters, getVoltageInitUrl } from "./services/voltage-init.js";
|
|
201
|
-
import { getPccMinStudyParameters, updatePccMinParameters } from "./services/pcc-min.js";
|
|
202
|
-
import { fetchDefaultSecurityAnalysisProvider, fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSecurityAnalysisDefaultLimitReductions, getSecurityAnalysisParameters, getStudyUrl, safeEncodeURIComponent, setSecurityAnalysisParameters, updateSecurityAnalysisParameters, updateSecurityAnalysisProvider } from "./services/security-analysis.js";
|
|
203
208
|
import { equalsArray } from "./utils/algos.js";
|
|
204
209
|
import { FetchStatus } from "./utils/constants/fetchStatus.js";
|
|
205
210
|
import { FieldConstants } from "./utils/constants/fieldConstants.js";
|
|
@@ -306,7 +311,9 @@ export {
|
|
|
306
311
|
BALANCE_TYPE,
|
|
307
312
|
BASE_EQUIPMENTS,
|
|
308
313
|
Battery,
|
|
314
|
+
BooleanCellRenderer,
|
|
309
315
|
BooleanInput,
|
|
316
|
+
BooleanNullableCellRenderer,
|
|
310
317
|
BottomRightButtons,
|
|
311
318
|
BusBar,
|
|
312
319
|
CENTER_LABEL,
|
|
@@ -334,6 +341,7 @@ export {
|
|
|
334
341
|
CombinatorSelector,
|
|
335
342
|
CombinatorType,
|
|
336
343
|
ComputingType,
|
|
344
|
+
ContingencyCellRenderer,
|
|
337
345
|
CountriesInput,
|
|
338
346
|
CountryValueEditor,
|
|
339
347
|
CreateParameterDialog,
|
|
@@ -368,6 +376,7 @@ export {
|
|
|
368
376
|
DISTRIBUTION_KEY,
|
|
369
377
|
DanglingLine,
|
|
370
378
|
DataType,
|
|
379
|
+
DefaultCellRenderer,
|
|
371
380
|
DescriptionField,
|
|
372
381
|
DescriptionModificationDialog,
|
|
373
382
|
DevModeBanner,
|
|
@@ -393,6 +402,7 @@ export {
|
|
|
393
402
|
EquipmentItem,
|
|
394
403
|
EquipmentType,
|
|
395
404
|
EquipmentsSelectionType,
|
|
405
|
+
ErrorCellRenderer,
|
|
396
406
|
ErrorInLogoutAlert,
|
|
397
407
|
ErrorInUserValidationAlert,
|
|
398
408
|
ErrorInput,
|
|
@@ -490,6 +500,7 @@ export {
|
|
|
490
500
|
MODIFICATION_TYPES,
|
|
491
501
|
MONITORED_BRANCHES_EQUIPMENT_TYPES,
|
|
492
502
|
MONITORED_VOLTAGE_LEVELS_EQUIPMENT_TYPES,
|
|
503
|
+
MessageLogCellRenderer,
|
|
493
504
|
MidFormError,
|
|
494
505
|
ModificationType,
|
|
495
506
|
ModifyElementSelection,
|
|
@@ -501,6 +512,7 @@ export {
|
|
|
501
512
|
NAME,
|
|
502
513
|
NO_ITEM_SELECTION_FOR_COPY,
|
|
503
514
|
NadPositionsGenerationMode,
|
|
515
|
+
NetworkModificationNameCellRenderer,
|
|
504
516
|
NetworkTimeoutError,
|
|
505
517
|
NetworkVisualizationParametersInline,
|
|
506
518
|
NetworkVisualizationTabValues,
|
|
@@ -508,6 +520,7 @@ export {
|
|
|
508
520
|
NotificationsContext,
|
|
509
521
|
NotificationsProvider,
|
|
510
522
|
NotificationsUrlKeys,
|
|
523
|
+
NumericCellRenderer,
|
|
511
524
|
NumericEditor,
|
|
512
525
|
OHM,
|
|
513
526
|
OPERATOR_OPTIONS,
|
|
@@ -516,6 +529,8 @@ export {
|
|
|
516
529
|
OptionalServicesStatus,
|
|
517
530
|
OverflowableChip,
|
|
518
531
|
OverflowableChipWithHelperText,
|
|
532
|
+
OverflowableTableCell,
|
|
533
|
+
OverflowableTableCellWithCheckbox,
|
|
519
534
|
OverflowableText,
|
|
520
535
|
PARAM_CENTER_LABEL,
|
|
521
536
|
PARAM_COMPONENT_LIBRARY,
|
|
@@ -555,6 +570,7 @@ export {
|
|
|
555
570
|
ParameterSwitch,
|
|
556
571
|
ParameterType,
|
|
557
572
|
PccMinParametersInLine,
|
|
573
|
+
PermissionType,
|
|
558
574
|
PhotoLibraryIcon,
|
|
559
575
|
PopupConfirmationDialog,
|
|
560
576
|
PredefinedParameters,
|
|
@@ -574,6 +590,7 @@ export {
|
|
|
574
590
|
RawReadOnlyInput,
|
|
575
591
|
ReactivePowerAdornment,
|
|
576
592
|
RemoveButton,
|
|
593
|
+
ResizeHandle,
|
|
577
594
|
RuleValueEditor,
|
|
578
595
|
SEARCH_EQUIPMENTS,
|
|
579
596
|
SELECTED,
|
|
@@ -725,6 +742,7 @@ export {
|
|
|
725
742
|
exportParamsFr,
|
|
726
743
|
extractDefault,
|
|
727
744
|
fetchAppsMetadata,
|
|
745
|
+
fetchBaseVoltages,
|
|
728
746
|
fetchConfigParameter,
|
|
729
747
|
fetchConfigParameters,
|
|
730
748
|
fetchCurrentAnnouncement,
|
|
@@ -786,6 +804,7 @@ export {
|
|
|
786
804
|
gridItem,
|
|
787
805
|
handleSigninCallback,
|
|
788
806
|
handleSilentRenewCallback,
|
|
807
|
+
hasElementPermission,
|
|
789
808
|
identity,
|
|
790
809
|
importExpertRules,
|
|
791
810
|
importParamsEn,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Metadata, StudyMetadata } from '../utils';
|
|
1
|
+
import { BaseVoltage, Metadata, StudyMetadata } from '../utils';
|
|
2
2
|
export type UrlString = `${string}://${string}` | `/${string}` | `./${string}`;
|
|
3
3
|
export type Url = UrlString | URL;
|
|
4
4
|
export type Env = {
|
|
@@ -10,6 +10,7 @@ export declare function fetchEnv(): Promise<Env>;
|
|
|
10
10
|
export declare function fetchAppsMetadata(): Promise<Metadata[]>;
|
|
11
11
|
export declare function isStudyMetadata(metadata: Metadata): metadata is StudyMetadata;
|
|
12
12
|
export declare function fetchStudyMetadata(): Promise<StudyMetadata>;
|
|
13
|
+
export declare function fetchBaseVoltages(): Promise<BaseVoltage[]>;
|
|
13
14
|
export declare function fetchFavoriteAndDefaultCountries(): Promise<{
|
|
14
15
|
favoriteCountries: string[];
|
|
15
16
|
defaultCountry?: string;
|
|
@@ -12,13 +12,19 @@ function isStudyMetadata(metadata) {
|
|
|
12
12
|
}
|
|
13
13
|
async function fetchStudyMetadata() {
|
|
14
14
|
console.info(`Fetching study metadata...`);
|
|
15
|
-
const studyMetadata = (await fetchAppsMetadata()).
|
|
15
|
+
const studyMetadata = (await fetchAppsMetadata()).find(isStudyMetadata);
|
|
16
16
|
if (!studyMetadata) {
|
|
17
17
|
throw new Error("Study entry could not be found in metadata");
|
|
18
18
|
} else {
|
|
19
|
-
return studyMetadata
|
|
19
|
+
return studyMetadata;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
async function fetchBaseVoltages() {
|
|
23
|
+
console.info(`Fetching apps' base voltages...`);
|
|
24
|
+
const env = await fetchEnv();
|
|
25
|
+
const res = await fetch(`${env.appsMetadataServerUrl}/apps-metadata-base-voltages.json`);
|
|
26
|
+
return res.json();
|
|
27
|
+
}
|
|
22
28
|
async function fetchFavoriteAndDefaultCountries() {
|
|
23
29
|
const { favoriteCountries = [], defaultCountry } = await fetchStudyMetadata();
|
|
24
30
|
return {
|
|
@@ -32,6 +38,7 @@ const fetchDefaultCountry = async () => {
|
|
|
32
38
|
};
|
|
33
39
|
export {
|
|
34
40
|
fetchAppsMetadata,
|
|
41
|
+
fetchBaseVoltages,
|
|
35
42
|
fetchDefaultCountry,
|
|
36
43
|
fetchEnv,
|
|
37
44
|
fetchFavoriteAndDefaultCountries,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024, 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
|
+
export declare function getAppName(appName: string, name: string): string;
|
|
8
|
+
export declare function updateConfigParameter(appName: string, name: string, value: string): Promise<Response>;
|
|
9
|
+
export declare function fetchConfigParameters(appName: string): Promise<any>;
|
|
10
|
+
export declare function fetchConfigParameter(appName: string, name: string): Promise<any>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { backendFetch, backendFetchJson } from "./utils.js";
|
|
2
|
+
import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES } from "../utils/constants/configConstants.js";
|
|
3
|
+
import "../utils/conversionUtils.js";
|
|
4
|
+
import "react/jsx-runtime";
|
|
5
|
+
import "@mui/icons-material";
|
|
6
|
+
import "../utils/types/equipmentType.js";
|
|
7
|
+
import "../utils/yupConfig.js";
|
|
8
|
+
const PREFIX_CONFIG_QUERIES = `${"api/gateway"}/config`;
|
|
9
|
+
function getAppName(appName, name) {
|
|
10
|
+
return COMMON_CONFIG_PARAMS_NAMES.has(name) ? COMMON_APP_NAME : appName;
|
|
11
|
+
}
|
|
12
|
+
function updateConfigParameter(appName, name, value) {
|
|
13
|
+
const targetAppName = getAppName(appName, name);
|
|
14
|
+
console.info(`Updating config parameter '${name}=${value}' for app '${targetAppName}'`);
|
|
15
|
+
const updateParams = `${PREFIX_CONFIG_QUERIES}/v1/applications/${targetAppName}/parameters/${name}?value=${encodeURIComponent(value)}`;
|
|
16
|
+
return backendFetch(updateParams, { method: "put" });
|
|
17
|
+
}
|
|
18
|
+
function fetchConfigParameters(appName) {
|
|
19
|
+
console.info(`Fetching UI configuration params for app : ${appName}`);
|
|
20
|
+
const fetchParams = `${PREFIX_CONFIG_QUERIES}/v1/applications/${appName}/parameters`;
|
|
21
|
+
return backendFetchJson(fetchParams);
|
|
22
|
+
}
|
|
23
|
+
function fetchConfigParameter(appName, name) {
|
|
24
|
+
const targetAppName = getAppName(appName, name);
|
|
25
|
+
console.info(`Fetching UI config parameter '${name}' for app '${targetAppName}'`);
|
|
26
|
+
const fetchParams = `${PREFIX_CONFIG_QUERIES}/v1/applications/${targetAppName}/parameters/${name}`;
|
|
27
|
+
return backendFetchJson(fetchParams);
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
fetchConfigParameter,
|
|
31
|
+
fetchConfigParameters,
|
|
32
|
+
getAppName,
|
|
33
|
+
updateConfigParameter
|
|
34
|
+
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { UUID } from 'node:crypto';
|
|
2
2
|
import { ElementAttributes } from '../utils';
|
|
3
|
-
export declare function getAppName(appName: string, name: string): string;
|
|
4
|
-
export declare function updateConfigParameter(appName: string, name: string, value: string): Promise<Response>;
|
|
5
|
-
export declare function fetchConfigParameters(appName: string): Promise<any>;
|
|
6
|
-
export declare function fetchConfigParameter(appName: string, name: string): Promise<any>;
|
|
7
3
|
export declare function fetchRootFolders(types: string[]): Promise<ElementAttributes[]>;
|
|
8
4
|
export declare function fetchDirectoryContent(directoryUuid: UUID, types?: string[]): Promise<ElementAttributes[]>;
|
|
9
5
|
export declare function fetchDirectoryElementPath(elementUuid: UUID): Promise<ElementAttributes[]>;
|
|
10
6
|
export declare function elementAlreadyExists(directoryUuid: UUID, elementName: string, type: string): Promise<boolean>;
|
|
7
|
+
export declare enum PermissionType {
|
|
8
|
+
READ = "READ",
|
|
9
|
+
WRITE = "WRITE",
|
|
10
|
+
MANAGE = "MANAGE"
|
|
11
|
+
}
|
|
12
|
+
export declare function hasElementPermission(elementUuid: UUID, permission: PermissionType): Promise<boolean>;
|
|
@@ -1,32 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { COMMON_APP_NAME, COMMON_CONFIG_PARAMS_NAMES } from "../utils/constants/configConstants.js";
|
|
3
|
-
import "../utils/conversionUtils.js";
|
|
4
|
-
import "react/jsx-runtime";
|
|
5
|
-
import "@mui/icons-material";
|
|
6
|
-
import "../utils/types/equipmentType.js";
|
|
7
|
-
import "../utils/yupConfig.js";
|
|
1
|
+
import { getRequestParamFromList, backendFetchJson, backendFetch } from "./utils.js";
|
|
8
2
|
const PREFIX_EXPLORE_SERVER_QUERIES = `${"api/gateway"}/explore`;
|
|
9
|
-
const PREFIX_CONFIG_QUERIES = `${"api/gateway"}/config`;
|
|
10
|
-
function getAppName(appName, name) {
|
|
11
|
-
return COMMON_CONFIG_PARAMS_NAMES.has(name) ? COMMON_APP_NAME : appName;
|
|
12
|
-
}
|
|
13
|
-
function updateConfigParameter(appName, name, value) {
|
|
14
|
-
const targetAppName = getAppName(appName, name);
|
|
15
|
-
console.info(`Updating config parameter '${name}=${value}' for app '${targetAppName}'`);
|
|
16
|
-
const updateParams = `${PREFIX_CONFIG_QUERIES}/v1/applications/${targetAppName}/parameters/${name}?value=${encodeURIComponent(value)}`;
|
|
17
|
-
return backendFetch(updateParams, { method: "put" });
|
|
18
|
-
}
|
|
19
|
-
function fetchConfigParameters(appName) {
|
|
20
|
-
console.info(`Fetching UI configuration params for app : ${appName}`);
|
|
21
|
-
const fetchParams = `${PREFIX_CONFIG_QUERIES}/v1/applications/${appName}/parameters`;
|
|
22
|
-
return backendFetchJson(fetchParams);
|
|
23
|
-
}
|
|
24
|
-
function fetchConfigParameter(appName, name) {
|
|
25
|
-
const targetAppName = getAppName(appName, name);
|
|
26
|
-
console.info(`Fetching UI config parameter '${name}' for app '${targetAppName}'`);
|
|
27
|
-
const fetchParams = `${PREFIX_CONFIG_QUERIES}/v1/applications/${targetAppName}/parameters/${name}`;
|
|
28
|
-
return backendFetchJson(fetchParams);
|
|
29
|
-
}
|
|
30
3
|
function fetchRootFolders(types) {
|
|
31
4
|
console.info("Fetching Root Directories");
|
|
32
5
|
const urlSearchParams = getRequestParamFromList("elementTypes", types).toString();
|
|
@@ -65,13 +38,25 @@ function elementAlreadyExists(directoryUuid, elementName, type) {
|
|
|
65
38
|
// HTTP 204 : No-content
|
|
66
39
|
);
|
|
67
40
|
}
|
|
41
|
+
var PermissionType = /* @__PURE__ */ ((PermissionType2) => {
|
|
42
|
+
PermissionType2["READ"] = "READ";
|
|
43
|
+
PermissionType2["WRITE"] = "WRITE";
|
|
44
|
+
PermissionType2["MANAGE"] = "MANAGE";
|
|
45
|
+
return PermissionType2;
|
|
46
|
+
})(PermissionType || {});
|
|
47
|
+
function hasElementPermission(elementUuid, permission) {
|
|
48
|
+
const url = `${PREFIX_EXPLORE_SERVER_QUERIES}/v1/explore/elements/${elementUuid}?permission=${permission}`;
|
|
49
|
+
console.debug(url);
|
|
50
|
+
return backendFetch(url, { method: "head" }).then((response) => response.status === 200).catch(() => {
|
|
51
|
+
console.info(`${permission} permission denied for element or directory ${elementUuid}`);
|
|
52
|
+
return false;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
68
55
|
export {
|
|
56
|
+
PermissionType,
|
|
69
57
|
elementAlreadyExists,
|
|
70
|
-
fetchConfigParameter,
|
|
71
|
-
fetchConfigParameters,
|
|
72
58
|
fetchDirectoryContent,
|
|
73
59
|
fetchDirectoryElementPath,
|
|
74
60
|
fetchRootFolders,
|
|
75
|
-
|
|
76
|
-
updateConfigParameter
|
|
61
|
+
hasElementPermission
|
|
77
62
|
};
|
package/dist/services/index.d.ts
CHANGED
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
5
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
6
|
*/
|
|
7
|
-
export * from './utils';
|
|
8
|
-
export * from './explore';
|
|
9
7
|
export * from './appsMetadata';
|
|
8
|
+
export * from './config';
|
|
10
9
|
export * from './directory';
|
|
10
|
+
export * from './explore';
|
|
11
11
|
export * from './loadflow';
|
|
12
|
+
export * from './pcc-min';
|
|
13
|
+
export * from './security-analysis';
|
|
12
14
|
export * from './study';
|
|
13
15
|
export * from './study-config';
|
|
14
16
|
export * from './userAdmin';
|
|
17
|
+
export * from './utils';
|
|
15
18
|
export * from './voltage-init';
|
|
16
|
-
export * from './pcc-min';
|
|
17
|
-
export * from './security-analysis';
|
package/dist/services/index.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fetchAppsMetadata, fetchBaseVoltages, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./appsMetadata.js";
|
|
2
|
+
import { fetchConfigParameter, fetchConfigParameters, getAppName, updateConfigParameter } from "./config.js";
|
|
3
|
+
import { PermissionType, elementAlreadyExists, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders, hasElementPermission } from "./directory.js";
|
|
2
4
|
import { createFilter, createParameter, fetchElementsInfos, saveFilter, updateParameter } from "./explore.js";
|
|
3
|
-
import { fetchAppsMetadata, fetchDefaultCountry, fetchEnv, fetchFavoriteAndDefaultCountries, fetchStudyMetadata, isStudyMetadata } from "./appsMetadata.js";
|
|
4
|
-
import { elementAlreadyExists, fetchConfigParameter, fetchConfigParameters, fetchDirectoryContent, fetchDirectoryElementPath, fetchRootFolders, getAppName, updateConfigParameter } from "./directory.js";
|
|
5
5
|
import { PREFIX_STUDY_QUERIES, fetchLoadFlowParameters, getDefaultLoadFlowProvider, getLoadFlowDefaultLimitReductions, getLoadFlowProviders, getLoadFlowSpecificParametersDescription, getLoadFlowUrl, setLoadFlowParameters } from "./loadflow.js";
|
|
6
|
+
import { getPccMinStudyParameters, updatePccMinParameters } from "./pcc-min.js";
|
|
7
|
+
import { fetchDefaultSecurityAnalysisProvider, fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSecurityAnalysisDefaultLimitReductions, getSecurityAnalysisParameters, getStudyUrl, safeEncodeURIComponent, setSecurityAnalysisParameters, updateSecurityAnalysisParameters, updateSecurityAnalysisProvider } from "./security-analysis.js";
|
|
6
8
|
import { exportFilter, getAvailableComponentLibraries, getStudyNetworkVisualizationsParameters, getStudyShortCircuitParameters, invalidateStudyShortCircuitStatus, setStudyNetworkVisualizationParameters, setStudyShortCircuitParameters, updateVoltageInitParameters } from "./study.js";
|
|
7
9
|
import { getNetworkVisualizationsParameters } from "./study-config.js";
|
|
8
10
|
import { fetchCurrentAnnouncement, fetchUserDetails } from "./userAdmin.js";
|
|
11
|
+
import { NetworkTimeoutError, backendFetch, backendFetchFile, backendFetchJson, backendFetchText, getRequestParamFromList } from "./utils.js";
|
|
9
12
|
import { getVoltageInitParameters, getVoltageInitUrl } from "./voltage-init.js";
|
|
10
|
-
import { getPccMinStudyParameters, updatePccMinParameters } from "./pcc-min.js";
|
|
11
|
-
import { fetchDefaultSecurityAnalysisProvider, fetchSecurityAnalysisParameters, fetchSecurityAnalysisProviders, getSecurityAnalysisDefaultLimitReductions, getSecurityAnalysisParameters, getStudyUrl, safeEncodeURIComponent, setSecurityAnalysisParameters, updateSecurityAnalysisParameters, updateSecurityAnalysisProvider } from "./security-analysis.js";
|
|
12
13
|
export {
|
|
13
14
|
NetworkTimeoutError,
|
|
14
15
|
PREFIX_STUDY_QUERIES,
|
|
16
|
+
PermissionType,
|
|
15
17
|
backendFetch,
|
|
16
18
|
backendFetchFile,
|
|
17
19
|
backendFetchJson,
|
|
@@ -21,6 +23,7 @@ export {
|
|
|
21
23
|
elementAlreadyExists,
|
|
22
24
|
exportFilter,
|
|
23
25
|
fetchAppsMetadata,
|
|
26
|
+
fetchBaseVoltages,
|
|
24
27
|
fetchConfigParameter,
|
|
25
28
|
fetchConfigParameters,
|
|
26
29
|
fetchCurrentAnnouncement,
|
|
@@ -54,6 +57,7 @@ export {
|
|
|
54
57
|
getStudyUrl,
|
|
55
58
|
getVoltageInitParameters,
|
|
56
59
|
getVoltageInitUrl,
|
|
60
|
+
hasElementPermission,
|
|
57
61
|
invalidateStudyShortCircuitStatus,
|
|
58
62
|
isStudyMetadata,
|
|
59
63
|
safeEncodeURIComponent,
|
|
@@ -23,4 +23,18 @@ export type StudyMetadata = Metadata & {
|
|
|
23
23
|
favoriteCountries?: string[];
|
|
24
24
|
substationPropertiesGlobalFilters?: Map<string, string[]>;
|
|
25
25
|
};
|
|
26
|
+
type ThemeColors = Record<string, string>;
|
|
27
|
+
type SldAndNadColors = {
|
|
28
|
+
darkThemeColors: ThemeColors;
|
|
29
|
+
lightThemeColors: ThemeColors;
|
|
30
|
+
};
|
|
31
|
+
export type BaseVoltageConfig = {
|
|
32
|
+
name: string;
|
|
33
|
+
minValue: number;
|
|
34
|
+
maxValue: number;
|
|
35
|
+
};
|
|
36
|
+
export type BaseVoltage = BaseVoltageConfig & {
|
|
37
|
+
networkMapColor: string;
|
|
38
|
+
sldAndNadColors: SldAndNadColors;
|
|
39
|
+
};
|
|
26
40
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridsuite/commons-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.142.0",
|
|
4
4
|
"description": "common react components for gridsuite applications",
|
|
5
5
|
"author": "gridsuite team",
|
|
6
6
|
"homepage": "https://github.com/gridsuite",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"react-dnd": "^16.0.1",
|
|
54
54
|
"react-dnd-html5-backend": "^16.0.1",
|
|
55
55
|
"react-querybuilder": "^8.11.0",
|
|
56
|
+
"react-resizable-panels": "^3.0.6",
|
|
56
57
|
"reconnecting-websocket": "^4.4.0",
|
|
57
58
|
"type-fest": "^4.41.0",
|
|
58
59
|
"uuid": "^13.0.0"
|
|
@@ -68,8 +69,8 @@
|
|
|
68
69
|
"ag-grid-community": "^33.0.3",
|
|
69
70
|
"ag-grid-react": "^33.0.4",
|
|
70
71
|
"notistack": "^3.0.2",
|
|
71
|
-
"react": "^
|
|
72
|
-
"react-dom": "^
|
|
72
|
+
"react": "^19.2.0",
|
|
73
|
+
"react-dom": "^19.2.0",
|
|
73
74
|
"react-hook-form": "^7.54.2",
|
|
74
75
|
"react-intl": "^7.1.6",
|
|
75
76
|
"react-papaparse": "^4.4.0",
|
|
@@ -103,8 +104,8 @@
|
|
|
103
104
|
"@types/localized-countries": "^2.0.3",
|
|
104
105
|
"@types/node": "^22.18.1",
|
|
105
106
|
"@types/prop-types": "^15.7.15",
|
|
106
|
-
"@types/react": "^
|
|
107
|
-
"@types/react-dom": "^
|
|
107
|
+
"@types/react": "^19.2.2",
|
|
108
|
+
"@types/react-dom": "^19.2.1",
|
|
108
109
|
"@types/react-resizable": "^3.0.8",
|
|
109
110
|
"@vitejs/plugin-react": "^5.0.4",
|
|
110
111
|
"ag-grid-community": "^33.1.0",
|
|
@@ -129,8 +130,8 @@
|
|
|
129
130
|
"notistack": "^3.0.2",
|
|
130
131
|
"prettier": "^3.6.2",
|
|
131
132
|
"prettier-plugin-properties": "^0.3.0",
|
|
132
|
-
"react": "^
|
|
133
|
-
"react-dom": "^
|
|
133
|
+
"react": "^19.2.0",
|
|
134
|
+
"react-dom": "^19.2.0",
|
|
134
135
|
"react-hook-form": "^7.62.0",
|
|
135
136
|
"react-intl": "^7.1.11",
|
|
136
137
|
"react-papaparse": "^4.4.0",
|