mirror of https://github.com/statping/statping
minor logic change
parent
a822b1bd58
commit
cc95b017eb
|
@ -305,7 +305,7 @@ class Api {
|
|||
}
|
||||
|
||||
async service_status (sec) {
|
||||
return axios.get(`/api/services/status?time=${sec}`).then((response) => response.data);
|
||||
return axios.get(`/api/services/status${sec && `?time=${sec}`}`).then((response) => response.data);
|
||||
}
|
||||
}
|
||||
const api = new Api()
|
||||
|
|
|
@ -140,7 +140,7 @@ export default {
|
|||
data: function () {
|
||||
return {
|
||||
isLoading: false,
|
||||
dateTime: new Date().toJSON(),
|
||||
dateTime: '',
|
||||
treeData: [],
|
||||
};
|
||||
},
|
||||
|
@ -152,23 +152,20 @@ export default {
|
|||
created: async function () {
|
||||
await this.getServiceStatus(this.dateTime);
|
||||
|
||||
const rootNode = getRootNodes(this.serviceStatus);
|
||||
const treeData = getTreeData(rootNode, this.serviceStatus);
|
||||
this.treeData = treeData;
|
||||
this.treeInitialize();
|
||||
},
|
||||
methods: {
|
||||
treeInitialize: function () {
|
||||
const rootNode = getRootNodes(this.serviceStatus);
|
||||
const treeData = getTreeData(rootNode, this.serviceStatus);
|
||||
this.treeData = treeData;
|
||||
},
|
||||
getServiceStatus: async function (dateTime) {
|
||||
let sec = null;
|
||||
|
||||
this.isLoading = true;
|
||||
if (!dateTime) {
|
||||
sec = this.convertDateObjToSec(new Date());
|
||||
} else {
|
||||
sec = this.convertDateObjToSec(dateTime);
|
||||
}
|
||||
|
||||
await this.$store.dispatch({ type: 'getServiceStatus', payload: sec });
|
||||
// 1643680748
|
||||
await this.$store.dispatch({ type: 'getServiceStatus', payload: dateTime });
|
||||
|
||||
this.treeInitialize();
|
||||
this.isLoading = false;
|
||||
},
|
||||
handleFilterSearch: function () {
|
||||
|
|
Loading…
Reference in New Issue