]> git.proxmox.com Git - pve-manager.git/blobdiff - www/manager6/node/Config.js
use Button from widget toolkit
[pve-manager.git] / www / manager6 / node / Config.js
index 4692ce974f76e6fcaa8d1b2b8343c878b3a7921b..e0a6cc0b8d4be8f61db38a4a9ace68a4f57e7d52 100644 (file)
@@ -2,6 +2,8 @@ Ext.define('PVE.node.Config', {
     extend: 'PVE.panel.Config',
     alias: 'widget.PVE.node.Config',
 
+    onlineHelp: 'chapter_system_administration',
+
     initComponent: function() {
         var me = this;
 
@@ -28,84 +30,76 @@ Ext.define('PVE.node.Config', {
                }
            });
        };
-       
+
        var actionBtn = Ext.create('Ext.Button', {
-           text: gettext('More'),
+           text: gettext('Bulk Actions'),
+           iconCls: 'fa fa-fw fa-ellipsis-v',
            disabled: !caps.nodes['Sys.PowerMgmt'],
            menu: new Ext.menu.Menu({
                items: [
                    {
-                       text: gettext('Start All VMs'),
-                       icon: '/pve2/images/start.png',
+                       text: gettext('Bulk Start'),
+                       iconCls: 'fa fa-fw fa-play',
                        handler: function() {
-                           var msg = Ext.String.format(gettext("Do you really want to start all Vms on  node {0}?"), nodename);
-                           Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
-                               if (btn !== 'yes') {
-                                   return;
-                               }
-                               PVE.Utils.API2Request({
-                                   params: { force: 1 },
-                                   url: '/nodes/' + nodename + '/startall',
-                                   method: 'POST',
-                                   waitMsgTarget: me,
-                                   failure: function(response, opts) {
-                                       Ext.Msg.alert('Error', response.htmlStatus);
-                                   }
-                               });
+                           var win = Ext.create('PVE.window.BulkAction', {
+                               nodename: nodename,
+                               title: gettext('Bulk Start'),
+                               btnText: gettext('Start'),
+                               action: 'startall'
                            });
+                           win.show();
                        }
                    },
                    {
-                       text: gettext('Stop All VMs'),
-                       icon: '/pve2/images/gtk-stop.png',
+                       text: gettext('Bulk Stop'),
+                       iconCls: 'fa fa-fw fa-stop',
                        handler: function() {
-                           var msg = Ext.String.format(gettext("Do you really want to stop all Vms on  node {0}?"), nodename);
-                           Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
-                               if (btn !== 'yes') {
-                                   return;
-                               }
-                           
-                               PVE.Utils.API2Request({
-                                   url: '/nodes/' + nodename + '/stopall',
-                                   method: 'POST',
-                                   waitMsgTarget: me,
-                                   failure: function(response, opts) {
-                                       Ext.Msg.alert('Error', response.htmlStatus);
-                                   }
-                               });
+                           var win = Ext.create('PVE.window.BulkAction', {
+                               nodename: nodename,
+                               title: gettext('Bulk Stop'),
+                               btnText: gettext('Stop'),
+                               action: 'stopall'
                            });
+                           win.show();
                        }
                    },
                    {
-                       text: gettext('Migrate All VMs'),
-                       icon: '/pve2/images/forward.png',
+                       text: gettext('Bulk Migrate'),
+                       iconCls: 'fa fa-fw fa-send-o',
                        handler: function() {
-                           var win = Ext.create('PVE.window.MigrateAll', {
+                           var win = Ext.create('PVE.window.BulkAction', {
                                nodename: nodename,
+                               title: gettext('Bulk Migrate'),
+                               btnText: gettext('Migrate'),
+                               action: 'migrateall'
                            });
                            win.show();
                        }
                    }
                ]
            })
-       }); 
+       });
 
-       var restartBtn = Ext.create('PVE.button.Button', {
+       var restartBtn = Ext.create('Proxmox.button.Button', {
            text: gettext('Restart'),
            disabled: !caps.nodes['Sys.PowerMgmt'],
-           confirmMsg: Ext.String.format(gettext("Do you really want to restart node {0}?"), nodename),
-           handler: function() { 
+           dangerous: true,
+           confirmMsg: gettext('Node') + " '" + nodename + "' - " + gettext('Restart'),
+           handler: function() {
                node_command('reboot');
-           }
+           },
+           iconCls: 'fa fa-undo'
        });
 
-       var shutdownBtn = Ext.create('PVE.button.Button', {
+       var shutdownBtn = Ext.create('Proxmox.button.Button', {
            text: gettext('Shutdown'),
            disabled: !caps.nodes['Sys.PowerMgmt'],
-           confirmMsg: Ext.String.format(gettext("Do you really want to shutdown node {0}?"), nodename),
-           handler: function() { 
+           dangerous: true,
+           confirmMsg: gettext('Node') + " '" + nodename + "' - " + gettext('Shutdown'),
+           handler: function() {
                node_command('shutdown');
-           }
+           },
+           iconCls: 'fa fa-power-off'
        });
 
        var shellBtn = Ext.create('PVE.button.ConsoleButton', {
@@ -128,105 +122,229 @@ Ext.define('PVE.node.Config', {
            me.items.push(
                {
                    title: gettext('Summary'),
+                   iconCls: 'fa fa-book',
                    itemId: 'summary',
                    xtype: 'pveNodeSummary'
+               }
+           );
+       }
+
+       if (caps.nodes['Sys.Console']) {
+           me.items.push(
+               {
+                   title: gettext('Shell'),
+                   iconCls: 'fa fa-terminal',
+                   itemId: 'console',
+                   xtype: 'pveNoVncConsole',
+                   consoleType: 'shell',
+                   nodename: nodename
                },
                {
-                   title: gettext('Services'),
+                   title: gettext('Shell (JS)'),
+                   iconCls: 'fa fa-terminal',
+                   itemId: 'jsconsole',
+                   xtype: 'pveNoVncConsole',
+                   consoleType: 'shell',
+                   xtermjs: true,
+                   nodename: nodename
+               }
+           );
+       }
+
+       if (caps.nodes['Sys.Audit']) {
+           me.items.push(
+               {
+                   title: gettext('System'),
+                   iconCls: 'fa fa-cogs',
                    itemId: 'services',
-//                 xtype: 'pveNodeServiceView',
-                   xtype: 'panel',
+                   expandedOnInit: true,
+                   startOnlyServices: {
+                       'pveproxy': true,
+                       'pvedaemon': true,
+                       'pve-cluster': true
+                   },
+                   nodename: nodename,
+                   onlineHelp: 'pve_service_daemons',
+                   xtype: 'proxmoxNodeServiceView'
                },
                {
                    title: gettext('Network'),
+                   iconCls: 'fa fa-exchange',
                    itemId: 'network',
-//                 xtype: 'pveNodeNetworkView'
-                   xtype: 'panel',
+                   groups: ['services'],
+                   nodename: nodename,
+                   onlineHelp: 'sysadmin_network_configuration',
+                   xtype: 'proxmoxNodeNetworkView'
                },
                {
                    title: gettext('DNS'),
+                   iconCls: 'fa fa-globe',
+                   groups: ['services'],
                    itemId: 'dns',
-//                 xtype: 'pveNodeDNSView'
-                   xtype: 'panel',
+                   nodename: nodename,
+                   onlineHelp: 'sysadmin_network_configuration',
+                   xtype: 'proxmoxNodeDNSView'
                },
                {
                    title: gettext('Time'),
                    itemId: 'time',
-//                 xtype: 'pveNodeTimeView'
-                   xtype: 'panel',
-               }
-           );
+                   groups: ['services'],
+                   nodename: nodename,
+                   xtype: 'proxmoxNodeTimeView',
+                   iconCls: 'fa fa-clock-o'
+               });
        }
 
        if (caps.nodes['Sys.Syslog']) {
-           me.items.push(
-               {
-                   title: 'Syslog',
-                   itemId: 'syslog',
-                   xtype: 'pveLogView',
-                   url: "/api2/extjs/nodes/" + nodename + "/syslog"
-               }
-           );
-       }
+           me.items.push({
+               title: 'Syslog',
+               iconCls: 'fa fa-list',
+               groups: ['services'],
+               disabled: !caps.nodes['Sys.Syslog'],
+               itemId: 'syslog',
+               xtype: 'pveLogView',
+               url: "/api2/extjs/nodes/" + nodename + "/syslog",
+               log_select_timespan: 1
+           });
 
-       me.items.push(
-           {
-               title: gettext('Task History'),
-               itemId: 'tasks',
-               xtype: 'pveNodeTasks'
+           if (caps.nodes['Sys.Modify']) {
+               me.items.push({
+                   title: gettext('Updates'),
+                   iconCls: 'fa fa-refresh',
+                   disabled: !caps.nodes['Sys.Console'],
+                   // do we want to link to system updates instead?
+                   itemId: 'apt',
+                   xtype: 'proxmoxNodeAPT',
+                   upgradeBtn: {
+                       xtype: 'pveConsoleButton',
+                       disabled: PVE.UserName !== 'root@pam',
+                       text: gettext('Upgrade'),
+                       consoleType: 'upgrade',
+                       nodename: nodename
+                   },
+                   nodename: nodename
+               });
            }
-       );
+       }
 
-       if (caps.nodes['Sys.Console']) {
+       if (caps.nodes['Sys.Audit']) {
            me.items.push(
                {
-//                 xtype: 'pveFirewallPanel',
-                   xtype: 'panel',
+                   xtype: 'pveFirewallRules',
+                   iconCls: 'fa fa-shield',
                    title: gettext('Firewall'),
-                   base_url: '/nodes/' + nodename + '/firewall',
-                   fwtype: 'node',
-                   phstateid: me.hstateid,
+                   allow_iface: true,
+                   base_url: '/nodes/' + nodename + '/firewall/rules',
+                   list_refs_url: '/cluster/firewall/refs',
                    itemId: 'firewall'
                },
                {
-                   title: gettext('Updates'),
-                   itemId: 'apt',
-//                 xtype: 'pveNodeAPT',
-                   xtype: 'panel',
-                   nodename: nodename
-               },
+                   xtype: 'pveFirewallOptions',
+                   title: gettext('Options'),
+                   iconCls: 'fa fa-gear',
+                   onlineHelp: 'pve_firewall_host_specific_configuration',
+                   groups: ['firewall'],
+                   base_url: '/nodes/' + nodename + '/firewall/options',
+                   fwtype: 'node',
+                   itemId: 'firewall-options'
+               });
+       }
+
+
+       if (caps.nodes['Sys.Audit']) {
+           me.items.push(
                {
-                   title: gettext('Console'),
-                   itemId: 'console',
-//                 xtype: 'pveNoVncConsole',
-                   xtype: 'panel',
-                   consoleType: 'shell',
-                   nodename: nodename
+                   title: gettext('Disks'),
+                   itemId: 'storage',
+                   expandedOnInit: true,
+                   iconCls: 'fa fa-hdd-o',
+                   xtype: 'pveNodeDiskList'
                },
                {
                    title: 'Ceph',
                    itemId: 'ceph',
-//             xtype: 'pveNodeCeph',
-                   xtype: 'panel',
-                   phstateid: me.hstateid,
-                   nodename: nodename
+                   iconCls: 'fa fa-ceph',
+                   xtype: 'pveNodeCephStatus'
+               },
+               {
+                   xtype: 'pveReplicaView',
+                   iconCls: 'fa fa-retweet',
+                   title: gettext('Replication'),
+                   itemId: 'replication'
+               },
+               {
+                   xtype: 'pveNodeCephConfigCrush',
+                   title: gettext('Configuration'),
+                   iconCls: 'fa fa-gear',
+                   groups: ['ceph'],
+                   itemId: 'ceph-config'
+               },
+               {
+                   xtype: 'pveNodeCephMonList',
+                   title: gettext('Monitor'),
+                   iconCls: 'fa fa-tv',
+                   groups: ['ceph'],
+                   itemId: 'ceph-monlist'
+               },
+               {
+                   xtype: 'pveNodeCephOsdTree',
+                   title: 'OSD',
+                   iconCls: 'fa fa-hdd-o',
+                   groups: ['ceph'],
+                   itemId: 'ceph-osdtree'
+               },
+               {
+                   xtype: 'pveNodeCephPoolList',
+                   title: 'Pools',
+                   iconCls: 'fa fa-sitemap',
+                   groups: ['ceph'],
+                   itemId: 'ceph-pools'
                }
            );
        }
 
+       if (caps.nodes['Sys.Syslog']) {
+           me.items.push(
+               {
+                   xtype: 'pveLogView',
+                   title: gettext('Log'),
+                   iconCls: 'fa fa-list',
+                   groups: ['firewall'],
+                   onlineHelp: 'chapter_pve_firewall',
+                   url: '/api2/extjs/nodes/' + nodename + '/firewall/log',
+                   itemId: 'firewall-fwlog'
+               },
+               {
+                   title: gettext('Log'),
+                   itemId: 'ceph-log',
+                   iconCls: 'fa fa-list',
+                   groups: ['ceph'],
+                   onlineHelp: 'chapter_pveceph',
+                   xtype: 'pveLogView',
+                   url: "/api2/extjs/nodes/" + nodename + "/ceph/log"
+               });
+       }
+
        me.items.push(
+           {
+               title: gettext('Task History'),
+               iconCls: 'fa fa-list',
+               itemId: 'tasks',
+               nodename: nodename,
+               xtype: 'proxmoxNodeTasks'
+           },
            {
                title: gettext('Subscription'),
+               iconCls: 'fa fa-support',
                itemId: 'support',
-//             xtype: 'pveNodeSubscription',
-               xtype: 'panel',
+               xtype: 'pveNodeSubscription',
                nodename: nodename
            }
        );
 
        me.callParent();
 
-       me.statusStore.on('load', function(s, records, success) {
+       me.mon(me.statusStore, 'load', function(s, records, success) {
            var uptimerec = s.data.get('uptime');
            var powermgmt = uptimerec ? uptimerec.data.value : false;
            if (!caps.nodes['Sys.PowerMgmt']) {