From d7e484d30cd507f48722cf7cf8bd1fc180e3efc8 Mon Sep 17 00:00:00 2001 From: Ruben Thoms Date: Thu, 12 Oct 2023 12:14:53 +0200 Subject: [PATCH] Removed unused code and renamed status hook --- frontend/src/framework/ModuleContext.ts | 11 ----------- .../internal/ModuleInstanceStatusControllerPrivate.ts | 2 +- .../ViewWrapper/private-components/header.tsx | 6 +++--- .../components/DebugProfiler/debugProfiler.tsx | 6 +++--- .../src/modules/SimulationTimeSeriesMatrix/view.tsx | 2 +- 5 files changed, 8 insertions(+), 19 deletions(-) diff --git a/frontend/src/framework/ModuleContext.ts b/frontend/src/framework/ModuleContext.ts index fa45a4d13..e1453da03 100644 --- a/frontend/src/framework/ModuleContext.ts +++ b/frontend/src/framework/ModuleContext.ts @@ -6,13 +6,6 @@ import { ModuleInstanceStatusController } from "./ModuleInstanceStatusController import { StateBaseType, StateStore, useSetStoreValue, useStoreState, useStoreValue } from "./StateStore"; import { SyncSettingKey } from "./SyncSettings"; -export enum ModuleInstanceState { - LOADING, - READY, - ERROR, - WARNING, -} - export class ModuleContext { private _moduleInstance: ModuleInstance; private _stateStore: StateStore; @@ -68,8 +61,4 @@ export class ModuleContext { getModuleInstanceStatusController(): ModuleInstanceStatusController { return this._moduleInstance.getStatusController(); } - - getSource(): string { - throw Error("Not implemented"); - } } diff --git a/frontend/src/framework/internal/ModuleInstanceStatusControllerPrivate.ts b/frontend/src/framework/internal/ModuleInstanceStatusControllerPrivate.ts index 7e07bd8e3..48463a775 100644 --- a/frontend/src/framework/internal/ModuleInstanceStatusControllerPrivate.ts +++ b/frontend/src/framework/internal/ModuleInstanceStatusControllerPrivate.ts @@ -67,7 +67,7 @@ export class ModuleInstanceStatusControllerPrivate extends ModuleInstanceStatusC } } -export function useStatusControllerValue( +export function useStatusControllerStateValue( statusController: ModuleInstanceStatusControllerPrivate, stateKey: T ): StatusControllerState[T] { diff --git a/frontend/src/framework/internal/components/Content/private-components/ViewWrapper/private-components/header.tsx b/frontend/src/framework/internal/components/Content/private-components/ViewWrapper/private-components/header.tsx index 77e1aab27..3747de730 100644 --- a/frontend/src/framework/internal/components/Content/private-components/ViewWrapper/private-components/header.tsx +++ b/frontend/src/framework/internal/components/Content/private-components/ViewWrapper/private-components/header.tsx @@ -4,7 +4,7 @@ import ReactDOM from "react-dom"; import { ModuleInstance } from "@framework/ModuleInstance"; import { StatusMessageType } from "@framework/ModuleInstanceStatusController"; import { SyncSettingKey, SyncSettingsMeta } from "@framework/SyncSettings"; -import { useStatusControllerValue } from "@framework/internal/ModuleInstanceStatusControllerPrivate"; +import { useStatusControllerStateValue } from "@framework/internal/ModuleInstanceStatusControllerPrivate"; import { Badge } from "@lib/components/Badge"; import { CircularProgress } from "@lib/components/CircularProgress"; import { useElementBoundingRect } from "@lib/hooks/useElementBoundingRect"; @@ -24,8 +24,8 @@ export const Header: React.FC = (props) => { props.moduleInstance.getSyncedSettingKeys() ); const [title, setTitle] = React.useState(props.moduleInstance.getTitle()); - const isLoading = useStatusControllerValue(props.moduleInstance.getStatusController(), "loading"); - const statusMessages = useStatusControllerValue(props.moduleInstance.getStatusController(), "messages"); + const isLoading = useStatusControllerStateValue(props.moduleInstance.getStatusController(), "loading"); + const statusMessages = useStatusControllerStateValue(props.moduleInstance.getStatusController(), "messages"); const [statusMessagesVisible, setStatusMessagesVisible] = React.useState(false); const ref = React.useRef(null); diff --git a/frontend/src/framework/internal/components/DebugProfiler/debugProfiler.tsx b/frontend/src/framework/internal/components/DebugProfiler/debugProfiler.tsx index 2f77ab8f8..2be384abb 100644 --- a/frontend/src/framework/internal/components/DebugProfiler/debugProfiler.tsx +++ b/frontend/src/framework/internal/components/DebugProfiler/debugProfiler.tsx @@ -3,7 +3,7 @@ import React from "react"; import { StatusSource } from "@framework/ModuleInstanceStatusController"; import { ModuleInstanceStatusControllerPrivate, - useStatusControllerValue, + useStatusControllerStateValue, } from "@framework/internal/ModuleInstanceStatusControllerPrivate"; import { isDevMode } from "@lib/utils/devMode"; @@ -61,11 +61,11 @@ type RenderInfo = { export const DebugProfiler: React.FC = (props) => { const [renderInfo, setRenderInfo] = React.useState(null); - const reportedRenderCount = useStatusControllerValue( + const reportedRenderCount = useStatusControllerStateValue( props.statusController, props.source === StatusSource.View ? "viewRenderCount" : "settingsRenderCount" ); - const customDebugMessage = useStatusControllerValue( + const customDebugMessage = useStatusControllerStateValue( props.statusController, props.source === StatusSource.View ? "viewDebugMessage" : "settingsDebugMessage" ); diff --git a/frontend/src/modules/SimulationTimeSeriesMatrix/view.tsx b/frontend/src/modules/SimulationTimeSeriesMatrix/view.tsx index 433be773b..102fd5868 100644 --- a/frontend/src/modules/SimulationTimeSeriesMatrix/view.tsx +++ b/frontend/src/modules/SimulationTimeSeriesMatrix/view.tsx @@ -4,7 +4,7 @@ import Plot from "react-plotly.js"; import { Ensemble } from "@framework/Ensemble"; import { EnsembleIdent } from "@framework/EnsembleIdent"; import { ModuleFCProps } from "@framework/Module"; -import { ViewStatusWriter, useViewStatusWriter } from "@framework/StatusWriter"; +import { useViewStatusWriter } from "@framework/StatusWriter"; import { useEnsembleSet } from "@framework/WorkbenchSession"; import { useElementSize } from "@lib/hooks/useElementSize"; import { ColorScaleGradientType } from "@lib/utils/ColorScale";