]> git.proxmox.com Git - pmg-gui.git/blobdiff - js/RuleConfiguration.js
fix bug #1707: use correct units for deferred mail queue (minutes)
[pmg-gui.git] / js / RuleConfiguration.js
index 3ee9f3c3a85b80b95bb0a93194bf0db6197be22d..82e4c30157a2800f8362a4f5dc28cbbccd444ffb 100644 (file)
@@ -1,7 +1,6 @@
 /*global Proxmox*/
 /*jslint confusion: true*/
-/* create is a function and boolean,
- * bind is a function and object,
+/* bind is a function and object,
  * callback is a function and string
  */
 Ext.define('pmg-rule-list', {
@@ -86,7 +85,7 @@ Ext.define('PMG.RulesConfiguration', {
            var win = Ext.create('PMG.RuleEditor', {
                url: '/api2/extjs/config/ruledb/rules/',
                method: 'POST',
-               create: true,
+               isCreate: true,
                listeners: {
                    destroy: function() {
                        me.lookupReference('rulegrid').getStore().load();
@@ -97,6 +96,32 @@ Ext.define('PMG.RulesConfiguration', {
            win.show();
        },
 
+       onFactoryDefaults: function() {
+           var me = this;
+
+           Ext.Msg.confirm(
+               gettext('Confirm'),
+               gettext('Reset rule database to factory defaults?'),
+               function(button) {
+                   if (button !== 'yes') {
+                       return;
+                   }
+                   var url = '/config/ruledb';
+                   Proxmox.Utils.API2Request({
+                       url: '/config/ruledb',
+                       method: 'POST',
+                       waitMsgTarget: me.getView(),
+                       callback: function() {
+                           me.reload();
+                       },
+                       failure: function (response, opts) {
+                           Ext.Msg.alert(gettext('Error'), response.htmlStatus);
+                       }
+                   });
+               }
+           );
+       },
+
        init: function(view) {
            var grid = this.lookupReference('rulegrid');
            Proxmox.Utils.monStoreErrors(grid, grid.getStore(), true);
@@ -152,6 +177,11 @@ Ext.define('PMG.RulesConfiguration', {
                        bind: {
                            baseurl: '{baseUrl}'
                        }
+                   },
+                   '->',
+                   {
+                       text: gettext('Factory Defaults'),
+                       handler: 'onFactoryDefaults'
                    }
                ]
            },