use plotStore instead of vmodel for plotConfigurator

This commit is contained in:
Matthias 2022-11-01 15:52:11 +01:00
parent e99deff46f
commit c5da60c090
2 changed files with 6 additions and 16 deletions

View File

@ -9,7 +9,7 @@
hide-backdrop hide-backdrop
button-size="sm" button-size="sm"
> >
<PlotConfigurator v-model="plotStore.plotConfig" :columns="datasetColumns" /> <PlotConfigurator :columns="datasetColumns" />
</b-modal> </b-modal>
<div class="row mr-0"> <div class="row mr-0">
@ -85,11 +85,7 @@
</div> </div>
<transition name="fade" mode="in-out"> <transition name="fade" mode="in-out">
<div v-if="!plotConfigModal" v-show="showPlotConfig" class="w-25 config-sidebar"> <div v-if="!plotConfigModal" v-show="showPlotConfig" class="w-25 config-sidebar">
<PlotConfigurator <PlotConfigurator :columns="datasetColumns" :as-modal="false" />
v-model="plotStore.plotConfig"
:columns="datasetColumns"
:as-modal="false"
/>
</div> </div>
</transition> </transition>
</div> </div>

View File

@ -133,13 +133,11 @@ export default defineComponent({
name: 'PlotConfigurator', name: 'PlotConfigurator',
components: { PlotIndicator }, components: { PlotIndicator },
props: { props: {
value: { type: Object as () => PlotConfig, required: true },
columns: { required: true, type: Array as () => string[] }, columns: { required: true, type: Array as () => string[] },
asModal: { required: false, default: true, type: Boolean }, asModal: { required: false, default: true, type: Boolean },
}, },
emits: ['input'], emits: ['input'],
setup(props, { emit }) { setup(props, { emit }) {
const botStore = useBotStore();
const plotStore = usePlotConfigStore(); const plotStore = usePlotConfigStore();
const plotConfig = ref<PlotConfig>(EMPTY_PLOTCONFIG); const plotConfig = ref<PlotConfig>(EMPTY_PLOTCONFIG);
@ -290,6 +288,7 @@ export default defineComponent({
}; };
const loadPlotConfigFromStrategy = async () => { const loadPlotConfigFromStrategy = async () => {
try { try {
const botStore = useBotStore();
await botStore.activeBot.getStrategyPlotConfig(); await botStore.activeBot.getStrategyPlotConfig();
if (botStore.activeBot.strategyPlotConfig) { if (botStore.activeBot.strategyPlotConfig) {
plotConfig.value = botStore.activeBot.strategyPlotConfig; plotConfig.value = botStore.activeBot.strategyPlotConfig;
@ -305,19 +304,14 @@ export default defineComponent({
plotStore.saveCustomPlotConfig({ [plotConfigNameLoc.value]: plotConfig.value }); plotStore.saveCustomPlotConfig({ [plotConfigNameLoc.value]: plotConfig.value });
}; };
watch(props.value, () => {
console.log('config value');
plotConfig.value = props.value;
plotConfigNameLoc.value = plotStore.plotConfigName;
});
onMounted(() => { onMounted(() => {
console.log('Config Mounted', props.value); // console.log('Config Mounted', props.value);
plotConfig.value = props.value; plotConfig.value = plotStore.plotConfig;
plotConfigNameLoc.value = plotStore.plotConfigName; plotConfigNameLoc.value = plotStore.plotConfigName;
}); });
return { return {
plotStore,
removeIndicator, removeIndicator,
addSubplot, addSubplot,
delSubplot, delSubplot,