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.
This commit is contained in:
csoni
2016-12-06 11:22:40 +05:30
committed by Chintan.kukadiya
parent edd376b5b8
commit b1e0b39c8e
8 changed files with 440 additions and 24 deletions

View File

@ -27,9 +27,40 @@ Zarafa.plugins.mdm.MDM = Ext.extend(Zarafa.core.Plugin, {
{
this.registerInsertionPoint('context.settings.categories', this.createSettingCategory, this);
this.registerInsertionPoint('settings.versioninformation', this.createVersionInfo, this);
Zarafa.core.data.SharedComponentType.addProperty('mdm.dialog.mdmdevicedetails');
Zarafa.plugins.mdm.MDM.superclass.initPlugin.apply(this, arguments);
},
/**
* Bid for the type of shared component and the given record.
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
* @param {Ext.data.Record} record Optionally passed record.
* @returns {Number}
*/
bidSharedComponent : function (type, record)
{
var bid = -1;
switch (type) {
case Zarafa.core.data.SharedComponentType['mdm.dialog.mdmdevicedetails']:
bid = 1;
break;
}
return bid;
},
/**
* Will return the reference to the shared component.
* Based on the type of component requested a component is returned.
* @param {Zarafa.core.data.SharedComponentType} type Type of component a context can bid for.
* @param {Ext.data.Record} record Optionally passed record.
* @return {Zarafa.plugins.mdm.dialogs.MDMDeviceDetailsContentPanel} Component
*/
getSharedComponent : function (type, record)
{
return Zarafa.plugins.mdm.dialogs.MDMDeviceDetailsContentPanel;
},
/**
* Creates a category in settings for Z-Push
* @return {mdmsettingscategory}

View File

@ -2,19 +2,23 @@ Ext.namespace('Zarafa.plugins.mdm');
Zarafa.plugins.mdm.data.MDMDeviceRecordFields = [
{name: 'entryid', type: 'string'},
{name: 'changed', type: 'boolean'},
{name: 'devicetype', type: 'string'},
{name: 'deviceos', type: 'string'},
{name: 'devicefriendlyname', type: 'string'},
{name: 'deviceinfo', type: 'string'},
{name: 'devicetype', type: 'string'},
{name: 'devicemodel', type: 'string'},
{name: 'domain', type: 'string'},
{name: 'hierarchyuuid', type: 'string'},
// ignoredmessages
{name: 'useragent', type: 'string'},
{name: 'asversion', type: 'string'},
{name: 'firstsynctime', type: 'date', dateFormat: 'timestamp'},
{name: 'lastsynctime', type: 'date', dateFormat: 'timestamp'},
{name: 'lastupdatetime', type: 'date', dateFormat: 'timestamp'},
{name: 'wipestatus', type: 'string'},
{name: 'useragent', type: 'string'}
{name: 'policyname', type: 'string'},
{name: 'totalfolders', type: 'string'},
{name: 'shortfolderids', type: 'string'},
{name: 'synchronizedfolders', type: 'string'},
{name: 'synchronizeddata', type: 'string'},
{name: 'koeversion', type: 'string'},
{name: 'koebuild', type: 'string'},
{name: 'koebuilddate', type: 'date', dateFormat: 'timestamp'}
];
/**

View File

@ -0,0 +1,38 @@
Ext.namespace('Zarafa.plugins.mdm.dialogs');
/**
* @class Zarafa.plugins.mdm.dialogs.MDMDeviceDetailsContentPanel
* @extends Zarafa.core.ui.ContentPanel
* @xtype mdmplugin.devicedetailscontentpanel
*
* The content panel which is use to show device detail panel.
*/
Zarafa.plugins.mdm.dialogs.MDMDeviceDetailsContentPanel = Ext.extend(Zarafa.core.ui.ContentPanel, {
/**
* @constructor
* @param config Configuration structure
*/
constructor: function (config) {
config = config || {};
Ext.applyIf(config, {
xtype: 'mdmplugin.devicedetailscontentpanel',
layout : 'fit',
modal : true,
width : 435,
minWidth : 435,
autoHeight: true,
title : dgettext('plugin_mdm', config.record.get('devicetype')),
items : [{
xtype: 'mdmplugin.devicedetailspanel',
record : config.record
}]
});
Zarafa.plugins.mdm.dialogs.MDMDeviceDetailsContentPanel.superclass.constructor.call(this, config);
}
});
Ext.reg('mdmplugin.devicedetailscontentpanel', Zarafa.plugins.mdm.dialogs.MDMDeviceDetailsContentPanel);

View File

@ -0,0 +1,184 @@
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);

View File

@ -87,7 +87,11 @@ Zarafa.plugins.mdm.settings.MDMSettingsWidget = Ext.extend(Zarafa.settings.ui.Se
ref : '../../../refresh',
handler : this.onRefresh,
scope : this
}]
}],
listeners : {
rowdblclick: this.onRowDblClick,
scope : this
}
}]
}]
});
@ -192,6 +196,21 @@ Zarafa.plugins.mdm.settings.MDMSettingsWidget = Ext.extend(Zarafa.settings.ui.Se
onRefresh : function()
{
this.deviceGrid.getStore().load();
},
/**
* Function is called if a row in the grid gets double clicked.
* Which is use to show a dialog with detail device information
* @param {Ext.grid.GridPanel} grid The Grid on which the user double-clicked
* @param {Number} rowIndex The Row number on which was double-clicked.
*/
onRowDblClick : function (grid, rowIndex)
{
var record = grid.getStore().getAt(rowIndex);
Zarafa.core.data.UIFactory.openLayerComponent(Zarafa.core.data.SharedComponentType['mdm.dialog.mdmdevicedetails'], undefined, {
manager : Ext.WindowMgr,
record : record
});
}
});