Skip to content

Commit

Permalink
Removed unused code and renamed status hook
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenthoms committed Oct 12, 2023
1 parent 9ef99d4 commit d7e484d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 19 deletions.
11 changes: 0 additions & 11 deletions frontend/src/framework/ModuleContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<S extends StateBaseType> {
private _moduleInstance: ModuleInstance<S>;
private _stateStore: StateStore<S>;
Expand Down Expand Up @@ -68,8 +61,4 @@ export class ModuleContext<S extends StateBaseType> {
getModuleInstanceStatusController(): ModuleInstanceStatusController {
return this._moduleInstance.getStatusController();
}

getSource(): string {
throw Error("Not implemented");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class ModuleInstanceStatusControllerPrivate extends ModuleInstanceStatusC
}
}

export function useStatusControllerValue<T extends keyof StatusControllerState>(
export function useStatusControllerStateValue<T extends keyof StatusControllerState>(
statusController: ModuleInstanceStatusControllerPrivate,
stateKey: T
): StatusControllerState[T] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -24,8 +24,8 @@ export const Header: React.FC<HeaderProps> = (props) => {
props.moduleInstance.getSyncedSettingKeys()
);
const [title, setTitle] = React.useState<string>(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<boolean>(false);

const ref = React.useRef<HTMLDivElement>(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -61,11 +61,11 @@ type RenderInfo = {

export const DebugProfiler: React.FC<DebugProfilerProps> = (props) => {
const [renderInfo, setRenderInfo] = React.useState<RenderInfo | null>(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"
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/modules/SimulationTimeSeriesMatrix/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit d7e484d

Please sign in to comment.