From 9c75b4d6beabcadd3bd484c2004952f859c350cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Herje?= <82032112+jorgenherje@users.noreply.github.com> Date: Tue, 5 Sep 2023 13:41:27 +0200 Subject: [PATCH] Fix MultiEnsembleSelect component and update usage (#295) --- .../MultiEnsembleSelect/multiEnsembleSelect.tsx | 4 +++- .../src/modules/SimulationTimeSeries/settings.tsx | 12 +++++------- .../SimulationTimeSeriesSensitivity/settings.tsx | 12 +++++------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/frontend/src/framework/components/MultiEnsembleSelect/multiEnsembleSelect.tsx b/frontend/src/framework/components/MultiEnsembleSelect/multiEnsembleSelect.tsx index b60edc43a..260af11f9 100644 --- a/frontend/src/framework/components/MultiEnsembleSelect/multiEnsembleSelect.tsx +++ b/frontend/src/framework/components/MultiEnsembleSelect/multiEnsembleSelect.tsx @@ -33,5 +33,7 @@ export function MultiEnsembleSelect(props: MultiEnsembleSelectProps): JSX.Elemen selectedArr.push(ident.toString()); } - return + ); } diff --git a/frontend/src/modules/SimulationTimeSeries/settings.tsx b/frontend/src/modules/SimulationTimeSeries/settings.tsx index cea48e189..f04fc8247 100644 --- a/frontend/src/modules/SimulationTimeSeries/settings.tsx +++ b/frontend/src/modules/SimulationTimeSeries/settings.tsx @@ -5,7 +5,7 @@ import { EnsembleIdent } from "@framework/EnsembleIdent"; import { ModuleFCProps } from "@framework/Module"; import { SyncSettingKey, SyncSettingsHelper } from "@framework/SyncSettings"; import { useEnsembleSet } from "@framework/WorkbenchSession"; -import { MultiEnsembleSelect } from "@framework/components/MultiEnsembleSelect"; +import { SingleEnsembleSelect } from "@framework/components/SingleEnsembleSelect"; import { fixupEnsembleIdent, maybeAssignFirstSyncedEnsemble } from "@framework/utils/ensembleUiHelpers"; import { ApiStateWrapper } from "@lib/components/ApiStateWrapper"; import { Checkbox } from "@lib/components/Checkbox"; @@ -82,9 +82,8 @@ export function settings({ moduleContext, workbenchSession, workbenchServices }: const computedEnsemble = computedEnsembleIdent ? ensembleSet.findEnsemble(computedEnsembleIdent) : null; - function handleEnsembleSelectionChange(ensembleIdentArr: EnsembleIdent[]) { - console.debug("handleEnsembleSelectionChange()", ensembleIdentArr); - const newEnsembleIdent = ensembleIdentArr[0] ?? null; + function handleEnsembleSelectionChange(newEnsembleIdent: EnsembleIdent | null) { + console.debug("handleEnsembleSelectionChange()", newEnsembleIdent); setSelectedEnsembleIdent(newEnsembleIdent); if (newEnsembleIdent) { syncHelper.publishValue(SyncSettingKey.ENSEMBLE, "global.syncValue.ensembles", [newEnsembleIdent]); @@ -139,11 +138,10 @@ export function settings({ moduleContext, workbenchSession, workbenchServices }: text="Ensemble" labelClassName={syncHelper.isSynced(SyncSettingKey.ENSEMBLE) ? "bg-indigo-700 text-white" : ""} > -