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 | }); |
---|
43 | |
---|
44 | JobsColumnModel = new Ext.grid.ColumnModel( |
---|
45 | [{ |
---|
46 | header: '#', |
---|
47 | tooltip: 'Job id', |
---|
48 | readOnly: true, |
---|
49 | dataIndex: 'jid', |
---|
50 | width: 50, |
---|
51 | hidden: false |
---|
52 | },{ |
---|
53 | header: 'S', |
---|
54 | tooltip: 'Job status', |
---|
55 | readOnly: true, |
---|
56 | dataIndex: 'status', |
---|
57 | width: 20, |
---|
58 | hidden: false |
---|
59 | },{ |
---|
60 | header: 'User', |
---|
61 | tooltip: 'Owner of job', |
---|
62 | readOnly: true, |
---|
63 | dataIndex: 'owner', |
---|
64 | width: 60, |
---|
65 | hidden: false |
---|
66 | },{ |
---|
67 | header: 'Queue', |
---|
68 | tooltip: 'In which queue does this job reside', |
---|
69 | readOnly: true, |
---|
70 | dataIndex: 'queue', |
---|
71 | width: 60, |
---|
72 | hidden: false |
---|
73 | },{ |
---|
74 | header: 'Name', |
---|
75 | tooltip: 'Name of job', |
---|
76 | readOnly: true, |
---|
77 | dataIndex: 'name', |
---|
78 | width: 100, |
---|
79 | hidden: false |
---|
80 | },{ |
---|
81 | header: 'Requested Time', |
---|
82 | tooltip: 'Amount of requested time (wallclock)', |
---|
83 | readOnly: true, |
---|
84 | dataIndex: 'requested_time', |
---|
85 | width: 100, |
---|
86 | hidden: false |
---|
87 | },{ |
---|
88 | header: 'Requested Memory', |
---|
89 | tooltip: 'Amount of requested memory', |
---|
90 | readOnly: true, |
---|
91 | dataIndex: 'requested_memory', |
---|
92 | width: 100, |
---|
93 | hidden: true |
---|
94 | },{ |
---|
95 | header: 'P', |
---|
96 | tooltip: 'Number of processors per node (PPN)', |
---|
97 | readOnly: true, |
---|
98 | dataIndex: 'ppn', |
---|
99 | width: 25, |
---|
100 | hidden: false |
---|
101 | },{ |
---|
102 | header: 'N', |
---|
103 | tooltip: 'Number of nodes (hosts)', |
---|
104 | readOnly: true, |
---|
105 | dataIndex: 'nodect', |
---|
106 | width: 25, |
---|
107 | hidden: false |
---|
108 | },{ |
---|
109 | header: 'Nodes', |
---|
110 | readOnly: true, |
---|
111 | dataIndex: 'nodes', |
---|
112 | width: 100, |
---|
113 | hidden: true |
---|
114 | },{ |
---|
115 | header: 'Queued', |
---|
116 | tooltip: 'At what time did this job enter the queue', |
---|
117 | readOnly: true, |
---|
118 | dataIndex: 'queued_timestamp', |
---|
119 | width: 140, |
---|
120 | hidden: false |
---|
121 | },{ |
---|
122 | header: 'Started', |
---|
123 | tooltip: 'At what time did this job enter the running status', |
---|
124 | readOnly: true, |
---|
125 | dataIndex: 'start_timestamp', |
---|
126 | width: 140, |
---|
127 | hidden: false |
---|
128 | },{ |
---|
129 | header: 'Runningtime', |
---|
130 | tooltip: 'How long has this job been in the running status', |
---|
131 | readOnly: true, |
---|
132 | dataIndex: 'runningtime', |
---|
133 | width: 140, |
---|
134 | hidden: false |
---|
135 | }] |
---|
136 | ); |
---|
137 | JobsColumnModel.defaultSortable= true; |
---|
138 | |
---|
139 | JobListingEditorGrid = new Ext.grid.EditorGridPanel({ |
---|
140 | id: 'JobListingEditorGrid', |
---|
141 | store: JobsDataStore, |
---|
142 | cm: JobsColumnModel, |
---|
143 | enableColLock:false, |
---|
144 | clicksToEdit:1, |
---|
145 | selModel: new Ext.grid.RowSelectionModel({singleSelect:false}) |
---|
146 | }); |
---|
147 | |
---|
148 | JobListingWindow = new Ext.Window({ |
---|
149 | id: 'JobListingWindow', |
---|
150 | title: 'Cluster Jobs Overview', |
---|
151 | closable:true, |
---|
152 | width:900, |
---|
153 | height:500, |
---|
154 | plain:true, |
---|
155 | layout: 'fit', |
---|
156 | items: JobListingEditorGrid |
---|
157 | }); |
---|
158 | } |
---|
159 | //JobProxy.on('beforeload', function(p, params) { |
---|
160 | // params.c = "GINA Cluster"; |
---|
161 | // }); |
---|
162 | //debug(); |
---|
163 | //JobsDataStore.load(); |
---|
164 | //JobListingWindow.show(); |
---|