@gridsuite/commons-ui 0.262.0 → 0.263.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.
@@ -8,7 +8,7 @@ export interface BatteryCreationDto {
8
8
  maxP: number;
9
9
  reactiveCapabilityCurve?: boolean | null;
10
10
  targetP: number | null;
11
- targetQ: number | null;
11
+ targetQ: number;
12
12
  targetV: number | null;
13
13
  voltageRegulationOn: boolean | null;
14
14
  regulatingTerminalId: string | null;
@@ -22,7 +22,7 @@ export declare const batteryCreationFormSchema: import('yup').ObjectSchema<NonNu
22
22
  name?: string | null | undefined;
23
23
  type?: string | undefined;
24
24
  } | null;
25
- reactivePowerSetpoint: number | null | undefined;
25
+ reactivePowerSetpoint: number;
26
26
  activePowerSetpoint: number | undefined;
27
27
  equipmentID: string;
28
28
  equipmentName: string | null | undefined;
@@ -62,7 +62,7 @@ import "../../../../components/composite/report/report-viewer/log-table/log-tabl
62
62
  import "react-window";
63
63
  import "../../../../components/composite/report/report-treeview/treeview-item.js";
64
64
  import "../../../../components/composite/report/report-viewer/context/report-viewer-context.js";
65
- import { getSetPointsSchema, getSetPointsEmptyFormData } from "../../common/setpoints/setPoints.utils.js";
65
+ import { getActivePowerSetPointSchema, getSetPointsEmptyFormData } from "../../common/setpoints/setPoints.utils.js";
66
66
  import { getActivePowerControlSchema, getActivePowerControlEmptyFormData } from "../../common/activePowerControl/activePowerControlForm.utils.js";
67
67
  import { getShortCircuitFormSchema, getShortCircuitEmptyFormData, getShortCircuitFormData } from "../../common/shortCircuit/shortCircuitForm.utils.js";
68
68
  import { getReactiveLimitsValidationSchema, getReactiveLimitsEmptyFormDataProps, getReactiveLimitsFormDataProps } from "../../common/reactiveLimits/reactiveLimits.utils.js";
@@ -91,7 +91,9 @@ const batteryCreationFormSchema = object().shape({
91
91
  }),
92
92
  [FieldConstants.CONNECTIVITY]: getConnectivityWithPositionSchema(false),
93
93
  [FieldConstants.REACTIVE_LIMITS]: getReactiveLimitsValidationSchema(),
94
- ...getSetPointsSchema(),
94
+ ...getActivePowerSetPointSchema(),
95
+ // override for batteries
96
+ [FieldConstants.REACTIVE_POWER_SET_POINT]: number().nullable().required(),
95
97
  ...getVoltageRegulationSchema(),
96
98
  ...getActivePowerControlSchema(),
97
99
  ...getShortCircuitFormSchema()
@@ -1,15 +1,15 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import { Alert, CircularProgress } from "@mui/material";
2
+ import { Alert, CircularProgress, Box, IconButton, Collapse } from "@mui/material";
3
3
  import { forwardRef, useState, useImperativeHandle, useCallback, useEffect, useMemo } from "react";
4
4
  import { useIntl, FormattedMessage } from "react-intl";
5
5
  import { useFormContext } from "react-hook-form";
6
+ import { ExpandLess, ExpandMore } from "@mui/icons-material";
6
7
  import { ACTIVATED, ID } from "../parameter-table-field/constants.js";
7
8
  import { ParameterTableField } from "../parameter-table-field/parameter-table-field.js";
8
9
  import { COLUMNS_DEFINITIONS_CONTINGENCY_LISTS_INFOS, isValidContingencyRow } from "./columns-definitions.js";
9
10
  import "../../../../utils/conversionUtils.js";
10
11
  import { snackWithFallback } from "../../../../utils/error.js";
11
12
  import "../../../../utils/types/equipmentType.js";
12
- import "@mui/icons-material";
13
13
  import { DEFAULT_TIMEOUT_MS, IGNORE_SIGNAL } from "../../../../services/utils.js";
14
14
  import "localized-countries";
15
15
  import "localized-countries/data/fr";
@@ -17,6 +17,7 @@ import "localized-countries/data/en";
17
17
  import { useSnackMessage } from "../../../../hooks/useSnackMessage.js";
18
18
  import { CONTINGENCY_LISTS } from "../constants.js";
19
19
  import { mapSimulatedContingencyList } from "./utils.js";
20
+ import NotFoundElementsTable from "./not-found-elements-table.js";
20
21
  const styles = {
21
22
  alert: { color: "text.primary", paddingTop: 0, paddingBottom: 0 },
22
23
  error: { color: "error.main", paddingTop: 0, paddingBottom: 0 }
@@ -30,6 +31,7 @@ function ContingencyTableWithApiRef({ name, showContingencyCount = false, fetchC
30
31
  null
31
32
  );
32
33
  const [contingencyCountRefreshTrigger, setContingencyCountRefreshTrigger] = useState(0);
34
+ const [expanded, setExpanded] = useState(false);
33
35
  useImperativeHandle(
34
36
  apiRef,
35
37
  () => ({
@@ -95,6 +97,11 @@ function ContingencyTableWithApiRef({ name, showContingencyCount = false, fetchC
95
97
  name,
96
98
  contingencyCountRefreshTrigger
97
99
  ]);
100
+ useEffect(() => {
101
+ if (simulatedContingencyCount === null || simulatedContingencyCount.success && simulatedContingencyCount.notFoundElements === 0) {
102
+ setExpanded(false);
103
+ }
104
+ }, [simulatedContingencyCount]);
98
105
  const renderContingencyCount = () => {
99
106
  if (!isBuiltCurrentNode) {
100
107
  return /* @__PURE__ */ jsx(Alert, { variant: "standard", severity: "warning", sx: styles.alert, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "contingencyCountImpossibleOnUnbuiltNode" }) });
@@ -105,16 +112,28 @@ function ContingencyTableWithApiRef({ name, showContingencyCount = false, fetchC
105
112
  if (simulatedContingencyCount === null || simulatedContingencyCount.success && simulatedContingencyCount.nbContingencies === 0) {
106
113
  return /* @__PURE__ */ jsx(Alert, { variant: "standard", severity: "error", sx: styles.alert, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "noContingency" }) });
107
114
  }
108
- return simulatedContingencyCount.success ? /* @__PURE__ */ jsx(Alert, { variant: "standard", icon: false, severity: "info", sx: styles.alert, children: /* @__PURE__ */ jsx(
109
- FormattedMessage,
110
- {
111
- id: "xContingenciesWillBeSimulatedAndYNotFound",
112
- values: {
113
- x: simulatedContingencyCount?.nbContingencies ?? "...",
114
- y: simulatedContingencyCount?.notFoundElements ?? "..."
115
+ return simulatedContingencyCount.success ? /* @__PURE__ */ jsxs(Box, { children: [
116
+ /* @__PURE__ */ jsx(
117
+ Alert,
118
+ {
119
+ variant: "standard",
120
+ severity: "info",
121
+ sx: styles.alert,
122
+ action: simulatedContingencyCount?.notFoundElements > 0 && /* @__PURE__ */ jsx(IconButton, { "aria-label": "expand", size: "small", onClick: () => setExpanded(!expanded), children: expanded ? /* @__PURE__ */ jsx(ExpandLess, {}) : /* @__PURE__ */ jsx(ExpandMore, {}) }),
123
+ children: /* @__PURE__ */ jsx(
124
+ FormattedMessage,
125
+ {
126
+ id: "xContingenciesWillBeSimulatedAndYNotFound",
127
+ values: {
128
+ x: simulatedContingencyCount?.nbContingencies ?? "...",
129
+ y: simulatedContingencyCount?.notFoundElements ?? "..."
130
+ }
131
+ }
132
+ )
115
133
  }
116
- }
117
- ) }) : /* @__PURE__ */ jsx(Alert, { variant: "standard", severity: "error", sx: styles.error, children: /* @__PURE__ */ jsx(
134
+ ),
135
+ /* @__PURE__ */ jsx(Collapse, { in: expanded, sx: { padding: 1 }, children: /* @__PURE__ */ jsx(NotFoundElementsTable, { data: simulatedContingencyCount?.NotFoundElementsData }) })
136
+ ] }) : /* @__PURE__ */ jsx(Alert, { variant: "standard", severity: "error", sx: styles.error, children: /* @__PURE__ */ jsx(
118
137
  FormattedMessage,
119
138
  {
120
139
  id: "contingenciesWillNotBeSimulated",
@@ -0,0 +1,5 @@
1
+ import { NotFoundElementsData } from './utils';
2
+ export type NotFoundElementsTableProps = {
3
+ data: NotFoundElementsData[];
4
+ };
5
+ export default function NotFoundElementsTable({ data }: Readonly<NotFoundElementsTableProps>): import("react").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { TableContainer, Table, TableHead, TableRow, TableCell, TableBody } from "@mui/material";
3
+ import { useIntl } from "react-intl";
4
+ function NotFoundElementsTable({ data }) {
5
+ const intl = useIntl();
6
+ return /* @__PURE__ */ jsx(TableContainer, { sx: { maxHeight: 370, overflow: "auto" }, children: /* @__PURE__ */ jsxs(Table, { stickyHeader: true, size: "small", children: [
7
+ /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
8
+ /* @__PURE__ */ jsx(TableCell, { children: intl.formatMessage({ id: "ContingenciesList" }) }, "list"),
9
+ /* @__PURE__ */ jsx(TableCell, { children: intl.formatMessage({ id: "Contingencies" }) }, "contingency"),
10
+ /* @__PURE__ */ jsx(TableCell, { children: intl.formatMessage({ id: "Equipment" }) }, "element")
11
+ ] }) }),
12
+ /* @__PURE__ */ jsx(TableBody, { children: data.map((row) => {
13
+ return /* @__PURE__ */ jsxs(TableRow, { hover: true, tabIndex: -1, children: [
14
+ /* @__PURE__ */ jsx(TableCell, { children: row.list }),
15
+ /* @__PURE__ */ jsx(TableCell, { children: row.contingency }),
16
+ /* @__PURE__ */ jsx(TableCell, { children: row.element })
17
+ ] }, `${row.list}-${row.contingency}-${row.element}`);
18
+ }) })
19
+ ] }) });
20
+ }
21
+ export {
22
+ NotFoundElementsTable as default
23
+ };
@@ -4,10 +4,16 @@ export type SuccessCountType = {
4
4
  success: true;
5
5
  nbContingencies: number;
6
6
  notFoundElements: number;
7
+ NotFoundElementsData: NotFoundElementsData[];
7
8
  };
8
9
  export type FailureCountType = {
9
10
  success: false;
10
11
  invalidContingencyErrorMessage: string;
11
12
  };
12
13
  export type SimulatedContingencyCountType = SuccessCountType | FailureCountType;
14
+ export type NotFoundElementsData = {
15
+ list: string;
16
+ contingency: string;
17
+ element: string;
18
+ };
13
19
  export declare function mapSimulatedContingencyList(contingencyCount: ContingencyCount, contingencyListsInfos: ContingencyListsInfosEnriched[]): SimulatedContingencyCountType;
@@ -7,6 +7,7 @@ function mapSimulatedContingencyList(contingencyCount, contingencyListsInfos) {
7
7
  });
8
8
  let total = 0;
9
9
  let totalNotFound = 0;
10
+ const rows = [];
10
11
  for (const [uuid, countByList] of Object.entries(contingencyCount.countByContingencyList)) {
11
12
  total += countByList.nbContingencies;
12
13
  const listName = namesById[uuid] ?? uuid;
@@ -19,11 +20,23 @@ function mapSimulatedContingencyList(contingencyCount, contingencyListsInfos) {
19
20
  if (countByList.notFoundElements !== null) {
20
21
  totalNotFound += Object.entries(countByList.notFoundElements).length;
21
22
  }
23
+ if (countByList.notFoundElements && Object.keys(countByList.notFoundElements).length > 0) {
24
+ Object.entries(countByList.notFoundElements).forEach(([contingency, elements]) => {
25
+ elements.forEach((element) => {
26
+ rows.push({
27
+ list: listName,
28
+ contingency,
29
+ element
30
+ });
31
+ });
32
+ });
33
+ }
22
34
  }
23
35
  return {
24
36
  success: true,
25
37
  nbContingencies: total,
26
- notFoundElements: totalNotFound
38
+ notFoundElements: totalNotFound,
39
+ NotFoundElementsData: rows
27
40
  };
28
41
  }
29
42
  export {
@@ -202,7 +202,7 @@ export declare const parametersEn: {
202
202
  angleFlowSensitivityValueThreshold: string;
203
203
  flowVoltageSensitivityValueThreshold: string;
204
204
  ContingencyListsSelection: string;
205
- contingencyLists: string;
205
+ ContingenciesList: string;
206
206
  Execute: string;
207
207
  AddContingencyList: string;
208
208
  DeleteContingencyList: string;
@@ -196,7 +196,7 @@ const parametersEn = {
196
196
  angleFlowSensitivityValueThreshold: "ΔMW ou ΔA / Δ°",
197
197
  flowVoltageSensitivityValueThreshold: "ΔkV / kV",
198
198
  ContingencyListsSelection: "Contingency lists selection",
199
- contingencyLists: "Contingency lists",
199
+ ContingenciesList: "Contingencies list",
200
200
  Execute: "Execute",
201
201
  AddContingencyList: "Add",
202
202
  DeleteContingencyList: "Delete",
@@ -203,7 +203,7 @@ export declare const parametersFr: {
203
203
  angleFlowSensitivityValueThreshold: string;
204
204
  flowVoltageSensitivityValueThreshold: string;
205
205
  ContingencyListsSelection: string;
206
- contingencyLists: string;
206
+ ContingenciesList: string;
207
207
  Execute: string;
208
208
  AddContingencyList: string;
209
209
  DeleteContingencyList: string;
@@ -197,7 +197,7 @@ const parametersFr = {
197
197
  angleFlowSensitivityValueThreshold: "ΔMW ou ΔA / Δ°",
198
198
  flowVoltageSensitivityValueThreshold: "ΔkV / kV",
199
199
  ContingencyListsSelection: "Sélection des listes d'aléas",
200
- contingencyLists: "Listes d'aléas",
200
+ ContingenciesList: "Liste d'aléas",
201
201
  Execute: "Exécuter",
202
202
  AddContingencyList: "Ajouter",
203
203
  DeleteContingencyList: "Supprimer",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.262.0",
3
+ "version": "0.263.0",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "author": "gridsuite team",
6
6
  "homepage": "https://github.com/gridsuite",