Summary.js 1.87 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Ext.define('PVE.qemu.Summary', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.pveQemuSummary',

    initComponent: function() {
        var me = this;

	var nodename = me.pveSelNode.data.node;
	if (!nodename) {
	    throw "no node name specified";
	}

	var vmid = me.pveSelNode.data.vmid;
	if (!vmid) {
	    throw "no VM ID specified";
	}

18 19 20 21
	if (!me.workspace) {
	    throw "no workspace specified";
	}

Dietmar Maurer's avatar
Dietmar Maurer committed
22 23 24 25 26 27
	if (!me.statusStore) {
	    throw "no status storage specified";
	}

	var rstore = me.statusStore;

28 29 30
	var statusview = Ext.create('PVE.qemu.StatusView', {
	    title: 'Status',
	    pveSelNode: me.pveSelNode,
Dietmar Maurer's avatar
Dietmar Maurer committed
31 32
	    width: 400,
	    rstore: rstore
33 34 35 36
	});

	var rrdurl = "/api2/png/nodes/" + nodename + "/qemu/" + vmid + "/rrd";

37
	var notesview = Ext.create('PVE.panel.NotesView', {
38 39 40 41 42
	    pveSelNode: me.pveSelNode,
	    flex: 1
	});

	Ext.apply(me, {
Dietmar Maurer's avatar
Dietmar Maurer committed
43
	    tbar: [ '->', { xtype: 'pveRRDTypeSelector' } ],
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
	    autoScroll: true,
	    bodyStyle: 'padding:10px',
	    defaults: {
		style: 'padding-top:10px',
		width: 800
	    },		
	    items: [
		{
		    style: 'padding-top:0px',
		    layout: {
			type: 'hbox',
			align: 'stretchmax'
		    },
		    border: false,
		    items: [ statusview, notesview ]
		},
		{
		    xtype: 'pveRRDView',
		    title: "CPU usage %",
		    pveSelNode: me.pveSelNode,
		    datasource: 'cpu',
		    rrdurl: rrdurl
		},
		{
		    xtype: 'pveRRDView',
		    title: "Memory usage",
		    pveSelNode: me.pveSelNode,
		    datasource: 'mem,maxmem',
		    rrdurl: rrdurl
		},
		{
		    xtype: 'pveRRDView',
		    title: "Network traffic",
		    pveSelNode: me.pveSelNode,
		    datasource: 'netin,netout',
		    rrdurl: rrdurl
		},
		{
		    xtype: 'pveRRDView',
		    title: "Disk IO",
		    pveSelNode: me.pveSelNode,
		    datasource: 'diskread,diskwrite',
		    rrdurl: rrdurl
		}
	    ]
	});

	me.on('show', function() {
	    notesview.load();
	});

	me.callParent();
    }
});