mirror of https://github.com/statping/statping
fixed filtering on ui
parent
8351c09161
commit
280eed0d8d
|
@ -65,6 +65,10 @@ export const initialParams = {
|
||||||
subStatus: ''
|
subStatus: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const convertToSec = (val) => {
|
||||||
|
return +new Date(val)/1000
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DashboardDowntimes',
|
name: 'DashboardDowntimes',
|
||||||
components: {
|
components: {
|
||||||
|
@ -79,15 +83,26 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState([ 'downtimes' ])
|
...mapState([ 'downtimes' ]),
|
||||||
},
|
},
|
||||||
async mounted () {
|
async mounted () {
|
||||||
this.getDowntimes(this.params);
|
this.getDowntimes(this.params);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getDowntimes: async function (params = this.params) {
|
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;
|
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;
|
this.isLoading = false;
|
||||||
},
|
},
|
||||||
getNextDowntimes: function () {
|
getNextDowntimes: function () {
|
||||||
|
@ -103,7 +118,8 @@ export default {
|
||||||
},
|
},
|
||||||
handleFilterSearch: function () {
|
handleFilterSearch: function () {
|
||||||
this.params = { ...this.params, skip: 0 };
|
this.params = { ...this.params, skip: 0 };
|
||||||
this.getDowntimes(this.params);
|
|
||||||
|
this.getDowntimes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -201,6 +201,7 @@ export default {
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
|
if(this.editDowntime) {
|
||||||
const { service_id, sub_status, failures, start, end } = this.editDowntime;
|
const { service_id, sub_status, failures, start, end } = this.editDowntime;
|
||||||
|
|
||||||
this.downtime = {
|
this.downtime = {
|
||||||
|
@ -210,7 +211,7 @@ export default {
|
||||||
serviceId: service_id,
|
serviceId: service_id,
|
||||||
subStatus: sub_status
|
subStatus: sub_status
|
||||||
};
|
};
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isCreateDowntimeBtnEnabled: function () {
|
isCreateDowntimeBtnEnabled: function () {
|
||||||
|
|
Loading…
Reference in New Issue