Ext.define('TP.PanletGridServer', {
    extend: 'TP.PanletGrid',

    title:  'Site Status',
    height: 200,
    width:  260,
    initComponent: function() {
        this.callParent();
        this.xdata.url       = 'panorama.cgi?task=site_status';
        TP.hideFormElements(this.down('form').getForm(), ['url', 'backends']);
        this.reloadOnSiteChanges = true;
    }
});

/* toggle backends */
TP.toggleBackend = function(panel, backend) {
    if(initial_backend_states[backend] == 2) {
        initial_backend_states[backend] = 0;
        panel.style.backgroundImage = 'url(../plugins/panorama/images/accept.png)';
    } else {
        initial_backend_states[backend] = 2;
        panel.style.backgroundImage = 'url(../plugins/panorama/images/sport_golf.png)';
    }
    initial_backends[backend].state = initial_backend_states[backend];

    TP.setBackendsCookieAndRefresh(1000);
}


Ext.define('TP.PanletGridServerStats', {
    extend: 'TP.PanletGrid',

    title:  'Server Status',
    height: 420,
    width:  200,
    initComponent: function() {
        this.callParent();
        this.xdata.url    = 'panorama.cgi?task=server_stats';
        this.xdata.cpu    = true;
        this.xdata.load   = true;
        this.xdata.memory = true;
        TP.hideFormElements(this.down('form').getForm(), ['url', 'backends']);

        this.down('form').add({
            fieldLabel: 'CPU',
            xtype:      'checkbox',
            name:       'cpu'
        });
        this.down('form').add({
            fieldLabel: 'Load',
            xtype:      'checkbox',
            name:       'load'
        });
        this.down('form').add({
            fieldLabel: 'Memory',
            xtype:      'checkbox',
            name:       'memory'
        });
    }
});
