mirror of
				https://git.proxmox.com/git/pve-manager
				synced 2025-11-04 01:49:36 +00:00 
			
		
		
		
	instead of having 2 panels, we have now a splitted panel with both config and crushmap also drop the not needed [] around the alias Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
		
			
				
	
	
		
			337 lines
		
	
	
		
			7.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			337 lines
		
	
	
		
			7.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
Ext.define('PVE.node.Config', {
 | 
						|
    extend: 'PVE.panel.Config',
 | 
						|
    alias: 'widget.PVE.node.Config',
 | 
						|
 | 
						|
    initComponent: function() {
 | 
						|
        var me = this;
 | 
						|
 | 
						|
	var nodename = me.pveSelNode.data.node;
 | 
						|
	if (!nodename) {
 | 
						|
	    throw "no node name specified";
 | 
						|
	}
 | 
						|
 | 
						|
	var caps = Ext.state.Manager.get('GuiCap');
 | 
						|
 | 
						|
	me.statusStore = Ext.create('PVE.data.ObjectStore', {
 | 
						|
	    url: "/api2/json/nodes/" + nodename + "/status",
 | 
						|
	    interval: 1000
 | 
						|
	});
 | 
						|
 | 
						|
	var node_command = function(cmd) {
 | 
						|
	    PVE.Utils.API2Request({
 | 
						|
		params: { command: cmd },
 | 
						|
		url: '/nodes/' + nodename + '/status',
 | 
						|
		method: 'POST',
 | 
						|
		waitMsgTarget: me,
 | 
						|
		failure: function(response, opts) {
 | 
						|
		    Ext.Msg.alert(gettext('Error'), response.htmlStatus);
 | 
						|
		}
 | 
						|
	    });
 | 
						|
	};
 | 
						|
 | 
						|
	var actionBtn = Ext.create('Ext.Button', {
 | 
						|
	    text: gettext('More'),
 | 
						|
	    iconCls: 'fa fa-fw fa-ellipsis-v',
 | 
						|
	    disabled: !caps.nodes['Sys.PowerMgmt'],
 | 
						|
	    menu: new Ext.menu.Menu({
 | 
						|
		items: [
 | 
						|
		    {
 | 
						|
			text: gettext('Start all VMs and Containers'),
 | 
						|
			iconCls: 'fa fa-fw fa-play',
 | 
						|
			handler: function() {
 | 
						|
			    var msg = gettext('Start all VMs and Containers') + ' (' + gettext('Node') + " '" + 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);
 | 
						|
				    }
 | 
						|
				});
 | 
						|
			    });
 | 
						|
			}
 | 
						|
		    },
 | 
						|
		    {
 | 
						|
			text: gettext('Stop all VMs and Containers'),
 | 
						|
			iconCls: 'fa fa-fw fa-stop fa-red',
 | 
						|
			handler: function() {
 | 
						|
			    var msg = gettext('Stop all VMs and Containers') + ' (' + gettext('Node') + " '" + 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);
 | 
						|
				    }
 | 
						|
				});
 | 
						|
			    });
 | 
						|
			}
 | 
						|
		    },
 | 
						|
		    {
 | 
						|
			text: gettext('Migrate all VMs and Containers'),
 | 
						|
			iconCls: 'fa fa-fw fa-send-o',
 | 
						|
			handler: function() {
 | 
						|
			    var win = Ext.create('PVE.window.MigrateAll', {
 | 
						|
				nodename: nodename
 | 
						|
			    });
 | 
						|
			    win.show();
 | 
						|
			}
 | 
						|
		    }
 | 
						|
		]
 | 
						|
	    })
 | 
						|
	});
 | 
						|
 | 
						|
	var restartBtn = Ext.create('PVE.button.Button', {
 | 
						|
	    text: gettext('Restart'),
 | 
						|
	    disabled: !caps.nodes['Sys.PowerMgmt'],
 | 
						|
	    confirmMsg: gettext('Node') + " '" + nodename + "' - " + gettext('Restart'),
 | 
						|
	    handler: function() {
 | 
						|
		node_command('reboot');
 | 
						|
	    },
 | 
						|
	    iconCls: 'fa fa-undo'
 | 
						|
	});
 | 
						|
 | 
						|
	var shutdownBtn = Ext.create('PVE.button.Button', {
 | 
						|
	    text: gettext('Shutdown'),
 | 
						|
	    disabled: !caps.nodes['Sys.PowerMgmt'],
 | 
						|
	    confirmMsg: gettext('Node') + " '" + nodename + "' - " + gettext('Shutdown'),
 | 
						|
	    handler: function() {
 | 
						|
		node_command('shutdown');
 | 
						|
	    },
 | 
						|
	    iconCls: 'fa fa-power-off'
 | 
						|
	});
 | 
						|
 | 
						|
	var shellBtn = Ext.create('PVE.button.ConsoleButton', {
 | 
						|
	    disabled: !caps.nodes['Sys.Console'],
 | 
						|
	    text: gettext('Shell'),
 | 
						|
	    consoleType: 'shell',
 | 
						|
	    nodename: nodename,
 | 
						|
		iconCls: 'fa fa-terminal'
 | 
						|
	});
 | 
						|
 | 
						|
	me.items = [];
 | 
						|
 | 
						|
	Ext.apply(me, {
 | 
						|
	    title: gettext('Node') + " '" + nodename + "'",
 | 
						|
	    hstateid: 'nodetab',
 | 
						|
	    defaults: { statusStore: me.statusStore },
 | 
						|
	    tbar: [ restartBtn, shutdownBtn, shellBtn, actionBtn]
 | 
						|
	});
 | 
						|
 | 
						|
	if (caps.nodes['Sys.Audit']) {
 | 
						|
	    me.items.push(
 | 
						|
		{
 | 
						|
		    title: gettext('Summary'),
 | 
						|
		    iconCls: 'fa fa-book',
 | 
						|
		    itemId: 'system',
 | 
						|
		    expandedOnInit: true,
 | 
						|
		    xtype: 'pveNodeSummary'
 | 
						|
		},
 | 
						|
		{
 | 
						|
		    title: gettext('Services'),
 | 
						|
		    iconCls: 'fa fa-cogs',
 | 
						|
		    itemId: 'services',
 | 
						|
		    groups: ['system'],
 | 
						|
		    xtype: 'pveNodeServiceView'
 | 
						|
		},
 | 
						|
		{
 | 
						|
		    title: gettext('Time'),
 | 
						|
		    itemId: 'time',
 | 
						|
		    groups: ['system'],
 | 
						|
		    xtype: 'pveNodeTimeView',
 | 
						|
		    iconCls: 'fa fa-clock-o'
 | 
						|
		});
 | 
						|
	}
 | 
						|
 | 
						|
	if (caps.nodes['Sys.Syslog']) {
 | 
						|
	    me.items.push({
 | 
						|
		title: 'Syslog',
 | 
						|
		iconCls: 'fa fa-list',
 | 
						|
		groups: ['system'],
 | 
						|
		disabled: !caps.nodes['Sys.Syslog'],
 | 
						|
		itemId: 'syslog',
 | 
						|
		xtype: 'pveLogView',
 | 
						|
		url: "/api2/extjs/nodes/" + nodename + "/syslog",
 | 
						|
		log_select_timespan: 1
 | 
						|
	    });
 | 
						|
 | 
						|
	    if (caps.nodes['Sys.Modify']) {
 | 
						|
		me.items.push({
 | 
						|
		    title: gettext('Updates'),
 | 
						|
		    iconCls: 'fa fa-refresh',
 | 
						|
		    disabled: !caps.nodes['Sys.Console'],
 | 
						|
		    itemId: 'apt',
 | 
						|
		    xtype: 'pveNodeAPT',
 | 
						|
		    nodename: nodename
 | 
						|
		});
 | 
						|
	    }
 | 
						|
	}
 | 
						|
 | 
						|
	if (caps.nodes['Sys.Audit']) {
 | 
						|
	    me.items.push(
 | 
						|
		{
 | 
						|
		    title: gettext('Network'),
 | 
						|
		    iconCls: 'fa fa-exchange',
 | 
						|
		    itemId: 'network',
 | 
						|
		    expandedOnInit: true,
 | 
						|
		    collapsibleTabBar: false,
 | 
						|
		    xtype: 'pveNodeNetworkView'
 | 
						|
		},
 | 
						|
		{
 | 
						|
		    title: gettext('DNS'),
 | 
						|
		    iconCls: 'fa fa-globe',
 | 
						|
		    groups: ['network'],
 | 
						|
		    itemId: 'dns',
 | 
						|
		    xtype: 'pveNodeDNSView'
 | 
						|
		},
 | 
						|
		{
 | 
						|
		    xtype: 'pveFirewallRules',
 | 
						|
		    iconCls: 'fa fa-shield',
 | 
						|
		    groups: ['network'],
 | 
						|
		    title: gettext('Firewall'),
 | 
						|
		    allow_iface: true,
 | 
						|
		    base_url: '/nodes/' + nodename + '/firewall/rules',
 | 
						|
		    list_refs_url: '/cluster/firewall/refs',
 | 
						|
		    itemId: 'firewall'
 | 
						|
		},
 | 
						|
		{
 | 
						|
		    xtype: 'pveFirewallOptions',
 | 
						|
		    title: gettext('Options'),
 | 
						|
		    iconCls: 'fa fa-gear',
 | 
						|
		    groups: ['network', 'firewall'],
 | 
						|
		    base_url: '/nodes/' + nodename + '/firewall/options',
 | 
						|
		    fwtype: 'node',
 | 
						|
		    itemId: 'firewall-options'
 | 
						|
		});
 | 
						|
	}
 | 
						|
 | 
						|
 | 
						|
	if (caps.nodes['Sys.Audit']) {
 | 
						|
	    me.items.push(
 | 
						|
		{
 | 
						|
		    title: 'Ceph',
 | 
						|
		    itemId: 'ceph',
 | 
						|
		    iconCls: 'fa fa-ceph',
 | 
						|
		    xtype: 'pveNodeCephStatus'
 | 
						|
		},
 | 
						|
		{
 | 
						|
		    title: gettext('Disks'),
 | 
						|
		    xtype: 'pveNodeCephDiskList',
 | 
						|
		    iconCls: 'fa fa-hdd-o',
 | 
						|
		    itemId: 'disklist',
 | 
						|
		    groups: ['ceph']
 | 
						|
		},
 | 
						|
		{
 | 
						|
		    xtype: 'pveNodeCephConfigCrush',
 | 
						|
		    title: gettext('Config'),
 | 
						|
		    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: gettext('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: ['network', 'firewall'],
 | 
						|
		    url: '/api2/extjs/nodes/' + nodename + '/firewall/log',
 | 
						|
		    itemId: 'firewall-fwlog'
 | 
						|
		},
 | 
						|
		{
 | 
						|
		    title: gettext('Log'),
 | 
						|
		    itemId: 'ceph-log',
 | 
						|
		    iconCls: 'fa fa-list',
 | 
						|
		    groups: ['ceph'],
 | 
						|
		    xtype: 'pveLogView',
 | 
						|
		    url: "/api2/extjs/nodes/" + nodename + "/ceph/log"
 | 
						|
		});
 | 
						|
	}
 | 
						|
 | 
						|
	if (caps.nodes['Sys.Console']) {
 | 
						|
	    me.items.push(
 | 
						|
		{
 | 
						|
		    title: gettext('Shell'),
 | 
						|
		    iconCls: 'fa fa-terminal',
 | 
						|
		    groups: ['system'],
 | 
						|
		    itemId: 'console',
 | 
						|
		    xtype: 'pveNoVncConsole',
 | 
						|
		    consoleType: 'shell',
 | 
						|
		    nodename: nodename
 | 
						|
		}
 | 
						|
	    );
 | 
						|
	}
 | 
						|
 | 
						|
	me.items.push(
 | 
						|
	    {
 | 
						|
		title: gettext('Task History'),
 | 
						|
		iconCls: 'fa fa-list',
 | 
						|
		itemId: 'tasks',
 | 
						|
		xtype: 'pveNodeTasks'
 | 
						|
	    },
 | 
						|
	    {
 | 
						|
		title: gettext('Subscription'),
 | 
						|
		iconCls: 'fa fa-support',
 | 
						|
		itemId: 'support',
 | 
						|
		xtype: 'pveNodeSubscription',
 | 
						|
		nodename: nodename
 | 
						|
	    }
 | 
						|
	);
 | 
						|
 | 
						|
	me.callParent();
 | 
						|
 | 
						|
	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']) {
 | 
						|
		powermgmt = false;
 | 
						|
	    }
 | 
						|
	    restartBtn.setDisabled(!powermgmt);
 | 
						|
	    shutdownBtn.setDisabled(!powermgmt);
 | 
						|
	    shellBtn.setDisabled(!powermgmt);
 | 
						|
	});
 | 
						|
 | 
						|
	me.on('afterrender', function() {
 | 
						|
	    me.statusStore.startUpdate();
 | 
						|
	});
 | 
						|
 | 
						|
	me.on('destroy', function() {
 | 
						|
	    me.statusStore.stopUpdate();
 | 
						|
	});
 | 
						|
    }
 | 
						|
});
 |