diff --git a/frontend/src/components/Dashboard/DashboardDowntimes.vue b/frontend/src/components/Dashboard/DashboardDowntimes.vue index 46893ab8..61edb26f 100644 --- a/frontend/src/components/Dashboard/DashboardDowntimes.vue +++ b/frontend/src/components/Dashboard/DashboardDowntimes.vue @@ -65,6 +65,10 @@ export const initialParams = { subStatus: '' }; +const convertToSec = (val) => { + return +new Date(val)/1000 +} + export default { name: 'DashboardDowntimes', components: { @@ -79,15 +83,26 @@ export default { }; }, computed: { - ...mapState([ 'downtimes' ]) + ...mapState([ 'downtimes' ]), }, async mounted () { this.getDowntimes(this.params); }, methods: { getDowntimes: async function (params = this.params) { + const {start, end} = params; + + let startSec = "", endSec = ""; + + if(start) { + startSec = convertToSec(start); + } + if(end) { + endSec = convertToSec(end); + } + this.isLoading = true; - await this.$store.dispatch({ type: 'getDowntimes', payload: params }); + await this.$store.dispatch({ type: 'getDowntimes', payload: { ...params, start: startSec, end: endSec } }); this.isLoading = false; }, getNextDowntimes: function () { @@ -103,7 +118,8 @@ export default { }, handleFilterSearch: function () { this.params = { ...this.params, skip: 0 }; - this.getDowntimes(this.params); + + this.getDowntimes(); } } }; diff --git a/frontend/src/forms/Downtime.vue b/frontend/src/forms/Downtime.vue index 04d0f9c3..7ddbd36b 100644 --- a/frontend/src/forms/Downtime.vue +++ b/frontend/src/forms/Downtime.vue @@ -201,6 +201,7 @@ export default { }), }, mounted: function () { + if(this.editDowntime) { const { service_id, sub_status, failures, start, end } = this.editDowntime; this.downtime = { @@ -210,7 +211,7 @@ export default { serviceId: service_id, subStatus: sub_status }; - + } }, methods: { isCreateDowntimeBtnEnabled: function () { diff --git a/frontend/src/forms/DowntimeFilters.vue b/frontend/src/forms/DowntimeFilters.vue index cc1bc30b..19a2fd53 100644 --- a/frontend/src/forms/DowntimeFilters.vue +++ b/frontend/src/forms/DowntimeFilters.vue @@ -142,7 +142,7 @@ export default { }; }, computed: { - ...mapState([ 'services' ]) + ...mapState([ 'services' ]) }, }; \ No newline at end of file