From: Jaroslav Kysela Date: Fri, 8 Jan 2016 13:05:23 +0000 (+0100) Subject: WEBUI: Fix the apply functionality (maintain dirty) X-Git-Tag: v4.2.1~1193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a06449615b04d4cf115e14d9d1bb50e9d3cbdc6;p=thirdparty%2Ftvheadend.git WEBUI: Fix the apply functionality (maintain dirty) --- diff --git a/src/webui/static/app/extensions.js b/src/webui/static/app/extensions.js index daa7b35af..3ea299b0e 100644 --- a/src/webui/static/app/extensions.js +++ b/src/webui/static/app/extensions.js @@ -1832,9 +1832,6 @@ Ext.ux.Window = Ext.extend(Ext.Window, { }); -// create namespace -Ext.ns('Ext.ux'); - Ext.layout.Column2Layout = Ext.extend(Ext.layout.ColumnLayout, { getLayoutTargetSize : function() { diff --git a/src/webui/static/app/idnode.js b/src/webui/static/app/idnode.js index ab59826ca..680706cf9 100644 --- a/src/webui/static/app/idnode.js +++ b/src/webui/static/app/idnode.js @@ -1105,7 +1105,8 @@ tvheadend.idnode_editor = function(_uilevel, item, conf) iconCls: 'apply', handler: function() { if (panel.getForm().isDirty()) { - var node = panel.getForm().getFieldValues(); + var form = panel.getForm(); + var node = form.getFieldValues(); node.uuid = conf.uuids ? conf.uuids : item.uuid; tvheadend.Ajax({ url: conf.saveURL || 'api/idnode/save', @@ -1113,7 +1114,13 @@ tvheadend.idnode_editor = function(_uilevel, item, conf) node: Ext.encode(node) }, success: function(d) { - panel.getForm().reset(); + Ext.MessageBox.alert(_('Apply'), _('Changes were applied!')); + form.trackResetOnLoad = true; + form.setValues(node); + }, + failure: function(response) { + Ext.MessageBox.alert(_('Apply'), _('Cannot apply') + ': ' + response.responseText + '!'); + form.reset(); } }); } @@ -1417,12 +1424,20 @@ tvheadend.idnode_create = function(conf, onlyDefault, cloneValues) params['uuid'] = puuid; if (pclass) params['class'] = pclass; - params['conf'] = Ext.encode(panel.getForm().getFieldValues()); + var form = panel.getForm(); + var values = form.getFieldValues(); + params['conf'] = Ext.encode(values); tvheadend.Ajax({ url: conf.create.url || conf.url + '/create', params: params, success: function(d) { - panel.getForm().reset(); + Ext.MessageBox.confirm(_('Apply'), _('Changes were applied!')); + form.trackResetOnLoad = true; + form.setValues(node); + }, + failure: function(response) { + Ext.MessageBox.confirm(_('Apply'), _('Cannot apply') + ': ' + response.responseText + '!'); + form.reset(); } }); }