From 46088c7ee56945f491ec0dc95fd202e73af2aed4 Mon Sep 17 00:00:00 2001 From: Ruben Thoms Date: Mon, 30 Oct 2023 22:03:41 +0100 Subject: [PATCH] Further implementation --- frontend/src/framework/Workbench.ts | 2 +- .../internal/WorkbenchSessionPrivate.ts | 2 -- frontend/src/main.tsx | 4 +++ .../components/filterSelect.tsx | 33 +++++++++++++++++++ .../useTableNameAndMetadataFilterOptions.ts | 6 +++- .../InplaceVolumetricsNew/settings.tsx | 28 ++++++---------- frontend/src/modules/registerAllModules.ts | 1 + frontend/vite.config.ts | 3 ++ 8 files changed, 57 insertions(+), 22 deletions(-) create mode 100644 frontend/src/modules/InplaceVolumetricsNew/components/filterSelect.tsx diff --git a/frontend/src/framework/Workbench.ts b/frontend/src/framework/Workbench.ts index 555d8fde7..9c8e6a084 100644 --- a/frontend/src/framework/Workbench.ts +++ b/frontend/src/framework/Workbench.ts @@ -227,8 +227,8 @@ export class Workbench { this._workbenchSession.setEnsembleSetLoadingState(true); const newEnsembleSet = await loadEnsembleSetMetadataFromBackend(queryClient, ensembleIdentsToLoad); console.debug("loadAndSetupEnsembleSetInSession - loading done"); - console.debug("loadAndSetupEnsembleSetInSession - publishing"); + this._workbenchSession.setEnsembleSetLoadingState(false); return this._workbenchSession.setEnsembleSet(newEnsembleSet); } diff --git a/frontend/src/framework/internal/WorkbenchSessionPrivate.ts b/frontend/src/framework/internal/WorkbenchSessionPrivate.ts index d0c9fb782..5b8e01f8d 100644 --- a/frontend/src/framework/internal/WorkbenchSessionPrivate.ts +++ b/frontend/src/framework/internal/WorkbenchSessionPrivate.ts @@ -13,7 +13,5 @@ export class WorkbenchSessionPrivate extends WorkbenchSession { setEnsembleSet(newEnsembleSet: EnsembleSet): void { this._ensembleSet = newEnsembleSet; this.notifySubscribers(WorkbenchSessionEvent.EnsembleSetChanged); - // Whenever a new ensemble set is set, we assume that the loading state has changed to false - this.notifySubscribers(WorkbenchSessionEvent.EnsembleSetLoadingStateChanged, { isLoading: false }); } } diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx index 86e1f2ce4..a935f229c 100644 --- a/frontend/src/main.tsx +++ b/frontend/src/main.tsx @@ -8,6 +8,10 @@ import { CustomQueryClientProvider } from "@framework/internal/providers/QueryCl import App from "./App"; import { GlobalErrorBoundary } from "./GlobalErrorBoundary"; +if (import.meta.hot) { + import.meta.hot.accept(); +} + /* If the `cleanStart` query parameter is given, the application will clear all local storage before rendering the application. diff --git a/frontend/src/modules/InplaceVolumetricsNew/components/filterSelect.tsx b/frontend/src/modules/InplaceVolumetricsNew/components/filterSelect.tsx new file mode 100644 index 000000000..66421a8f9 --- /dev/null +++ b/frontend/src/modules/InplaceVolumetricsNew/components/filterSelect.tsx @@ -0,0 +1,33 @@ +import React from "react"; + +import { Label } from "@lib/components/Label"; +import { Select, SelectOption } from "@lib/components/Select"; +import { useValidState } from "@lib/hooks/useValidState"; + +export type FilterSelectProps = { + name: string; + options: string[]; + size: number; + onChange?: (value: string) => void; +}; + +export const FilterSelect: React.FC = (props) => { + const [value, setValue] = useValidState("", props.options); + + const selectOptions = props.options.map((option) => ({ value: `${option}`, label: `${option}` })); + + function handleSelectionChange(values: string[]) { + setValue(values[0]); + if (props.onChange) { + props.onChange(values[0]); + } + } + + return ( + - ); + const stringifiedOptions = options.map((option) => `${option}`); + return ; } - const fluidZoneOptions = - filterOptions?.fluidZones.map((fluidZone) => ({ value: fluidZone, label: fluidZone })) ?? []; - const sourceOptions = filterOptions?.sources.map((source) => ({ value: source, label: source })) ?? []; - return (
- }> + } expanded> + + + } expanded>