BCFailCnt.js 1.13 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
/*jslint confusion: true */
Ext.define('PVE.node.BCFailCnt', {
    extend: 'Ext.grid.GridPanel',
    alias: ['widget.pveNodeBCFailCnt'],

    initComponent : function() {
	var me = this;

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

	var store = new Ext.data.Store({
	    model: 'pve-openvz-ubc',
	    proxy: {
		type: 'pve',
		url: '/api2/json/nodes/' + nodename + '/ubcfailcnt'
	    },
	    sorters: [
		{
		    property : 'id',
		    direction: 'ASC'
		}
	    ]
	});

	var reload = function() {
	    store.load();
	};

	Ext.applyIf(me, {
	    store: store,
	    stateful: false,
	    columns: [
		{
		    header: 'Container',
		    width: 100,
		    dataIndex: 'id'
		},
		{
		    header: 'failcnt',
		    flex: 1,
		    dataIndex: 'failcnt'
		}
	    ],
	    listeners: {
		show: reload,
		itemdblclick: function(v, record) {
		    var ws = me.up('pveStdWorkspace');
		    ws.selectById('openvz/' + record.data.id);
Dietmar Maurer's avatar
Dietmar Maurer committed
52
		}
53 54 55 56 57 58 59 60 61 62 63 64 65 66
	    }
	});

	me.callParent();

   }
}, function() {

    Ext.define('pve-openvz-ubc', {
	extend: "Ext.data.Model",
	fields: [ 'id', { name: 'failcnt', type: 'number' } ]
    });

});