1 | var JobsDataStore; |
---|
2 | var JobsColumnModel; |
---|
3 | var JobListingEditorGrid; |
---|
4 | var JobListingWindow; |
---|
5 | var JobProxy; |
---|
6 | |
---|
7 | //Ext.onReady( initJobGrid() ); |
---|
8 | |
---|
9 | function 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 | tbar: [ new Ext.app.SearchField({ |
---|
153 | store: JobsDataStore, |
---|
154 | params: {start: 0, limit: 30}, |
---|
155 | width: 200 |
---|
156 | }) |
---|
157 | ] |
---|
158 | }); |
---|
159 | |
---|
160 | JobListingWindow = new Ext.Window({ |
---|
161 | id: 'JobListingWindow', |
---|
162 | title: 'Cluster Jobs Overview', |
---|
163 | closable:true, |
---|
164 | width:900, |
---|
165 | height:500, |
---|
166 | plain:true, |
---|
167 | layout: 'fit', |
---|
168 | items: JobListingEditorGrid |
---|
169 | }); |
---|
170 | } |
---|