mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-26 04:55:15 +00:00
config saving improvements
This commit is contained in:
parent
64d165828b
commit
600c99fca4
|
@ -8,7 +8,7 @@
|
|||
><i-mdi-delete width="24" height="24"
|
||||
/></b-button>
|
||||
|
||||
<b-form-input v-model="pairlistStore.config.name" placeholder="Configuration name..." />
|
||||
<b-form-input v-model="configName" placeholder="Configuration name..." />
|
||||
|
||||
<b-button-group>
|
||||
<b-dropdown variant="dark" title="Saved configs">
|
||||
|
@ -22,10 +22,17 @@
|
|||
<b-button
|
||||
title="Save config"
|
||||
variant="dark"
|
||||
:disabled="!pairlistStore.config.name"
|
||||
@click="pairlistStore.saveConfig()"
|
||||
:disabled="!configName || pairlistStore.config.pairlists.length == 0"
|
||||
@click="pairlistStore.saveConfig(configName)"
|
||||
><i-mdi-content-save width="24" height="24"
|
||||
/></b-button>
|
||||
<b-button
|
||||
title="Clone config"
|
||||
variant="dark"
|
||||
:disabled="!pairlistStore.config.name || !pairlistStore.isSavedConfig"
|
||||
@click="pairlistStore.cloneConfig()"
|
||||
><i-mdi-content-copy width="24" height="24"
|
||||
/></b-button>
|
||||
</b-button-group>
|
||||
<b-button
|
||||
title="New config"
|
||||
|
@ -48,5 +55,15 @@
|
|||
</template>
|
||||
<script setup>
|
||||
import { usePairlistConfigStore } from '@/stores/pairlistConfig';
|
||||
import { ref, watch } from 'vue';
|
||||
const pairlistStore = usePairlistConfigStore();
|
||||
|
||||
const configName = ref(pairlistStore.config.name);
|
||||
|
||||
watch(
|
||||
() => pairlistStore.config.name,
|
||||
() => {
|
||||
configName.value = pairlistStore.config.name;
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
|
|
@ -57,8 +57,9 @@ export const usePairlistConfigStore = defineStore(
|
|||
config.value.pairlists.splice(index, 1);
|
||||
}
|
||||
|
||||
function saveConfig() {
|
||||
function saveConfig(name: string) {
|
||||
const i = savedConfigs.value.findIndex((c) => c.name === config.value.name);
|
||||
config.value.name = name;
|
||||
|
||||
if (i > -1) {
|
||||
savedConfigs.value[i] = config.value;
|
||||
|
@ -67,6 +68,13 @@ export const usePairlistConfigStore = defineStore(
|
|||
}
|
||||
}
|
||||
|
||||
function cloneConfig() {
|
||||
config.value = {
|
||||
name: '',
|
||||
pairlists: structuredClone(toRaw(config.value.pairlists)),
|
||||
};
|
||||
}
|
||||
|
||||
function deleteConfig() {
|
||||
const i = savedConfigs.value.findIndex((c) => c.name === config.value.name);
|
||||
if (i > -1) {
|
||||
|
@ -162,6 +170,7 @@ export const usePairlistConfigStore = defineStore(
|
|||
addToConfig,
|
||||
removeFromConfig,
|
||||
saveConfig,
|
||||
cloneConfig,
|
||||
deleteConfig,
|
||||
selectConfig,
|
||||
newConfig,
|
||||
|
|
Loading…
Reference in New Issue
Block a user