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
Line 
1var JobsDataStore;
2var JobsColumnModel;
3var JobListingEditorGrid;
4var JobListingWindow;
5var JobProxy;
6
7//Ext.onReady( initJobGrid() );
8
9function initJobGrid() {
10
11  Ext.QuickTips.init();
12
13  JobProxy = new Ext.data.HttpProxy({
14                url: 'jobstore.php',
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'},
35        {name: 'nodect', type: 'int', mapping: 'nodect'},
36        {name: 'nodes', type: 'string', mapping: 'nodes'},
37        {name: 'queued_timestamp', type: 'string', mapping: 'queued_timestamp'},
38        {name: 'start_timestamp', type: 'string', mapping: 'start_timestamp'},
39        {name: 'runningtime', type: 'string', mapping: 'runningtime'}
40      ]),
41      sortInfo: {field: 'jid', direction: "ASC"},
42      remoteSort: true
43    });
44   
45  JobsColumnModel = new Ext.grid.ColumnModel(
46    [{
47        header: '#',
48        tooltip: 'Job id',
49        readOnly: true,
50        dataIndex: 'jid',
51        width: 50,
52        hidden: false
53      },{
54        header: 'S',
55        tooltip: 'Job status',
56        readOnly: true,
57        dataIndex: 'status',
58        width: 20,
59        hidden: false
60      },{
61        header: 'User',
62        tooltip: 'Owner of job',
63        readOnly: true,
64        dataIndex: 'owner',
65        width: 60,
66        hidden: false
67      },{
68        header: 'Queue',
69        tooltip: 'In which queue does this job reside',
70        readOnly: true,
71        dataIndex: 'queue',
72        width: 60,
73        hidden: false
74      },{
75        header: 'Name',
76        tooltip: 'Name of job',
77        readOnly: true,
78        dataIndex: 'name',
79        width: 100,
80        hidden: false
81      },{
82        header: 'Requested Time',
83        tooltip: 'Amount of requested time (wallclock)',
84        readOnly: true,
85        dataIndex: 'requested_time',
86        width: 100,
87        hidden: false
88      },{
89        header: 'Requested Memory',
90        tooltip: 'Amount of requested memory',
91        readOnly: true,
92        dataIndex: 'requested_memory',
93        width: 100,
94        hidden: true
95      },{
96        header: 'P',
97        tooltip: 'Number of processors per node (PPN)',
98        readOnly: true,
99        dataIndex: 'ppn',
100        width: 25,
101        hidden: false
102      },{
103        header: 'N',
104        tooltip: 'Number of nodes (hosts)',
105        readOnly: true,
106        dataIndex: 'nodect',
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',
117        tooltip: 'At what time did this job enter the queue',
118        readOnly: true,
119        dataIndex: 'queued_timestamp',
120        width: 140,
121        hidden: false
122      },{
123        header: 'Started',
124        tooltip: 'At what time did this job enter the running status',
125        readOnly: true,
126        dataIndex: 'start_timestamp',
127        width: 140,
128        hidden: false
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
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,
146      selModel: new Ext.grid.RowSelectionModel({singleSelect:false}),
147      bbar: new Ext.PagingToolbar({
148                pageSize: 30,
149                store: JobsDataStore,
150                displayInfo: true
151            })
152    });
153
154  JobListingWindow = new Ext.Window({
155      id: 'JobListingWindow',
156      title: 'Cluster Jobs Overview',
157      closable:true,
158      width:900,
159      height:500,
160      plain:true,
161      layout: 'fit',
162      items: JobListingEditorGrid
163    });
164}
Note: See TracBrowser for help on using the repository browser.