From e2b9cb5d91976ee7aa6d9dbe0372c74ad6bbe17e Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 17 Sep 2013 19:01:06 +0200 Subject: [PATCH] luci2: fix session heartbeat and serialization of cbi section creations --- luci2/htdocs/luci2/luci2.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/luci2/htdocs/luci2/luci2.js b/luci2/htdocs/luci2/luci2.js index a074b44..cdc7c4f 100644 --- a/luci2/htdocs/luci2/luci2.js +++ b/luci2/htdocs/luci2/luci2.js @@ -1429,7 +1429,7 @@ function LuCI2() startHeartbeat: function() { this._hearbeatInterval = window.setInterval(function() { - _luci2.session.isAlive(function(alive) { + _luci2.session.isAlive().then(function(alive) { if (!alive) { _luci2.session.stopHeartbeat(); @@ -1443,7 +1443,10 @@ function LuCI2() stopHeartbeat: function() { if (typeof(this._hearbeatInterval) != 'undefined') + { window.clearInterval(this._hearbeatInterval); + delete this._hearbeatInterval; + } } }; @@ -1759,6 +1762,7 @@ function LuCI2() _luci2.session.isAlive().then(function(access) { if (access) { + _luci2.session.startHeartbeat(); _luci2._login_deferred.resolve(); } else @@ -5296,11 +5300,11 @@ function LuCI2() for (var k in this.uci.creates[c][s]) { if (k == '.type') - r.type = this.uci.creates[i][k]; + r.type = this.uci.creates[c][s][k]; else if (k == '.create') - r.name = this.uci.creates[i][k]; + r.name = this.uci.creates[c][s][k]; else if (k.charAt(0) != '.') - r.values[k] = this.uci.creates[i][k]; + r.values[k] = this.uci.creates[c][s][k]; } _luci2.uci.add(r.config, r.type, r.name, r.values); -- 2.30.2