TECHZEN Zenoss User Community ARCHIVE  

Adding Status Column to Infrastructure Device Grid

Subject: Adding Status Column to Infrastructure Device Grid
Author: [Not Specified]
Posted: 2016-06-30 00:36

Hello

In my ZenPack I am trying to add a new column to the device grid in the INFRASTRUCTURE page that shows the device's status (UP or DOWN). I am using Zenoss Core 4.2.5 which uses ExtJS 4.0.1

It seems that the current default column values for each device come from the usage of JSON API call to the getDevices method, called from ExtJS. However, for some unknown design reason, the status value of the devices is not included in the dictionary returned by this function. It seems this value is obtained by using the getInfo call instead.

Therefore my question is, how can I obtain this value to add it into the grid, from my ZenPack and without modifying the Zenoss Core original ExtJS code

For completion, below is the code that adds the column assuming that a valid 'status' dataIndex exists (which does not):

Ext.onReady(function() {
Ext.ns('Zenoss');

var DEVICE_GRID_ID = 'device_grid';

Ext.ComponentMgr.onAvailable(DEVICE_GRID_ID, function() {
var grid = Ext.getCmp(DEVICE_GRID_ID);
var store = grid.getStore();
var model = store.model;

// Add 'status' field to the Zenoss.device.DeviceModel model
Zenoss.device.DeviceModel.prototype.fields.add(new Ext.data.Field({name: 'status', type: 'string'}));

// Create the 'status' column
var status_column = Ext.create('Ext.grid.column.Column', {
id: 'status',
width: 100,
dataIndex: 'status',
header: _t('Status'),
//renderer: Zenoss.render.pingStatus
});

// Insert the status column into the device grid
grid.headerCt.insert(1, status_column);
grid.getView().refresh();
});
});



Subject: Anyone...?
Author: [Not Specified]
Posted: 2016-07-03 20:49

Anyone...



Subject: Hi,
Author: [Not Specified]
Posted: 2016-07-04 03:35

Hi,

This may help, add property store instead of dataIndex:

store: new Ext.data.DirectStore({
directFn: Zenoss.remote.DeviceRouter.getInfo,
root: 'data',
model: 'Zenoss.InstanceModel',
fields: ['pingStatus'],
listeners: {
load: function() {
//update grid here
}
}
}),

Take a look at zenoss directory for "zenoss-compiled-debug.js" file. This one has a lot of interesting stuff.

Regards,
V.



Subject: Vsergeyv thank you for your
Author: [Not Specified]
Posted: 2016-07-05 00:39

Vsergeyv thank you for your reply.

When creating and loading the store in your code, I get an error notificiation in Zenoss that says:

TypeError: getInfo() got an unexpected keyword argument 'start'

Which raises the question of the getInfo parameters (which I assume are uid and keys.), how do I specify these parameters in the directFn field They should somehow be served for each device found in the device grid, but I am not sure exactly how...



Subject: Anyone... ?
Author: [Not Specified]
Posted: 2016-07-18 00:34

Anyone...



< Previous
ZenPack Developers' Guide now publicly available!
  Next
Modeling 2012 R2 domain controller causes 100% CPU
>