mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-25 12:35:15 +00:00
Fix online status
This commit is contained in:
parent
0c731255ab
commit
70011435de
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<div class="align-items-center d-flex">
|
<div class="align-items-center d-flex">
|
||||||
<span class="ml-2 mr-1 align-middle">{{
|
<span class="ml-2 mr-1 align-middle">{{
|
||||||
botStore.availableBots[bot.botId] ? '🟢' : '🔴'
|
botStore.botStores[bot.botId].isBotOnline ? '🟢' : '🔴'
|
||||||
}}</span>
|
}}</span>
|
||||||
<b-form-checkbox
|
<b-form-checkbox
|
||||||
v-model="autoRefreshLoc"
|
v-model="autoRefreshLoc"
|
||||||
|
|
|
@ -98,7 +98,7 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
selectedBacktestResultKey: '',
|
selectedBacktestResultKey: '',
|
||||||
backtestHistory: {} as Record<string, StrategyBacktestResult>,
|
backtestHistory: {} as Record<string, StrategyBacktestResult>,
|
||||||
backtestHistoryList: [] as BacktestHistoryEntry[],
|
backtestHistoryList: [] as BacktestHistoryEntry[],
|
||||||
sysinfo: {} as SysInfoResponse,
|
sysInfo: {} as SysInfoResponse,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
|
@ -164,15 +164,16 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
botAdded() {
|
botAdded() {
|
||||||
this.autoRefresh = userService.getAutoRefresh();
|
this.autoRefresh = userService.getAutoRefresh();
|
||||||
},
|
},
|
||||||
async ping() {
|
async fetchPing() {
|
||||||
try {
|
try {
|
||||||
const result = await api.get('/ping');
|
const result = await api.get('/ping');
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
// TODO: Name collision!
|
// TODO: Name collision!
|
||||||
// this.ping = `${result.data.status} ${now.toString()}`;
|
this.ping = `${result.data.status} ${now.toString()}`;
|
||||||
this.isBotOnline = true;
|
this.isBotOnline = true;
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log('ping fail');
|
||||||
this.isBotOnline = false;
|
this.isBotOnline = false;
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
|
@ -789,10 +790,9 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
setBacktestResultKey(key: string) {
|
setBacktestResultKey(key: string) {
|
||||||
this.selectedBacktestResultKey = key;
|
this.selectedBacktestResultKey = key;
|
||||||
},
|
},
|
||||||
async sysInfo() {
|
async getSysInfo() {
|
||||||
try {
|
try {
|
||||||
// TODO: TYPE me
|
const { data } = await api.get<SysInfoResponse>('/sysinfo');
|
||||||
const { data } = await api.get('/sysinfo');
|
|
||||||
this.sysInfo = data;
|
this.sysInfo = data;
|
||||||
return Promise.resolve(data);
|
return Promise.resolve(data);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
@ -266,7 +266,7 @@ export const useBotStore = defineStore('wrapper', {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
Object.entries(this.botStores).map(async ([_, v]) => {
|
Object.entries(this.botStores).map(async ([_, v]) => {
|
||||||
try {
|
try {
|
||||||
await v.ping();
|
await v.fetchPing();
|
||||||
} catch {
|
} catch {
|
||||||
// pass
|
// pass
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user