Skip to content

Commit

Permalink
fix app with new module
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmaLRussell committed Jun 25, 2024
1 parent 9bca540 commit eb9297a
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 19 deletions.
8 changes: 4 additions & 4 deletions app/static/src/app/components/WodinPlot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
Expand Down
8 changes: 4 additions & 4 deletions app/static/src/app/components/options/GraphSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand Down
3 changes: 2 additions & 1 deletion app/static/src/app/components/options/LinkData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 = [];
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/app/components/run/RunPlot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/app/components/run/RunStochasticPlot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion app/static/src/app/components/run/RunTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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(() => {
Expand All @@ -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?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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 };
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/app/store/basic/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const storeOptions: StoreOptions<BasicState> = {
multiSensitivity,
sessions,
versions,
graphSettings: graphs,
graphs,
language
},
plugins: [logMutations, persistState]
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/app/store/fit/fit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const storeOptions: StoreOptions<FitState> = {
multiSensitivity,
sessions,
versions,
graphSettings: graphs,
graphs,
language
},
plugins: [logMutations, persistState]
Expand Down
4 changes: 4 additions & 0 deletions app/static/src/app/store/graphs/graphs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { GraphsState } from "./state";
import { actions } from "./actions";
import { getters } from "./getters";
import { mutations } from "./mutations";

export const defaultState: GraphsState = {
Expand All @@ -18,5 +20,7 @@ export const defaultState: GraphsState = {
export const graphs = {
namespaced: true,
state: defaultState,
actions,
getters,
mutations
};
2 changes: 1 addition & 1 deletion app/static/src/app/store/model/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const compileModelAndUpdateStore = (context: ActionContext<ModelState, AppState>

// 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);
Expand Down
2 changes: 1 addition & 1 deletion app/static/src/app/store/stochastic/stochastic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const storeOptions: StoreOptions<StochasticState> = {
multiSensitivity,
sessions,
versions,
graphSettings: graphs,
graphs,
language
},
plugins: [logMutations, persistState]
Expand Down

0 comments on commit eb9297a

Please sign in to comment.