frequi_origin/src/components/ftbot/PairlistConfigResults.vue

66 lines
1.9 KiB
Vue
Raw Normal View History

<template>
2023-05-30 18:50:04 +00:00
<div>
<div v-if="whitelist.length > 0" class="d-flex flex-column flex-lg-row px-2">
2023-05-31 10:32:36 +00:00
<!-- TODO: look into flexbox solution to have overflow scroll? -->
<b-list-group class="col-12 col-md-2 overflow-auto" style="height: calc(100vh - 135px)">
<b-list-group-item
v-for="(pair, i) in whitelist"
:key="pair.pair"
button
class="d-flex justify-content-between align-items-center py-1"
:active="pair.pair === botStore.activeBot.selectedPair"
:title="pair.pair"
@click="botStore.activeBot.selectedPair = pair.pair"
>
<b-form-checkbox v-model="whitelist[i].enabled"></b-form-checkbox>
{{ pair.pair }}
</b-list-group-item>
</b-list-group>
2023-05-30 18:50:04 +00:00
<div class="flex-fill">
<ChartView />
</div>
<div class="col-12 col-md-2">
<CopyableTextfield
2023-05-31 10:32:36 +00:00
style="height: calc(100vh - 135px)"
class="overflow-auto"
2023-05-30 18:50:04 +00:00
:content="
JSON.stringify(
whitelist.filter((p) => p.enabled === true).map((p) => p.pair),
null,
2,
)
"
/>
</div>
2023-05-30 18:43:35 +00:00
</div>
2023-05-30 18:50:04 +00:00
<div v-else>
<p>Evaluation returned 0 pairs</p>
2023-05-30 18:43:35 +00:00
</div>
</div>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue';
2023-05-26 17:45:52 +00:00
import { useBotStore } from '@/stores/ftbotwrapper';
import { usePairlistConfigStore } from '@/stores/pairlistConfig';
import ChartView from '@/views/ChartsView.vue';
import CopyableTextfield from '@/components/general/CopyableTextfield.vue';
2023-05-26 17:45:52 +00:00
const botStore = useBotStore();
const pairlistStore = usePairlistConfigStore();
2023-05-26 17:45:52 +00:00
const whitelist = ref<{ enabled: boolean; pair: string }[]>([]);
watch(
() => pairlistStore.whitelist,
() => {
whitelist.value = pairlistStore.whitelist.map((p) => {
return {
enabled: true,
pair: p,
};
});
},
2023-05-26 17:45:52 +00:00
);
</script>