mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-10 18:23:50 +00:00
Add Sysinfo endpoint
This commit is contained in:
parent
a24a93411e
commit
67cb1af105
|
@ -30,6 +30,7 @@ import {
|
|||
PairHistory,
|
||||
LogLine,
|
||||
BacktestSteps,
|
||||
SysInfoResponse,
|
||||
} from '@/types';
|
||||
|
||||
import {
|
||||
|
@ -70,6 +71,7 @@ export enum BotStoreGetters {
|
|||
stakeCurrencyDecimals = 'stakeCurrencyDecimals',
|
||||
strategyPlotConfig = 'strategyPlotConfig',
|
||||
version = 'version',
|
||||
sysinfo = 'sysinfo',
|
||||
profit = 'profit',
|
||||
botState = 'botState',
|
||||
whitelist = 'whitelist',
|
||||
|
@ -136,6 +138,7 @@ export enum BotStoreActions {
|
|||
pollBacktest = 'pollBacktest',
|
||||
removeBacktest = 'removeBacktest',
|
||||
stopBacktest = 'stopBacktest',
|
||||
sysInfo = 'sysInfo',
|
||||
logout = 'logout',
|
||||
}
|
||||
|
||||
|
@ -244,6 +247,9 @@ export function createBotSubStore(botId: string, botName: string) {
|
|||
[BotStoreGetters.version](state: FtbotStateType): string {
|
||||
return state.version;
|
||||
},
|
||||
[BotStoreGetters.version](state: FtbotStateType): SysInfoResponse | {} {
|
||||
return state.sysinfo;
|
||||
},
|
||||
[BotStoreGetters.profit](state: FtbotStateType): ProfitInterface | {} {
|
||||
return state.profit;
|
||||
},
|
||||
|
@ -423,6 +429,9 @@ export function createBotSubStore(botId: string, botName: string) {
|
|||
setBacktestResultKey(state: FtbotStateType, key: string) {
|
||||
state.selectedBacktestResultKey = key;
|
||||
},
|
||||
updateSysInfo(state, sysinfo: SysInfoResponse) {
|
||||
state.sysinfo = sysinfo;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
[BotStoreActions.botAdded]({ commit }) {
|
||||
|
@ -942,6 +951,15 @@ export function createBotSubStore(botId: string, botName: string) {
|
|||
return Promise.reject(err);
|
||||
}
|
||||
},
|
||||
async [BotStoreActions.sysInfo]({ commit }) {
|
||||
try {
|
||||
const result = await api.get('/sysinfo');
|
||||
commit('updateSysInfo', result.data);
|
||||
return Promise.resolve(result.data);
|
||||
} catch (err) {
|
||||
return Promise.reject(err);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
StrategyBacktestResult,
|
||||
BacktestSteps,
|
||||
LogLine,
|
||||
SysInfoResponse,
|
||||
} from '@/types';
|
||||
|
||||
export interface FtbotStateType {
|
||||
|
@ -56,6 +57,7 @@ export interface FtbotStateType {
|
|||
backtestResult?: BacktestResult;
|
||||
selectedBacktestResultKey: string;
|
||||
backtestHistory: Record<string, StrategyBacktestResult>;
|
||||
sysinfo: SysInfoResponse | {};
|
||||
}
|
||||
|
||||
const state = (): FtbotStateType => {
|
||||
|
@ -98,6 +100,7 @@ const state = (): FtbotStateType => {
|
|||
backtestResult: undefined,
|
||||
selectedBacktestResultKey: '',
|
||||
backtestHistory: {},
|
||||
sysinfo: {},
|
||||
};
|
||||
};
|
||||
export default state;
|
||||
|
|
|
@ -134,3 +134,8 @@ export interface PairHistory {
|
|||
/** Data end date in as millisecond timestamp */
|
||||
data_stop_ts: number;
|
||||
}
|
||||
|
||||
export interface SysInfoResponse {
|
||||
cpu_pct: number[];
|
||||
ram_pct: number;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user