mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-27 05:25:17 +00:00
Fix some things with multibot login
This commit is contained in:
parent
ebe3ce21d5
commit
b90e376b37
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div v-if="botCount > 0">
|
||||||
<h3 v-if="!small">Available bots</h3>
|
<h3 v-if="!small">Available bots</h3>
|
||||||
<b-list-group>
|
<b-list-group>
|
||||||
<b-list-group-item
|
<b-list-group-item
|
||||||
|
@ -31,6 +31,8 @@ const ftbot = namespace('ftbot');
|
||||||
export default class BotList extends Vue {
|
export default class BotList extends Vue {
|
||||||
@Prop({ default: false, type: Boolean }) small!: boolean;
|
@Prop({ default: false, type: Boolean }) small!: boolean;
|
||||||
|
|
||||||
|
@ftbot.Getter [MultiBotStoreGetters.botCount]: number;
|
||||||
|
|
||||||
@ftbot.Getter [MultiBotStoreGetters.selectedBot]: string;
|
@ftbot.Getter [MultiBotStoreGetters.selectedBot]: string;
|
||||||
|
|
||||||
@ftbot.Getter [MultiBotStoreGetters.allIsBotOnline]: Record<string, boolean>;
|
@ftbot.Getter [MultiBotStoreGetters.allIsBotOnline]: Record<string, boolean>;
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
<b-form-input
|
<b-form-input
|
||||||
id="name-input"
|
id="name-input"
|
||||||
v-model="auth.botName"
|
v-model="auth.botName"
|
||||||
required
|
|
||||||
placeholder="Bot Name"
|
placeholder="Bot Name"
|
||||||
@keydown.enter.native="handleOk"
|
@keydown.enter.native="handleOk"
|
||||||
></b-form-input>
|
></b-form-input>
|
||||||
|
@ -85,9 +84,14 @@ export default class Login extends Vue {
|
||||||
|
|
||||||
@ftbot.Getter [MultiBotStoreGetters.nextBotId]: string;
|
@ftbot.Getter [MultiBotStoreGetters.nextBotId]: string;
|
||||||
|
|
||||||
|
@ftbot.Getter [MultiBotStoreGetters.selectedBot]: string;
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
@ftbot.Action addBot!: (payload: BotDescriptor) => void;
|
@ftbot.Action addBot!: (payload: BotDescriptor) => void;
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
@ftbot.Action selectBot!: (botId: string) => void;
|
||||||
|
|
||||||
@Prop({ default: false }) inModal!: boolean;
|
@Prop({ default: false }) inModal!: boolean;
|
||||||
|
|
||||||
$refs!: {
|
$refs!: {
|
||||||
|
@ -149,13 +153,16 @@ export default class Login extends Vue {
|
||||||
userService
|
userService
|
||||||
.login(this.auth)
|
.login(this.auth)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
const botId = this.nextBotId;
|
||||||
this.addBot({
|
this.addBot({
|
||||||
botName: this.auth.botName,
|
botName: this.auth.botName,
|
||||||
botId: this.nextBotId,
|
botId,
|
||||||
botUrl: this.auth.url,
|
botUrl: this.auth.url,
|
||||||
});
|
});
|
||||||
// TODO: Investigate how this needs to be done properly
|
if (this.selectedBot === '') {
|
||||||
// setBaseUrl(userService.getAPIUrl());
|
console.log(`selecting bot ${botId}`);
|
||||||
|
this.selectBot(botId);
|
||||||
|
}
|
||||||
|
|
||||||
this.emitLoginResult(true);
|
this.emitLoginResult(true);
|
||||||
if (this.inModal === false) {
|
if (this.inModal === false) {
|
||||||
|
|
|
@ -90,8 +90,8 @@
|
||||||
<b-checkbox v-model="layoutLockedLocal" class="ml-2"> Lock layout</b-checkbox>
|
<b-checkbox v-model="layoutLockedLocal" class="ml-2"> Lock layout</b-checkbox>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav-item class="nav-link navbar-nav" @click="resetDynamicLayout"
|
<b-nav-item class="nav-link navbar-nav" @click="resetDynamicLayout"
|
||||||
>Reset Layout</nav-item
|
>Reset Layout</b-nav-item
|
||||||
>
|
>
|
||||||
<router-link
|
<router-link
|
||||||
v-if="botCount === 1"
|
v-if="botCount === 1"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div>
|
<div>
|
||||||
<b-button v-b-modal.modal-prevent-closing>{{ loginText }}</b-button>
|
<b-button v-b-modal.modal-prevent-closing>{{ loginText }}</b-button>
|
||||||
<b-modal id="modal-prevent-closing" ref="modal" title="Login to your bot" @ok="handleOk">
|
<b-modal id="modal-prevent-closing" ref="modal" title="Login to your bot" @ok="handleOk">
|
||||||
<Login id="loginForm" ref="loginForm" in-modal />
|
<Login id="loginForm" ref="loginForm" in-modal @loginResult="handleLoginResult" />
|
||||||
</b-modal>
|
</b-modal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -18,6 +18,7 @@ import Login from '@/components/Login.vue';
|
||||||
export default class LoginModal extends Vue {
|
export default class LoginModal extends Vue {
|
||||||
$refs!: {
|
$refs!: {
|
||||||
loginForm: HTMLFormElement;
|
loginForm: HTMLFormElement;
|
||||||
|
modal: HTMLElement;
|
||||||
};
|
};
|
||||||
|
|
||||||
@Prop({ required: false, default: 'Login', type: String }) loginText!: string;
|
@Prop({ required: false, default: 'Login', type: String }) loginText!: string;
|
||||||
|
@ -26,6 +27,12 @@ export default class LoginModal extends Vue {
|
||||||
// this.$refs.loginForm.resetLogin();
|
// this.$refs.loginForm.resetLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleLoginResult(result: boolean) {
|
||||||
|
if (result) {
|
||||||
|
(this.$refs.modal as any).hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleOk(evt) {
|
handleOk(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
this.$refs.loginForm.handleSubmit();
|
this.$refs.loginForm.handleSubmit();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user