Don't show signout button in multibot scenario

This commit is contained in:
Matthias 2021-08-29 20:33:48 +02:00
parent a96eb11812
commit 030459023c
4 changed files with 33 additions and 10 deletions

View File

@ -46,13 +46,15 @@ export default class BotList extends Vue {
@ftbot.Action selectBot;
clickRemoveBot(botId: BotDescriptor) {
clickRemoveBot(bot: BotDescriptor) {
//
this.$bvModal.msgBoxConfirm(`Really remove (logout) from ${botId}?`).then((value: boolean) => {
if (value) {
this.removeBot(botId.botId);
}
});
this.$bvModal
.msgBoxConfirm(`Really remove (logout) from '${bot.botName}' (${bot.botId})?`)
.then((value: boolean) => {
if (value) {
this.removeBot(bot.botId);
}
});
}
}
</script>

View File

@ -6,6 +6,7 @@
v-for="bot in allAvailableBots"
:key="bot.botId"
:active="bot.botId === selectedBot"
button
:title="`${bot.botId} - ${bot.botName} - ${bot.botUrl}`"
@click="selectBot(bot.botId)"
>

View File

@ -31,7 +31,13 @@
<!-- Right aligned nav items -->
<b-navbar-nav class="ml-auto" menu-class="w-100">
<b-dropdown size="sm" class="m-1" variant="outline-info">
<b-dropdown
v-if="botCount > 1"
size="sm"
class="m-1"
variant="info"
menu-class="my-0 py-0"
>
<template #button-content>
<BotEntry class="d-inline" :bot="selectedBotObj" :no-buttons="true" />
</template>
@ -49,14 +55,18 @@
<li v-if="hasBots" class="nav-item">
<!-- Hide dropdown on xs, instead show below -->
<b-nav-item-dropdown right class="d-none d-sm-block">
<b-dropdown-item>V: {{ getUiVersion }}</b-dropdown-item>
<template #button-content>
<b-avatar size="2em" button>FT</b-avatar>
</template>
<b-dropdown-item>V: {{ getUiVersion }}</b-dropdown-item>
<router-link class="dropdown-item" to="/settings">Settings</router-link>
<b-checkbox v-model="layoutLockedLocal" class="pl-5">Lock layout</b-checkbox>
<b-dropdown-item @click="resetDynamicLayout">Reset Layout</b-dropdown-item>
<router-link class="dropdown-item" to="/" @click.native="clickLogout()"
<router-link
v-if="botCount === 1"
class="dropdown-item"
to="/"
@click.native="clickLogout()"
>Sign Out</router-link
>
</b-nav-item-dropdown>
@ -66,7 +76,11 @@
<router-link class="dropdown-item" to="/settings">Settings</router-link>
<b-checkbox v-model="layoutLockedLocal" class="pl-5">Lock layout</b-checkbox>
<b-dropdown-item @click="resetDynamicLayout">Reset Layout</b-dropdown-item>
<router-link class="dropdown-item" to="/" @click.native="clickLogout()"
<router-link
v-if="botCount === 1"
class="dropdown-item"
to="/"
@click.native="clickLogout()"
>Sign Out</router-link
>
</div>
@ -122,6 +136,8 @@ export default class NavBar extends Vue {
@ftbot.Getter [MultiBotStoreGetters.hasBots]: boolean;
@ftbot.Getter [MultiBotStoreGetters.botCount]: number;
@ftbot.Getter [BotStoreGetters.botName]: string;
@ftbot.Getter [BotStoreGetters.openTradeCount]: number;

View File

@ -15,6 +15,7 @@ interface FTMultiBotState {
export enum MultiBotStoreGetters {
hasBots = 'hasBots',
botCount = 'botCount',
selectedBot = 'selectedBot',
selectedBotObj = 'selectedBotObj',
allAvailableBots = 'allAvailableBots',
@ -39,6 +40,9 @@ export default function createBotStore(store) {
[MultiBotStoreGetters.hasBots](state: FTMultiBotState): boolean {
return Object.keys(state.availableBots).length > 0;
},
[MultiBotStoreGetters.botCount](state: FTMultiBotState): number {
return Object.keys(state.availableBots).length;
},
[MultiBotStoreGetters.selectedBot](state: FTMultiBotState): string {
return state.selectedBot;
},