Forked mumble-django project from https://bitbucket.org/Svedrin/mumble-django
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.2 KiB

  1. // kate: space-indent on; indent-width 4; replace-tabs on;
  2. Ext.namespace('Ext.ux');
  3. Ext.ux.LogViewerPanel = function( config ){
  4. Ext.apply( this, config );
  5. Ext.applyIf( this, {
  6. xtype: 'grid',
  7. title: gettext('Log messages'),
  8. colModel: new Ext.grid.ColumnModel([{
  9. header: gettext('Timestamp'),
  10. dataIndex: 'timestamp',
  11. width: 100,
  12. renderer: function( value ){
  13. return new Date(value*1000).format( "Y-m-d H:i:s" );
  14. }
  15. }, {
  16. header: gettext('Log entry'),
  17. width: 500,
  18. dataIndex: 'txt'
  19. }]),
  20. bbar: [{
  21. text: gettext('Filter') + ':'
  22. }, {
  23. xtype: 'textfield',
  24. name: 'filter',
  25. listeners: {
  26. render: function(c) {
  27. Ext.QuickTips.register({
  28. target: c.getEl(),
  29. text: gettext('Enter a string to filter the logs by and press Enter. To display all log entries, empty this field.')
  30. });
  31. },
  32. specialkey: function( field, ev ){
  33. if( ev.getKey() == ev.ENTER ){
  34. field.ownerCt.ownerCt.store.baseParams.filter = field.getValue();
  35. field.ownerCt.ownerCt.store.reload();
  36. }
  37. }
  38. }
  39. }, '-', {
  40. iconCls: 'x-tbar-loading',
  41. tooltip: gettext('Refresh'),
  42. handler: function(){
  43. this.ownerCt.ownerCt.store.reload();
  44. }
  45. }],
  46. store: new Ext.data.DirectStore({
  47. baseParams: {'server': this.server, 'start': 0, 'limit': 100, 'filter': ''},
  48. directFn: Mumble.log,
  49. paramOrder: ['server', 'start', 'limit', 'filter'],
  50. root: 'data',
  51. fields: ['timestamp', 'txt'],
  52. autoLoad: true,
  53. remoteSort: false
  54. }),
  55. viewConfig: { forceFit: true }
  56. });
  57. Ext.ux.LogViewerPanel.superclass.constructor.call( this );
  58. }
  59. Ext.extend( Ext.ux.LogViewerPanel, Ext.grid.EditorGridPanel, {
  60. } );
  61. Ext.reg( 'logViewerPanel', Ext.ux.LogViewerPanel );