source: trunk/web2/addons/job_monarch/js/monarch.js @ 594

Last change on this file since 594 was 594, checked in by ramonb, 15 years ago

job_monarch/js/monarch.js:

  • changed show graphs button into menu button
File size: 20.0 KB
Line 
1var JobsDataStore;
2var JobsColumnModel;
3var JobListingEditorGrid;
4var JobListingWindow;
5var JobProxy;
6var SearchField;
7var filterButton;
8
9// associative filter array
10//
11var myfilters = { };
12
13// any other datastore params
14//
15var myparams = { };
16
17// (default) paging size
18//
19var mylimit = 15;
20
21var ClusterImageArgs = { };
22
23var filterfields = [ "jid", "queue", "name", "owner" ];
24
25var filterMenu = new Ext.menu.Menu(
26{
27        id:     'filterMenu',
28        items:  [ new Ext.menu.Item({ text: 'Clear all', handler: clearFilters }) ]
29});
30
31var filterButton = new Ext.MenuButton(
32{
33        id:             'filtermenuknop',
34        text:           'Filters',
35        disabled:       true,
36        menu:           filterMenu,
37        listeners:
38        {
39                'click':
40                {
41                        scope:  this,
42                        fn:     function( myButton, event )
43                                {
44                                        myButton.menu.show( myButton.getEl() );
45                                }
46                }
47        }
48});
49
50function checkGraphWindowOption( item, checked )
51{
52        alert('Item Check', 'You {1} the "{0}" menu item.', item.text, checked ? 'checked' : 'unchecked');
53}
54
55var graphMenu = new Ext.menu.Menu(
56{
57        id:     'graphMenu',
58        items:
59        [{
60                text:           'Each job in new window',
61                checked:        false,
62                group:          'graphwindow',
63                handler:        checkGraphWindowOption
64        },{
65                text:           'Each job in a seperate tab, in new window',
66                checked:        true,
67                group:          'graphwindow',
68                handler:        checkGraphWindowOption
69        },{
70                text:           'Each job in a seperate tab, in last opened window',
71                checked:        false,
72                group:          'graphwindow',
73                handler:        checkGraphWindowOption
74        }]
75});
76
77var showGraphsButton = new Ext.MenuButton(
78{
79        id:             'showgraphbutton',
80        text:           'Show graphs',
81        disabled:       true,
82        menu:           graphMenu,
83        listeners:
84        {
85                'click':
86                {
87                        scope:  this,
88                        fn:     ShowGraphs
89                }
90        }
91});
92
93Ext.namespace('Ext.ux');
94
95Ext.ux.PageSizePlugin = function()
96{
97        Ext.ux.PageSizePlugin.superclass.constructor.call(this,
98        {
99                store:  new Ext.data.SimpleStore(
100                {
101                        fields: ['text', 'value'],
102                        data:   [['10', 10], ['15', 15], ['20', 20], ['30', 30], ['50', 50], ['100', 100], ['max', 'max' ]]
103                }),
104                mode:           'local',
105                displayField:   'text',
106                valueField:     'value',
107                editable:       false,
108                allowBlank:     false,
109                triggerAction:  'all',
110                width:          40
111        });
112};
113
114Ext.extend(Ext.ux.PageSizePlugin, Ext.form.ComboBox,
115{
116        init:                   function(paging)
117                                {
118                                        paging.on('render', this.onInitView, this);
119                                },
120   
121        onInitView:             function(paging)
122                                {
123                                        paging.add('-',
124                                        this,
125                                        'jobs per page'
126                                        );
127                                        this.setValue(paging.pageSize);
128                                        this.on('select', this.onPageSizeChanged, paging);
129                                },
130
131        onPageSizeChanged:      function(combo)
132                                {
133                                        if ( combo.getValue() == 'max' )
134                                        {
135                                                mylimit = JobsDataStore.getTotalCount();
136                                        }
137                                        else
138                                        {
139                                                mylimit = parseInt(combo.getValue());
140                                        }
141                                        this.pageSize = mylimit;
142                                        this.doLoad(0);
143                                }
144});
145
146Ext.namespace( 'Ext' );
147
148function clearFilters()
149{
150        if( inMyArrayKeys( myfilters, 'query' ) )
151        {
152                SearchField.getEl().dom.value = '';
153                delete SearchField.store.baseParams['query'];
154                delete myfilters['query'];
155                delete myparams['query'];
156        }
157        if( inMyArrayKeys( myfilters, 'host' ) )
158        {
159                delete myfilters['host'];
160                delete myparams['host'];
161        }
162        if( inMyArrayKeys( myfilters, 'jid' ) )
163        {
164                delete myfilters['jid'];
165                delete myparams['jid'];
166        }
167        if( inMyArrayKeys( myfilters, 'queue' ) )
168        {
169                delete myfilters['queue'];
170                delete myparams['queue'];
171        }
172        if( inMyArrayKeys( myfilters, 'owner' ) )
173        {
174                delete myfilters['owner'];
175                delete myparams['owner'];
176        }
177        if( inMyArrayKeys( myfilters, 'status' ) )
178        {
179                delete myfilters['status'];
180                delete myparams['status'];
181        }
182        reloadJobStore();
183}
184
185function makeArrayURL( somearr )
186{
187        filter_url = '';
188        filter_sep = '';
189
190        for( filtername in somearr )
191        {
192                filter_url = filter_url + filter_sep + filtername + '=' + somearr[filtername];
193                filter_sep = '&';
194        }
195
196        return filter_url;
197}
198
199
200function isset( somevar )
201{
202        try
203        {
204                if( eval( somevar ) ) { }
205        }
206        catch( err )
207        {
208                return false;
209        }
210        return true;
211}
212
213function inMyArray( arr, someval )
214{
215        for( arval in arr )
216        {
217                if( arval == someval )
218                {
219                        return true;
220                }
221        }
222        return false;
223}
224
225function ArraySize( arr )
226{
227        count = 0;
228
229        for( arkey in arr )
230        {
231                count = count + 1;
232        }
233
234        return count;
235}
236
237function inMyArrayValues( arr, someval )
238{
239        for( arkey in arr )
240        {
241                if( arr[arkey] == someval )
242                {
243                        return true;
244                }
245        }
246        return false;
247}
248
249function inMyArrayKeys( arr, someval )
250{
251        for( arkey in arr )
252        {
253                if( arkey == someval )
254                {
255                        return true;
256                }
257        }
258        return false;
259}
260
261function joinMyArray( arr1, arr2 )
262{
263        for( arkey in arr2 )
264        {
265                arr1[arkey] = arr2[arkey];
266        }
267
268        return arr1;
269}
270
271function ClusterImageSelectHost( somehost )
272{
273        if( !inMyArrayKeys( myfilters, 'host' ) )
274        {
275                myfilters['host'] = somehost;
276        }
277        else
278        {
279                if( myfilters['host'] == somehost )
280                {
281                        delete myfilters['host'];
282                        delete myparams['host'];
283                }
284                else
285                {
286                        myfilters['host'] = somehost;
287                }
288        }
289
290        reloadClusterImage();
291        reloadJobStore();
292
293        // returning false causes a image reload
294        //
295        return false;
296}
297
298function reloadJobStore()
299{
300        // Respect any other parameters that may have been set outside filters
301        //
302        myparams = joinMyArray( myparams, myfilters );
303
304        // Can't be sure if there are enough pages for new filter: reset to page 1
305        //
306        myparams = joinMyArray( myparams, { start: 0, limit: mylimit } );
307
308        JobsDataStore.reload( { params: myparams } );
309}
310
311function addListener(element, type, expression, bubbling)
312{
313        bubbling = bubbling || false;
314
315        if(window.addEventListener)
316        { // Standard
317                element.addEventListener(type, expression, bubbling);
318                return true;
319        } 
320        else if(window.attachEvent) 
321        { // IE
322                element.attachEvent('on' + type, expression);
323                return true;
324        }
325        else 
326        {
327                return false;
328        }
329}
330
331function makeFilterString()
332{
333        var filter_str = '';
334
335        for( arkey in myfilters )
336        {
337                filter_str = filter_str + ' > ' + myfilters[arkey];
338        }
339
340        return filter_str;
341}
342
343var ImageLoader = function( id, url )
344{
345        this.url = url;
346        this.image = document.getElementById( id );
347        this.loadEvent = null;
348};
349
350ImageLoader.prototype = 
351{
352        load:           function()
353                        {
354                                var url = this.url;
355                                var image = this.image;
356                                var loadEvent = this.loadEvent;
357                                addListener( this.image, 'load',
358                                        function(e)
359                                        {
360                                                if( loadEvent != null )
361                                                {
362                                                        loadEvent( url, image );
363                                                }
364                                        }, false);
365                                this.image.src = this.url;
366                        },
367        getImage:       function()
368                        {
369                                return this.image;
370                        }
371};
372
373function achorJobListing()
374{
375        JobListingWindow.anchorTo( "ClusterImageWindow", "tr-br", [ 0, 10 ] );
376}
377
378function setClusterImagePosition()
379{
380        ci_x = (window.innerWidth - ClusterImageWindow.getSize()['width'] - 20); 
381        ClusterImageWindow.setPosition( ci_x, 10 );
382}
383
384function deselectFilterMenu( menuItem, event )
385{
386        filterValue = menuItem.text;
387
388        if( filterValue == SearchField.getEl().dom.value && inMyArrayKeys( myfilters, 'query' ) )
389        {
390                SearchField.getEl().dom.value = '';
391                delete SearchField.store.baseParams['query'];
392        }
393
394        for( arkey in myfilters )
395        {
396                if( myfilters[arkey] == filterValue )
397                {
398                        delete myfilters[arkey];
399                        delete myparams[arkey];
400                }
401        }
402        reloadJobStore();
403}
404
405function makeFilterMenu()
406{
407        var filterMenu = new Ext.menu.Menu(
408        {
409                id:     'filterMenu',
410                items:  [ new Ext.menu.Item({ text: 'Clear all', handler: clearFilters }) ]
411        });
412
413        if( ArraySize( myfilters ) > 0 )
414        {
415                filterMenu.addSeparator();
416        }
417
418        for( arkey in myfilters )
419        {
420                filterMenu.add( new Ext.menu.CheckItem({ text: myfilters[arkey], handler: deselectFilterMenu, checked: true }) );
421        }
422
423        if( filterButton )
424        {
425                filterButton.menu = filterMenu;
426
427                if( ArraySize( myfilters ) > 0 )
428                {
429                        filterButton.enable();
430                }
431                else
432                {
433                        filterButton.disable();
434                }
435        }
436}
437
438function reloadClusterImage()
439{
440        ClusterImageArgs['view'] = 'big-clusterimage';
441
442        filt_url = makeArrayURL( myfilters );
443        imag_url = makeArrayURL( ClusterImageArgs );
444        img_url = './image.php?' + filt_url + '&' + imag_url;
445
446        var newClusterImage = new ImageLoader( 'clusterimage', img_url );
447        newClusterImage.loadEvent = function( url, image ) 
448        {
449                ClusterImageWindow.getBottomToolbar().clearStatus( { useDefaults:true } );
450                setTimeout( "resizeClusterImage()", 250 );
451                setTimeout( "setClusterImagePosition()", 500 );
452                //setTimeout( "achorJobListing()", 1000 );
453        }
454
455        ClusterImageWindow.getBottomToolbar().showBusy();
456
457        filter_str = 'Nodes' + makeFilterString();
458        ClusterImageWindow.setTitle( filter_str );
459
460        newClusterImage.load();
461}
462
463function resizeClusterImage()
464{
465        var ci_height = document.getElementById( "clusterimage" ).height + ClusterImageWindow.getFrameHeight();
466        var ci_width = document.getElementById( "clusterimage" ).width + ClusterImageWindow.getFrameWidth();
467
468        ClusterImageWindow.setSize( ci_width, ci_height );
469}
470
471Ext.apply(Ext.form.VTypes,
472{
473        num:            function(val, field)
474                        {
475                                if (val) 
476                                {
477                                        var strValidChars = "0123456789";
478                                        var blnResult = true;
479
480                                        if (val.length == 0) return false;
481
482                                        //  test strString consists of valid characters listed above
483                                        for (i = 0; i < val.length && blnResult == true; i++)
484                                        {
485                                                strChar = val.charAt(i);
486                                                if (strValidChars.indexOf(strChar) == -1)
487                                                {
488                                                        blnResult = false;
489                                                }
490                                        }
491                                        return blnResult;
492
493                                }
494                        },
495        numText:        'Must be numeric'
496});
497
498function jobRowSelect( selModel ) 
499{
500        if( selModel.hasSelection() )
501        {
502                showGraphsButton.enable();
503        }
504        else
505        {
506                showGraphsButton.disable();
507        }
508}
509
510function jobCellClick(grid, rowIndex, columnIndex, e)
511{
512        var record              = grid.getStore().getAt(rowIndex);  // Get the Record
513        var fieldName           = grid.getColumnModel().getDataIndex(columnIndex);
514        var data                = record.get(fieldName);
515        var view                = grid.getView();
516        var cell                = view.getCell( rowIndex, columnIndex );
517        var filter_title        = false;
518        var fil_dis             = 'filter';
519        var fil_ena             = 'filterenabled';
520        var filterName          = fieldName;
521
522        if( fieldName == 'owner' || fieldName == 'jid' || fieldName == 'status' || fieldName == 'queue' || fieldName == 'nodes')
523        {
524                if( fieldName == 'nodes' )
525                {
526                        filterName = 'host';
527                        fil_dis = 'nodesfilter';
528                        fil_ena = 'nodesfilterenabled';
529                }
530                if( inMyArrayKeys( myfilters, filterName ) )
531                {
532                        Ext.fly(cell).removeClass( fil_ena );
533                        Ext.fly(cell).addClass( fil_dis );
534
535                        // Remove this filter
536                        //
537                        delete myfilters[filterName];
538                        delete myparams[filterName];
539
540                        reloadJobStore();
541                        //reloadClusterImage();
542                }
543                else
544                {
545                        Ext.fly(cell).removeClass( fil_dis );
546                        Ext.fly(cell).addClass( fil_ena );
547
548                        if( fieldName == 'nodes' )
549                        { // Get the first node (master mom) as node filter
550                                new_data = data.split( ',' )[0];
551                                data = new_data;
552                        }
553
554                        // Set filter for selected column to selected cell value
555                        //
556                        myfilters[filterName] = data;
557
558                        reloadJobStore();
559                        //reloadClusterImage();
560                }
561                JobListingWindow.setTitle( filter_str );
562                filter_title = true;
563                filter_str = myparams.c + ' Jobs Overview' + makeFilterString();
564        }
565}
566
567function jobCellRender( value, metadata, record, rowindex, colindex, store )
568{
569        var fieldName = JobsColumnModel.getColumnById( colindex ).dataIndex;
570        var fil_dis = 'filter';
571        var fil_ena = 'filterenabled';
572        var filterName = fieldName;
573
574        if( fieldName == 'owner' || fieldName == 'jid' || fieldName == 'status' || fieldName == 'queue' || fieldName == 'nodes' )
575        {
576                if( fieldName == 'nodes' )
577                {
578                        fil_dis = 'nodesfilter';
579                        fil_ena = 'nodesfilterenabled';
580                        filterName = 'host';
581                }
582                if( myfilters[filterName] != null )
583                {
584                        metadata.css = fil_ena;
585                }
586                else
587                {
588                        metadata.css = fil_dis;
589                }
590        }
591        return value;
592}
593
594JobProxy = new Ext.data.HttpProxy(
595{
596        url:    'jobstore.php',
597        method: 'POST'
598});
599
600JobsDataStore = new Ext.data.Store(
601{
602        id:             'JobsDataStore',
603        proxy:          JobProxy,
604        baseParams:     { task: "GETJOBS" },
605        reader:
606                new Ext.data.JsonReader(
607                {
608                        root: 'results',
609                        totalProperty: 'total',
610                        id: 'id'
611                },
612                [
613                        {name: 'jid', type: 'int', mapping: 'jid'},
614                        {name: 'status', type: 'string', mapping: 'status'},
615                        {name: 'owner', type: 'string', mapping: 'owner'},
616                        {name: 'queue', type: 'string', mapping: 'queue'},
617                        {name: 'name', type: 'string', mapping: 'name'},
618                        {name: 'requested_time', type: 'string', mapping: 'requested_time'},
619                        {name: 'requested_memory', type: 'string', mapping: 'requested_memory'},
620                        {name: 'ppn', type: 'int', mapping: 'ppn'},
621                        {name: 'nodect', type: 'int', mapping: 'nodect'},
622                        {name: 'nodes', type: 'string', mapping: 'nodes'},
623                        {name: 'queued_timestamp', type: 'string', mapping: 'queued_timestamp'},
624                        {name: 'start_timestamp', type: 'string', mapping: 'start_timestamp'},
625                        {name: 'runningtime', type: 'string', mapping: 'runningtime'}
626                ]),
627        sortInfo: 
628        { 
629                field: 'jid', 
630                direction: "DESC" 
631        },
632        remoteSort: true,
633        listeners:
634        { 
635                'beforeload':
636                {
637                        scope: this,
638                        fn:
639
640                        function()
641                        {
642                                if( SearchField )
643                                {
644                                        search_value = SearchField.getEl().dom.value;
645                                        if( search_value == '' )
646                                        {
647                                                delete SearchField.store.baseParams['query'];
648                                                delete myfilters['query'];
649                                                delete myparams['query'];
650                                        }
651                                        else
652                                        {
653                                                myfilters['query']      = search_value;
654                                        }
655
656                                        makeFilterMenu();
657                                        reloadClusterImage();
658
659                                        filter_str = myparams.c + ' Jobs Overview' + makeFilterString();
660                                        JobListingWindow.setTitle( filter_str );
661                                }
662                        }
663                }
664        }
665});
666   
667var CheckJobs =
668
669        new Ext.grid.CheckboxSelectionModel(
670        {
671                listeners:
672                {
673                        'selectionchange':
674                        {
675                                scope:  this,
676                                fn:     jobRowSelect
677                        }
678                },
679        });
680
681JobsColumnModel = new Ext.grid.ColumnModel(
682[
683        CheckJobs,
684        {
685                header:         '#',
686                tooltip:        'Job id',
687                readOnly:       true,
688                dataIndex:      'jid',
689                width:          50,
690                hidden:         false,
691                renderer:       jobCellRender
692        },{
693                header:         'S',
694                tooltip:        'Job status',
695                readOnly:       true,
696                dataIndex:      'status',
697                width:          20,
698                hidden:         false,
699                renderer:       jobCellRender
700        },{
701                header:         'User',
702                tooltip:        'Owner of job',
703                readOnly:       true,
704                dataIndex:      'owner',
705                width:          60,
706                hidden:         false,
707                renderer:       jobCellRender
708        },{
709                header:         'Queue',
710                tooltip:        'In which queue does this job reside',
711                readOnly:       true,
712                dataIndex:      'queue',
713                width:          60,
714                hidden:         false,
715                renderer:       jobCellRender
716        },{
717                header:         'Name',
718                tooltip:        'Name of job',
719                readOnly:       true,
720                dataIndex:      'name',
721                width:          100,
722                hidden:         false
723        },{
724                header:         'Requested Time',
725                tooltip:        'Amount of requested time (wallclock)',
726                readOnly:       true,
727                dataIndex:      'requested_time',
728                width:          100,
729                hidden:         false
730        },{
731                header:         'Requested Memory',
732                tooltip:        'Amount of requested memory',
733                readOnly:       true,
734                dataIndex:      'requested_memory',
735                width:          100,
736                hidden:         true
737        },{
738                header:         'P',
739                tooltip:        'Number of processors per node (PPN)',
740                readOnly:       true,
741                dataIndex:      'ppn',
742                width:          25,
743                hidden:         false
744        },{
745                header:         'N',
746                tooltip:        'Number of nodes (hosts)',
747                readOnly:       true,
748                dataIndex:      'nodect',
749                width:          25,
750                hidden:         false
751        },{
752                header:         'Nodes',
753                readOnly:       true,
754                dataIndex:      'nodes',
755                width:          100,
756                hidden:         false,
757                renderer:       jobCellRender
758        },{
759                header:         'Queued',
760                tooltip:        'At what time did this job enter the queue',
761                readOnly:       true,
762                dataIndex:      'queued_timestamp',
763                width:          120,
764                hidden:         false
765        },{
766                header:         'Started',
767                tooltip:        'At what time did this job enter the running status',
768                readOnly:       true,
769                dataIndex:      'start_timestamp',
770                width:          120,
771                hidden:         false
772        },{
773                header:         'Runningtime',
774                tooltip:        'How long has this job been in the running status',
775                readOnly:       true,
776                dataIndex:      'runningtime',
777                width:          140,
778                hidden:         false
779        }]
780);
781
782JobsColumnModel.defaultSortable = true;
783
784var win;
785
786MetricsDataStore = new Ext.data.Store(
787{
788        id:             'MetricsDataStore',
789        proxy:          JobProxy,
790        autoLoad:       false,
791        baseParams:     { task: "GETMETRICS" },
792        reader:
793                new Ext.data.JsonReader(
794                {
795                        root: 'names',
796                        totalProperty: 'total',
797                        id: 'id'
798                },
799                [{
800                        name: 'ID'
801                },{
802                        name: 'name'
803                }]
804                )
805});
806
807SearchField     = new Ext.app.SearchField(
808                {
809                        store:  JobsDataStore,
810                        params: {start: 0, limit: mylimit},
811                        width:  200
812                });
813
814NodesDataStore = new Ext.data.Store(
815{
816        id: 'NodesDataStore',
817        proxy: JobProxy,
818        autoLoad: false,
819        baseParams: { task: "GETNODES" },
820        reader: new Ext.data.JsonReader(
821        {
822                root: 'results',
823                totalProperty: 'total',
824                id: 'id'
825        },[
826                {name: 'c', type: 'string', mapping: 'c'},
827                {name: 'h', type: 'string', mapping: 'h'},
828                {name: 'x', type: 'string', mapping: 'x'},
829                {name: 'v', type: 'string', mapping: 'v'},
830                {name: 'l', type: 'string', mapping: 'l'},
831                {name: 'jr', type: 'string', mapping: 'jr'},
832                {name: 'js', type: 'string', mapping: 'js'}
833        ]),
834        listeners: 
835        {
836                'beforeload': 
837                {
838                        scope: this,
839                        fn: 
840                       
841                        function() 
842                        {
843                                var jids;
844
845                                var row_records = CheckJobs.getSelections();
846
847                                for(var i=0; i<row_records.length; i++ )
848                                {
849                                        rsel = row_records[i];
850                                        if( !jids )
851                                        {
852                                                jids = rsel.get('jid');
853                                        }
854                                        else
855                                        {
856                                                jids = jids + ',' + rsel.get('jid');
857                                        }
858                                }
859                                NodesDataStore.baseParams.jids  = jids;
860                                NodesDataStore.baseParams.c     = myparams.c;
861                        }
862                }
863        }
864});
865
866function ShowGraphs( Button, Event ) 
867{
868        var GraphView =
869       
870                new Ext.DataView(
871                {
872                        itemSelector:   'thumb',
873                        style:          'overflow:auto',
874                        multiSelect:    true,
875                        store:          NodesDataStore,
876                        tpl:
877                       
878                                new Ext.XTemplate(
879                                        '<tpl for=".">',
880                                        '<div class="rrd-float"><img src="../../graph.php?z=small&c={c}&h={h}&l={l}&v={v}&x={x}&r=job&jr={jr}&js={js}" border="0"></div>',
881                                        '</tpl>'
882                                )
883                });
884
885        var images = 
886
887                new Ext.Panel(
888                {
889                        id:             'images',
890                        //title:        'My Images',
891                        region:         'center',
892                        bodyStyle:      'background: transparent',
893                        //margins:      '2 2 2 0',
894                        layout:         'fit',
895                        items:          GraphView
896                });
897
898        if(!win)
899        {
900                win = new Ext.Window(
901                {
902                        animateTarget:  Button,
903                        width:          500,
904                        height:         300,
905                        closeAction:    'hide',
906                        collapsible:    true,
907                        animCollapse:   true,
908                        maximizable:    true,
909                        title:          'Node graph details',
910                        layout:         'fit',
911                        tbar:   
912                       
913                        new Ext.form.ComboBox(
914                        {
915                                fieldLabel:     'Metric',
916                                //hiddenName:   'ID',
917                                store:          MetricsDataStore,
918                                valueField:     'name',
919                                displayField:   'name',
920                                typeAhead:      true,
921                                mode:           'remote',
922                                triggerAction:  'all',
923                                emptyText:      'Select metric',
924                                selectOnFocus:  true,
925                                xtype:          'combo',
926                                width:          190,
927                                listeners:
928                                {
929                                        select: 
930                                                       
931                                        function(combo, record, index)
932                                        {
933                                                var metric = record.data.name;
934                                                // doe iets
935                                        }
936                                }
937
938                        }),
939
940                        items:  [ images ]
941                });
942        }
943        NodesDataStore.load();
944        win.show( Button );
945}
946
947var JobListingEditorGrid =
948
949        new Ext.grid.EditorGridPanel(
950        {
951                id:             'JobListingEditorGrid',
952                store:          JobsDataStore,
953                cm:             JobsColumnModel,
954                enableColLock:  false,
955                clicksToEdit:   1,
956                loadMask:       true,
957                selModel:       new Ext.grid.RowSelectionModel({singleSelect:false}),
958                stripeRows:     true,
959                sm:             CheckJobs,
960                listeners:
961                {
962                        'cellclick':
963                        {
964                                scope:  this,
965                                fn:     jobCellClick
966                        }
967                },
968                bbar:
969       
970                new Ext.PagingToolbar(
971                {
972                        pageSize: 15,
973                        store: JobsDataStore,
974                        displayInfo: true,
975                        displayMsg: 'Displaying jobs {0} - {1} out of {2} jobs total found.',
976                        emptyMsg: 'No jobs found to display',
977                        plugins: [new Ext.ux.PageSizePlugin()]
978                }),
979
980                tbar: 
981                [ 
982                        SearchField,
983                        showGraphsButton,
984                        filterButton 
985                ]
986        });
987
988var ClusterImageWindow =
989
990        new Ext.Window(
991        {
992                id:             'ClusterImageWindow',
993                title:          'Nodes',
994                closable:       true,
995                collapsible:    true,
996                animCollapse:   true,
997                width:          1,
998                height:         1,
999                y:              15,
1000                plain:          true,
1001                shadow:         true,
1002                resizable:      false,
1003                shadowOffset:   10,
1004                layout:         'fit',
1005                bbar: 
1006               
1007                        new Ext.StatusBar(
1008                        {
1009                                defaultText: 'Ready.',
1010                                id: 'basic-statusbar',
1011                                defaultIconCls: ''
1012                        })
1013        });
1014
1015var GraphSummaryWindow =
1016
1017        new Ext.Window(
1018        {
1019                id:             'GraphSummaryWindow',
1020                title:          'Graph Summary',
1021                closable:       true,
1022                collapsible:    true,
1023                animCollapse:   true,
1024                width:          500,
1025                height:         400,
1026                x:              10,
1027                y:              10,
1028                plain:          true,
1029                shadow:         true,
1030                resizable:      true,
1031                shadowOffset:   10,
1032                layout:         'table',
1033                layoutConfig: 
1034                {
1035                        columns: 2
1036                },
1037                defaults:       { border: false },
1038                items: 
1039                [
1040                        {
1041                                id:             'monarchlogo',
1042                                cls:            'monarch',
1043                                bodyStyle:      'background: transparent',
1044                                html:           '<A HREF="https://subtrac.sara.nl/oss/jobmonarch/" TARGET="_blank"><IMG SRC="./jobmonarch.gif" ALT="Job Monarch" BORDER="0"></A>'
1045                                //colspan: 2
1046                        },{
1047                                id:             'summarycount'
1048                        },{
1049                                id:             'rjqjgraph'
1050                        },{
1051                                id:             'pie',
1052                                colspan:        2
1053                        }
1054                ],
1055                bbar:
1056               
1057                        new Ext.StatusBar(
1058                        {
1059                                defaultText:    'Ready.',
1060                                id:             'basic-statusbar',
1061                                defaultIconCls: ''
1062                        })
1063        });
1064
1065var JobListingWindow =
1066
1067        new Ext.Window(
1068        {
1069                id:             'JobListingWindow',
1070                title:          'Cluster Jobs Overview',
1071                closable:       true,
1072                collapsible:    true,
1073                animCollapse:   true,
1074                maximizable:    true,
1075                y:              375,
1076                width:          860,
1077                height:         445,
1078                plain:          true,
1079                shadow:         true,
1080                shadowOffset:   10,
1081                layout:         'fit',
1082                items:          JobListingEditorGrid
1083        });
Note: See TracBrowser for help on using the repository browser.