@gridsuite/commons-ui 0.68.2 → 0.68.3

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.
@@ -13,5 +13,5 @@ export type FormEquipment = {
13
13
  label: string;
14
14
  fields: FormField[];
15
15
  };
16
- export declare const CONTINGENCY_LIST_EQUIPMENTS: Record<EquipmentType.BUSBAR_SECTION | EquipmentType.LINE | EquipmentType.TWO_WINDINGS_TRANSFORMER | EquipmentType.GENERATOR | EquipmentType.SHUNT_COMPENSATOR | EquipmentType.HVDC_LINE | EquipmentType.DANGLING_LINE, FormEquipment>;
16
+ export declare const CONTINGENCY_LIST_EQUIPMENTS: Record<EquipmentType.BUSBAR_SECTION | EquipmentType.LINE | EquipmentType.TWO_WINDINGS_TRANSFORMER | EquipmentType.THREE_WINDINGS_TRANSFORMER | EquipmentType.GENERATOR | EquipmentType.BATTERY | EquipmentType.LOAD | EquipmentType.SHUNT_COMPENSATOR | EquipmentType.STATIC_VAR_COMPENSATOR | EquipmentType.HVDC_LINE | EquipmentType.DANGLING_LINE, FormEquipment>;
17
17
  export declare const FILTER_EQUIPMENTS: Record<EquipmentType.SUBSTATION | EquipmentType.VOLTAGE_LEVEL | EquipmentType.LINE | EquipmentType.TWO_WINDINGS_TRANSFORMER | EquipmentType.THREE_WINDINGS_TRANSFORMER | EquipmentType.GENERATOR | EquipmentType.BATTERY | EquipmentType.LOAD | EquipmentType.SHUNT_COMPENSATOR | EquipmentType.STATIC_VAR_COMPENSATOR | EquipmentType.HVDC_LINE | EquipmentType.DANGLING_LINE, FormEquipment>;
@@ -82,16 +82,36 @@ const CONTINGENCY_LIST_EQUIPMENTS = {
82
82
  label: "TwoWindingsTransformers",
83
83
  fields: [countries, nominalVoltage1, nominalVoltage2]
84
84
  },
85
+ THREE_WINDINGS_TRANSFORMER: {
86
+ id: "THREE_WINDINGS_TRANSFORMER",
87
+ label: "ThreeWindingsTransformers",
88
+ fields: [countries, nominalVoltage1, nominalVoltage2, nominalVoltage3]
89
+ },
85
90
  GENERATOR: {
86
91
  id: "GENERATOR",
87
92
  label: "Generators",
88
93
  fields: [countries, nominalVoltage]
89
94
  },
95
+ BATTERY: {
96
+ id: "BATTERY",
97
+ label: "Batteries",
98
+ fields: [countries, nominalVoltage]
99
+ },
100
+ LOAD: {
101
+ id: "LOAD",
102
+ label: "Loads",
103
+ fields: [countries, nominalVoltage]
104
+ },
90
105
  SHUNT_COMPENSATOR: {
91
106
  id: "SHUNT_COMPENSATOR",
92
107
  label: "ShuntCompensators",
93
108
  fields: [countries, nominalVoltage]
94
109
  },
110
+ STATIC_VAR_COMPENSATOR: {
111
+ id: "STATIC_VAR_COMPENSATOR",
112
+ label: "StaticVarCompensators",
113
+ fields: [countries, nominalVoltage]
114
+ },
95
115
  HVDC_LINE: {
96
116
  id: "HVDC_LINE",
97
117
  label: "HvdcLines",
@@ -30,26 +30,32 @@ function saveFilter(filter, name, token) {
30
30
  token
31
31
  );
32
32
  }
33
- function fetchElementsInfos(ids, elementTypes, equipmentTypes) {
33
+ async function fetchElementsInfos(ids, elementTypes, equipmentTypes) {
34
34
  console.info("Fetching elements metadata");
35
- const idsParams = getRequestParamFromList(
36
- "ids",
37
- ids.filter((id) => id)
38
- // filter falsy elements
39
- );
40
- const equipmentTypesParams = getRequestParamFromList("equipmentTypes", equipmentTypes);
41
- const elementTypesParams = getRequestParamFromList("elementTypes", elementTypes);
42
- const urlSearchParams = new URLSearchParams([
43
- ...idsParams,
44
- ...equipmentTypesParams,
45
- ...elementTypesParams
46
- ]).toString();
47
- const url = `${PREFIX_EXPLORE_SERVER_QUERIES}/v1/explore/elements/metadata?${urlSearchParams}`;
48
- console.debug(url);
49
- return backendFetchJson(url, {
50
- method: "get",
51
- headers: { "Content-Type": "application/json" }
52
- });
35
+ let final = [];
36
+ const chunkSize = 50;
37
+ for (let i = 0; i < ids.length; i += chunkSize) {
38
+ const partitionIds = ids.slice(i, i + chunkSize);
39
+ const idsParams = getRequestParamFromList(
40
+ "ids",
41
+ partitionIds.filter((id) => id)
42
+ // filter falsy elements
43
+ );
44
+ const equipmentTypesParams = getRequestParamFromList("equipmentTypes", equipmentTypes);
45
+ const elementTypesParams = getRequestParamFromList("elementTypes", elementTypes);
46
+ const urlSearchParams = new URLSearchParams([
47
+ ...idsParams,
48
+ ...equipmentTypesParams,
49
+ ...elementTypesParams
50
+ ]).toString();
51
+ const url = `${PREFIX_EXPLORE_SERVER_QUERIES}/v1/explore/elements/metadata?${urlSearchParams}`;
52
+ const result = await backendFetchJson(url, {
53
+ method: "get",
54
+ headers: { "Content-Type": "application/json" }
55
+ });
56
+ final = final.concat(result);
57
+ }
58
+ return final;
53
59
  }
54
60
  export {
55
61
  createFilter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.68.2",
3
+ "version": "0.68.3",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "engines": {
6
6
  "npm": ">=9",