]> git.proxmox.com Git - pve-manager.git/commitdiff
popup dialog to remind user about subscriptions
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 13 Jun 2013 10:53:51 +0000 (12:53 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 13 Jun 2013 10:53:51 +0000 (12:53 +0200)
www/manager/Utils.js
www/manager/dc/Support.js
www/manager/node/APT.js

index d5de2e2ee93e665df9f27a9e7f7fa8908063c51c..509b629474592e54ccabe64cec0e68455fdcc929 100644 (file)
@@ -107,6 +107,8 @@ Ext.define('PVE.Utils', { statics: {
        'p': gettext('Premium')
     },
 
+    noSubKeyHtml: 'You do not have a valid subscription for this server. Please visit <a target="_blank" href="http://www.proxmox.com/products/proxmox-ve/subscription-service-plans">www.proxmox.com</a> to get a list of available options.',
+
     kvm_ostypes: {
        other: gettext('Other OS types'),
        wxp: 'Microsoft Windows XP/2003',
@@ -429,6 +431,37 @@ Ext.define('PVE.Utils', { statics: {
        }
     },
 
+    checked_command: function(orig_cmd) {
+       PVE.Utils.API2Request({
+           url: '/nodes/localhost/subscription',
+           method: 'GET',
+           //waitMsgTarget: me,
+           failure: function(response, opts) {
+               Ext.Msg.alert('Error', response.htmlStatus);
+           },
+           success: function(response, opts) {
+               var data = response.result.data;
+
+               if (data.status !== 'Active') {
+                   Ext.Msg.show({
+                       title: 'No valid subscription',
+                       icon: Ext.Msg.WARNING,
+                       msg: PVE.Utils.noSubKeyHtml,
+                       buttons: Ext.Msg.OK,
+                       callback: function(btn) {
+                           if (btn !== 'ok') {
+                               return;
+                           }
+                           orig_cmd();
+                       }
+                   });
+               } else {
+                   orig_cmd();
+               }
+           }
+       });
+    },
+
     task_desc_table: {
        vncproxy: [ 'VM/CT', gettext('Console') ],
        vncshell: [ '', gettext('Shell') ],
index c54cb3d642c0a3ce1515214ad0270969ba63b5c4..bcdae79bb43173f47b73baf2dece434362281964 100644 (file)
@@ -2,7 +2,7 @@ Ext.define('PVE.dc.Support', {
     extend: 'Ext.panel.Panel',
     alias: 'widget.pveDcSupport',
 
-    invalidHtml: '<h1>No valid subscription</h1>You do not have a valid subscription for this server. Please visit <a target="_blank" href="http://www.proxmox.com/products/proxmox-ve/subscription-service-plans">www.proxmox.com</a> to get a list of available options.',
+    invalidHtml: '<h1>No valid subscription</h1>' + PVE.Utils.noSubKeyHtml,
 
     communityHtml: 'Please use the public community <a target="_blank" href="http://forum.proxmox.com">forum</a> for any questions.',
 
index bcf604bcc34d64857b8feb2fb8d79c81ee3f363d..ea16a0737fe43d9f910e838706670d5c4f243856 100644 (file)
@@ -73,7 +73,7 @@ Ext.define('PVE.node.APT', {
        var update_btn = new Ext.Button({
            text: gettext('Update'),
            handler: function(){
-               apt_command('update');
+               PVE.Utils.checked_command(function() { apt_command('update'); });
            }
        });
 
@@ -84,7 +84,7 @@ Ext.define('PVE.node.APT', {
                return gettext('Are you sure you want to upgrade this node?');
            },
            handler: function(){
-               apt_command('upgrade');
+               PVE.Utils.checked_command(function() { apt_command('upgrade'); });
            }
        });