Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always show the Period in Dashboard #431

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions src/frontend/src/modules/Dashboard/FinancialOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export default {
},
loading: false,
setPeriod: false,
periodText: "-",
disabled: {
customPredictor: function (date) {
let today = new Date()
Expand All @@ -137,7 +136,18 @@ export default {
},
}
},

mounted() {
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")
},
watch: {
// eslint-disable-next-line no-unused-vars
revenue(newVal, oldVal) {
Expand All @@ -146,10 +156,6 @@ export default {
},
methods: {
showPeriod() {
this.period = {
from: null,
to: null,
}
this.setPeriod = !this.setPeriod
},
async getClusterFinancialData() {
Expand All @@ -158,18 +164,9 @@ export default {
return
}
this.loading = true
const from =
this.period.from !== null
? moment(this.period.from).format("YYYY-MM-DD")
: null
const to =
this.period.to !== null
? moment(this.period.to).format("YYYY-MM-DD")
: null
this.periodChanged(from, to)
if (from !== null) {
this.periodText = from + " - " + to
}
console.log(this.period.from)
console.log(this.period.to)
this.periodChanged(this.period.from, this.period.to)
this.setPeriod = false
this.loading = false
},
Expand All @@ -190,6 +187,9 @@ export default {
},
},
computed: {
periodText() {
return this.period.from + " - " + this.period.to
},
lineChartData() {
return this.clusterService.lineChartData(true)
},
Expand Down
Loading