Skip to content

Commit

Permalink
Add battery expert filters.
Browse files Browse the repository at this point in the history
Signed-off-by: AAJELLAL <ali.ajellalod@gmail.com>
  • Loading branch information
AAJELLAL committed Jan 24, 2024
1 parent c9f738d commit f851521
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
16 changes: 16 additions & 0 deletions src/components/dialogs/filter/expert/expert-filter-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export const EXPERT_FILTER_EQUIPMENTS = {
id: 'LOAD',
label: 'Loads',
},
BATTERY: {
id: 'BATTERY',
label: 'Batteries',
},
};

export const ENERGY_SOURCE_OPTIONS = [
Expand Down Expand Up @@ -247,4 +251,16 @@ export const fields: Record<string, Field[]> = {
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' },
],
};
4 changes: 2 additions & 2 deletions src/components/dialogs/filter/expert/expert-filter-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = {
Expand Down
4 changes: 3 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
4 changes: 3 additions & 1 deletion src/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit f851521

Please sign in to comment.