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">
.pairlist {
padding: 1rem 1rem;
padding: 1rem 0;
width: 100%;
border: 1px solid white;
text-align: left;

View File

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

View File

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