Changeset 546 for trunk


Ignore:
Timestamp:
07/12/08 22:54:34 (14 years ago)
Author:
ramonb
Message:

job_monarch/templates/header.tpl:

  • set clustername in grid window title
  • respect filters for each load: filters now stick beyond multiple pages

job_monarch/js/jobgrid.js:

  • added some useful functions
  • respect parameters set while applying filters: filters now stick beyond multiple pages
Location:
trunk/web2/addons/job_monarch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/web2/addons/job_monarch/js/jobgrid.js

    r545 r546  
    44var JobListingWindow;
    55var JobProxy;
    6 var myfilters = { start: 0, limit: 30};
     6var myfilters = { };
     7var myparams = { };
     8
     9var filterfields = [ "jid", "queue", "name", "owner" ];
     10
     11function isset( somevar )
     12{
     13  try
     14  {
     15    if( eval( somevar ) ) { }
     16  }
     17  catch( err )
     18  {
     19    return false;
     20  }
     21  return true;
     22}
     23
     24function inMyArray( arr, someval )
     25{
     26  for( arval in arr )
     27  {
     28    if( arval == someval )
     29    {
     30      return true;
     31    }
     32  }
     33  return false;
     34}
     35
     36function inMyArrayValues( arr, someval )
     37{
     38  for( arkey in arr )
     39  {
     40    if( arr[arkey] == someval )
     41    {
     42      return true;
     43    }
     44  }
     45  return false;
     46}
     47
     48function inMyArrayKeys( arr, someval )
     49{
     50  for( arkey in arr )
     51  {
     52    if( arkey == someval )
     53    {
     54      return true;
     55    }
     56  }
     57  return false;
     58}
     59
     60function joinMyArray( arr1, arr2 )
     61{
     62  for( arkey in arr2 )
     63  {
     64    arr1[arkey] = arr2[arkey];
     65  }
     66
     67  return arr1;
     68}
    769
    870function initJobGrid() {
     
    2082    if( fieldName == 'owner' || fieldName == 'jid' || fieldName == 'status' || fieldName == 'queue' )
    2183    {
    22       if( myfilters[fieldName] != null )
     84      if( !isset( myfilters[fieldName] ) )
    2385      {
    2486        Ext.fly(cell).removeClass( 'filterenabled' );
    2587        Ext.fly(cell).addClass( 'filter' );
    2688
     89        // Remove this filter
     90        //
    2791        delete myfilters[fieldName];
    28 
    29         grid.getStore().reload( {params: myfilters} );
     92        delete myparams[fieldName];
     93
     94        // Respect any other parameters that may have been set outside filters
     95        //
     96        myparams = joinMyArray( myparams, myfilters );
     97
     98        // Can't be sure if there are enough pages for new filter: reset to page 1
     99        //
     100        myparams = joinMyArray( myparams, { start: 0, limit: 30 } );
     101
     102        grid.getStore().reload( { params: myparams } );
    30103      }
    31104      else
     
    34107        Ext.fly(cell).addClass( 'filterenabled' );
    35108
     109        // Set filter for selected column to selected cell value
     110        //
    36111        myfilters[fieldName] = data;
    37112
    38         grid.getStore().reload( {params: myfilters} );
     113        myparams = joinMyArray( myparams, myfilters );
     114        myparams = joinMyArray( myparams, { start: 0, limit: 30 } );
     115
     116        grid.getStore().reload( { params: myparams } );
    39117      }
    40118    }
  • trunk/web2/addons/job_monarch/templates/header.tpl

    r541 r546  
    99<link rel="stylesheet" type="text/css" href="./css/styles.css" />
    1010<script type="text/javascript" src="./lib/extjs/adapter/ext/ext-base.js"></script>
    11 <script type="text/javascript" src="./lib/extjs/adapter/ext/ext-base-debug.js"></script>
     11<!-- <script type="text/javascript" src="./lib/extjs/adapter/ext/ext-base-debug.js"></script> -->
    1212<script type="text/javascript" src="./lib/extjs/ext-all.js"></script>
    13 <script type="text/javascript" src="./lib/extjs/ext-all-debug.js"></script>
     13<!-- <script type="text/javascript" src="./lib/extjs/ext-all-debug.js"></script> -->
    1414<script type="text/javascript" src="./lib/extjs/searchfield.js"></script>
    1515<script type="text/javascript" src="./js/jobgrid.js"></script>
     
    1919  JobProxy.on('beforeload', function(p, params) {
    2020        params.c = "{cluster}";
     21        newparams = joinMyArray( params, myfilters );
     22        myparams = newparams;
     23        params = newparams;
    2124    });
    2225  JobsDataStore.load( {params: {start: 0, limit: 30}} );
     26  JobListingWindow.setTitle( "{cluster} Jobs Overview" );
    2327  JobListingWindow.show();
    2428  });
Note: See TracChangeset for help on using the changeset viewer.