fixed filtering on ui

pull/1097/head
smit95tpatel 2021-12-17 19:16:55 +05:30
parent 8351c09161
commit 280eed0d8d
3 changed files with 22 additions and 5 deletions

View File

@ -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();
}
}
};

View File

@ -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 () {

View File

@ -142,7 +142,7 @@ export default {
};
},
computed: {
...mapState([ 'services' ])
...mapState([ 'services' ])
},
};
</script>