mirror of https://github.com/shunfei/cronsun
修复首次登陆,节点列表未加载,需要刷新浏览器
parent
8513038938
commit
f7b2dabe4e
|
@ -46,6 +46,17 @@ var restApi = new Rest('/v1/', (msg) => {
|
||||||
bus.$emit('goLogin')
|
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.use((Vue, options) => {
|
||||||
Vue.prototype.$rest = restApi;
|
Vue.prototype.$rest = restApi;
|
||||||
}, null);
|
}, null);
|
||||||
|
@ -60,6 +71,8 @@ Vue.use((Vue) => {
|
||||||
}
|
}
|
||||||
Vue.use(Config);
|
Vue.use(Config);
|
||||||
bus.$emit('conf_loaded', resp);
|
bus.$emit('conf_loaded', resp);
|
||||||
|
loadNodes();
|
||||||
|
|
||||||
}).onfailed((data, xhr) => {
|
}).onfailed((data, xhr) => {
|
||||||
var msg = data ? data : xhr.status + ' ' + xhr.statusText;
|
var msg = data ? data : xhr.status + ' ' + xhr.statusText;
|
||||||
bus.$emit('error', msg);
|
bus.$emit('error', msg);
|
||||||
|
@ -132,17 +145,6 @@ var initConf = new Promise((resolve) => {
|
||||||
restApi.GET('configurations').onsucceed(200, (resp) => {
|
restApi.GET('configurations').onsucceed(200, (resp) => {
|
||||||
Vue.use((Vue) => Vue.prototype.$appConfig = resp);
|
Vue.use((Vue) => Vue.prototype.$appConfig = resp);
|
||||||
bus.$emit('conf_loaded', 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();
|
loadNodes();
|
||||||
setInterval(loadNodes, 60*1000);
|
setInterval(loadNodes, 60*1000);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue