2020-07-31 05:17:50 +00:00
|
|
|
<template>
|
2021-01-19 20:48:17 +00:00
|
|
|
<div>
|
2021-01-19 20:51:34 +00:00
|
|
|
<div class="w-100 d-flex">
|
|
|
|
<b-form-group
|
|
|
|
label="Strategy"
|
|
|
|
label-for="strategyName"
|
|
|
|
invalid-feedback="Strategy is required"
|
|
|
|
class="flex-grow-1"
|
|
|
|
>
|
|
|
|
<b-form-select v-model="locStrategy" :options="strategyList" @change="strategyChanged">
|
|
|
|
</b-form-select>
|
|
|
|
</b-form-group>
|
|
|
|
<div class="ml-2 d-flex align-items-center">
|
|
|
|
<b-button class="mt-2" @click="getStrategyList">↻</b-button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2021-01-19 20:48:17 +00:00
|
|
|
<textarea v-if="showDetails && strategy" v-model="strategyCode" class="w-100 h-100"></textarea>
|
|
|
|
</div>
|
2020-07-31 05:17:50 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Vue, Prop, Emit } from 'vue-property-decorator';
|
|
|
|
import { namespace } from 'vuex-class';
|
|
|
|
|
|
|
|
const ftbot = namespace('ftbot');
|
|
|
|
|
|
|
|
@Component({})
|
|
|
|
export default class StrategyList extends Vue {
|
|
|
|
@Prop() value!: string;
|
|
|
|
|
2021-01-19 20:48:17 +00:00
|
|
|
@Prop({ default: false, required: false }) showDetails!: boolean;
|
|
|
|
|
2020-07-31 05:17:50 +00:00
|
|
|
@ftbot.Action getStrategyList;
|
|
|
|
|
2020-09-17 06:01:23 +00:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
@ftbot.Action getStrategy!: (strategy: string) => void;
|
|
|
|
|
2021-01-19 20:51:34 +00:00
|
|
|
@ftbot.State strategyList!: string[];
|
2020-07-31 05:17:50 +00:00
|
|
|
|
2021-01-19 20:48:17 +00:00
|
|
|
@ftbot.State strategy;
|
|
|
|
|
2020-07-31 05:17:50 +00:00
|
|
|
@Emit('input')
|
|
|
|
emitStrategy(strategy: string) {
|
2020-09-17 06:01:23 +00:00
|
|
|
this.getStrategy(strategy);
|
2020-07-31 05:17:50 +00:00
|
|
|
return strategy;
|
|
|
|
}
|
|
|
|
|
2021-01-19 20:48:17 +00:00
|
|
|
get strategyCode(): string {
|
|
|
|
return this.strategy?.code;
|
|
|
|
}
|
|
|
|
|
|
|
|
get locStrategy() {
|
2020-07-31 05:17:50 +00:00
|
|
|
return this.value;
|
|
|
|
}
|
|
|
|
|
2021-01-19 20:48:17 +00:00
|
|
|
set locStrategy(val) {
|
2020-07-31 05:17:50 +00:00
|
|
|
this.emitStrategy(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
strategyChanged(newVal) {
|
|
|
|
this.value = newVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
mounted() {
|
2021-01-19 20:55:14 +00:00
|
|
|
if (this.strategyList.length === 0) {
|
2021-01-19 20:51:34 +00:00
|
|
|
this.getStrategyList();
|
|
|
|
}
|
2020-07-31 05:17:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style></style>
|