mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-22 19:15:15 +00:00
properly fill pair input
This commit is contained in:
parent
a5239f9cdc
commit
68d072e7fa
|
@ -63,7 +63,7 @@ forceexit
|
|||
>
|
||||
<PlayIcon />
|
||||
</button>
|
||||
<ForceEntryForm @close="hideForceenter" />
|
||||
<ForceEntryForm :pair="botStore.activeBot.selectedPair" @close="hideForceenter" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -29,11 +29,16 @@
|
|||
<b-form-group label="Pair" label-for="pair-input" invalid-feedback="Pair is required">
|
||||
<b-form-input
|
||||
id="pair-input"
|
||||
v-model="pair"
|
||||
v-model="selectedPair"
|
||||
list="pair-input-whitelist"
|
||||
required
|
||||
:placeholder="botStore.activeBot.selectedPair"
|
||||
@keydown.enter.native="handleEntry"
|
||||
@focus="inputSelect"
|
||||
></b-form-input>
|
||||
<b-form-datalist
|
||||
id="pair-input-whitelist"
|
||||
:options="botStore.activeBot.whitelist"
|
||||
></b-form-datalist>
|
||||
</b-form-group>
|
||||
<b-form-group
|
||||
label="*Price [optional]"
|
||||
|
@ -106,12 +111,18 @@ import { defineComponent, ref, nextTick, getCurrentInstance } from 'vue';
|
|||
|
||||
export default defineComponent({
|
||||
name: 'ForceEntryForm',
|
||||
setup() {
|
||||
props: {
|
||||
pair: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const root = getCurrentInstance();
|
||||
const botStore = useBotStore();
|
||||
|
||||
const form = ref<HTMLFormElement>();
|
||||
const pair = ref('');
|
||||
const selectedPair = ref('');
|
||||
const price = ref<number | null>(null);
|
||||
const stakeAmount = ref<number | null>(null);
|
||||
const leverage = ref<number | null>(null);
|
||||
|
@ -126,15 +137,13 @@ export default defineComponent({
|
|||
};
|
||||
|
||||
const handleSubmit = async () => {
|
||||
pair.value = pair.value !== '' ? pair.value : botStore.activeBot.selectedPair;
|
||||
await nextTick();
|
||||
// Exit when the form isn't valid
|
||||
if (!checkFormValidity()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// call forceentry
|
||||
const payload: ForceEnterPayload = { pair: pair.value };
|
||||
const payload: ForceEnterPayload = { pair: selectedPair.value };
|
||||
if (price.value) {
|
||||
payload.price = Number(price.value);
|
||||
}
|
||||
|
@ -157,7 +166,7 @@ export default defineComponent({
|
|||
};
|
||||
const resetForm = () => {
|
||||
console.log('resetForm');
|
||||
pair.value = '';
|
||||
selectedPair.value = props.pair;
|
||||
price.value = null;
|
||||
stakeAmount.value = null;
|
||||
if (botStore.activeBot.botApiVersion > 1.1) {
|
||||
|
@ -176,13 +185,18 @@ export default defineComponent({
|
|||
// Trigger submit handler
|
||||
handleSubmit();
|
||||
};
|
||||
const inputSelect = (bvModalEvt) => {
|
||||
bvModalEvt.srcElement?.select();
|
||||
};
|
||||
|
||||
return {
|
||||
handleSubmit,
|
||||
botStore,
|
||||
form,
|
||||
handleEntry,
|
||||
inputSelect,
|
||||
resetForm,
|
||||
pair,
|
||||
selectedPair,
|
||||
price,
|
||||
stakeAmount,
|
||||
ordertype,
|
||||
|
|
Loading…
Reference in New Issue
Block a user