Skip to content

Commit

Permalink
Merge pull request #177 from mrc-ide/mrc-4456_single_edit
Browse files Browse the repository at this point in the history
mrc-4456_single_edit Configuration and settings for multi-sensitivity
  • Loading branch information
EmmaLRussell authored Sep 1, 2023
2 parents 204997e + dcb982e commit 70a9512
Show file tree
Hide file tree
Showing 39 changed files with 1,213 additions and 314 deletions.
10 changes: 8 additions & 2 deletions app/static/src/app/components/basic/BasicApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<template v-slot:Sensitivity>
<sensitivity-tab></sensitivity-tab>
</template>
<template v-slot:Multi-sensitivity>
<multi-sensitivity-tab></multi-sensitivity-tab>
</template>
</wodin-tabs>
</template>
</wodin-app>
Expand All @@ -35,10 +38,11 @@ import CodeTab from "../code/CodeTab.vue";
import RunTab from "../run/RunTab.vue";
import OptionsTab from "../options/OptionsTab.vue";
import SensitivityTab from "../sensitivity/SensitivityTab.vue";
import MultiSensitivityTab from "../multiSensitivity/MultiSensitivityTab.vue";
import { AppStateMutation } from "../../store/appState/mutations";
import { VisualisationTab } from "../../store/appState/state";
import HelpTab from "../help/HelpTab.vue";
import includeHelpTab from "../mixins/includeHelpTab";
import includeConfiguredTabs from "../mixins/includeConfiguredTabs";
export default defineComponent({
name: "BasicApp",
Expand All @@ -48,18 +52,20 @@ export default defineComponent({
RunTab,
OptionsTab,
SensitivityTab,
MultiSensitivityTab,
WodinApp,
WodinTabs
},
setup() {
const store = useStore();
const rightTabSelected = (tab: string) => { store.commit(AppStateMutation.SetOpenVisualisationTab, tab); };
const { helpTabName, rightTabNames } = includeHelpTab(store,
const { helpTabName, multiSensitivityTabName, rightTabNames } = includeConfiguredTabs(store,
[VisualisationTab.Run, VisualisationTab.Sensitivity]);
return {
rightTabSelected,
helpTabName,
multiSensitivityTabName,
rightTabNames
};
}
Expand Down
9 changes: 7 additions & 2 deletions app/static/src/app/components/fit/FitApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<template v-slot:Sensitivity>
<sensitivity-tab></sensitivity-tab>
</template>
<template v-slot:Multi-sensitivity>
<multi-sensitivity-tab></multi-sensitivity-tab>
</template>
</wodin-tabs>
</template>
</wodin-app>
Expand All @@ -35,6 +38,7 @@
<script lang="ts">
import { defineComponent } from "vue";
import { useStore } from "vuex";
import MultiSensitivityTab from "@/app/components/multiSensitivity/MultiSensitivityTab.vue";
import WodinApp from "../WodinApp.vue";
import WodinTabs from "../WodinTabs.vue";
import CodeTab from "../code/CodeTab.vue";
Expand All @@ -46,11 +50,12 @@ import OptionsTab from "../options/OptionsTab.vue";
import SensitivityTab from "../sensitivity/SensitivityTab.vue";
import { VisualisationTab } from "../../store/appState/state";
import { AppStateMutation } from "../../store/appState/mutations";
import includeHelpTab from "../mixins/includeHelpTab";
import includeConfiguredTabs from "../mixins/includeConfiguredTabs";
export default defineComponent({
name: "FitApp",
components: {
MultiSensitivityTab,
CodeTab,
DataTab,
FitTab,
Expand All @@ -67,7 +72,7 @@ export default defineComponent({
const rightTabSelected = (tab: string) => {
store.commit(AppStateMutation.SetOpenVisualisationTab, tab);
};
const { helpTabName, rightTabNames } = includeHelpTab(store,
const { helpTabName, rightTabNames } = includeConfiguredTabs(store,
[VisualisationTab.Run, VisualisationTab.Fit, VisualisationTab.Sensitivity]);
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import { Store } from "vuex";
import { computed } from "vue";
import { AppState } from "../../store/appState/state";
import { AppState, VisualisationTab } from "../../store/appState/state";

export default (store: Store<AppState>, nonHelpTabNames: string[]) => {
export default (store: Store<AppState>, fixedTabNames: string[]) => {
const helpTabName = computed(() => {
if (store.state.config?.help?.markdown?.length) {
return store.state.config.help.tabName || "Explanation"; // default if markdown but no tab name
}
// do not show tab if no markdown
return null;
});
const multiSensitivityTabName = computed(() => {
return store.state.config?.multiSensitivity ? VisualisationTab.MultiSensitivity : null;
});
const rightTabNames = computed(() => {
const result = [...nonHelpTabNames];
const result = [...fixedTabNames];
if (multiSensitivityTabName.value) {
result.push(multiSensitivityTabName.value);
}
if (helpTabName.value) {
result.unshift(helpTabName.value);
}
Expand All @@ -20,6 +26,7 @@ export default (store: Store<AppState>, nonHelpTabNames: string[]) => {

return {
helpTabName,
multiSensitivityTabName,
rightTabNames
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
<div class="multi-sensitivity-tab">
Multi-sensitivity coming soon!
</div>
</template>
<script lang="ts">
import { defineComponent } from "vue";
export default defineComponent({
name: "MultiSensitivityTab"
});
</script>
20 changes: 11 additions & 9 deletions app/static/src/app/components/options/EditParamSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<label class="col-form-label">Values</label>
</div>
<div class="col-6">
<tag-input :tags="settingsInternal.customValues" :numeric-only="true" @update="updateUserValues">
<tag-input :tags="settingsInternal.customValues" :numeric-only="true" @update="updateCustomValues">
</tag-input>
</div>
</div>
Expand Down Expand Up @@ -123,10 +123,9 @@

<script lang="ts">
import {
computed, defineComponent, reactive, watch
computed, defineComponent, PropType, reactive, watch
} from "vue";
import { useStore } from "vuex";
import { SensitivityMutation } from "../../store/sensitivity/mutations";
import {
SensitivityParameterSettings,
SensitivityScaleType,
Expand All @@ -139,11 +138,15 @@ import ErrorInfo from "../ErrorInfo.vue";
import TagInput from "./TagInput.vue";
export default defineComponent({
name: "EditParamSettings.vue",
name: "EditParamSettings",
props: {
open: {
type: Boolean,
required: true
},
paramSettings: {
type: Object as PropType<SensitivityParameterSettings>,
required: false
}
},
components: {
Expand All @@ -169,7 +172,7 @@ export default defineComponent({
watch(() => props.open, (newValue) => {
if (newValue) {
Object.assign(settingsInternal, { ...store.state.sensitivity.paramSettings });
Object.assign(settingsInternal, { ...props.paramSettings });
}
});
Expand All @@ -191,7 +194,7 @@ export default defineComponent({
}
return batchParsResult.value?.error;
});
const updateUserValues = (newValues: number[]) => {
const updateCustomValues = (newValues: number[]) => {
// sort and remove duplicates
settingsInternal.customValues = newValues;
};
Expand All @@ -200,8 +203,7 @@ export default defineComponent({
const updateSettings = () => {
// sort custom values
const customValues = settingsInternal.customValues.sort((a, b) => a - b);
store.commit(`sensitivity/${SensitivityMutation.SetParamSettings}`,
{ ...settingsInternal, customValues });
emit("update", { ...settingsInternal, customValues });
close();
};
Expand All @@ -214,7 +216,7 @@ export default defineComponent({
centralValue,
batchPars,
batchParsError,
updateUserValues,
updateCustomValues,
close,
updateSettings
};
Expand Down
59 changes: 32 additions & 27 deletions app/static/src/app/components/options/OptionsTab.vue
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
<template>
<div>
<sensitivity-options v-if="sensitivityOpen"></sensitivity-options>
<vertical-collapse v-if="isFit" title="Link" collapse-id="link-data">
<link-data></link-data>
</vertical-collapse>
<vertical-collapse title="Model Parameters" collapse-id="model-params">
<parameter-values></parameter-values>
</vertical-collapse>
<vertical-collapse title="Run Options" collapse-id="run-options">
<run-options></run-options>
</vertical-collapse>
<vertical-collapse v-if="fitTabIsOpen" title="Optimisation" collapse-id="optimisation">
<optimisation-options></optimisation-options>
</vertical-collapse>
<vertical-collapse title="Graph Settings" collapse-id="graph-settings">
<graph-settings></graph-settings>
</vertical-collapse>
<vertical-collapse v-if="!isStochastic"
title="Advanced Settings"
collapse-id="advanced-settings"
:collapsed-default="true">
<advanced-settings></advanced-settings>
</vertical-collapse>
<vertical-collapse v-if="!isStochastic" title="Saved Parameter Sets" collapse-id="parameter-sets">
<parameter-sets></parameter-sets>
</vertical-collapse>
</div>
<div>
<sensitivity-options v-if="sensitivityOpen || multiSensitivityOpen"
:multi-sensitivity="multiSensitivityOpen"></sensitivity-options>
<vertical-collapse v-if="isFit" title="Link" collapse-id="link-data">
<link-data></link-data>
</vertical-collapse>
<vertical-collapse title="Model Parameters" collapse-id="model-params">
<parameter-values></parameter-values>
</vertical-collapse>
<vertical-collapse title="Run Options" collapse-id="run-options">
<run-options></run-options>
</vertical-collapse>
<vertical-collapse v-if="fitTabIsOpen" title="Optimisation" collapse-id="optimisation">
<optimisation-options></optimisation-options>
</vertical-collapse>
<vertical-collapse title="Graph Settings" collapse-id="graph-settings">
<graph-settings></graph-settings>
</vertical-collapse>
<vertical-collapse v-if="!isStochastic"
title="Advanced Settings"
collapse-id="advanced-settings"
:collapsed-default="true">
<advanced-settings></advanced-settings>
</vertical-collapse>
<vertical-collapse v-if="!isStochastic" title="Saved Parameter Sets" collapse-id="parameter-sets">
<parameter-sets></parameter-sets>
</vertical-collapse>
</div>
</template>

<script lang="ts">
Expand Down Expand Up @@ -61,12 +62,16 @@ export default {
const isStochastic = computed(() => store.state.appType === AppType.Stochastic);
const sensitivityOpen = computed(() => store.state.openVisualisationTab === VisualisationTab.Sensitivity);
const multiSensitivityOpen = computed(() => {
return store.state.openVisualisationTab === VisualisationTab.MultiSensitivity;
});
const fitTabIsOpen = computed(() => store.state.openVisualisationTab === VisualisationTab.Fit);
return {
isFit,
isStochastic,
sensitivityOpen,
multiSensitivityOpen,
fitTabIsOpen
};
}
Expand Down
Loading

0 comments on commit 70a9512

Please sign in to comment.