From 70011435de6bf69571efa1ee7665608869c9b121 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 21 Apr 2022 20:18:28 +0200 Subject: [PATCH] Fix online status --- src/components/BotEntry.vue | 2 +- src/stores/ftbot.ts | 12 ++++++------ src/stores/ftbotwrapper.ts | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/BotEntry.vue b/src/components/BotEntry.vue index 28eab373..fe888ea4 100644 --- a/src/components/BotEntry.vue +++ b/src/components/BotEntry.vue @@ -4,7 +4,7 @@
{{ - botStore.availableBots[bot.botId] ? '🟢' : '🔴' + botStore.botStores[bot.botId].isBotOnline ? '🟢' : '🔴' }} , backtestHistoryList: [] as BacktestHistoryEntry[], - sysinfo: {} as SysInfoResponse, + sysInfo: {} as SysInfoResponse, }; }, getters: { @@ -164,15 +164,16 @@ export function createBotSubStore(botId: string, botName: string) { botAdded() { this.autoRefresh = userService.getAutoRefresh(); }, - async ping() { + async fetchPing() { try { const result = await api.get('/ping'); const now = Date.now(); // TODO: Name collision! - // this.ping = `${result.data.status} ${now.toString()}`; + this.ping = `${result.data.status} ${now.toString()}`; this.isBotOnline = true; return Promise.resolve(); } catch (error) { + console.log('ping fail'); this.isBotOnline = false; return Promise.reject(); } @@ -789,10 +790,9 @@ export function createBotSubStore(botId: string, botName: string) { setBacktestResultKey(key: string) { this.selectedBacktestResultKey = key; }, - async sysInfo() { + async getSysInfo() { try { - // TODO: TYPE me - const { data } = await api.get('/sysinfo'); + const { data } = await api.get('/sysinfo'); this.sysInfo = data; return Promise.resolve(data); } catch (err) { diff --git a/src/stores/ftbotwrapper.ts b/src/stores/ftbotwrapper.ts index ce728a94..564eea7c 100644 --- a/src/stores/ftbotwrapper.ts +++ b/src/stores/ftbotwrapper.ts @@ -266,7 +266,7 @@ export const useBotStore = defineStore('wrapper', { await Promise.all( Object.entries(this.botStores).map(async ([_, v]) => { try { - await v.ping(); + await v.fetchPing(); } catch { // pass }