source: trunk/web2/addons/job_monarch/js/jobgrid.js @ 537

Last change on this file since 537 was 537, checked in by ramonb, 16 years ago

job_monarch/templates/header.tpl:

  • load Grid with paging limits

job_monarch/jobstore.php:

  • sort jobs
  • only return jobs within Ext's paging start/limit

job_monarch/js/jobgrid.js:

  • add paging toolbar to Grid
File size: 4.4 KB
RevLine 
[532]1var JobsDataStore;
2var JobsColumnModel;
3var JobListingEditorGrid;
4var JobListingWindow;
[535]5var JobProxy;
[532]6
[536]7//Ext.onReady( initJobGrid() );
[532]8
[536]9function initJobGrid() {
10
[532]11  Ext.QuickTips.init();
12
13  JobProxy = new Ext.data.HttpProxy({
[536]14                url: 'jobstore.php',
[532]15                method: 'POST'
16            });
17
18  JobsDataStore = new Ext.data.Store({
19      id: 'JobsDataStore',
20      proxy: JobProxy,
21      baseParams:{task: "LISTING"}, // this parameter is passed for any HTTP request
22      reader: new Ext.data.JsonReader({
23        root: 'results',
24        totalProperty: 'total',
25        id: 'id'
26      },[
27        {name: 'jid', type: 'int', mapping: 'jid'},
28        {name: 'status', type: 'string', mapping: 'status'},
29        {name: 'owner', type: 'string', mapping: 'owner'},
30        {name: 'queue', type: 'string', mapping: 'queue'},
31        {name: 'name', type: 'string', mapping: 'name'},
32        {name: 'requested_time', type: 'string', mapping: 'requested_time'},
33        //{name: 'requested_memory', type: 'string', mapping: 'requested_memory'},
34        {name: 'ppn', type: 'int', mapping: 'ppn'},
[535]35        {name: 'nodect', type: 'int', mapping: 'nodect'},
[532]36        {name: 'nodes', type: 'string', mapping: 'nodes'},
37        {name: 'queued_timestamp', type: 'string', mapping: 'queued_timestamp'},
[535]38        {name: 'start_timestamp', type: 'string', mapping: 'start_timestamp'},
39        {name: 'runningtime', type: 'string', mapping: 'runningtime'}
[532]40      ]),
[537]41      sortInfo: {field: 'jid', direction: "ASC"},
42      remoteSort: true
[532]43    });
44   
45  JobsColumnModel = new Ext.grid.ColumnModel(
46    [{
47        header: '#',
[535]48        tooltip: 'Job id',
[532]49        readOnly: true,
50        dataIndex: 'jid',
51        width: 50,
52        hidden: false
53      },{
54        header: 'S',
[535]55        tooltip: 'Job status',
[532]56        readOnly: true,
57        dataIndex: 'status',
58        width: 20,
59        hidden: false
60      },{
61        header: 'User',
[535]62        tooltip: 'Owner of job',
[532]63        readOnly: true,
64        dataIndex: 'owner',
65        width: 60,
66        hidden: false
67      },{
68        header: 'Queue',
[535]69        tooltip: 'In which queue does this job reside',
[532]70        readOnly: true,
71        dataIndex: 'queue',
72        width: 60,
73        hidden: false
74      },{
75        header: 'Name',
[535]76        tooltip: 'Name of job',
[532]77        readOnly: true,
78        dataIndex: 'name',
79        width: 100,
80        hidden: false
81      },{
[534]82        header: 'Requested Time',
[535]83        tooltip: 'Amount of requested time (wallclock)',
[532]84        readOnly: true,
85        dataIndex: 'requested_time',
86        width: 100,
87        hidden: false
88      },{
89        header: 'Requested Memory',
[535]90        tooltip: 'Amount of requested memory',
[532]91        readOnly: true,
92        dataIndex: 'requested_memory',
93        width: 100,
94        hidden: true
95      },{
[535]96        header: 'P',
97        tooltip: 'Number of processors per node (PPN)',
[532]98        readOnly: true,
99        dataIndex: 'ppn',
100        width: 25,
101        hidden: false
102      },{
[535]103        header: 'N',
104        tooltip: 'Number of nodes (hosts)',
[532]105        readOnly: true,
[535]106        dataIndex: 'nodect',
[532]107        width: 25,
108        hidden: false
109      },{
110        header: 'Nodes',
111        readOnly: true,
112        dataIndex: 'nodes',
113        width: 100,
114        hidden: true
115      },{
116        header: 'Queued',
[535]117        tooltip: 'At what time did this job enter the queue',
[532]118        readOnly: true,
119        dataIndex: 'queued_timestamp',
[534]120        width: 140,
[532]121        hidden: false
122      },{
123        header: 'Started',
[535]124        tooltip: 'At what time did this job enter the running status',
[532]125        readOnly: true,
126        dataIndex: 'start_timestamp',
[534]127        width: 140,
[532]128        hidden: false
[535]129      },{
130        header: 'Runningtime',
131        tooltip: 'How long has this job been in the running status',
132        readOnly: true,
133        dataIndex: 'runningtime',
134        width: 140,
135        hidden: false
[532]136      }]
137    );
138    JobsColumnModel.defaultSortable= true;
139
140  JobListingEditorGrid =  new Ext.grid.EditorGridPanel({
141      id: 'JobListingEditorGrid',
142      store: JobsDataStore,
143      cm: JobsColumnModel,
144      enableColLock:false,
145      clicksToEdit:1,
[537]146      selModel: new Ext.grid.RowSelectionModel({singleSelect:false}),
147      bbar: new Ext.PagingToolbar({
148                pageSize: 30,
149                store: JobsDataStore,
150                displayInfo: true
151            })
[532]152    });
153
154  JobListingWindow = new Ext.Window({
155      id: 'JobListingWindow',
156      title: 'Cluster Jobs Overview',
157      closable:true,
[535]158      width:900,
159      height:500,
[532]160      plain:true,
161      layout: 'fit',
162      items: JobListingEditorGrid
163    });
[536]164}
Note: See TracBrowser for help on using the repository browser.