partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

BatchJobGrid.js (1554B)


      1 Ext.define('PartKeepr.BatchJobGrid', {
      2     extend: 'PartKeepr.EditorGrid',
      3     alias: 'widget.BatchJobGrid',
      4     columns: [
      5         {header: i18n("Batch Job"), dataIndex: 'name', flex: 1}
      6     ],
      7     addButtonText: i18n("Add Batch Job"),
      8     addButtonIconCls: 'fugue-icon task--plus',
      9     deleteButtonText: i18n("Delete Batch Job"),
     10     deleteButtonIconCls: 'fugue-icon task--minus',
     11     automaticPageSize: true,
     12     initComponent: function ()
     13     {
     14         this.callParent();
     15 
     16         this.executeBatchJob = Ext.create("Ext.button.Button", {
     17             iconCls: 'fugue-icon task--arrow',
     18             tooltip: i18n("Execute Batch Job"),
     19             handler: this.onExecuteBatchJob,
     20             disabled: true,
     21             scope: this
     22         });
     23         this.topToolbar.insert(2, {xtype: 'tbseparator'});
     24         this.topToolbar.insert(3, this.executeBatchJob);
     25     },
     26     /**
     27      * Called when an item was selected. Enables/disables the delete button.
     28      */
     29     _updateDeleteButton: function ()
     30     {
     31         this.callParent(arguments);
     32 
     33         /* Right now, we support delete on a single record only */
     34         if (this.getSelectionModel().getCount() == 1) {
     35             this.executeBatchJob.enable();
     36         } else {
     37             this.executeBatchJob.disable();
     38         }
     39     },
     40     onExecuteBatchJob: function ()
     41     {
     42         var selection = this.getSelectionModel().getSelection();
     43 
     44         var j = Ext.create("PartKeepr.Components.BatchJob.BatchJobExecutionWindow", {
     45             batchJob: selection[0]
     46         });
     47         j.show();
     48     }
     49 });