Fix bug where opening chart directly fails

This commit is contained in:
Matthias 2023-09-14 20:27:41 +02:00
parent 86cee7161d
commit 381cc67c0d
2 changed files with 18 additions and 15 deletions

View File

@ -72,7 +72,7 @@
</div>
<transition name="fade" mode="in-out">
<div v-if="!plotConfigModal" v-show="showPlotConfig" class="w-25 config-sidebar">
<PlotConfigurator :columns="datasetColumns" :as-modal="false" />
<PlotConfigurator :columns="datasetColumns" :is-visible="showPlotConfig ?? false" />
</div>
</transition>
<b-modal
@ -83,7 +83,7 @@
ok-only
hide-backdrop
>
<PlotConfigurator v-if="showPlotConfigModal" :columns="datasetColumns" />
<PlotConfigurator :is-visible="showPlotConfigModal" :columns="datasetColumns" />
</b-modal>
</div>
</template>

View File

@ -166,12 +166,12 @@ import PlotIndicatorSelect from './PlotIndicatorSelect.vue';
import { deepClone } from '@/shared/deepClone';
import { useBotStore } from '@/stores/ftbotwrapper';
import { usePlotConfigStore } from '@/stores/plotConfig';
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
import { computed, ref, watch } from 'vue';
import randomColor from '@/shared/randomColor';
defineProps({
const props = defineProps({
columns: { required: true, type: Array as () => string[] },
asModal: { required: false, default: true, type: Boolean },
isVisible: { required: true, default: false, type: Boolean },
});
const plotStore = usePlotConfigStore();
@ -360,16 +360,19 @@ watch(
},
);
onMounted(() => {
// Deep clone and assign to editable
plotStore.editablePlotConfig = deepClone(plotStore.plotConfig);
plotStore.isEditing = true;
plotConfigNameLoc.value = plotStore.plotConfigName;
});
onUnmounted(() => {
// TODO: Unmounted is not called when closing in Chart view
plotStore.isEditing = false;
});
watch(
() => props.isVisible,
() => {
if (props.isVisible) {
// Deep clone and assign to editable
plotStore.editablePlotConfig = deepClone(plotStore.plotConfig);
plotStore.isEditing = true;
plotConfigNameLoc.value = plotStore.plotConfigName;
} else {
plotStore.isEditing = false;
}
},
);
</script>
<style scoped>