From f851521aede1af9c616cc575fb6851b530cd986e Mon Sep 17 00:00:00 2001 From: AAJELLAL Date: Wed, 24 Jan 2024 10:56:47 +0100 Subject: [PATCH] Add battery expert filters. Signed-off-by: AAJELLAL --- .../filter/expert/expert-filter-constants.ts | 16 ++++++++++++++++ .../dialogs/filter/expert/expert-filter-form.tsx | 4 ++-- src/translations/en.json | 4 +++- src/translations/fr.json | 4 +++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/components/dialogs/filter/expert/expert-filter-constants.ts b/src/components/dialogs/filter/expert/expert-filter-constants.ts index 9c7840b09..fc04ab989 100644 --- a/src/components/dialogs/filter/expert/expert-filter-constants.ts +++ b/src/components/dialogs/filter/expert/expert-filter-constants.ts @@ -22,6 +22,10 @@ export const EXPERT_FILTER_EQUIPMENTS = { id: 'LOAD', label: 'Loads', }, + BATTERY: { + id: 'BATTERY', + label: 'Batteries', + }, }; export const ENERGY_SOURCE_OPTIONS = [ @@ -247,4 +251,16 @@ export const fields: Record = { FIELDS_OPTIONS.P0, FIELDS_OPTIONS.Q0, ], + BATTERY: [ + FIELDS_OPTIONS.ID, + FIELDS_OPTIONS.NAME, + FIELDS_OPTIONS.VOLTAGE_LEVEL_ID, + FIELDS_OPTIONS.NOMINAL_VOLTAGE, + FIELDS_OPTIONS.CONNECTED, + FIELDS_OPTIONS.COUNTRY, + FIELDS_OPTIONS.MIN_P, + FIELDS_OPTIONS.MAX_P, + { ...FIELDS_OPTIONS.TARGET_P, label: 'batteryTargetP' }, + { ...FIELDS_OPTIONS.TARGET_Q, label: 'batteryTargetQ' }, + ], }; diff --git a/src/components/dialogs/filter/expert/expert-filter-form.tsx b/src/components/dialogs/filter/expert/expert-filter-form.tsx index c4162d454..2e0541b5f 100644 --- a/src/components/dialogs/filter/expert/expert-filter-form.tsx +++ b/src/components/dialogs/filter/expert/expert-filter-form.tsx @@ -22,7 +22,7 @@ import InputWithPopupConfirmation from '../../../utils/rhf-inputs/select-inputs/ import { SelectInput } from '@gridsuite/commons-ui'; import { useFormContext, useWatch } from 'react-hook-form'; import { testQuery } from './expert-filter-utils'; -import { Generator, Load } from '../../../../utils/equipment-types'; +import { Battery, Generator, Load } from "../../../../utils/equipment-types"; import { COMBINATOR_OPTIONS, EXPERT_FILTER_EQUIPMENTS, @@ -76,7 +76,7 @@ export const expertFilterSchema = { }; function isSupportedEquipmentType(equipmentType: string): boolean { - return equipmentType === Generator.type || equipmentType === Load.type; + return equipmentType === Generator.type || equipmentType === Load.type || equipmentType === Battery.type; } const defaultQuery = { diff --git a/src/translations/en.json b/src/translations/en.json index 13e1411bd..2425bb95c 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -268,5 +268,7 @@ "descriptionModificationError": "An error when modifying the description", "descriptionLimitError": "Description exceeds character limit", "p0": "Constant P", - "q0": "Constant Q" + "q0": "Constant Q", + "batteryTargetP": "Constant active power", + "batteryTargetQ": "Constant reactive power" } diff --git a/src/translations/fr.json b/src/translations/fr.json index 72db130cc..23b568608 100644 --- a/src/translations/fr.json +++ b/src/translations/fr.json @@ -283,5 +283,7 @@ "descriptionModificationError": "Erreur lors de la modification de la description", "descriptionLimitError": "La description dépasse la limite de caractères", "p0": "P constant", - "q0": "Q constant" + "q0": "Q constant", + "batteryTargetP": "Puissance active constante", + "batteryTargetQ": "Puissance réactive constante" }