]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
WEBUI: Fix the apply functionality (maintain dirty)
authorJaroslav Kysela <perex@perex.cz>
Fri, 8 Jan 2016 13:05:23 +0000 (14:05 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 8 Jan 2016 13:05:23 +0000 (14:05 +0100)
src/webui/static/app/extensions.js
src/webui/static/app/idnode.js

index daa7b35af7945d276c5e9f16ff06927e5a347464..3ea299b0ed583acec792ab35b78f3137e7af9f85 100644 (file)
@@ -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() {
index ab59826cab3d04db9c9f5d217aea0d235d0f856f..680706cf98bb5da74568a15cd3080865114144c5 100644 (file)
@@ -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();
                         }
                     });
                 }