diff --git a/webapp/public/locales/en/main.json b/webapp/public/locales/en/main.json
index f7651f99b1..e966640063 100644
--- a/webapp/public/locales/en/main.json
+++ b/webapp/public/locales/en/main.json
@@ -479,7 +479,6 @@
"study.modelization.bindingConst.question.deleteConstraintTerm": "Are you sure you want to delete this constraint term?",
"study.modelization.bindingConst.question.deleteBindingConstraint": "Are you sure you want to delete this binding constraint?",
"study.results.mc": "Monte-Carlo",
- "study.results.mc.year": "Year",
"study.results.display": "Display",
"study.results.temporality": "Temporality",
"study.results.noData": "No data available",
diff --git a/webapp/public/locales/fr/main.json b/webapp/public/locales/fr/main.json
index d60556d964..9be8545238 100644
--- a/webapp/public/locales/fr/main.json
+++ b/webapp/public/locales/fr/main.json
@@ -110,7 +110,7 @@
"form.submit.inProgress": "Le formulaire est en cours de soumission. Etes-vous sûr de vouloir quitter la page ?",
"form.asyncDefaultValues.error": "Impossible d'obtenir les valeurs",
"form.field.required": "Champ requis",
- "form.field.duplicate": "Cette valeur existe déjà: {{0}}",
+ "form.field.duplicate": "Cette valeur existe déjà: {{0}}",
"form.field.minLength": "{{0}} caractère(s) minimum",
"form.field.minValue": "La valeur minimum est {{0}}",
"form.field.maxValue": "La valeur maximum est {{0}}",
@@ -479,7 +479,6 @@
"study.modelization.bindingConst.question.deleteConstraintTerm": "Êtes-vous sûr de vouloir supprimer ce terme ?",
"study.modelization.bindingConst.question.deleteBindingConstraint": "Êtes-vous sûr de vouloir supprimer cette contrainte couplante ?",
"study.results.mc": "Monte-Carlo",
- "study.results.mc.year": "année",
"study.results.display": "Affichage",
"study.results.temporality": "Temporalité",
"study.results.noData": "Aucune donnée disponible",
diff --git a/webapp/src/components/App/Singlestudy/explore/Results/ResultDetails/SelectionDrawer.tsx b/webapp/src/components/App/Singlestudy/explore/Results/ResultDetails/SelectionDrawer.tsx
deleted file mode 100644
index da3aef3229..0000000000
--- a/webapp/src/components/App/Singlestudy/explore/Results/ResultDetails/SelectionDrawer.tsx
+++ /dev/null
@@ -1,124 +0,0 @@
-import { Box, Button, Drawer, RadioGroup } from "@mui/material";
-import { useEffect, useState } from "react";
-import { useTranslation } from "react-i18next";
-import BooleanFE from "../../../../../common/fieldEditors/BooleanFE";
-import NumberFE from "../../../../../common/fieldEditors/NumberFE";
-import RadioFE from "../../../../../common/fieldEditors/RadioFE";
-import Fieldset from "../../../../../common/Fieldset";
-import { DataType, MAX_YEAR, Timestep } from "./utils";
-
-export interface SelectionDrawerProps {
- open: boolean;
- onClose: () => void;
- values: {
- dataType: DataType;
- timestep: Timestep;
- year: number;
- };
- maxYear?: number;
- onSelection: (values: SelectionDrawerProps["values"]) => void;
-}
-
-function SelectionDrawer(props: SelectionDrawerProps) {
- const { open, onClose, values, maxYear = MAX_YEAR, onSelection } = props;
- const [dataTypeTmp, setDataTypeTmp] = useState(values.dataType);
- const [timestepTmp, setTimestepTemp] = useState(values.timestep);
- const [yearTmp, setYearTmp] = useState(values.year);
- const { t } = useTranslation();
-
- useEffect(() => {
- setDataTypeTmp(values.dataType);
- setTimestepTemp(values.timestep);
- setYearTmp(values.year);
- }, [values.dataType, values.timestep, values.year]);
-
- ////////////////////////////////////////////////////////////////
- // Event Handlers
- ////////////////////////////////////////////////////////////////
-
- const handleSelection = () => {
- onSelection({
- dataType: dataTypeTmp,
- timestep: timestepTmp,
- year: yearTmp,
- });
- onClose();
- };
-
- const handleClose = () => {
- setDataTypeTmp(values.dataType);
- setTimestepTemp(values.timestep);
- setYearTmp(values.year);
- onClose();
- };
-
- ////////////////////////////////////////////////////////////////
- // JSX
- ////////////////////////////////////////////////////////////////
-
- return (
-
-
-
-
-
-
-
-
-
-
- );
-}
-
-export default SelectionDrawer;
diff --git a/webapp/src/components/App/Singlestudy/explore/Results/ResultDetails/index.tsx b/webapp/src/components/App/Singlestudy/explore/Results/ResultDetails/index.tsx
index abc29e9b4b..00f9cc90f7 100644
--- a/webapp/src/components/App/Singlestudy/explore/Results/ResultDetails/index.tsx
+++ b/webapp/src/components/App/Singlestudy/explore/Results/ResultDetails/index.tsx
@@ -31,14 +31,22 @@ import EditableMatrix from "../../../../../common/EditableMatrix";
import PropertiesView from "../../../../../common/PropertiesView";
import SplitLayoutView from "../../../../../common/SplitLayoutView";
import ListElement from "../../common/ListElement";
-import SelectionDrawer, { SelectionDrawerProps } from "./SelectionDrawer";
-import { createPath, DataType, OutputItemType, Timestep } from "./utils";
+import {
+ createPath,
+ DataType,
+ MAX_YEAR,
+ OutputItemType,
+ Timestep,
+} from "./utils";
import UsePromiseCond, {
mergeResponses,
} from "../../../../../common/utils/UsePromiseCond";
import useStudySynthesis from "../../../../../../redux/hooks/useStudySynthesis";
import { downloadMatrix } from "../../../../../../utils/matrixUtils";
import ButtonBack from "../../../../../common/ButtonBack";
+import BooleanFE from "../../../../../common/fieldEditors/BooleanFE";
+import SelectFE from "../../../../../common/fieldEditors/SelectFE";
+import NumberFE from "../../../../../common/fieldEditors/NumberFE";
function ResultDetails() {
const { study } = useOutletContext<{ study: StudyMetadata }>();
@@ -53,7 +61,6 @@ function ResultDetails() {
const [dataType, setDataType] = useState(DataType.General);
const [timestep, setTimeStep] = useState(Timestep.Hourly);
const [year, setYear] = useState(-1);
- const [showFilter, setShowFilter] = useState(false);
const [itemType, setItemType] = useState(OutputItemType.Areas);
const [selectedItemId, setSelectedItemId] = useState("");
const [searchValue, setSearchValue] = useState("");
@@ -76,6 +83,8 @@ function ResultDetails() {
(item) => item.id === selectedItemId
) as (Area & { id: string }) | LinkElement | undefined;
+ const maxYear = output?.nbyears ?? MAX_YEAR;
+
useEffect(
() => {
const isValidSelectedItem =
@@ -94,7 +103,7 @@ function ResultDetails() {
async () => {
if (output && selectedItem) {
const path = createPath({
- output: { ...output, id: outputId as string },
+ output,
item: selectedItem,
dataType,
timestep,
@@ -116,7 +125,7 @@ function ResultDetails() {
{
resetDataOnReload: true,
resetErrorOnReload: true,
- deps: [study.id, output, selectedItem],
+ deps: [study.id, output, selectedItem, dataType, timestep, year],
}
);
@@ -131,16 +140,6 @@ function ResultDetails() {
setItemType(value);
};
- const handleSelection: SelectionDrawerProps["onSelection"] = ({
- dataType,
- timestep,
- year,
- }) => {
- setDataType(dataType);
- setTimeStep(timestep);
- setYear(year);
- };
-
const handleDownload = (matrixData: MatrixType, fileName: string): void => {
downloadMatrix(matrixData, fileName);
};
@@ -150,152 +149,211 @@ function ResultDetails() {
////////////////////////////////////////////////////////////////
return (
- <>
-
+ navigate("..")} />
+
+ }
+ mainContent={
+ <>
+
- navigate("..")} />
-
- }
- mainContent={
- <>
-
-
- {t("study.areas")}
-
-
- {t("study.links")}
-
-
- setSelectedItemId(item.id)}
- />
- >
- }
- onSearchFilterChange={setSearchValue}
- />
- }
- right={
+
+ {t("study.areas")}
+
+
+ {t("study.links")}
+
+
+ setSelectedItemId(item.id)}
+ />
+ >
+ }
+ onSearchFilterChange={setSearchValue}
+ />
+ }
+ right={
+
-
- {[
+ {(
+ [
[
`${t("study.results.mc")}:`,
- year > 0 ? `${t("study.results.mc.year")} ${year}` : "all",
+ // year > 0 ? `${t("study.results.mc.year")} ${year}` : "all",
+ () => (
+ <>
+ {
+ setYear(event?.target.value ? -1 : 1);
+ }}
+ />
+ {year > 0 && (
+ {
+ setYear(Number(event.target.value));
+ }}
+ />
+ )}
+ >
+ ),
],
- [`${t("study.results.display")}:`, dataType],
- [`${t("study.results.temporality")}:`, timestep],
- ].map(([label, value]) => (
-
-
- {label}
-
- {value}
-
- ))}
-
-
- }
- onClick={() =>
- matrixRes.data &&
- handleDownload(matrixRes.data, `matrix_${study.id}`)
- }
- disabled={matrixRes.isLoading}
- >
- {t("global.download")}
-
-
-
- (
-
- )}
- ifResolved={([, matrix]) =>
- matrix && (
- (
+ {
+ setDataType(event?.target.value as DataType);
+ }}
/>
- )
- }
- ifRejected={(err) => (
-
- {axios.isAxiosError(err) && err.response?.status === 404 ? (
- <>
-
- {t("study.results.noData")}
- >
- ) : (
- t("data.error.matrix")
- )}
-
- )}
- />
-
+ ),
+ ],
+ [
+ `${t("study.results.temporality")}:`,
+ () => (
+ {
+ setTimeStep(event?.target.value as Timestep);
+ }}
+ />
+ ),
+ ],
+ ] as const
+ ).map(([label, Field]) => (
+
+
+ {label}
+
+
+
+ ))}
+
- }
- />
- setShowFilter(false)}
- values={{ dataType, timestep, year }}
- maxYear={output?.nbyears}
- onSelection={handleSelection}
- />
- >
+
+ (
+
+ )}
+ ifResolved={([, matrix]) =>
+ matrix && (
+
+ )
+ }
+ ifRejected={(err) => (
+
+ {axios.isAxiosError(err) && err.response?.status === 404 ? (
+ <>
+
+ {t("study.results.noData")}
+ >
+ ) : (
+ t("data.error.matrix")
+ )}
+
+ )}
+ />
+
+
+ }
+ />
);
}