]> git.proxmox.com Git - pve-manager.git/blobdiff - www/manager6/grid/Replication.js
drop jslint lines
[pve-manager.git] / www / manager6 / grid / Replication.js
index 682da6598e0cc7866ad4e14a61bb3518652776d7..19e67d904719bbe1af0955b663352858a454ac68 100644 (file)
@@ -1,5 +1,5 @@
 Ext.define('PVE.window.ReplicaEdit', {
-    extend: 'PVE.window.Edit',
+    extend: 'Proxmox.window.Edit',
     xtype: 'pveReplicaEdit',
 
     subject: gettext('Replication Job'),
@@ -40,7 +40,7 @@ Ext.define('PVE.window.ReplicaEdit', {
            },
            {
                xtype: 'numberfield',
-               fieldLabel: gettext('Rate (MB/s)'),
+               fieldLabel: gettext('Rate limit') + ' (MB/s)',
                step: 1,
                minValue: 1,
                emptyText: gettext('unlimited'),
@@ -52,7 +52,7 @@ Ext.define('PVE.window.ReplicaEdit', {
                name: 'comment'
            },
            {
-               xtype: 'pvecheckbox',
+               xtype: 'proxmoxcheckbox',
                name: 'enabled',
                defaultValue: 'on',
                checked: true,
@@ -129,6 +129,7 @@ Ext.define('PVE.window.ReplicaEdit', {
     }
 });
 
+/* callback is a function and string */
 Ext.define('PVE.grid.ReplicaView', {
     extend: 'Ext.grid.Panel',
     xtype: 'pveReplicaView',
@@ -166,25 +167,11 @@ Ext.define('PVE.grid.ReplicaView', {
            win.show();
        },
 
-       removeJob: function(button,event,rec) {
-           var me = this.getView();
-           var controller = this;
-           PVE.Utils.API2Request({
-               url: '/api2/extjs/cluster/replication/' + rec.data.id,
-               waitMsgTarget: me,
-               method: 'DELETE',
-               callback: function() { controller.reload(); },
-               failure: function (response, opts) {
-                   Ext.Msg.alert('Error', response.htmlStatus);
-               }
-           });
-       },
-
        scheduleJobNow: function(button,event,rec) {
            var me = this.getView();
            var controller = this;
 
-           PVE.Utils.API2Request({
+           Proxmox.Utils.API2Request({
                url: "/api2/extjs/nodes/" + me.nodename + "/replication/" + rec.data.id + "/schedule_now",
                method: 'POST',
                waitMsgTarget: me,
@@ -198,7 +185,7 @@ Ext.define('PVE.grid.ReplicaView', {
        showLog: function(button, event, rec) {
            var me = this.getView();
            var controller = this;
-           var logView = Ext.create('PVE.panel.LogView', {
+           var logView = Ext.create('Proxmox.panel.LogView', {
                border: false,
                url: "/api2/extjs/nodes/" + me.nodename + "/replication/" + rec.data.id + "/log"
            });
@@ -259,33 +246,28 @@ Ext.define('PVE.grid.ReplicaView', {
            handler: 'addJob'
        },
        {
-           xtype: 'pveButton',
+           xtype: 'proxmoxButton',
            text: gettext('Edit'),
            itemId: 'editButton',
            handler: 'editJob',
            disabled: true
        },
        {
-           xtype: 'pveButton',
-           text: gettext('Remove'),
+           xtype: 'proxmoxStdRemoveButton',
            itemId: 'removeButton',
-           handler: 'removeJob',
+           baseurl: '/api2/extjs/cluster/replication/',
            dangerous: true,
-           confirmMsg: function(rec) {
-               var msg = Ext.String.format(gettext("Are you sure you want to remove replication job '{0}'?"), rec.id);
-               return msg;
-           },
-           disabled: true
+           callback: 'reload'
        },
        {
-           xtype: 'pveButton',
+           xtype: 'proxmoxButton',
            text: gettext('Log'),
            itemId: 'logButton',
            handler: 'showLog',
            disabled: true
        },
        {
-           xtype: 'pveButton',
+           xtype: 'proxmoxButton',
            text: gettext('Schedule now'),
            itemId: 'scheduleNowButton',
            handler: 'scheduleJobNow',
@@ -310,7 +292,7 @@ Ext.define('PVE.grid.ReplicaView', {
                disabled: true
            },
            {
-               text: gettext('ID'),
+               text: 'ID',
                dataIndex: 'id',
                width: 60,
                hidden: true
@@ -347,7 +329,8 @@ Ext.define('PVE.grid.ReplicaView', {
                {
                    text: gettext('Status'),
                    dataIndex: 'state',
-                   width: 60,
+                   minWidth: 160,
+                   flex: 1,
                    renderer: function(value, metadata, record) {
 
                        if (record.data.pid) {
@@ -355,46 +338,27 @@ Ext.define('PVE.grid.ReplicaView', {
                            return '';
                        }
 
+                       var icons = [];
                        var states = [];
 
                        if (record.data.remove_job) {
-                           states.push('<i class="fa fa-ban warning" title="'
+                           icons.push('<i class="fa fa-ban warning" title="'
                                        + gettext("Removal Scheduled") + '"></i>');
-                       }
-
-                       if (record.data.error) {
-                           states.push('<i class="fa fa-times critical" title="'
-                                       + gettext("Error") + '"></i>');
-                       }
-
-                       if (states.length > 0) {
-                           return states.join(',');
-                       }
-
-                       return '<i class="fa fa-check good"></i>';
-                   }
-               },
-               {
-                   text: gettext('Status Text'),
-                   dataIndex: 'error',
-                   minWidth: 100,
-                   flex: 1,
-                   renderer: function(value, metadata, record) {
-                       var states = [];
-
-                       if (record.data.remove_job) {
                            states.push(gettext("Removal Scheduled"));
                        }
 
                        if (record.data.error) {
+                           icons.push('<i class="fa fa-times critical" title="'
+                                       + gettext("Error") + '"></i>');
                            states.push(record.data.error);
                        }
 
-                       if (states.length > 0) {
-                           return states.join(', ');
+                       if (icons.length == 0) {
+                           icons.push('<i class="fa fa-check good"></i>');
+                           states.push(gettext('OK'));
                        }
 
-                       return gettext('OK');
+                       return icons.join(',') + ' ' + states.join(',');
                    }
                },
                {
@@ -410,14 +374,14 @@ Ext.define('PVE.grid.ReplicaView', {
                            return gettext('syncing');
                        }
 
-                       return PVE.Utils.render_timestamp(value);
+                       return Proxmox.Utils.render_timestamp(value);
                    }
                },
                {
                    text: gettext('Duration'),
                    dataIndex: 'duration',
                    width: 60,
-                   renderer: PVE.Utils.render_duration
+                   renderer: Proxmox.Utils.render_duration
                },
                {
                    text: gettext('Next Sync'),
@@ -435,7 +399,7 @@ Ext.define('PVE.grid.ReplicaView', {
                            return gettext('pending');
                        }
 
-                       return PVE.Utils.render_timestamp(value);
+                       return Proxmox.Utils.render_timestamp(value);
                    }
                }
            );
@@ -448,7 +412,7 @@ Ext.define('PVE.grid.ReplicaView', {
                dataIndex: 'schedule'
            },
            {
-               text: gettext('Rate'),
+               text: gettext('Rate limit'),
                dataIndex: 'rate',
                renderer: function(value) {
                    if (!value) {
@@ -466,17 +430,17 @@ Ext.define('PVE.grid.ReplicaView', {
            }
        );
 
-       me.rstore = Ext.create('PVE.data.UpdateStore', {
+       me.rstore = Ext.create('Proxmox.data.UpdateStore', {
            storeid: 'pve-replica-' + me.nodename + me.vmid,
            model: (mode === 'dc')? 'pve-replication' : 'pve-replication-state',
            interval: 3000,
            proxy: {
-               type: 'pve',
+               type: 'proxmox',
                url: "/api2/json" + url
            }
        });
 
-       me.store = Ext.create('PVE.data.DiffStore', {
+       me.store = Ext.create('Proxmox.data.DiffStore', {
            rstore: me.rstore,
            sorters: [
                {
@@ -504,7 +468,7 @@ Ext.define('PVE.grid.ReplicaView', {
            return;
        }
 
-       PVE.Utils.monStoreErrors(me, me.rstore);
+       Proxmox.Utils.monStoreErrors(me, me.rstore);
 
        me.on('destroy', me.rstore.stopUpdate);
        me.rstore.startUpdate();