mirror of https://github.com/statping/statping
fixed filtering on ui
parent
8351c09161
commit
280eed0d8d
|
@ -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();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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 () {
|
||||
|
|
|
@ -142,7 +142,7 @@ export default {
|
|||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState([ 'services' ])
|
||||
...mapState([ 'services' ])
|
||||
},
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue