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