From f7b2dabe4ed13b8b18f19ccdbe581bf4eb2dce2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=85=B5=E5=85=B5?= Date: Mon, 26 Nov 2018 18:24:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A6=96=E6=AC=A1=E7=99=BB?= =?UTF-8?q?=E9=99=86=EF=BC=8C=E8=8A=82=E7=82=B9=E5=88=97=E8=A1=A8=E6=9C=AA?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=EF=BC=8C=E9=9C=80=E8=A6=81=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/ui/src/main.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/web/ui/src/main.js b/web/ui/src/main.js index 44e0180..2284483 100644 --- a/web/ui/src/main.js +++ b/web/ui/src/main.js @@ -46,6 +46,17 @@ var restApi = new Rest('/v1/', (msg) => { bus.$emit('goLogin') } }); +var loadNodes = function() { + restApi.GET('nodes').onsucceed(200, (resp) => { + var nodes = {}; + for (var i in resp) { + nodes[resp[i].id] = resp[i]; + } + store.commit('setNodes', nodes); + resolve(); + }).do(); +} + Vue.use((Vue, options) => { Vue.prototype.$rest = restApi; }, null); @@ -60,6 +71,8 @@ Vue.use((Vue) => { } Vue.use(Config); bus.$emit('conf_loaded', resp); + loadNodes(); + }).onfailed((data, xhr) => { var msg = data ? data : xhr.status + ' ' + xhr.statusText; bus.$emit('error', msg); @@ -132,17 +145,6 @@ var initConf = new Promise((resolve) => { restApi.GET('configurations').onsucceed(200, (resp) => { Vue.use((Vue) => Vue.prototype.$appConfig = resp); bus.$emit('conf_loaded', resp); - - var loadNodes = function() { - restApi.GET('nodes').onsucceed(200, (resp) => { - var nodes = {}; - for (var i in resp) { - nodes[resp[i].id] = resp[i]; - } - store.commit('setNodes', nodes); - resolve(); - }).do(); - } loadNodes(); setInterval(loadNodes, 60*1000);