diff --git a/app/static/src/app/components/WodinPlot.vue b/app/static/src/app/components/WodinPlot.vue index b1ca86af..025f9875 100644 --- a/app/static/src/app/components/WodinPlot.vue +++ b/app/static/src/app/components/WodinPlot.vue @@ -59,16 +59,16 @@ export default defineComponent({ const hasPlotData = computed(() => !!baseData.value?.length); - const yAxisType = computed(() => (store.state.graphSettings.logScaleYAxis ? "log" : ("linear" as AxisType))); - const lockYAxis = computed(() => store.state.graphSettings.lockYAxis); - const yAxisRange = computed(() => store.state.graphSettings.yAxisRange as YAxisRange); + const yAxisType = computed(() => (store.state.graphs.settings.logScaleYAxis ? "log" : ("linear" as AxisType))); + const lockYAxis = computed(() => store.state.graphs.settings.lockYAxis); + const yAxisRange = computed(() => store.state.graphs.settings.yAxisRange as YAxisRange); const updateAxesRange = () => { // eslint-disable-next-line @typescript-eslint/no-explicit-any const plotLayout = (plot.value as any).layout; const yRange = plotLayout.yaxis?.range; if (plotLayout) { - store.commit(`graphSettings/${GraphsMutation.SetYAxisRange}`, yRange); + store.commit(`graphs/${GraphsMutation.SetYAxisRange}`, yRange); } }; diff --git a/app/static/src/app/components/options/GraphSettings.vue b/app/static/src/app/components/options/GraphSettings.vue index 750000dd..7974c9e4 100644 --- a/app/static/src/app/components/options/GraphSettings.vue +++ b/app/static/src/app/components/options/GraphSettings.vue @@ -35,19 +35,19 @@ export default defineComponent({ const store = useStore(); const logScaleYAxis = computed({ get() { - return store.state.graphSettings.logScaleYAxis; + return store.state.graphs.settings.logScaleYAxis; }, set(newValue) { - store.commit(`graphSettings/${GraphsMutation.SetLogScaleYAxis}`, newValue); + store.commit(`graphs/${GraphsMutation.SetLogScaleYAxis}`, newValue); } }); const lockYAxis = computed({ get() { - return store.state.graphSettings.lockYAxis; + return store.state.graphs.settings.lockYAxis; }, set(newValue) { - store.commit(`graphSettings/${GraphsMutation.SetLockYAxis}`, newValue); + store.commit(`graphs/${GraphsMutation.SetLockYAxis}`, newValue); } }); diff --git a/app/static/src/app/components/options/LinkData.vue b/app/static/src/app/components/options/LinkData.vue index aa6db969..00a7e492 100644 --- a/app/static/src/app/components/options/LinkData.vue +++ b/app/static/src/app/components/options/LinkData.vue @@ -33,6 +33,7 @@ import { useStore } from "vuex"; import { FitDataGetter } from "../../store/fitData/getters"; import userMessages from "../../userMessages"; import { FitDataAction } from "../../store/fitData/actions"; +import {GraphsGetter} from "../../store/graphs/getters"; export default defineComponent({ name: "LinkData", @@ -41,7 +42,7 @@ export default defineComponent({ const store = useStore(); const dataColumns = computed(() => store.getters[`${namespace}/${FitDataGetter.nonTimeColumns}`]); const modelSuccess = computed(() => store.state.model.odinModelResponse?.valid); - const selectedVariables = computed(() => store.state.model.selectedVariables); + const selectedVariables = computed(() => store.getters[`graphs/${GraphsGetter.allSelectedVariables}`]); const linkedVariables = computed(() => store.state.fitData.linkedVariables); const linkPrerequisitesMessage = computed(() => { const messages = []; diff --git a/app/static/src/app/components/run/RunPlot.vue b/app/static/src/app/components/run/RunPlot.vue index a818e5a4..51841f68 100644 --- a/app/static/src/app/components/run/RunPlot.vue +++ b/app/static/src/app/components/run/RunPlot.vue @@ -58,7 +58,7 @@ export default defineComponent({ const allFitData = computed(() => store.getters[`fitData/${FitDataGetter.allData}`]); - const selectedVariables = computed(() => store.state.model.selectedVariables); + const selectedVariables = computed(() => store.state.graphs.config[0].selectedVariables); const placeholderMessage = computed(() => runPlaceholderMessage(selectedVariables.value, false)); const allPlotData = (start: number, end: number, points: number): WodinPlotData => { diff --git a/app/static/src/app/components/run/RunStochasticPlot.vue b/app/static/src/app/components/run/RunStochasticPlot.vue index a4376c61..a655090e 100644 --- a/app/static/src/app/components/run/RunStochasticPlot.vue +++ b/app/static/src/app/components/run/RunStochasticPlot.vue @@ -29,7 +29,7 @@ export default defineComponent({ setup() { const store = useStore(); - const selectedVariables = computed(() => store.state.model.selectedVariables); + const selectedVariables = computed(() => store.state.graphs.config[0].selectedVariables); const placeholderMessage = computed(() => runPlaceholderMessage(selectedVariables.value, false)); const solution = computed(() => store.state.run.resultDiscrete?.solution); diff --git a/app/static/src/app/components/run/RunTab.vue b/app/static/src/app/components/run/RunTab.vue index 85f1b570..db301eac 100644 --- a/app/static/src/app/components/run/RunTab.vue +++ b/app/static/src/app/components/run/RunTab.vue @@ -55,6 +55,7 @@ import LoadingSpinner from "../LoadingSpinner.vue"; import { AppType } from "../../store/appState/state"; import { ModelGetter } from "../../store/model/getters"; import RunStochasticPlot from "./RunStochasticPlot.vue"; +import {GraphsGetter} from "../../store/graphs/getters"; export default defineComponent({ name: "RunTab", @@ -81,6 +82,7 @@ export default defineComponent({ const sumOfSquares = computed(() => store.state.modelFit?.sumOfSquares); const hasRunner = computed(() => store.getters[`model/${ModelGetter.hasRunner}`]); + const allSelectedVariables = computed(() => store.getters[`graphs/${GraphsGetter.allSelectedVariables}`]); // Enable run button if model has initialised and compile is not required const canRunModel = computed(() => { @@ -99,7 +101,7 @@ export default defineComponent({ if (store.state.model.compileRequired) { return userMessages.run.compileRequired; } - if (!store.state.model.selectedVariables.length) { + if (!allSelectedVariables.value.length) { return userMessages.model.selectAVariable; } // TODO: eventually make runRequired to runUpdateRequired I think? diff --git a/app/static/src/app/components/sensitivity/SensitivitySummaryPlot.vue b/app/static/src/app/components/sensitivity/SensitivitySummaryPlot.vue index c110d6cd..6f65fc38 100644 --- a/app/static/src/app/components/sensitivity/SensitivitySummaryPlot.vue +++ b/app/static/src/app/components/sensitivity/SensitivitySummaryPlot.vue @@ -39,7 +39,7 @@ export default defineComponent({ const batch = computed(() => store.state.sensitivity.result?.batch); const plotSettings = computed(() => store.state.sensitivity.plotSettings); const palette = computed(() => store.state.model.paletteModel); - const selectedVariables = computed(() => store.state.model.selectedVariables); + const selectedVariables = computed(() => store.state.graphs.config[0].selectedVariables); const placeholderMessage = computed(() => runPlaceholderMessage(selectedVariables.value, true)); const xAxisSettings = computed(() => { @@ -54,7 +54,7 @@ export default defineComponent({ const yAxisSettings = computed(() => { const isNotTimePlot = plotSettings.value.plotType !== SensitivityPlotType.TimeAtExtreme; - const logScale = store.state.graphSettings.logScaleYAxis && isNotTimePlot; + const logScale = store.state.graphs.settings.logScaleYAxis && isNotTimePlot; const type = logScale ? "log" : ("linear" as AxisType); return { type }; }); diff --git a/app/static/src/app/components/sensitivity/SensitivityTracesPlot.vue b/app/static/src/app/components/sensitivity/SensitivityTracesPlot.vue index d3fc5f1c..c7bb0729 100644 --- a/app/static/src/app/components/sensitivity/SensitivityTracesPlot.vue +++ b/app/static/src/app/components/sensitivity/SensitivityTracesPlot.vue @@ -78,7 +78,7 @@ export default defineComponent({ const palette = computed(() => store.state.model.paletteModel); - const selectedVariables = computed(() => store.state.model.selectedVariables); + const selectedVariables = computed(() => store.state.graphs.config[0].selectedVariables); const placeholderMessage = computed(() => runPlaceholderMessage(selectedVariables.value, true)); diff --git a/app/static/src/app/store/basic/basic.ts b/app/static/src/app/store/basic/basic.ts index d55da85d..024b18f5 100644 --- a/app/static/src/app/store/basic/basic.ts +++ b/app/static/src/app/store/basic/basic.ts @@ -52,7 +52,7 @@ export const storeOptions: StoreOptions = { multiSensitivity, sessions, versions, - graphSettings: graphs, + graphs, language }, plugins: [logMutations, persistState] diff --git a/app/static/src/app/store/fit/fit.ts b/app/static/src/app/store/fit/fit.ts index 9184a613..6986a46f 100644 --- a/app/static/src/app/store/fit/fit.ts +++ b/app/static/src/app/store/fit/fit.ts @@ -56,7 +56,7 @@ export const storeOptions: StoreOptions = { multiSensitivity, sessions, versions, - graphSettings: graphs, + graphs, language }, plugins: [logMutations, persistState] diff --git a/app/static/src/app/store/graphs/graphs.ts b/app/static/src/app/store/graphs/graphs.ts index 3d65fb67..4a159920 100644 --- a/app/static/src/app/store/graphs/graphs.ts +++ b/app/static/src/app/store/graphs/graphs.ts @@ -1,4 +1,6 @@ import { GraphsState } from "./state"; +import { actions } from "./actions"; +import { getters } from "./getters"; import { mutations } from "./mutations"; export const defaultState: GraphsState = { @@ -18,5 +20,7 @@ export const defaultState: GraphsState = { export const graphs = { namespaced: true, state: defaultState, + actions, + getters, mutations }; diff --git a/app/static/src/app/store/model/actions.ts b/app/static/src/app/store/model/actions.ts index 5c567cda..832e80c1 100644 --- a/app/static/src/app/store/model/actions.ts +++ b/app/static/src/app/store/model/actions.ts @@ -70,7 +70,7 @@ const compileModelAndUpdateStore = (context: ActionContext // Retain variable selections. Newly added variables will be selected by default in the first graph const selectedVariables = variables.filter((s) => !rootState.graphs.config[0].unselectedVariables.includes(s)); - dispatch(`graphs/${GraphsAction.UpdateSelectedVariables}`, { index: 0, selectedVariables }); + dispatch(`graphs/${GraphsAction.UpdateSelectedVariables}`, { index: 0, selectedVariables }, { root: true}); if (state.compileRequired) { commit(ModelMutation.SetCompileRequired, false); diff --git a/app/static/src/app/store/stochastic/stochastic.ts b/app/static/src/app/store/stochastic/stochastic.ts index 09c438a3..3a637e64 100644 --- a/app/static/src/app/store/stochastic/stochastic.ts +++ b/app/static/src/app/store/stochastic/stochastic.ts @@ -52,7 +52,7 @@ export const storeOptions: StoreOptions = { multiSensitivity, sessions, versions, - graphSettings: graphs, + graphs, language }, plugins: [logMutations, persistState]