mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-25 12:35:15 +00:00
Don't use emit when updating config
This commit is contained in:
parent
c5da60c090
commit
7cd5f094e1
|
@ -125,7 +125,7 @@ import { getCustomPlotConfig } from '@/shared/storage';
|
||||||
import PlotIndicator from '@/components/charts/PlotIndicator.vue';
|
import PlotIndicator from '@/components/charts/PlotIndicator.vue';
|
||||||
import { showAlert } from '@/stores/alerts';
|
import { showAlert } from '@/stores/alerts';
|
||||||
|
|
||||||
import { defineComponent, computed, ref, watch, onMounted } from 'vue';
|
import { defineComponent, computed, ref, onMounted } from 'vue';
|
||||||
import { useBotStore } from '@/stores/ftbotwrapper';
|
import { useBotStore } from '@/stores/ftbotwrapper';
|
||||||
import { usePlotConfigStore } from '@/stores/plotConfig';
|
import { usePlotConfigStore } from '@/stores/plotConfig';
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ export default defineComponent({
|
||||||
asModal: { required: false, default: true, type: Boolean },
|
asModal: { required: false, default: true, type: Boolean },
|
||||||
},
|
},
|
||||||
emits: ['input'],
|
emits: ['input'],
|
||||||
setup(props, { emit }) {
|
setup() {
|
||||||
const plotStore = usePlotConfigStore();
|
const plotStore = usePlotConfigStore();
|
||||||
|
|
||||||
const plotConfig = ref<PlotConfig>(EMPTY_PLOTCONFIG);
|
const plotConfig = ref<PlotConfig>(EMPTY_PLOTCONFIG);
|
||||||
|
@ -193,7 +193,7 @@ export default defineComponent({
|
||||||
plotConfig.value = { ...plotConfig.value };
|
plotConfig.value = { ...plotConfig.value };
|
||||||
// Reset random color
|
// Reset random color
|
||||||
addNewIndicator.value = false;
|
addNewIndicator.value = false;
|
||||||
emit('input', plotConfig.value);
|
plotStore.setPlotConfig(plotConfig.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const selIndicator = computed({
|
const selIndicator = computed({
|
||||||
|
@ -250,7 +250,7 @@ export default defineComponent({
|
||||||
plotConfig.value = { ...plotConfig.value };
|
plotConfig.value = { ...plotConfig.value };
|
||||||
console.log(plotConfig.value);
|
console.log(plotConfig.value);
|
||||||
selIndicatorName.value = '';
|
selIndicatorName.value = '';
|
||||||
emit('input', plotConfig.value);
|
plotStore.setPlotConfig(plotConfig.value);
|
||||||
};
|
};
|
||||||
const addSubplot = () => {
|
const addSubplot = () => {
|
||||||
plotConfig.value.subplots = {
|
plotConfig.value.subplots = {
|
||||||
|
@ -260,27 +260,27 @@ export default defineComponent({
|
||||||
selSubPlot.value = newSubplotName.value;
|
selSubPlot.value = newSubplotName.value;
|
||||||
newSubplotName.value = '';
|
newSubplotName.value = '';
|
||||||
|
|
||||||
console.log(plotConfig.value);
|
plotStore.setPlotConfig(plotConfig.value);
|
||||||
emit('input', plotConfig.value);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const delSubplot = () => {
|
const delSubplot = () => {
|
||||||
delete plotConfig.value.subplots[selSubPlot.value];
|
delete plotConfig.value.subplots[selSubPlot.value];
|
||||||
plotConfig.value.subplots = { ...plotConfig.value.subplots };
|
plotConfig.value.subplots = { ...plotConfig.value.subplots };
|
||||||
selSubPlot.value = '';
|
selSubPlot.value = '';
|
||||||
|
plotStore.setPlotConfig(plotConfig.value);
|
||||||
};
|
};
|
||||||
const loadPlotConfig = () => {
|
const loadPlotConfig = () => {
|
||||||
plotConfig.value = getCustomPlotConfig(plotConfigNameLoc.value);
|
plotConfig.value = getCustomPlotConfig(plotConfigNameLoc.value);
|
||||||
console.log(plotConfig.value);
|
console.log(plotConfig.value);
|
||||||
console.log('loading config');
|
console.log('loading config');
|
||||||
emit('input', plotConfig.value);
|
plotStore.setPlotConfig(plotConfig.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadConfigFromString = () => {
|
const loadConfigFromString = () => {
|
||||||
// this.plotConfig = JSON.parse();
|
// this.plotConfig = JSON.parse();
|
||||||
if (tempPlotConfig.value !== undefined && tempPlotConfigValid.value) {
|
if (tempPlotConfig.value !== undefined && tempPlotConfigValid.value) {
|
||||||
plotConfig.value = tempPlotConfig.value;
|
plotConfig.value = tempPlotConfig.value;
|
||||||
emit('input', plotConfig.value);
|
plotStore.setPlotConfig(plotConfig.value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const resetConfig = () => {
|
const resetConfig = () => {
|
||||||
|
@ -292,7 +292,7 @@ export default defineComponent({
|
||||||
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;
|
||||||
emit('input', plotConfig.value);
|
plotStore.setPlotConfig(plotConfig.value);
|
||||||
}
|
}
|
||||||
} catch (data) {
|
} catch (data) {
|
||||||
//
|
//
|
||||||
|
|
|
@ -35,5 +35,9 @@ export const usePlotConfigStore = defineStore('plotConfig', {
|
||||||
this.plotConfig = getCustomPlotConfig(this.plotConfigName);
|
this.plotConfig = getCustomPlotConfig(this.plotConfigName);
|
||||||
this.setPlotConfigName(this.plotConfigName);
|
this.setPlotConfigName(this.plotConfigName);
|
||||||
},
|
},
|
||||||
|
setPlotConfig(plotConfig: PlotConfig) {
|
||||||
|
console.log('emit...');
|
||||||
|
this.plotConfig = { ...plotConfig };
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user