From ee4cfc8b8ed2acba3ec44d07f6caf442323cf0c2 Mon Sep 17 00:00:00 2001 From: Daniel Mohns Date: Thu, 21 Mar 2024 10:03:56 +0100 Subject: [PATCH 1/2] Always show `period` in FinancialOverview --- .../src/modules/Dashboard/FinancialOverview.vue | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Website/ui/src/modules/Dashboard/FinancialOverview.vue b/Website/ui/src/modules/Dashboard/FinancialOverview.vue index 7356d2518..2036bf11c 100644 --- a/Website/ui/src/modules/Dashboard/FinancialOverview.vue +++ b/Website/ui/src/modules/Dashboard/FinancialOverview.vue @@ -16,6 +16,7 @@ v-model="period.from" md-immediately v-validate="'required'" + data-vv-name="periodFrom" > @@ -28,6 +29,7 @@ v-model="period.to" md-immediately v-validate="'required'" + data-vv-name="periodTo" > @@ -108,7 +110,6 @@ export default { }, loading: false, setPeriod: false, - periodText: '-', disabled: { customPredictor: function (date) { let today = new Date() @@ -134,12 +135,12 @@ export default { this.clusterService.financialData = newVal }, }, + mounted() { + this.setDate(new Date('2024-01-01'), 'from') + this.setDate(new Date(), 'to') + }, methods: { showPeriod() { - this.period = { - from: null, - to: null, - } this.setPeriod = !this.setPeriod }, async getClusterFinancialData() { @@ -157,9 +158,6 @@ export default { ? moment(this.period.to).format('YYYY-MM-DD') : null this.periodChanged(from, to) - if (from !== null) { - this.periodText = from + ' - ' + to - } this.setPeriod = false this.loading = false }, @@ -180,6 +178,9 @@ export default { }, }, computed: { + periodText() { + return this.period.from + ' - ' + this.period.to + }, lineChartData() { return this.clusterService.lineChartData(true) }, From d35933e0f3279e579b2ec9eda77090e76ec62002 Mon Sep 17 00:00:00 2001 From: Daniel Mohns Date: Thu, 21 Mar 2024 10:25:35 +0100 Subject: [PATCH 2/2] Dynamically set start date --- .../ui/src/modules/Dashboard/FinancialOverview.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Website/ui/src/modules/Dashboard/FinancialOverview.vue b/Website/ui/src/modules/Dashboard/FinancialOverview.vue index 2036bf11c..f36e17fad 100644 --- a/Website/ui/src/modules/Dashboard/FinancialOverview.vue +++ b/Website/ui/src/modules/Dashboard/FinancialOverview.vue @@ -136,8 +136,17 @@ export default { }, }, mounted() { - this.setDate(new Date('2024-01-01'), 'from') - this.setDate(new Date(), 'to') + let currentDate = new Date() + // Set the time frame to show past 3 month until today + let startDate = new Date( + currentDate.getFullYear(), + currentDate.getMonth() - 2, + 1, + ) + let endDate = currentDate + + this.setDate(startDate, 'from') + this.setDate(endDate, 'to') }, methods: { showPeriod() {