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