Allow filtering in TradesList

This commit is contained in:
Matthias 2021-08-09 19:56:11 +02:00
parent 4f4dc43688
commit 180b3c5fa3
2 changed files with 23 additions and 7 deletions

View File

@ -49,6 +49,7 @@
<TradeList
class="row trade-history mt-2 w-100"
:trades="backtestResult.trades"
:show-filter="true"
:stake-currency="backtestResult.stake_currency"
/>
</b-card>

View File

@ -14,6 +14,7 @@
primary-key="trade_id"
selectable
select-mode="single"
:filter="filterText"
@row-contextmenu="handleContextMenuEvent"
@row-clicked="onRowClicked"
@row-selected="onRowSelected"
@ -54,13 +55,23 @@
<DateTimeTZ :date="row.item.close_timestamp" />
</template>
</b-table>
<b-pagination
v-if="!activeTrades"
v-model="currentPage"
:total-rows="rows"
:per-page="perPage"
aria-controls="my-table"
></b-pagination>
<div class="w-100 d-flex justify-content-between">
<b-pagination
v-if="!activeTrades"
v-model="currentPage"
:total-rows="rows"
:per-page="perPage"
aria-controls="my-table"
></b-pagination>
<b-input
v-if="showFilter"
v-model="filterText"
type="text"
placeholder="Filter"
size="sm"
style="width: unset"
/>
</div>
</div>
</template>
@ -99,6 +110,8 @@ export default class TradeList extends Vue {
@Prop({ default: false }) activeTrades!: boolean;
@Prop({ default: false }) showFilter!: boolean;
@Prop({ default: 'No Trades to show.' }) emptyText!: string;
@ftbot.State detailTradeId?: number;
@ -117,6 +130,8 @@ export default class TradeList extends Vue {
selectedItemIndex? = undefined;
filterText = '';
@Watch('detailTradeId')
watchTradeDetail(val) {
const index = this.trades.findIndex((v) => v.trade_id === val);