SystemInformationGrid.js (1863B)
1 /** 2 * This class represents a list of all system information records. 3 */ 4 Ext.define('PartKeepr.SystemInformationGrid', { 5 extend: 'PartKeepr.BaseGrid', 6 7 /* Define the columns */ 8 columns: [ 9 { 10 header: 'Name', 11 dataIndex: 'name', 12 width: 200 13 }, { 14 header: 'Value', 15 dataIndex: 'value', 16 renderer: Ext.util.Format.htmlEncode, 17 flex: 1 18 }, { 19 header: 'Category', 20 dataIndex: 'category', 21 hidden: true 22 } 23 ], 24 25 /** 26 * Initializes the component 27 */ 28 initComponent: function () 29 { 30 31 /* Add grouping */ 32 var groupingFeature = Ext.create('Ext.grid.feature.Grouping', { 33 groupHeaderTpl: '{name}' 34 }); 35 36 this.features = [groupingFeature]; 37 38 /* Create the store using an in-memory proxy */ 39 this.store = Ext.create("Ext.data.Store", { 40 model: 'PartKeepr.SystemInformationRecord', 41 sorters: ['category', 'name'], 42 groupField: 'category' 43 }); 44 45 46 /* Add the refresh button */ 47 this.refreshButton = Ext.create("Ext.button.Button", { 48 handler: function () { this.store.load(); }, 49 scope: this, 50 text: i18n("Refresh") 51 }); 52 53 this.bottomToolbar = Ext.create("Ext.toolbar.Toolbar", { 54 dock: 'bottom', 55 ui: 'footer', 56 items: [this.refreshButton] 57 }); 58 59 this.dockedItems = [this.bottomToolbar]; 60 61 // Initialize the panel 62 this.callParent(); 63 64 // Retrieve the system information 65 this.store.load(); 66 }, 67 statics: { 68 iconCls: 'fugue-icon system-monitor', 69 title: i18n('System Information'), 70 closable: true, 71 menuPath: [{text: i18n("View")}] 72 } 73 });