KWA-MDM/js/dialogs/MDMDeviceDetailsPanel.js
csoni b1e0b39c8e Pop-up webapp dialog with additional device info
On server side prepare device information data from z-push webservice response.
On client side prepare dialog to show addition device information on row double click.
2017-01-06 16:22:32 +05:30

184 lines
6.0 KiB
JavaScript

Ext.namespace('Zarafa.plugins.mdm.dialogs');
/**
* @class Zarafa.plugins.mdm.dialogs.MDMDeviceDetailsPanel
* @extends Ext.form.FormPanel
* @xtype mdmplugin.devicedetailspanel
*
* This dialog panel will provide detail information of device.
*/
Zarafa.plugins.mdm.dialogs.MDMDeviceDetailsPanel = Ext.extend(Ext.form.FormPanel, {
/**
* @cfg {Zarafa.plugins.mdm.data.MDMDeviceRecord} record The device record which
* is being display by this panel.
*/
record : null,
/**
* @constructor
* @param config Configuration structure
*/
constructor : function (config) {
config = config || {};
Ext.applyIf(config, {
xtype : 'mdmplugin.devicedetailspanel',
layout : 'form',
autoScroll : true,
autoResize : true,
height : 500,
defaultType : 'textfield',
defaults : {
width : 300,
readOnly : true
},
items : this.createPanelItems(config),
listeners : {
afterlayout : this.onAfterLayout,
scope : this
}
});
Zarafa.plugins.mdm.dialogs.MDMDeviceDetailsPanel.superclass.constructor.call(this, config);
},
/**
* Function will create panel items for {@link Zarafa.plugins.mdm.dialogs.MDMDeviceDetailsPanel MDMDeviceDetailsPanel}.
* @param config Configuration structure
* @return {Array} array of items that should be added to panel.
*/
createPanelItems : function (config)
{
var items = [{
fieldLabel : dgettext('plugin_mdm', 'Device Id'),
name : "entryid"
}, {
fieldLabel : dgettext('plugin_mdm', 'Device Type'),
name : "devicetype"
}, {
fieldLabel : dgettext('plugin_mdm', 'Device OS'),
name : "deviceos"
}, {
fieldLabel : dgettext('plugin_mdm', 'Device Friendly Name'),
name : "devicefriendlyname"
}, {
fieldLabel : dgettext('plugin_mdm', 'User Agent'),
name : "useragent"
}, {
fieldLabel : dgettext('plugin_mdm', 'ActiveSync Version'),
name : "asversion"
}, {
fieldLabel : dgettext('plugin_mdm', 'Z-Push Version'),
value : container.getSettingsModel().get('zarafa/v1/plugins/mdm/zpush-server-version', true)
}, {
xtype : "label",
width : 100,
text : dgettext('plugin_mdm', 'First sync') + ':'
}, {
xtype : 'zarafa.datetimefield',
name : "firstsynctime"
}, {
xtype : "label",
width : 100,
text : dgettext('plugin_mdm', 'Last sync') + ':'
}, {
xtype : 'zarafa.datetimefield',
name : "lastsynctime"
}, {
xtype : "label",
width : 100,
text : dgettext('plugin_mdm', 'Last Update Time') + ':'
}, {
xtype : 'zarafa.datetimefield',
name : "lastupdatetime"
}, {
fieldLabel : dgettext('plugin_mdm', 'Total folders'),
name : "totalfolders"
}, {
fieldLabel : dgettext('plugin_mdm', 'Short folder Ids'),
name : "shortfolderids"
}, {
fieldLabel : dgettext('plugin_mdm', 'Synchronized folders'),
name : "synchronizedfolders"
}, {
xtype : 'textarea',
fieldLabel : dgettext('plugin_mdm', 'Synchronized data'),
autoHeight : true,
name : "synchronizeddata"
}, {
fieldLabel : dgettext('plugin_mdm', 'Status'),
listeners : {
afterrender : this.onAfterRenderStatus,
scope : this
}
}, {
fieldLabel : dgettext('plugin_mdm', 'Policy name'),
name : "policyname"
}];
// KOE information
if (config.record && config.record.get('koeversion')) {
items.push(this.createKOEItems());
}
return items;
},
/**
* Function will create Kopano Outlook Extension panel items for
* {@link Zarafa.plugins.mdm.dialogs.MDMDeviceDetailsPanel MDMDeviceDetailsPanel}.
* @return {Array} array of items that should be added to panel.
*/
createKOEItems : function ()
{
return [{
xtype : 'fieldset',
checkboxToggle : false,
title : dgettext('plugin_mdm', 'Kopano Outlook Extension'),
layout : 'form',
width : 405,
defaultType : 'textfield',
defaults : {
readOnly : true,
width : 285
},
items : [{
fieldLabel : dgettext('plugin_mdm', 'Version'),
name : "koeversion"
}, {
fieldLabel : dgettext('plugin_mdm', 'Build'),
name : "koebuild"
},{
xtype : "label",
width : 100,
text : dgettext('plugin_mdm', 'Build Date') + ':'
}, {
xtype : 'zarafa.datetimefield',
name : "koebuilddate"
}]
}]
},
/**
* Function which handles the after layout event of {@link Zarafa.plugins.mdm.dialogs.MDMDeviceDetailsPanel panel}
* Which is use to set record values into form fields.
*/
onAfterLayout : function ()
{
this.getForm().loadRecord(this.record);
},
/**
* Function which handles the after render event of status field.
* Which is use to set the the display name for the given Provisioning Status into given field
* @param {Ext.form.TextField} statusField text field
*/
onAfterRenderStatus : function (statusField)
{
var status = parseInt(this.record.get("wipestatus"));
statusField.setValue(Zarafa.plugins.mdm.data.ProvisioningStatus.getDisplayName(status));
}
});
Ext.reg('mdmplugin.devicedetailspanel', Zarafa.plugins.mdm.dialogs.MDMDeviceDetailsPanel);