Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WEBUI: refresh page when the global view level or persistent level se…
…ttings is changed

- sometimes, the simplest solutions are best
  • Loading branch information
perexg committed Dec 2, 2015
1 parent fb734d8 commit 4aeabd2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 32 deletions.
9 changes: 7 additions & 2 deletions src/webui/static/app/config.js
Expand Up @@ -16,9 +16,14 @@ tvheadend.baseconf = function(panel, index) {
if (l >= 0) {
var tr = {0:'basic',1:'advanced',2:'expert'};
l = (l in tr) ? tr[l] : 'basic';
tvheadend.change_uilevel(l);
abuttons.uilevel.initialConfig.tvh_uilevel_set(l);
if (l !== tvheadend.uilevel) {
window.location.reload();
return;
}
}
var n = data['uilevel_nochange'] ? true : false;
if (n !== tvheadend.uilevel_nochange)
window.location.reload();
},
help: function() {
new tvheadend.help(_('General Configuration'), 'config_general.html');
Expand Down
18 changes: 0 additions & 18 deletions src/webui/static/app/idnode.js
Expand Up @@ -1316,24 +1316,6 @@ tvheadend.idnode_panel = function(conf, panel, dpanel, builder, destroyer)
tvheadend.paneladd(panel, dpanel, conf.tabIndex);
tvheadend.panelreg(panel, dpanel, builder, destroyer);
}

if (conf.uilevel) {
var f = function(l) {
var d = panel.findById(dpanel.id);
if (!tvheadend.uilevel_match(conf.uilevel, l)) {
if (d) {
panel.remove(dpanel);
destroyer();
}
} else {
if (!d) {
tvheadend.paneladd(panel, dpanel, conf.tabIndex);
tvheadend.panelreg(panel, dpanel, builder, destroyer);
}
}
}
tvheadend.uilevel_cb.push(f);
}
}

/*
Expand Down
15 changes: 3 additions & 12 deletions src/webui/static/app/tvheadend.js
Expand Up @@ -5,7 +5,6 @@ tvheadend.admin = false;
tvheadend.dialog = null;
tvheadend.uilevel = 'expert';
tvheadend.uilevel_nochange = false;
tvheadend.uilevel_cb = [];

tvheadend.cookieProvider = new Ext.state.CookieProvider({
// 7 days from now
Expand Down Expand Up @@ -45,14 +44,6 @@ tvheadend.uilevel_match = function(target, current) {
return true;
}

tvheadend.change_uilevel = function(uilevel) {
if (tvheadend.uilevel !== uilevel) {
tvheadend.uilevel = uilevel;
for (var i = 0; i < tvheadend.uilevel_cb.length; i++)
tvheadend.uilevel_cb[i](uilevel);
}
}

/**
* Displays a help popup window
*/
Expand Down Expand Up @@ -430,6 +421,9 @@ function accessUpdate(o) {

tvheadend.admin = o.admin == true;

if (o.uilevel)
tvheadend.uilevel = o.uilevel;

if (o.uilevel_nochange)
tvheadend.uilevel_nochange = true;

Expand Down Expand Up @@ -577,9 +571,6 @@ function accessUpdate(o) {
tvheadend.uilevel = '';
}

if (o.uilevel)
tvheadend.change_uilevel(o.uilevel);

if (o.admin == true && tvheadend.statuspanel == null) {
tvheadend.statuspanel = new tvheadend.status;
tvheadend.rootTabPanel.add(tvheadend.statuspanel);
Expand Down

0 comments on commit 4aeabd2

Please sign in to comment.