mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-27 05:25:17 +00:00
Show online status for all bots
This commit is contained in:
parent
5f7282cb0a
commit
5a8916f2ce
|
@ -17,6 +17,7 @@
|
|||
<b-button class="btn-xs ml-1" size="sm" title="Delete bot" @click="clickRemoveBot(bot)">
|
||||
<DeleteIcon :size="16" title="Delete trade" />
|
||||
</b-button>
|
||||
{{ allIsBotOnline[bot.botId] ? 'Online' : 'Offline' }}
|
||||
</b-list-group-item>
|
||||
</b-list-group>
|
||||
<LoginModal class="mt-2" login-text="Add new bot" />
|
||||
|
@ -38,6 +39,8 @@ const ftbot = namespace('ftbot');
|
|||
export default class BotList extends Vue {
|
||||
@ftbot.Getter [MultiBotStoreGetters.selectedBot]: string;
|
||||
|
||||
@ftbot.Getter [MultiBotStoreGetters.allIsBotOnline];
|
||||
|
||||
@ftbot.Getter [MultiBotStoreGetters.allAvailableBots]: BotDescriptors;
|
||||
|
||||
@ftbot.Action removeBot;
|
||||
|
|
|
@ -87,7 +87,7 @@ export default class NavBar extends Vue {
|
|||
|
||||
@Getter getUiVersion!: string;
|
||||
|
||||
@ftbot.Action ping;
|
||||
@ftbot.Action pingAll;
|
||||
|
||||
@ftbot.Action getState;
|
||||
|
||||
|
@ -116,9 +116,9 @@ export default class NavBar extends Vue {
|
|||
favicon: Favico | undefined = undefined;
|
||||
|
||||
mounted() {
|
||||
this.ping();
|
||||
this.pingAll();
|
||||
this.loadUIVersion();
|
||||
this.pingInterval = window.setInterval(this.ping, 60000);
|
||||
this.pingInterval = window.setInterval(this.pingAll, 60000);
|
||||
|
||||
if (this.hasBots) {
|
||||
// Query botstate - this will enable / disable certain modes
|
||||
|
|
|
@ -10,6 +10,8 @@ export enum MultiBotStoreGetters {
|
|||
hasBots = 'hasBots',
|
||||
selectedBot = 'selectedBot',
|
||||
allAvailableBots = 'allAvailableBots',
|
||||
allAvailableBotsList = 'allAvailableBotsList',
|
||||
allIsBotOnline = 'allIsBotOnline',
|
||||
nextBotId = 'nextBotId',
|
||||
}
|
||||
|
||||
|
@ -30,6 +32,16 @@ export default function createBotStore(store) {
|
|||
[MultiBotStoreGetters.allAvailableBots](state: FTMultiBotState): BotDescriptors {
|
||||
return state.availableBots;
|
||||
},
|
||||
[MultiBotStoreGetters.allAvailableBotsList](state: FTMultiBotState): string[] {
|
||||
return Object.keys(state.availableBots);
|
||||
},
|
||||
[MultiBotStoreGetters.allIsBotOnline](state: FTMultiBotState, getters): {} {
|
||||
const result = {};
|
||||
getters.allAvailableBotsList.forEach((e) => {
|
||||
result[e] = getters[`${e}/isBotOnline`];
|
||||
});
|
||||
return result;
|
||||
},
|
||||
[MultiBotStoreGetters.nextBotId](state: FTMultiBotState): string {
|
||||
let botCount = Object.keys(state.availableBots).length;
|
||||
|
||||
|
@ -96,6 +108,11 @@ export default function createBotStore(store) {
|
|||
selectBot({ commit }, botId: string) {
|
||||
commit('selectBot', botId);
|
||||
},
|
||||
pingAll({ getters, dispatch }) {
|
||||
getters.allAvailableBotsList.forEach((e) => {
|
||||
dispatch(`${e}/ping`);
|
||||
});
|
||||
},
|
||||
};
|
||||
// Autocreate Actions from botstores
|
||||
Object.keys(BotStoreActions).forEach((e) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user