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

View File

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