]> git.proxmox.com Git - pve-manager.git/commitdiff
refactor backupconfig window
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 30 Aug 2016 12:18:45 +0000 (14:18 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 5 Sep 2016 09:20:41 +0000 (11:20 +0200)
refactor it in its own class, because we need it again

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
www/manager6/Makefile
www/manager6/grid/BackupView.js
www/manager6/window/BackupConfig.js [new file with mode: 0644]

index 41c564f65946cf76b81b36aa5f1d41d09f691d73..d76342d8bf74628ff999c23179297f574d869581 100644 (file)
@@ -85,6 +85,7 @@ JSSRC=                                                        \
        window/Backup.js                                \
        window/Restore.js                               \
        window/SafeDestroy.js                           \
+       window/BackupConfig.js                          \
        panel/NotesView.js                              \
        grid/SelectFeature.js                           \
        grid/ObjectGrid.js                              \
index cc654bc8d9d022d9a133db7e23c5b6b3de08422f..2f673374e2514ba787cda5d861767c009319f5ac 100644 (file)
@@ -187,40 +187,12 @@ Ext.define('PVE.grid.BackupView', {
                    return;
                }
 
-               var win = Ext.create('Ext.window.Window', {
-                   title: gettext('Configuration'),
-                   width: 600,
-                   height: 400,
-                   layout: 'fit',
-                   modal: true,
-                   items: [{
-                       xtype: 'component',
-                       itemId: 'configtext',
-                       autoScroll: true,
-                       style: {
-                           'background-color': 'white',
-                           'white-space': 'pre',
-                           'font-family': 'monospace',
-                           padding: '5px'
-                       }
-                   }]
+               var win = Ext.create('PVE.window.BackupConfig', {
+                   volume: rec.data.volid,
+                   pveSelNode: me.pveSelNode
                });
 
-               PVE.Utils.API2Request({
-                   url: "/nodes/" + nodename + "/vzdump/extractconfig",
-                   method: 'GET',
-                   params: {
-                       volume: rec.data.volid
-                   },
-                   failure: function(response, opts) {
-                       win.close();
-                       Ext.Msg.alert('Error', response.htmlStatus);
-                   },
-                   success: function(response,options) {
-                       win.show();
-                       win.down('#configtext').update(Ext.htmlEncode(response.result.data));
-                   }
-               });
+               win.show();
            }
        });
 
diff --git a/www/manager6/window/BackupConfig.js b/www/manager6/window/BackupConfig.js
new file mode 100644 (file)
index 0000000..8b0fd04
--- /dev/null
@@ -0,0 +1,50 @@
+Ext.define('PVE.window.BackupConfig', {
+    extend: 'Ext.window.Window',
+    title: gettext('Configuration'),
+    width: 600,
+    height: 400,
+    layout: 'fit',
+    modal: true,
+    items: {
+       xtype: 'component',
+       itemId: 'configtext',
+       autoScroll: true,
+       style: {
+           'background-color': 'white',
+           'white-space': 'pre',
+           'font-family': 'monospace',
+           padding: '5px'
+       }
+    },
+
+    initComponent: function() {
+       var me = this;
+
+       if (!me.volume) {
+           throw "no volume specified";
+       }
+
+       var nodename = me.pveSelNode.data.node;
+       if (!nodename) {
+           throw "no node name specified";
+       }
+
+       me.callParent();
+
+       PVE.Utils.API2Request({
+           url: "/nodes/" + nodename + "/vzdump/extractconfig",
+           method: 'GET',
+           params: {
+               volume: me.volume
+           },
+           failure: function(response, opts) {
+               me.close();
+               Ext.Msg.alert('Error', response.htmlStatus);
+           },
+           success: function(response,options) {
+               me.show();
+               me.down('#configtext').update(Ext.htmlEncode(response.result.data));
+           }
+       });
+    }
+});