frequi_origin/src/views/Dashboard.vue

90 lines
2.0 KiB
Vue
Raw Normal View History

2020-08-17 19:16:27 +00:00
<template>
2020-08-29 09:38:43 +00:00
<GridLayout
class="h-100 w-100"
:row-height="50"
:layout="gridLayout"
@layout-updated="layoutUpdatedEvent"
>
2020-08-18 05:05:40 +00:00
<GridItem
:i="gridLayout[0].i"
:x="gridLayout[0].x"
:y="gridLayout[0].y"
:w="gridLayout[0].w"
:h="gridLayout[0].h"
>
<DailyChart v-if="dailyStats.data" :daily-stats="dailyStats" />
</GridItem>
<GridItem
:i="gridLayout[1].i"
:x="gridLayout[1].x"
:y="gridLayout[1].y"
:w="gridLayout[1].w"
:h="gridLayout[1].h"
>
<HourlyChart :trades="closedTrades" />
</GridItem>
<GridItem
:i="gridLayout[2].i"
:x="gridLayout[2].x"
:y="gridLayout[2].y"
:w="gridLayout[2].w"
:h="gridLayout[2].h"
>
<CumProfitChart :trades="closedTrades" />
</GridItem>
</GridLayout>
2020-08-17 19:16:27 +00:00
</template>
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import { namespace } from 'vuex-class';
2020-08-29 09:38:43 +00:00
import { GridLayout, GridItem, GridItemData } from 'vue-grid-layout';
2020-08-17 19:16:27 +00:00
import DailyChart from '@/components/charts/DailyChart.vue';
import HourlyChart from '@/components/charts/HourlyChart.vue';
2020-08-24 17:28:46 +00:00
import CumProfitChart from '@/components/charts/CumProfitChart.vue';
2020-08-17 19:16:27 +00:00
2020-08-29 09:23:39 +00:00
import { Trade, DailyReturnValue } from '@/types';
2020-08-17 19:16:27 +00:00
const ftbot = namespace('ftbot');
2020-08-18 06:29:40 +00:00
const layoutNs = namespace('layout');
2020-08-17 19:16:27 +00:00
@Component({
components: {
2020-08-29 09:38:43 +00:00
GridLayout,
GridItem,
2020-08-17 19:16:27 +00:00
DailyChart,
HourlyChart,
2020-08-24 17:28:46 +00:00
CumProfitChart,
2020-08-17 19:16:27 +00:00
},
})
2020-08-18 06:29:40 +00:00
export default class Dashboard extends Vue {
@ftbot.Getter closedTrades!: Trade[];
2020-08-17 19:16:27 +00:00
@ftbot.State dailyStats!: DailyReturnValue;
@ftbot.Action getDaily;
@ftbot.Action getTrades;
2020-08-18 06:29:40 +00:00
@layoutNs.Getter getDashboardLayout!: GridItemData[];
@layoutNs.Mutation setDashboardLayout;
get gridLayout(): GridItemData[] {
return this.getDashboardLayout;
}
2020-08-18 05:05:40 +00:00
2020-08-17 19:16:27 +00:00
mounted() {
this.getDaily();
this.getTrades();
}
2020-08-29 09:38:43 +00:00
2020-08-18 06:29:40 +00:00
layoutUpdatedEvent(newLayout) {
this.setDashboardLayout(newLayout);
2020-08-29 09:38:43 +00:00
}
2020-08-17 19:16:27 +00:00
}
</script>
<style scoped></style>