mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-25 04:25:15 +00:00
Improve handling when not logged in
This commit is contained in:
parent
90695c7650
commit
4c08ec9030
|
@ -81,6 +81,14 @@ describe('Login', () => {
|
||||||
cy.get('span').should('contain', 'TestBot');
|
cy.get('span').should('contain', 'TestBot');
|
||||||
// Check API calls have been made.
|
// Check API calls have been made.
|
||||||
cy.wait('@RandomAPICall');
|
cy.wait('@RandomAPICall');
|
||||||
|
// login button gone
|
||||||
|
cy.get('button').should('not.contain', 'Login');
|
||||||
|
|
||||||
|
// Test logout
|
||||||
|
cy.get('[id=avatar-drop]').parent().click();
|
||||||
|
cy.get('.dropdown-menu > a:last').click();
|
||||||
|
cy.get('button').should('contain', 'Login');
|
||||||
|
// login button there again
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Test Login failed - wrong api url', () => {
|
it('Test Login failed - wrong api url', () => {
|
||||||
|
|
|
@ -12,24 +12,15 @@
|
||||||
|
|
||||||
<b-collapse id="nav-collapse" class="text-right text-md-center" is-nav>
|
<b-collapse id="nav-collapse" class="text-right text-md-center" is-nav>
|
||||||
<b-navbar-nav>
|
<b-navbar-nav>
|
||||||
<router-link
|
<router-link v-if="!botStore.canRunBacktest" class="nav-link navbar-nav" to="/trade"
|
||||||
v-if="!botStore.activeBot.canRunBacktest"
|
|
||||||
class="nav-link navbar-nav"
|
|
||||||
to="/trade"
|
|
||||||
>Trade</router-link
|
>Trade</router-link
|
||||||
>
|
>
|
||||||
<router-link
|
<router-link v-if="!botStore.canRunBacktest" class="nav-link navbar-nav" to="/dashboard"
|
||||||
v-if="!botStore.activeBot.canRunBacktest"
|
|
||||||
class="nav-link navbar-nav"
|
|
||||||
to="/dashboard"
|
|
||||||
>Dashboard</router-link
|
>Dashboard</router-link
|
||||||
>
|
>
|
||||||
<router-link class="nav-link navbar-nav" to="/graph">Chart</router-link>
|
<router-link class="nav-link navbar-nav" to="/graph">Chart</router-link>
|
||||||
<router-link class="nav-link navbar-nav" to="/logs">Logs</router-link>
|
<router-link class="nav-link navbar-nav" to="/logs">Logs</router-link>
|
||||||
<router-link
|
<router-link v-if="botStore.canRunBacktest" class="nav-link navbar-nav" to="/backtest"
|
||||||
v-if="botStore.activeBot.canRunBacktest"
|
|
||||||
class="nav-link navbar-nav"
|
|
||||||
to="/backtest"
|
|
||||||
>Backtest</router-link
|
>Backtest</router-link
|
||||||
>
|
>
|
||||||
<BootswatchThemeSelect />
|
<BootswatchThemeSelect />
|
||||||
|
@ -57,10 +48,17 @@
|
||||||
</div>
|
</div>
|
||||||
<li class="d-none d-sm-block nav-item text-secondary mr-2">
|
<li class="d-none d-sm-block nav-item text-secondary mr-2">
|
||||||
<b-nav-text class="verticalCenter small mr-2">
|
<b-nav-text class="verticalCenter small mr-2">
|
||||||
{{ botStore.activeBot.botName || 'No bot selected' }}
|
{{
|
||||||
|
(botStore.activeBotorUndefined && botStore.activeBotorUndefined.botName) ||
|
||||||
|
'No bot selected'
|
||||||
|
}}
|
||||||
</b-nav-text>
|
</b-nav-text>
|
||||||
<b-nav-text class="verticalCenter">
|
<b-nav-text class="verticalCenter">
|
||||||
{{ botStore.activeBot.isBotOnline ? 'Online' : 'Offline' }}
|
{{
|
||||||
|
botStore.activeBotorUndefined && botStore.activeBotorUndefined.isBotOnline
|
||||||
|
? 'Online'
|
||||||
|
: 'Offline'
|
||||||
|
}}
|
||||||
</b-nav-text>
|
</b-nav-text>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="botStore.hasBots" class="nav-item">
|
<li v-if="botStore.hasBots" class="nav-item">
|
||||||
|
@ -86,10 +84,17 @@
|
||||||
<li class="nav-item text-secondary ml-2 d-sm-none d-flex justify-content-between">
|
<li class="nav-item text-secondary ml-2 d-sm-none d-flex justify-content-between">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<b-nav-text class="verticalCenter small mr-2">
|
<b-nav-text class="verticalCenter small mr-2">
|
||||||
{{ botStore.activeBot.botName || 'No bot selected' }}
|
{{
|
||||||
|
(botStore.activeBotorUndefined && botStore.activeBotorUndefined.botName) ||
|
||||||
|
'No bot selected'
|
||||||
|
}}
|
||||||
</b-nav-text>
|
</b-nav-text>
|
||||||
<b-nav-text class="verticalCenter">
|
<b-nav-text class="verticalCenter">
|
||||||
{{ botStore.activeBot.isBotOnline ? 'Online' : 'Offline' }}
|
{{
|
||||||
|
botStore.activeBotorUndefined && botStore.activeBotorUndefined.isBotOnline
|
||||||
|
? 'Online'
|
||||||
|
: 'Offline'
|
||||||
|
}}
|
||||||
</b-nav-text>
|
</b-nav-text>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
@ -175,10 +180,10 @@ export default defineComponent({
|
||||||
const setTitle = () => {
|
const setTitle = () => {
|
||||||
let title = 'freqUI';
|
let title = 'freqUI';
|
||||||
if (settingsStore.openTradesInTitle === OpenTradeVizOptions.asTitle) {
|
if (settingsStore.openTradesInTitle === OpenTradeVizOptions.asTitle) {
|
||||||
title = `(${botStore.activeBot.openTradeCount}) ${title}`;
|
title = `(${botStore.activeBotorUndefined?.openTradeCount}) ${title}`;
|
||||||
}
|
}
|
||||||
if (botStore.activeBot.botName) {
|
if (botStore.activeBotorUndefined?.botName) {
|
||||||
title = `${title} - ${botStore.activeBot.botName}`;
|
title = `${title} - ${botStore.activeBotorUndefined?.botName}`;
|
||||||
}
|
}
|
||||||
document.title = title;
|
document.title = title;
|
||||||
};
|
};
|
||||||
|
@ -203,16 +208,16 @@ export default defineComponent({
|
||||||
const needsUpdate = settingsStore.openTradesInTitle !== state.openTradesInTitle;
|
const needsUpdate = settingsStore.openTradesInTitle !== state.openTradesInTitle;
|
||||||
if (needsUpdate) {
|
if (needsUpdate) {
|
||||||
setTitle();
|
setTitle();
|
||||||
setOpenTradesAsPill(botStore.activeBot.openTradeCount);
|
setOpenTradesAsPill(botStore.activeBotorUndefined?.openTradeCount || 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => botStore.activeBot.botName,
|
() => botStore.activeBotorUndefined?.botName,
|
||||||
() => setTitle(),
|
() => setTitle(),
|
||||||
);
|
);
|
||||||
watch(
|
watch(
|
||||||
() => botStore.activeBot.openTradeCount,
|
() => botStore.activeBotorUndefined?.openTradeCount,
|
||||||
() => {
|
() => {
|
||||||
console.log('openTradeCount changed');
|
console.log('openTradeCount changed');
|
||||||
if (settingsStore.openTradesInTitle === OpenTradeVizOptions.showPill) {
|
if (settingsStore.openTradesInTitle === OpenTradeVizOptions.showPill) {
|
||||||
|
|
|
@ -3,43 +3,23 @@
|
||||||
<!-- Only visible on xs (phone) viewport! -->
|
<!-- Only visible on xs (phone) viewport! -->
|
||||||
<hr class="my-0" />
|
<hr class="my-0" />
|
||||||
<div class="d-flex flex-align-center justify-content-center">
|
<div class="d-flex flex-align-center justify-content-center">
|
||||||
<router-link
|
<router-link v-if="!botStore.canRunBacktest" class="nav-link navbar-nav" to="/open_trades">
|
||||||
v-if="!botStore.activeBot.canRunBacktest"
|
|
||||||
class="nav-link navbar-nav"
|
|
||||||
to="/open_trades"
|
|
||||||
>
|
|
||||||
<OpenTradesIcon />
|
<OpenTradesIcon />
|
||||||
Trades
|
Trades
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link
|
<router-link v-if="!botStore.canRunBacktest" class="nav-link navbar-nav" to="/trade_history">
|
||||||
v-if="!botStore.activeBot.canRunBacktest"
|
|
||||||
class="nav-link navbar-nav"
|
|
||||||
to="/trade_history"
|
|
||||||
>
|
|
||||||
<ClosedTradesIcon />
|
<ClosedTradesIcon />
|
||||||
History
|
History
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link
|
<router-link v-if="!botStore.canRunBacktest" class="nav-link navbar-nav" to="/pairlist">
|
||||||
v-if="!botStore.activeBot.canRunBacktest"
|
|
||||||
class="nav-link navbar-nav"
|
|
||||||
to="/pairlist"
|
|
||||||
>
|
|
||||||
<PairListIcon />
|
<PairListIcon />
|
||||||
Pairlist
|
Pairlist
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link
|
<router-link v-if="!botStore.canRunBacktest" class="nav-link navbar-nav" to="/balance">
|
||||||
v-if="!botStore.activeBot.canRunBacktest"
|
|
||||||
class="nav-link navbar-nav"
|
|
||||||
to="/balance"
|
|
||||||
>
|
|
||||||
<BalanceIcon />
|
<BalanceIcon />
|
||||||
Balance
|
Balance
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link
|
<router-link v-if="!botStore.canRunBacktest" class="nav-link navbar-nav" to="/dashboard">
|
||||||
v-if="!botStore.activeBot.canRunBacktest"
|
|
||||||
class="nav-link navbar-nav"
|
|
||||||
to="/dashboard"
|
|
||||||
>
|
|
||||||
<DashboardIcon />
|
<DashboardIcon />
|
||||||
Dashboard
|
Dashboard
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
|
@ -41,6 +41,8 @@ export const useBotStore = defineStore('wrapper', {
|
||||||
botCount: (state) => Object.keys(state.availableBots).length,
|
botCount: (state) => Object.keys(state.availableBots).length,
|
||||||
allBotStores: (state) => Object.values(state.botStores),
|
allBotStores: (state) => Object.values(state.botStores),
|
||||||
activeBot: (state) => state.botStores[state.selectedBot] as BotSubStore,
|
activeBot: (state) => state.botStores[state.selectedBot] as BotSubStore,
|
||||||
|
activeBotorUndefined: (state) => state.botStores[state.selectedBot] as BotSubStore | undefined,
|
||||||
|
canRunBacktest: (state) => state.botStores[state.selectedBot]?.canRunBacktest ?? false,
|
||||||
selectedBotObj: (state) => state.availableBots[state.selectedBot],
|
selectedBotObj: (state) => state.availableBots[state.selectedBot],
|
||||||
nextBotId: (state) => {
|
nextBotId: (state) => {
|
||||||
let botCount = Object.keys(state.availableBots).length;
|
let botCount = Object.keys(state.availableBots).length;
|
||||||
|
@ -149,6 +151,8 @@ export const useBotStore = defineStore('wrapper', {
|
||||||
botStore.botAdded();
|
botStore.botAdded();
|
||||||
this.botStores[bot.botId] = botStore;
|
this.botStores[bot.botId] = botStore;
|
||||||
this.availableBots[bot.botId] = bot;
|
this.availableBots[bot.botId] = bot;
|
||||||
|
this.botStores = { ...this.botStores };
|
||||||
|
this.availableBots = { ...this.availableBots };
|
||||||
},
|
},
|
||||||
renameBot(bot: RenameBotPayload) {
|
renameBot(bot: RenameBotPayload) {
|
||||||
if (!Object.keys(this.availableBots).includes(bot.botId)) {
|
if (!Object.keys(this.availableBots).includes(bot.botId)) {
|
||||||
|
@ -166,6 +170,8 @@ export const useBotStore = defineStore('wrapper', {
|
||||||
|
|
||||||
delete this.botStores[botId];
|
delete this.botStores[botId];
|
||||||
delete this.availableBots[botId];
|
delete this.availableBots[botId];
|
||||||
|
this.botStores = { ...this.botStores };
|
||||||
|
this.availableBots = { ...this.availableBots };
|
||||||
// commit('removeBot', botId);
|
// commit('removeBot', botId);
|
||||||
} else {
|
} else {
|
||||||
console.warn(`bot ${botId} not found! could not remove`);
|
console.warn(`bot ${botId} not found! could not remove`);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user