stop the timer and show error messages

This commit is contained in:
Tako 2023-05-24 20:15:28 +00:00
parent e8c50a167a
commit 2f07024f11
3 changed files with 15 additions and 9 deletions

View File

@ -136,7 +136,7 @@ watch(
<style lang="scss"> <style lang="scss">
.pairlist { .pairlist {
padding: 1rem 1rem; padding: 1rem 0;
width: 100%; width: 100%;
border: 1px solid white; border: 1px solid white;
text-align: left; text-align: left;

View File

@ -279,9 +279,12 @@ export interface PairlistsResponse {
} }
export interface PairlistEvalResponse { export interface PairlistEvalResponse {
detail?: string; error?: string;
method?: string[]; status: string;
whitelist?: string[]; result?: {
method: string[];
whitelist: string[];
};
} }
export interface Pairlist { export interface Pairlist {

View File

@ -2,6 +2,7 @@
<div> <div>
<div> <div>
<b-form-select v-model="selectedConfig" :options="configsSelectOptions"></b-form-select> <b-form-select v-model="selectedConfig" :options="configsSelectOptions"></b-form-select>
<p>{{ progressMessage }}</p>
<b-button :disabled="evaluating" @click="test">Test</b-button> <b-button :disabled="evaluating" @click="test">Test</b-button>
<div> <div>
<code v-if="whitelist.length > 0">{{ whitelist }}</code> <code v-if="whitelist.length > 0">{{ whitelist }}</code>
@ -57,16 +58,18 @@ const test = async () => {
whitelist.value = []; whitelist.value = [];
const res = await botStore.activeBot.evaluatePairlist(payload); const res = await botStore.activeBot.evaluatePairlist(payload);
console.log(res); console.log(res);
progressMessage.value = res.status;
const evalIntervalId = setInterval(async () => { const evalIntervalId = setInterval(async () => {
const res = await botStore.activeBot.getPairlistEvalStatus(); const res = await botStore.activeBot.getPairlistEvalStatus();
if (res.status === 'success' && res.result) {
if (res.whitelist) { whitelist.value = res.result.whitelist;
whitelist.value = res.whitelist;
clearInterval(evalIntervalId); clearInterval(evalIntervalId);
evaluating.value = false; evaluating.value = false;
progressMessage.value = ''; progressMessage.value = '';
} else if (res.detail) { } else if (res.error) {
progressMessage.value = res.detail; progressMessage.value = res.error;
clearInterval(evalIntervalId);
evaluating.value = false;
} }
}, 1000); }, 1000);
}; };