diff --git a/frontend/src/API.js b/frontend/src/API.js index db51de4d..c286fd4a 100644 --- a/frontend/src/API.js +++ b/frontend/src/API.js @@ -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() diff --git a/frontend/src/components/Dashboard/ServiceTreeView.vue b/frontend/src/components/Dashboard/ServiceTreeView.vue index 7e31de61..8b3f37a3 100644 --- a/frontend/src/components/Dashboard/ServiceTreeView.vue +++ b/frontend/src/components/Dashboard/ServiceTreeView.vue @@ -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 () {