hide config delete button if not saved

This commit is contained in:
Tako 2023-05-30 15:51:19 +00:00
parent 954100eb63
commit 37c06453df
2 changed files with 6 additions and 1 deletions

View File

@ -2,7 +2,7 @@
<b-input-group class="mb-2">
<template #prepend>
<b-button
:disabled="!pairlistStore.config.name"
:disabled="!pairlistStore.isSavedConfig"
variant="danger"
@click="pairlistStore.deleteConfig()"
><i-mdi-close class="fs-4"

View File

@ -39,6 +39,10 @@ export const usePairlistConfigStore = defineStore(
return JSON.stringify(configToPayloadItems(), null, 2);
});
const isSavedConfig = computed(
() => savedConfigs.value.findIndex((c) => c.name === config.value.name) > -1,
);
function addToConfig(pairlist: Pairlist, index: number) {
pairlist = structuredClone(toRaw(pairlist));
for (const param in pairlist.params) {
@ -161,6 +165,7 @@ export const usePairlistConfigStore = defineStore(
newConfig,
addToBlacklist,
removeFromBlacklist,
isSavedConfig,
firstPairlistIsGenerator,
pairlistValid,
};