mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-22 19:15:15 +00:00
Add "from-String" method to plotconfigurator
This commit is contained in:
parent
0a30561bed
commit
bdc0673110
|
@ -79,9 +79,26 @@
|
|||
>Show</b-button
|
||||
>
|
||||
</div>
|
||||
<div class="col-mb-3 ml-2">
|
||||
<b-button
|
||||
variant="primary"
|
||||
@click="loadConfigFromString"
|
||||
size="sm"
|
||||
v-if="showConfig"
|
||||
title="Load configuration from text box below"
|
||||
>Load from String</b-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-mb-5 ml-2" v-if="showConfig">
|
||||
<b-textarea id="TextArea" class="textArea" v-model="plotConfigJson" size="sm"> </b-textarea>
|
||||
<div class="col-mb-5 ml-2 mt-2" v-if="showConfig">
|
||||
<b-textarea
|
||||
id="TextArea"
|
||||
class="textArea"
|
||||
v-model="plotConfigJson"
|
||||
size="sm"
|
||||
:state="tempPlotConfigValid"
|
||||
>
|
||||
</b-textarea>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -122,6 +139,10 @@ export default class PlotConfigurator extends Vue {
|
|||
|
||||
selField = '';
|
||||
|
||||
tempPlotConfig?: PlotConfig = undefined;
|
||||
|
||||
tempPlotConfigValid = true;
|
||||
|
||||
selColor = randomColor();
|
||||
|
||||
@ftbot.Mutation
|
||||
|
@ -131,6 +152,16 @@ export default class PlotConfigurator extends Vue {
|
|||
return JSON.stringify(this.plotConfig, null, 2);
|
||||
}
|
||||
|
||||
set plotConfigJson(newValue: string) {
|
||||
try {
|
||||
this.tempPlotConfig = JSON.parse(newValue);
|
||||
// TODO: Should Validate schema validity (should be PlotConfig type...)
|
||||
this.tempPlotConfigValid = true;
|
||||
} catch (err) {
|
||||
this.tempPlotConfigValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
get subplots() {
|
||||
// Subplot keys (for selection window)
|
||||
return Object.keys(this.plotConfig.subplots);
|
||||
|
@ -194,6 +225,14 @@ export default class PlotConfigurator extends Vue {
|
|||
console.log('loading config');
|
||||
this.emitPlotConfig();
|
||||
}
|
||||
|
||||
loadConfigFromString() {
|
||||
// this.plotConfig = JSON.parse();
|
||||
if (this.tempPlotConfig !== undefined && this.tempPlotConfigValid) {
|
||||
this.plotConfig = this.tempPlotConfig;
|
||||
this.emitPlotConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user