Show More
@@ -0,0 +1,93 b'' | |||
|
1 | ||
|
2 | <table id="procList"> | |
|
3 | <% | |
|
4 | def get_name(proc): | |
|
5 | cmd = ' '.join(proc.cmdline()) | |
|
6 | if 'vcsserver.ini' in cmd: | |
|
7 | return 'VCSServer' | |
|
8 | elif 'rhodecode.ini' in cmd: | |
|
9 | return 'RhodeCode' | |
|
10 | return proc.name() | |
|
11 | %> | |
|
12 | <tr> | |
|
13 | <td colspan="8"> | |
|
14 | <span id="processTimeStamp">${h.format_date(h.datetime.now())}</span> | |
|
15 | </td> | |
|
16 | </tr> | |
|
17 | % for proc in c.gunicorn_processes: | |
|
18 | <% mem = proc.memory_info()%> | |
|
19 | <% children = proc.children(recursive=True) %> | |
|
20 | % if children: | |
|
21 | ||
|
22 | <tr> | |
|
23 | <td> | |
|
24 | <code> | |
|
25 | ${proc.pid} - ${get_name(proc)} | |
|
26 | </code> | |
|
27 | </td> | |
|
28 | <td> | |
|
29 | <a href="#showCommand" onclick="$('#pid'+${proc.pid}).toggle();return false"> command </a> | |
|
30 | <code id="pid${proc.pid}" style="display: none"> | |
|
31 | ${' '.join(proc.cmdline())} | |
|
32 | </code> | |
|
33 | </td> | |
|
34 | <td></td> | |
|
35 | <td> | |
|
36 | RSS:${h.format_byte_size_binary(mem.rss)} | |
|
37 | </td> | |
|
38 | <td> | |
|
39 | VMS:${h.format_byte_size_binary(mem.vms)} | |
|
40 | </td> | |
|
41 | <td> | |
|
42 | AGE: ${h.age_component(h.time_to_utcdatetime(proc.create_time()))} | |
|
43 | </td> | |
|
44 | <td> | |
|
45 | MASTER | |
|
46 | </td> | |
|
47 | </tr> | |
|
48 | <% mem_sum = 0 %> | |
|
49 | % for proc_child in children: | |
|
50 | <% mem = proc_child.memory_info()%> | |
|
51 | <tr> | |
|
52 | <td> | |
|
53 | <code> | |
|
54 | | ${proc_child.pid} - ${get_name(proc_child)} | |
|
55 | </code> | |
|
56 | </td> | |
|
57 | <td> | |
|
58 | <a href="#showCommand" onclick="$('#pid'+${proc_child.pid}).toggle();return false"> command </a> | |
|
59 | <code id="pid${proc_child.pid}" style="display: none"> | |
|
60 | ${' '.join(proc_child.cmdline())} | |
|
61 | </code> | |
|
62 | </td> | |
|
63 | <td> | |
|
64 | CPU: ${proc_child.cpu_percent()} % | |
|
65 | </td> | |
|
66 | <td> | |
|
67 | RSS:${h.format_byte_size_binary(mem.rss)} | |
|
68 | <% mem_sum += mem.rss %> | |
|
69 | </td> | |
|
70 | <td> | |
|
71 | VMS:${h.format_byte_size_binary(mem.vms)} | |
|
72 | </td> | |
|
73 | <td> | |
|
74 | AGE: ${h.age_component(h.time_to_utcdatetime(proc_child.create_time()))} | |
|
75 | </td> | |
|
76 | <td> | |
|
77 | <a href="#restartProcess" onclick="restart(this, ${proc_child.pid});return false"> | |
|
78 | restart | |
|
79 | </a> | |
|
80 | </td> | |
|
81 | </tr> | |
|
82 | % endfor | |
|
83 | <tr> | |
|
84 | <td colspan="2"><code>| total processes: ${len(children)}</code></td> | |
|
85 | <td></td> | |
|
86 | <td><strong>RSS:${h.format_byte_size_binary(mem_sum)}</strong></td> | |
|
87 | <td></td> | |
|
88 | </tr> | |
|
89 | <tr><td> <code> -- </code> </td></tr> | |
|
90 | ||
|
91 | % endif | |
|
92 | % endfor | |
|
93 | </table> |
@@ -1,403 +1,406 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | # Copyright (C) 2016-2018 RhodeCode GmbH |
|
4 | 4 | # |
|
5 | 5 | # This program is free software: you can redistribute it and/or modify |
|
6 | 6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
7 | 7 | # (only), as published by the Free Software Foundation. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU Affero General Public License |
|
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 | 16 | # |
|
17 | 17 | # This program is dual-licensed. If you wish to learn more about the |
|
18 | 18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
19 | 19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
20 | 20 | |
|
21 | 21 | |
|
22 | 22 | from rhodecode.apps._base import ADMIN_PREFIX |
|
23 | 23 | |
|
24 | 24 | |
|
25 | 25 | def admin_routes(config): |
|
26 | 26 | """ |
|
27 | 27 | Admin prefixed routes |
|
28 | 28 | """ |
|
29 | 29 | |
|
30 | 30 | config.add_route( |
|
31 | 31 | name='admin_audit_logs', |
|
32 | 32 | pattern='/audit_logs') |
|
33 | 33 | |
|
34 | 34 | config.add_route( |
|
35 | 35 | name='admin_audit_log_entry', |
|
36 | 36 | pattern='/audit_logs/{audit_log_id}') |
|
37 | 37 | |
|
38 | 38 | config.add_route( |
|
39 | 39 | name='pull_requests_global_0', # backward compat |
|
40 | 40 | pattern='/pull_requests/{pull_request_id:\d+}') |
|
41 | 41 | config.add_route( |
|
42 | 42 | name='pull_requests_global_1', # backward compat |
|
43 | 43 | pattern='/pull-requests/{pull_request_id:\d+}') |
|
44 | 44 | config.add_route( |
|
45 | 45 | name='pull_requests_global', |
|
46 | 46 | pattern='/pull-request/{pull_request_id:\d+}') |
|
47 | 47 | |
|
48 | 48 | config.add_route( |
|
49 | 49 | name='admin_settings_open_source', |
|
50 | 50 | pattern='/settings/open_source') |
|
51 | 51 | config.add_route( |
|
52 | 52 | name='admin_settings_vcs_svn_generate_cfg', |
|
53 | 53 | pattern='/settings/vcs/svn_generate_cfg') |
|
54 | 54 | |
|
55 | 55 | config.add_route( |
|
56 | 56 | name='admin_settings_system', |
|
57 | 57 | pattern='/settings/system') |
|
58 | 58 | config.add_route( |
|
59 | 59 | name='admin_settings_system_update', |
|
60 | 60 | pattern='/settings/system/updates') |
|
61 | 61 | |
|
62 | 62 | config.add_route( |
|
63 | 63 | name='admin_settings_sessions', |
|
64 | 64 | pattern='/settings/sessions') |
|
65 | 65 | config.add_route( |
|
66 | 66 | name='admin_settings_sessions_cleanup', |
|
67 | 67 | pattern='/settings/sessions/cleanup') |
|
68 | 68 | |
|
69 | 69 | config.add_route( |
|
70 | 70 | name='admin_settings_process_management', |
|
71 | 71 | pattern='/settings/process_management') |
|
72 | 72 | config.add_route( |
|
73 | name='admin_settings_process_management_data', | |
|
74 | pattern='/settings/process_management/data') | |
|
75 | config.add_route( | |
|
73 | 76 | name='admin_settings_process_management_signal', |
|
74 | 77 | pattern='/settings/process_management/signal') |
|
75 | 78 | |
|
76 | 79 | # default settings |
|
77 | 80 | config.add_route( |
|
78 | 81 | name='admin_defaults_repositories', |
|
79 | 82 | pattern='/defaults/repositories') |
|
80 | 83 | config.add_route( |
|
81 | 84 | name='admin_defaults_repositories_update', |
|
82 | 85 | pattern='/defaults/repositories/update') |
|
83 | 86 | |
|
84 | 87 | # admin settings |
|
85 | 88 | |
|
86 | 89 | config.add_route( |
|
87 | 90 | name='admin_settings', |
|
88 | 91 | pattern='/settings') |
|
89 | 92 | config.add_route( |
|
90 | 93 | name='admin_settings_update', |
|
91 | 94 | pattern='/settings/update') |
|
92 | 95 | |
|
93 | 96 | config.add_route( |
|
94 | 97 | name='admin_settings_global', |
|
95 | 98 | pattern='/settings/global') |
|
96 | 99 | config.add_route( |
|
97 | 100 | name='admin_settings_global_update', |
|
98 | 101 | pattern='/settings/global/update') |
|
99 | 102 | |
|
100 | 103 | config.add_route( |
|
101 | 104 | name='admin_settings_vcs', |
|
102 | 105 | pattern='/settings/vcs') |
|
103 | 106 | config.add_route( |
|
104 | 107 | name='admin_settings_vcs_update', |
|
105 | 108 | pattern='/settings/vcs/update') |
|
106 | 109 | config.add_route( |
|
107 | 110 | name='admin_settings_vcs_svn_pattern_delete', |
|
108 | 111 | pattern='/settings/vcs/svn_pattern_delete') |
|
109 | 112 | |
|
110 | 113 | config.add_route( |
|
111 | 114 | name='admin_settings_mapping', |
|
112 | 115 | pattern='/settings/mapping') |
|
113 | 116 | config.add_route( |
|
114 | 117 | name='admin_settings_mapping_update', |
|
115 | 118 | pattern='/settings/mapping/update') |
|
116 | 119 | |
|
117 | 120 | config.add_route( |
|
118 | 121 | name='admin_settings_visual', |
|
119 | 122 | pattern='/settings/visual') |
|
120 | 123 | config.add_route( |
|
121 | 124 | name='admin_settings_visual_update', |
|
122 | 125 | pattern='/settings/visual/update') |
|
123 | 126 | |
|
124 | 127 | |
|
125 | 128 | config.add_route( |
|
126 | 129 | name='admin_settings_issuetracker', |
|
127 | 130 | pattern='/settings/issue-tracker') |
|
128 | 131 | config.add_route( |
|
129 | 132 | name='admin_settings_issuetracker_update', |
|
130 | 133 | pattern='/settings/issue-tracker/update') |
|
131 | 134 | config.add_route( |
|
132 | 135 | name='admin_settings_issuetracker_test', |
|
133 | 136 | pattern='/settings/issue-tracker/test') |
|
134 | 137 | config.add_route( |
|
135 | 138 | name='admin_settings_issuetracker_delete', |
|
136 | 139 | pattern='/settings/issue-tracker/delete') |
|
137 | 140 | |
|
138 | 141 | config.add_route( |
|
139 | 142 | name='admin_settings_email', |
|
140 | 143 | pattern='/settings/email') |
|
141 | 144 | config.add_route( |
|
142 | 145 | name='admin_settings_email_update', |
|
143 | 146 | pattern='/settings/email/update') |
|
144 | 147 | |
|
145 | 148 | config.add_route( |
|
146 | 149 | name='admin_settings_hooks', |
|
147 | 150 | pattern='/settings/hooks') |
|
148 | 151 | config.add_route( |
|
149 | 152 | name='admin_settings_hooks_update', |
|
150 | 153 | pattern='/settings/hooks/update') |
|
151 | 154 | config.add_route( |
|
152 | 155 | name='admin_settings_hooks_delete', |
|
153 | 156 | pattern='/settings/hooks/delete') |
|
154 | 157 | |
|
155 | 158 | config.add_route( |
|
156 | 159 | name='admin_settings_search', |
|
157 | 160 | pattern='/settings/search') |
|
158 | 161 | |
|
159 | 162 | config.add_route( |
|
160 | 163 | name='admin_settings_labs', |
|
161 | 164 | pattern='/settings/labs') |
|
162 | 165 | config.add_route( |
|
163 | 166 | name='admin_settings_labs_update', |
|
164 | 167 | pattern='/settings/labs/update') |
|
165 | 168 | |
|
166 | 169 | # global permissions |
|
167 | 170 | |
|
168 | 171 | config.add_route( |
|
169 | 172 | name='admin_permissions_application', |
|
170 | 173 | pattern='/permissions/application') |
|
171 | 174 | config.add_route( |
|
172 | 175 | name='admin_permissions_application_update', |
|
173 | 176 | pattern='/permissions/application/update') |
|
174 | 177 | |
|
175 | 178 | config.add_route( |
|
176 | 179 | name='admin_permissions_global', |
|
177 | 180 | pattern='/permissions/global') |
|
178 | 181 | config.add_route( |
|
179 | 182 | name='admin_permissions_global_update', |
|
180 | 183 | pattern='/permissions/global/update') |
|
181 | 184 | |
|
182 | 185 | config.add_route( |
|
183 | 186 | name='admin_permissions_object', |
|
184 | 187 | pattern='/permissions/object') |
|
185 | 188 | config.add_route( |
|
186 | 189 | name='admin_permissions_object_update', |
|
187 | 190 | pattern='/permissions/object/update') |
|
188 | 191 | |
|
189 | 192 | config.add_route( |
|
190 | 193 | name='admin_permissions_ips', |
|
191 | 194 | pattern='/permissions/ips') |
|
192 | 195 | |
|
193 | 196 | config.add_route( |
|
194 | 197 | name='admin_permissions_overview', |
|
195 | 198 | pattern='/permissions/overview') |
|
196 | 199 | |
|
197 | 200 | config.add_route( |
|
198 | 201 | name='admin_permissions_auth_token_access', |
|
199 | 202 | pattern='/permissions/auth_token_access') |
|
200 | 203 | |
|
201 | 204 | config.add_route( |
|
202 | 205 | name='admin_permissions_ssh_keys', |
|
203 | 206 | pattern='/permissions/ssh_keys') |
|
204 | 207 | config.add_route( |
|
205 | 208 | name='admin_permissions_ssh_keys_data', |
|
206 | 209 | pattern='/permissions/ssh_keys/data') |
|
207 | 210 | config.add_route( |
|
208 | 211 | name='admin_permissions_ssh_keys_update', |
|
209 | 212 | pattern='/permissions/ssh_keys/update') |
|
210 | 213 | |
|
211 | 214 | # users admin |
|
212 | 215 | config.add_route( |
|
213 | 216 | name='users', |
|
214 | 217 | pattern='/users') |
|
215 | 218 | |
|
216 | 219 | config.add_route( |
|
217 | 220 | name='users_data', |
|
218 | 221 | pattern='/users_data') |
|
219 | 222 | |
|
220 | 223 | config.add_route( |
|
221 | 224 | name='users_create', |
|
222 | 225 | pattern='/users/create') |
|
223 | 226 | |
|
224 | 227 | config.add_route( |
|
225 | 228 | name='users_new', |
|
226 | 229 | pattern='/users/new') |
|
227 | 230 | |
|
228 | 231 | # user management |
|
229 | 232 | config.add_route( |
|
230 | 233 | name='user_edit', |
|
231 | 234 | pattern='/users/{user_id:\d+}/edit', |
|
232 | 235 | user_route=True) |
|
233 | 236 | config.add_route( |
|
234 | 237 | name='user_edit_advanced', |
|
235 | 238 | pattern='/users/{user_id:\d+}/edit/advanced', |
|
236 | 239 | user_route=True) |
|
237 | 240 | config.add_route( |
|
238 | 241 | name='user_edit_global_perms', |
|
239 | 242 | pattern='/users/{user_id:\d+}/edit/global_permissions', |
|
240 | 243 | user_route=True) |
|
241 | 244 | config.add_route( |
|
242 | 245 | name='user_edit_global_perms_update', |
|
243 | 246 | pattern='/users/{user_id:\d+}/edit/global_permissions/update', |
|
244 | 247 | user_route=True) |
|
245 | 248 | config.add_route( |
|
246 | 249 | name='user_update', |
|
247 | 250 | pattern='/users/{user_id:\d+}/update', |
|
248 | 251 | user_route=True) |
|
249 | 252 | config.add_route( |
|
250 | 253 | name='user_delete', |
|
251 | 254 | pattern='/users/{user_id:\d+}/delete', |
|
252 | 255 | user_route=True) |
|
253 | 256 | config.add_route( |
|
254 | 257 | name='user_force_password_reset', |
|
255 | 258 | pattern='/users/{user_id:\d+}/password_reset', |
|
256 | 259 | user_route=True) |
|
257 | 260 | config.add_route( |
|
258 | 261 | name='user_create_personal_repo_group', |
|
259 | 262 | pattern='/users/{user_id:\d+}/create_repo_group', |
|
260 | 263 | user_route=True) |
|
261 | 264 | |
|
262 | 265 | # user auth tokens |
|
263 | 266 | config.add_route( |
|
264 | 267 | name='edit_user_auth_tokens', |
|
265 | 268 | pattern='/users/{user_id:\d+}/edit/auth_tokens', |
|
266 | 269 | user_route=True) |
|
267 | 270 | config.add_route( |
|
268 | 271 | name='edit_user_auth_tokens_add', |
|
269 | 272 | pattern='/users/{user_id:\d+}/edit/auth_tokens/new', |
|
270 | 273 | user_route=True) |
|
271 | 274 | config.add_route( |
|
272 | 275 | name='edit_user_auth_tokens_delete', |
|
273 | 276 | pattern='/users/{user_id:\d+}/edit/auth_tokens/delete', |
|
274 | 277 | user_route=True) |
|
275 | 278 | |
|
276 | 279 | # user ssh keys |
|
277 | 280 | config.add_route( |
|
278 | 281 | name='edit_user_ssh_keys', |
|
279 | 282 | pattern='/users/{user_id:\d+}/edit/ssh_keys', |
|
280 | 283 | user_route=True) |
|
281 | 284 | config.add_route( |
|
282 | 285 | name='edit_user_ssh_keys_generate_keypair', |
|
283 | 286 | pattern='/users/{user_id:\d+}/edit/ssh_keys/generate', |
|
284 | 287 | user_route=True) |
|
285 | 288 | config.add_route( |
|
286 | 289 | name='edit_user_ssh_keys_add', |
|
287 | 290 | pattern='/users/{user_id:\d+}/edit/ssh_keys/new', |
|
288 | 291 | user_route=True) |
|
289 | 292 | config.add_route( |
|
290 | 293 | name='edit_user_ssh_keys_delete', |
|
291 | 294 | pattern='/users/{user_id:\d+}/edit/ssh_keys/delete', |
|
292 | 295 | user_route=True) |
|
293 | 296 | |
|
294 | 297 | # user emails |
|
295 | 298 | config.add_route( |
|
296 | 299 | name='edit_user_emails', |
|
297 | 300 | pattern='/users/{user_id:\d+}/edit/emails', |
|
298 | 301 | user_route=True) |
|
299 | 302 | config.add_route( |
|
300 | 303 | name='edit_user_emails_add', |
|
301 | 304 | pattern='/users/{user_id:\d+}/edit/emails/new', |
|
302 | 305 | user_route=True) |
|
303 | 306 | config.add_route( |
|
304 | 307 | name='edit_user_emails_delete', |
|
305 | 308 | pattern='/users/{user_id:\d+}/edit/emails/delete', |
|
306 | 309 | user_route=True) |
|
307 | 310 | |
|
308 | 311 | # user IPs |
|
309 | 312 | config.add_route( |
|
310 | 313 | name='edit_user_ips', |
|
311 | 314 | pattern='/users/{user_id:\d+}/edit/ips', |
|
312 | 315 | user_route=True) |
|
313 | 316 | config.add_route( |
|
314 | 317 | name='edit_user_ips_add', |
|
315 | 318 | pattern='/users/{user_id:\d+}/edit/ips/new', |
|
316 | 319 | user_route_with_default=True) # enabled for default user too |
|
317 | 320 | config.add_route( |
|
318 | 321 | name='edit_user_ips_delete', |
|
319 | 322 | pattern='/users/{user_id:\d+}/edit/ips/delete', |
|
320 | 323 | user_route_with_default=True) # enabled for default user too |
|
321 | 324 | |
|
322 | 325 | # user perms |
|
323 | 326 | config.add_route( |
|
324 | 327 | name='edit_user_perms_summary', |
|
325 | 328 | pattern='/users/{user_id:\d+}/edit/permissions_summary', |
|
326 | 329 | user_route=True) |
|
327 | 330 | config.add_route( |
|
328 | 331 | name='edit_user_perms_summary_json', |
|
329 | 332 | pattern='/users/{user_id:\d+}/edit/permissions_summary/json', |
|
330 | 333 | user_route=True) |
|
331 | 334 | |
|
332 | 335 | # user user groups management |
|
333 | 336 | config.add_route( |
|
334 | 337 | name='edit_user_groups_management', |
|
335 | 338 | pattern='/users/{user_id:\d+}/edit/groups_management', |
|
336 | 339 | user_route=True) |
|
337 | 340 | |
|
338 | 341 | config.add_route( |
|
339 | 342 | name='edit_user_groups_management_updates', |
|
340 | 343 | pattern='/users/{user_id:\d+}/edit/edit_user_groups_management/updates', |
|
341 | 344 | user_route=True) |
|
342 | 345 | |
|
343 | 346 | # user audit logs |
|
344 | 347 | config.add_route( |
|
345 | 348 | name='edit_user_audit_logs', |
|
346 | 349 | pattern='/users/{user_id:\d+}/edit/audit', user_route=True) |
|
347 | 350 | |
|
348 | 351 | # user-groups admin |
|
349 | 352 | config.add_route( |
|
350 | 353 | name='user_groups', |
|
351 | 354 | pattern='/user_groups') |
|
352 | 355 | |
|
353 | 356 | config.add_route( |
|
354 | 357 | name='user_groups_data', |
|
355 | 358 | pattern='/user_groups_data') |
|
356 | 359 | |
|
357 | 360 | config.add_route( |
|
358 | 361 | name='user_groups_new', |
|
359 | 362 | pattern='/user_groups/new') |
|
360 | 363 | |
|
361 | 364 | config.add_route( |
|
362 | 365 | name='user_groups_create', |
|
363 | 366 | pattern='/user_groups/create') |
|
364 | 367 | |
|
365 | 368 | # repos admin |
|
366 | 369 | config.add_route( |
|
367 | 370 | name='repos', |
|
368 | 371 | pattern='/repos') |
|
369 | 372 | |
|
370 | 373 | config.add_route( |
|
371 | 374 | name='repo_new', |
|
372 | 375 | pattern='/repos/new') |
|
373 | 376 | |
|
374 | 377 | config.add_route( |
|
375 | 378 | name='repo_create', |
|
376 | 379 | pattern='/repos/create') |
|
377 | 380 | |
|
378 | 381 | # repo groups admin |
|
379 | 382 | config.add_route( |
|
380 | 383 | name='repo_groups', |
|
381 | 384 | pattern='/repo_groups') |
|
382 | 385 | |
|
383 | 386 | config.add_route( |
|
384 | 387 | name='repo_group_new', |
|
385 | 388 | pattern='/repo_group/new') |
|
386 | 389 | |
|
387 | 390 | config.add_route( |
|
388 | 391 | name='repo_group_create', |
|
389 | 392 | pattern='/repo_group/create') |
|
390 | 393 | |
|
391 | 394 | |
|
392 | 395 | def includeme(config): |
|
393 | 396 | from rhodecode.apps.admin.navigation import includeme as nav_includeme |
|
394 | 397 | |
|
395 | 398 | # Create admin navigation registry and add it to the pyramid registry. |
|
396 | 399 | nav_includeme(config) |
|
397 | 400 | |
|
398 | 401 | # main admin routes |
|
399 | 402 | config.add_route(name='admin_home', pattern=ADMIN_PREFIX) |
|
400 | 403 | config.include(admin_routes, route_prefix=ADMIN_PREFIX) |
|
401 | 404 | |
|
402 | 405 | # Scan module for configuration decorators. |
|
403 | 406 | config.scan('.views', ignore='.tests') |
@@ -1,91 +1,103 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | # Copyright (C) 2016-2018 RhodeCode GmbH |
|
4 | 4 | # |
|
5 | 5 | # This program is free software: you can redistribute it and/or modify |
|
6 | 6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
7 | 7 | # (only), as published by the Free Software Foundation. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU Affero General Public License |
|
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 | 16 | # |
|
17 | 17 | # This program is dual-licensed. If you wish to learn more about the |
|
18 | 18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
19 | 19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
20 | 20 | |
|
21 | 21 | import logging |
|
22 | 22 | |
|
23 | 23 | import psutil |
|
24 | 24 | from pyramid.view import view_config |
|
25 | 25 | |
|
26 | 26 | from rhodecode.apps._base import BaseAppView |
|
27 | 27 | from rhodecode.apps.admin.navigation import navigation_list |
|
28 | 28 | from rhodecode.lib.auth import ( |
|
29 | 29 | LoginRequired, HasPermissionAllDecorator, CSRFRequired) |
|
30 | 30 | from rhodecode.lib.utils2 import safe_int |
|
31 | 31 | |
|
32 | 32 | log = logging.getLogger(__name__) |
|
33 | 33 | |
|
34 | 34 | |
|
35 | 35 | class AdminProcessManagementView(BaseAppView): |
|
36 | 36 | def load_default_context(self): |
|
37 | 37 | c = self._get_local_tmpl_context() |
|
38 | 38 | |
|
39 | 39 | return c |
|
40 | 40 | |
|
41 | 41 | @LoginRequired() |
|
42 | 42 | @HasPermissionAllDecorator('hg.admin') |
|
43 | 43 | @view_config( |
|
44 | 44 | route_name='admin_settings_process_management', request_method='GET', |
|
45 | 45 | renderer='rhodecode:templates/admin/settings/settings.mako') |
|
46 | 46 | def process_management(self): |
|
47 | 47 | _ = self.request.translate |
|
48 | 48 | c = self.load_default_context() |
|
49 | 49 | |
|
50 | 50 | c.active = 'process_management' |
|
51 | 51 | c.navlist = navigation_list(self.request) |
|
52 | 52 | c.gunicorn_processes = ( |
|
53 | 53 | p for p in psutil.process_iter() if 'gunicorn' in p.name()) |
|
54 | 54 | return self._get_template_context(c) |
|
55 | 55 | |
|
56 | 56 | @LoginRequired() |
|
57 | 57 | @HasPermissionAllDecorator('hg.admin') |
|
58 | @view_config( | |
|
59 | route_name='admin_settings_process_management_data', request_method='GET', | |
|
60 | renderer='rhodecode:templates/admin/settings/settings_process_management_data.mako') | |
|
61 | def process_management_data(self): | |
|
62 | _ = self.request.translate | |
|
63 | c = self.load_default_context() | |
|
64 | c.gunicorn_processes = ( | |
|
65 | p for p in psutil.process_iter() if 'gunicorn' in p.name()) | |
|
66 | return self._get_template_context(c) | |
|
67 | ||
|
68 | @LoginRequired() | |
|
69 | @HasPermissionAllDecorator('hg.admin') | |
|
58 | 70 | @CSRFRequired() |
|
59 | 71 | @view_config( |
|
60 | 72 | route_name='admin_settings_process_management_signal', |
|
61 | 73 | request_method='POST', renderer='json_ext') |
|
62 | 74 | def process_management_signal(self): |
|
63 | 75 | pids = self.request.json.get('pids', []) |
|
64 | 76 | result = [] |
|
65 | 77 | def on_terminate(proc): |
|
66 | 78 | msg = "process `PID:{}` terminated with exit code {}".format( |
|
67 | 79 | proc.pid, proc.returncode) |
|
68 | 80 | result.append(msg) |
|
69 | 81 | |
|
70 | 82 | procs = [] |
|
71 | 83 | for pid in pids: |
|
72 | 84 | pid = safe_int(pid) |
|
73 | 85 | if pid: |
|
74 | 86 | try: |
|
75 | 87 | proc = psutil.Process(pid) |
|
76 | 88 | except psutil.NoSuchProcess: |
|
77 | 89 | continue |
|
78 | 90 | |
|
79 | 91 | children = proc.children(recursive=True) |
|
80 | 92 | if children: |
|
81 | 93 | print('Wont kill Master Process') |
|
82 | 94 | else: |
|
83 | 95 | procs.append(proc) |
|
84 | 96 | |
|
85 | 97 | for p in procs: |
|
86 | 98 | p.terminate() |
|
87 | 99 | gone, alive = psutil.wait_procs(procs, timeout=10, callback=on_terminate) |
|
88 | 100 | for p in alive: |
|
89 | 101 | p.kill() |
|
90 | 102 | |
|
91 | 103 | return {'result': result} |
@@ -1,316 +1,318 b'' | |||
|
1 | 1 | |
|
2 | 2 | /****************************************************************************** |
|
3 | 3 | * * |
|
4 | 4 | * DO NOT CHANGE THIS FILE MANUALLY * |
|
5 | 5 | * * |
|
6 | 6 | * * |
|
7 | 7 | * This file is automatically generated when the app starts up with * |
|
8 | 8 | * generate_js_files = true * |
|
9 | 9 | * * |
|
10 | 10 | * To add a route here pass jsroute=True to the route definition in the app * |
|
11 | 11 | * * |
|
12 | 12 | ******************************************************************************/ |
|
13 | 13 | function registerRCRoutes() { |
|
14 | 14 | // routes registration |
|
15 | 15 | pyroutes.register('favicon', '/favicon.ico', []); |
|
16 | 16 | pyroutes.register('robots', '/robots.txt', []); |
|
17 | 17 | pyroutes.register('auth_home', '/_admin/auth*traverse', []); |
|
18 | 18 | pyroutes.register('global_integrations_new', '/_admin/integrations/new', []); |
|
19 | 19 | pyroutes.register('global_integrations_home', '/_admin/integrations', []); |
|
20 | 20 | pyroutes.register('global_integrations_list', '/_admin/integrations/%(integration)s', ['integration']); |
|
21 | 21 | pyroutes.register('global_integrations_create', '/_admin/integrations/%(integration)s/new', ['integration']); |
|
22 | 22 | pyroutes.register('global_integrations_edit', '/_admin/integrations/%(integration)s/%(integration_id)s', ['integration', 'integration_id']); |
|
23 | 23 | pyroutes.register('repo_group_integrations_home', '/%(repo_group_name)s/_settings/integrations', ['repo_group_name']); |
|
24 | 24 | pyroutes.register('repo_group_integrations_new', '/%(repo_group_name)s/_settings/integrations/new', ['repo_group_name']); |
|
25 | 25 | pyroutes.register('repo_group_integrations_list', '/%(repo_group_name)s/_settings/integrations/%(integration)s', ['repo_group_name', 'integration']); |
|
26 | 26 | pyroutes.register('repo_group_integrations_create', '/%(repo_group_name)s/_settings/integrations/%(integration)s/new', ['repo_group_name', 'integration']); |
|
27 | 27 | pyroutes.register('repo_group_integrations_edit', '/%(repo_group_name)s/_settings/integrations/%(integration)s/%(integration_id)s', ['repo_group_name', 'integration', 'integration_id']); |
|
28 | 28 | pyroutes.register('repo_integrations_home', '/%(repo_name)s/settings/integrations', ['repo_name']); |
|
29 | 29 | pyroutes.register('repo_integrations_new', '/%(repo_name)s/settings/integrations/new', ['repo_name']); |
|
30 | 30 | pyroutes.register('repo_integrations_list', '/%(repo_name)s/settings/integrations/%(integration)s', ['repo_name', 'integration']); |
|
31 | 31 | pyroutes.register('repo_integrations_create', '/%(repo_name)s/settings/integrations/%(integration)s/new', ['repo_name', 'integration']); |
|
32 | 32 | pyroutes.register('repo_integrations_edit', '/%(repo_name)s/settings/integrations/%(integration)s/%(integration_id)s', ['repo_name', 'integration', 'integration_id']); |
|
33 | 33 | pyroutes.register('ops_ping', '/_admin/ops/ping', []); |
|
34 | 34 | pyroutes.register('ops_error_test', '/_admin/ops/error', []); |
|
35 | 35 | pyroutes.register('ops_redirect_test', '/_admin/ops/redirect', []); |
|
36 | 36 | pyroutes.register('ops_ping_legacy', '/_admin/ping', []); |
|
37 | 37 | pyroutes.register('ops_error_test_legacy', '/_admin/error_test', []); |
|
38 | 38 | pyroutes.register('admin_home', '/_admin', []); |
|
39 | 39 | pyroutes.register('admin_audit_logs', '/_admin/audit_logs', []); |
|
40 | 40 | pyroutes.register('admin_audit_log_entry', '/_admin/audit_logs/%(audit_log_id)s', ['audit_log_id']); |
|
41 | 41 | pyroutes.register('pull_requests_global_0', '/_admin/pull_requests/%(pull_request_id)s', ['pull_request_id']); |
|
42 | 42 | pyroutes.register('pull_requests_global_1', '/_admin/pull-requests/%(pull_request_id)s', ['pull_request_id']); |
|
43 | 43 | pyroutes.register('pull_requests_global', '/_admin/pull-request/%(pull_request_id)s', ['pull_request_id']); |
|
44 | 44 | pyroutes.register('admin_settings_open_source', '/_admin/settings/open_source', []); |
|
45 | 45 | pyroutes.register('admin_settings_vcs_svn_generate_cfg', '/_admin/settings/vcs/svn_generate_cfg', []); |
|
46 | 46 | pyroutes.register('admin_settings_system', '/_admin/settings/system', []); |
|
47 | 47 | pyroutes.register('admin_settings_system_update', '/_admin/settings/system/updates', []); |
|
48 | 48 | pyroutes.register('admin_settings_sessions', '/_admin/settings/sessions', []); |
|
49 | 49 | pyroutes.register('admin_settings_sessions_cleanup', '/_admin/settings/sessions/cleanup', []); |
|
50 | 50 | pyroutes.register('admin_settings_process_management', '/_admin/settings/process_management', []); |
|
51 | pyroutes.register('admin_settings_process_management_data', '/_admin/settings/process_management/data', []); | |
|
51 | 52 | pyroutes.register('admin_settings_process_management_signal', '/_admin/settings/process_management/signal', []); |
|
52 | 53 | pyroutes.register('admin_defaults_repositories', '/_admin/defaults/repositories', []); |
|
53 | 54 | pyroutes.register('admin_defaults_repositories_update', '/_admin/defaults/repositories/update', []); |
|
54 | 55 | pyroutes.register('admin_settings', '/_admin/settings', []); |
|
55 | 56 | pyroutes.register('admin_settings_update', '/_admin/settings/update', []); |
|
56 | 57 | pyroutes.register('admin_settings_global', '/_admin/settings/global', []); |
|
57 | 58 | pyroutes.register('admin_settings_global_update', '/_admin/settings/global/update', []); |
|
58 | 59 | pyroutes.register('admin_settings_vcs', '/_admin/settings/vcs', []); |
|
59 | 60 | pyroutes.register('admin_settings_vcs_update', '/_admin/settings/vcs/update', []); |
|
60 | 61 | pyroutes.register('admin_settings_vcs_svn_pattern_delete', '/_admin/settings/vcs/svn_pattern_delete', []); |
|
61 | 62 | pyroutes.register('admin_settings_mapping', '/_admin/settings/mapping', []); |
|
62 | 63 | pyroutes.register('admin_settings_mapping_update', '/_admin/settings/mapping/update', []); |
|
63 | 64 | pyroutes.register('admin_settings_visual', '/_admin/settings/visual', []); |
|
64 | 65 | pyroutes.register('admin_settings_visual_update', '/_admin/settings/visual/update', []); |
|
65 | 66 | pyroutes.register('admin_settings_issuetracker', '/_admin/settings/issue-tracker', []); |
|
66 | 67 | pyroutes.register('admin_settings_issuetracker_update', '/_admin/settings/issue-tracker/update', []); |
|
67 | 68 | pyroutes.register('admin_settings_issuetracker_test', '/_admin/settings/issue-tracker/test', []); |
|
68 | 69 | pyroutes.register('admin_settings_issuetracker_delete', '/_admin/settings/issue-tracker/delete', []); |
|
69 | 70 | pyroutes.register('admin_settings_email', '/_admin/settings/email', []); |
|
70 | 71 | pyroutes.register('admin_settings_email_update', '/_admin/settings/email/update', []); |
|
71 | 72 | pyroutes.register('admin_settings_hooks', '/_admin/settings/hooks', []); |
|
72 | 73 | pyroutes.register('admin_settings_hooks_update', '/_admin/settings/hooks/update', []); |
|
73 | 74 | pyroutes.register('admin_settings_hooks_delete', '/_admin/settings/hooks/delete', []); |
|
74 | 75 | pyroutes.register('admin_settings_search', '/_admin/settings/search', []); |
|
75 | 76 | pyroutes.register('admin_settings_labs', '/_admin/settings/labs', []); |
|
76 | 77 | pyroutes.register('admin_settings_labs_update', '/_admin/settings/labs/update', []); |
|
77 | 78 | pyroutes.register('admin_permissions_application', '/_admin/permissions/application', []); |
|
78 | 79 | pyroutes.register('admin_permissions_application_update', '/_admin/permissions/application/update', []); |
|
79 | 80 | pyroutes.register('admin_permissions_global', '/_admin/permissions/global', []); |
|
80 | 81 | pyroutes.register('admin_permissions_global_update', '/_admin/permissions/global/update', []); |
|
81 | 82 | pyroutes.register('admin_permissions_object', '/_admin/permissions/object', []); |
|
82 | 83 | pyroutes.register('admin_permissions_object_update', '/_admin/permissions/object/update', []); |
|
83 | 84 | pyroutes.register('admin_permissions_ips', '/_admin/permissions/ips', []); |
|
84 | 85 | pyroutes.register('admin_permissions_overview', '/_admin/permissions/overview', []); |
|
85 | 86 | pyroutes.register('admin_permissions_auth_token_access', '/_admin/permissions/auth_token_access', []); |
|
86 | 87 | pyroutes.register('admin_permissions_ssh_keys', '/_admin/permissions/ssh_keys', []); |
|
87 | 88 | pyroutes.register('admin_permissions_ssh_keys_data', '/_admin/permissions/ssh_keys/data', []); |
|
88 | 89 | pyroutes.register('admin_permissions_ssh_keys_update', '/_admin/permissions/ssh_keys/update', []); |
|
89 | 90 | pyroutes.register('users', '/_admin/users', []); |
|
90 | 91 | pyroutes.register('users_data', '/_admin/users_data', []); |
|
91 | 92 | pyroutes.register('users_create', '/_admin/users/create', []); |
|
92 | 93 | pyroutes.register('users_new', '/_admin/users/new', []); |
|
93 | 94 | pyroutes.register('user_edit', '/_admin/users/%(user_id)s/edit', ['user_id']); |
|
94 | 95 | pyroutes.register('user_edit_advanced', '/_admin/users/%(user_id)s/edit/advanced', ['user_id']); |
|
95 | 96 | pyroutes.register('user_edit_global_perms', '/_admin/users/%(user_id)s/edit/global_permissions', ['user_id']); |
|
96 | 97 | pyroutes.register('user_edit_global_perms_update', '/_admin/users/%(user_id)s/edit/global_permissions/update', ['user_id']); |
|
97 | 98 | pyroutes.register('user_update', '/_admin/users/%(user_id)s/update', ['user_id']); |
|
98 | 99 | pyroutes.register('user_delete', '/_admin/users/%(user_id)s/delete', ['user_id']); |
|
99 | 100 | pyroutes.register('user_force_password_reset', '/_admin/users/%(user_id)s/password_reset', ['user_id']); |
|
100 | 101 | pyroutes.register('user_create_personal_repo_group', '/_admin/users/%(user_id)s/create_repo_group', ['user_id']); |
|
101 | 102 | pyroutes.register('edit_user_auth_tokens', '/_admin/users/%(user_id)s/edit/auth_tokens', ['user_id']); |
|
102 | 103 | pyroutes.register('edit_user_auth_tokens_add', '/_admin/users/%(user_id)s/edit/auth_tokens/new', ['user_id']); |
|
103 | 104 | pyroutes.register('edit_user_auth_tokens_delete', '/_admin/users/%(user_id)s/edit/auth_tokens/delete', ['user_id']); |
|
104 | 105 | pyroutes.register('edit_user_ssh_keys', '/_admin/users/%(user_id)s/edit/ssh_keys', ['user_id']); |
|
105 | 106 | pyroutes.register('edit_user_ssh_keys_generate_keypair', '/_admin/users/%(user_id)s/edit/ssh_keys/generate', ['user_id']); |
|
106 | 107 | pyroutes.register('edit_user_ssh_keys_add', '/_admin/users/%(user_id)s/edit/ssh_keys/new', ['user_id']); |
|
107 | 108 | pyroutes.register('edit_user_ssh_keys_delete', '/_admin/users/%(user_id)s/edit/ssh_keys/delete', ['user_id']); |
|
108 | 109 | pyroutes.register('edit_user_emails', '/_admin/users/%(user_id)s/edit/emails', ['user_id']); |
|
109 | 110 | pyroutes.register('edit_user_emails_add', '/_admin/users/%(user_id)s/edit/emails/new', ['user_id']); |
|
110 | 111 | pyroutes.register('edit_user_emails_delete', '/_admin/users/%(user_id)s/edit/emails/delete', ['user_id']); |
|
111 | 112 | pyroutes.register('edit_user_ips', '/_admin/users/%(user_id)s/edit/ips', ['user_id']); |
|
112 | 113 | pyroutes.register('edit_user_ips_add', '/_admin/users/%(user_id)s/edit/ips/new', ['user_id']); |
|
113 | 114 | pyroutes.register('edit_user_ips_delete', '/_admin/users/%(user_id)s/edit/ips/delete', ['user_id']); |
|
114 | 115 | pyroutes.register('edit_user_perms_summary', '/_admin/users/%(user_id)s/edit/permissions_summary', ['user_id']); |
|
115 | 116 | pyroutes.register('edit_user_perms_summary_json', '/_admin/users/%(user_id)s/edit/permissions_summary/json', ['user_id']); |
|
116 | 117 | pyroutes.register('edit_user_groups_management', '/_admin/users/%(user_id)s/edit/groups_management', ['user_id']); |
|
117 | 118 | pyroutes.register('edit_user_groups_management_updates', '/_admin/users/%(user_id)s/edit/edit_user_groups_management/updates', ['user_id']); |
|
118 | 119 | pyroutes.register('edit_user_audit_logs', '/_admin/users/%(user_id)s/edit/audit', ['user_id']); |
|
119 | 120 | pyroutes.register('user_groups', '/_admin/user_groups', []); |
|
120 | 121 | pyroutes.register('user_groups_data', '/_admin/user_groups_data', []); |
|
121 | 122 | pyroutes.register('user_groups_new', '/_admin/user_groups/new', []); |
|
122 | 123 | pyroutes.register('user_groups_create', '/_admin/user_groups/create', []); |
|
123 | 124 | pyroutes.register('repos', '/_admin/repos', []); |
|
124 | 125 | pyroutes.register('repo_new', '/_admin/repos/new', []); |
|
125 | 126 | pyroutes.register('repo_create', '/_admin/repos/create', []); |
|
126 | 127 | pyroutes.register('repo_groups', '/_admin/repo_groups', []); |
|
127 | 128 | pyroutes.register('repo_group_new', '/_admin/repo_group/new', []); |
|
128 | 129 | pyroutes.register('repo_group_create', '/_admin/repo_group/create', []); |
|
129 | 130 | pyroutes.register('channelstream_connect', '/_admin/channelstream/connect', []); |
|
130 | 131 | pyroutes.register('channelstream_subscribe', '/_admin/channelstream/subscribe', []); |
|
131 | 132 | pyroutes.register('channelstream_proxy', '/_channelstream', []); |
|
132 | 133 | pyroutes.register('login', '/_admin/login', []); |
|
133 | 134 | pyroutes.register('logout', '/_admin/logout', []); |
|
134 | 135 | pyroutes.register('register', '/_admin/register', []); |
|
135 | 136 | pyroutes.register('reset_password', '/_admin/password_reset', []); |
|
136 | 137 | pyroutes.register('reset_password_confirmation', '/_admin/password_reset_confirmation', []); |
|
137 | 138 | pyroutes.register('home', '/', []); |
|
138 | 139 | pyroutes.register('user_autocomplete_data', '/_users', []); |
|
139 | 140 | pyroutes.register('user_group_autocomplete_data', '/_user_groups', []); |
|
140 | 141 | pyroutes.register('repo_list_data', '/_repos', []); |
|
141 | 142 | pyroutes.register('goto_switcher_data', '/_goto_data', []); |
|
142 | 143 | pyroutes.register('journal', '/_admin/journal', []); |
|
143 | 144 | pyroutes.register('journal_rss', '/_admin/journal/rss', []); |
|
144 | 145 | pyroutes.register('journal_atom', '/_admin/journal/atom', []); |
|
145 | 146 | pyroutes.register('journal_public', '/_admin/public_journal', []); |
|
146 | 147 | pyroutes.register('journal_public_atom', '/_admin/public_journal/atom', []); |
|
147 | 148 | pyroutes.register('journal_public_atom_old', '/_admin/public_journal_atom', []); |
|
148 | 149 | pyroutes.register('journal_public_rss', '/_admin/public_journal/rss', []); |
|
149 | 150 | pyroutes.register('journal_public_rss_old', '/_admin/public_journal_rss', []); |
|
150 | 151 | pyroutes.register('toggle_following', '/_admin/toggle_following', []); |
|
151 | 152 | pyroutes.register('repo_creating', '/%(repo_name)s/repo_creating', ['repo_name']); |
|
152 | 153 | pyroutes.register('repo_creating_check', '/%(repo_name)s/repo_creating_check', ['repo_name']); |
|
153 | 154 | pyroutes.register('repo_summary_explicit', '/%(repo_name)s/summary', ['repo_name']); |
|
154 | 155 | pyroutes.register('repo_summary_commits', '/%(repo_name)s/summary-commits', ['repo_name']); |
|
155 | 156 | pyroutes.register('repo_commit', '/%(repo_name)s/changeset/%(commit_id)s', ['repo_name', 'commit_id']); |
|
156 | 157 | pyroutes.register('repo_commit_children', '/%(repo_name)s/changeset_children/%(commit_id)s', ['repo_name', 'commit_id']); |
|
157 | 158 | pyroutes.register('repo_commit_parents', '/%(repo_name)s/changeset_parents/%(commit_id)s', ['repo_name', 'commit_id']); |
|
158 | 159 | pyroutes.register('repo_commit_raw', '/%(repo_name)s/changeset-diff/%(commit_id)s', ['repo_name', 'commit_id']); |
|
159 | 160 | pyroutes.register('repo_commit_patch', '/%(repo_name)s/changeset-patch/%(commit_id)s', ['repo_name', 'commit_id']); |
|
160 | 161 | pyroutes.register('repo_commit_download', '/%(repo_name)s/changeset-download/%(commit_id)s', ['repo_name', 'commit_id']); |
|
161 | 162 | pyroutes.register('repo_commit_data', '/%(repo_name)s/changeset-data/%(commit_id)s', ['repo_name', 'commit_id']); |
|
162 | 163 | pyroutes.register('repo_commit_comment_create', '/%(repo_name)s/changeset/%(commit_id)s/comment/create', ['repo_name', 'commit_id']); |
|
163 | 164 | pyroutes.register('repo_commit_comment_preview', '/%(repo_name)s/changeset/%(commit_id)s/comment/preview', ['repo_name', 'commit_id']); |
|
164 | 165 | pyroutes.register('repo_commit_comment_delete', '/%(repo_name)s/changeset/%(commit_id)s/comment/%(comment_id)s/delete', ['repo_name', 'commit_id', 'comment_id']); |
|
165 | 166 | pyroutes.register('repo_commit_raw_deprecated', '/%(repo_name)s/raw-changeset/%(commit_id)s', ['repo_name', 'commit_id']); |
|
166 | 167 | pyroutes.register('repo_archivefile', '/%(repo_name)s/archive/%(fname)s', ['repo_name', 'fname']); |
|
167 | 168 | pyroutes.register('repo_files_diff', '/%(repo_name)s/diff/%(f_path)s', ['repo_name', 'f_path']); |
|
168 | 169 | pyroutes.register('repo_files_diff_2way_redirect', '/%(repo_name)s/diff-2way/%(f_path)s', ['repo_name', 'f_path']); |
|
169 | 170 | pyroutes.register('repo_files', '/%(repo_name)s/files/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
170 | 171 | pyroutes.register('repo_files:default_path', '/%(repo_name)s/files/%(commit_id)s/', ['repo_name', 'commit_id']); |
|
171 | 172 | pyroutes.register('repo_files:default_commit', '/%(repo_name)s/files', ['repo_name']); |
|
172 | 173 | pyroutes.register('repo_files:rendered', '/%(repo_name)s/render/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
173 | 174 | pyroutes.register('repo_files:annotated', '/%(repo_name)s/annotate/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
174 | 175 | pyroutes.register('repo_files:annotated_previous', '/%(repo_name)s/annotate-previous/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
175 | 176 | pyroutes.register('repo_nodetree_full', '/%(repo_name)s/nodetree_full/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
176 | 177 | pyroutes.register('repo_nodetree_full:default_path', '/%(repo_name)s/nodetree_full/%(commit_id)s/', ['repo_name', 'commit_id']); |
|
177 | 178 | pyroutes.register('repo_files_nodelist', '/%(repo_name)s/nodelist/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
178 | 179 | pyroutes.register('repo_file_raw', '/%(repo_name)s/raw/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
179 | 180 | pyroutes.register('repo_file_download', '/%(repo_name)s/download/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
180 | 181 | pyroutes.register('repo_file_download:legacy', '/%(repo_name)s/rawfile/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
181 | 182 | pyroutes.register('repo_file_history', '/%(repo_name)s/history/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
182 | 183 | pyroutes.register('repo_file_authors', '/%(repo_name)s/authors/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
183 | 184 | pyroutes.register('repo_files_remove_file', '/%(repo_name)s/remove_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
184 | 185 | pyroutes.register('repo_files_delete_file', '/%(repo_name)s/delete_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
185 | 186 | pyroutes.register('repo_files_edit_file', '/%(repo_name)s/edit_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
186 | 187 | pyroutes.register('repo_files_update_file', '/%(repo_name)s/update_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
187 | 188 | pyroutes.register('repo_files_add_file', '/%(repo_name)s/add_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
188 | 189 | pyroutes.register('repo_files_create_file', '/%(repo_name)s/create_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
189 | 190 | pyroutes.register('repo_refs_data', '/%(repo_name)s/refs-data', ['repo_name']); |
|
190 | 191 | pyroutes.register('repo_refs_changelog_data', '/%(repo_name)s/refs-data-changelog', ['repo_name']); |
|
191 | 192 | pyroutes.register('repo_stats', '/%(repo_name)s/repo_stats/%(commit_id)s', ['repo_name', 'commit_id']); |
|
192 | 193 | pyroutes.register('repo_changelog', '/%(repo_name)s/changelog', ['repo_name']); |
|
193 | 194 | pyroutes.register('repo_changelog_file', '/%(repo_name)s/changelog/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
194 | 195 | pyroutes.register('repo_changelog_elements', '/%(repo_name)s/changelog_elements', ['repo_name']); |
|
195 | 196 | pyroutes.register('repo_changelog_elements_file', '/%(repo_name)s/changelog_elements/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); |
|
196 | 197 | pyroutes.register('repo_compare_select', '/%(repo_name)s/compare', ['repo_name']); |
|
197 | 198 | pyroutes.register('repo_compare', '/%(repo_name)s/compare/%(source_ref_type)s@%(source_ref)s...%(target_ref_type)s@%(target_ref)s', ['repo_name', 'source_ref_type', 'source_ref', 'target_ref_type', 'target_ref']); |
|
198 | 199 | pyroutes.register('tags_home', '/%(repo_name)s/tags', ['repo_name']); |
|
199 | 200 | pyroutes.register('branches_home', '/%(repo_name)s/branches', ['repo_name']); |
|
200 | 201 | pyroutes.register('bookmarks_home', '/%(repo_name)s/bookmarks', ['repo_name']); |
|
201 | 202 | pyroutes.register('repo_fork_new', '/%(repo_name)s/fork', ['repo_name']); |
|
202 | 203 | pyroutes.register('repo_fork_create', '/%(repo_name)s/fork/create', ['repo_name']); |
|
203 | 204 | pyroutes.register('repo_forks_show_all', '/%(repo_name)s/forks', ['repo_name']); |
|
204 | 205 | pyroutes.register('repo_forks_data', '/%(repo_name)s/forks/data', ['repo_name']); |
|
205 | 206 | pyroutes.register('pullrequest_show', '/%(repo_name)s/pull-request/%(pull_request_id)s', ['repo_name', 'pull_request_id']); |
|
206 | 207 | pyroutes.register('pullrequest_show_all', '/%(repo_name)s/pull-request', ['repo_name']); |
|
207 | 208 | pyroutes.register('pullrequest_show_all_data', '/%(repo_name)s/pull-request-data', ['repo_name']); |
|
208 | 209 | pyroutes.register('pullrequest_repo_refs', '/%(repo_name)s/pull-request/refs/%(target_repo_name)s', ['repo_name', 'target_repo_name']); |
|
209 | 210 | pyroutes.register('pullrequest_repo_destinations', '/%(repo_name)s/pull-request/repo-destinations', ['repo_name']); |
|
210 | 211 | pyroutes.register('pullrequest_new', '/%(repo_name)s/pull-request/new', ['repo_name']); |
|
211 | 212 | pyroutes.register('pullrequest_create', '/%(repo_name)s/pull-request/create', ['repo_name']); |
|
212 | 213 | pyroutes.register('pullrequest_update', '/%(repo_name)s/pull-request/%(pull_request_id)s/update', ['repo_name', 'pull_request_id']); |
|
213 | 214 | pyroutes.register('pullrequest_merge', '/%(repo_name)s/pull-request/%(pull_request_id)s/merge', ['repo_name', 'pull_request_id']); |
|
214 | 215 | pyroutes.register('pullrequest_delete', '/%(repo_name)s/pull-request/%(pull_request_id)s/delete', ['repo_name', 'pull_request_id']); |
|
215 | 216 | pyroutes.register('pullrequest_comment_create', '/%(repo_name)s/pull-request/%(pull_request_id)s/comment', ['repo_name', 'pull_request_id']); |
|
216 | 217 | pyroutes.register('pullrequest_comment_delete', '/%(repo_name)s/pull-request/%(pull_request_id)s/comment/%(comment_id)s/delete', ['repo_name', 'pull_request_id', 'comment_id']); |
|
217 | 218 | pyroutes.register('edit_repo', '/%(repo_name)s/settings', ['repo_name']); |
|
218 | 219 | pyroutes.register('edit_repo_advanced', '/%(repo_name)s/settings/advanced', ['repo_name']); |
|
219 | 220 | pyroutes.register('edit_repo_advanced_delete', '/%(repo_name)s/settings/advanced/delete', ['repo_name']); |
|
220 | 221 | pyroutes.register('edit_repo_advanced_locking', '/%(repo_name)s/settings/advanced/locking', ['repo_name']); |
|
221 | 222 | pyroutes.register('edit_repo_advanced_journal', '/%(repo_name)s/settings/advanced/journal', ['repo_name']); |
|
222 | 223 | pyroutes.register('edit_repo_advanced_fork', '/%(repo_name)s/settings/advanced/fork', ['repo_name']); |
|
223 | 224 | pyroutes.register('edit_repo_caches', '/%(repo_name)s/settings/caches', ['repo_name']); |
|
224 | 225 | pyroutes.register('edit_repo_perms', '/%(repo_name)s/settings/permissions', ['repo_name']); |
|
225 | 226 | pyroutes.register('edit_repo_maintenance', '/%(repo_name)s/settings/maintenance', ['repo_name']); |
|
226 | 227 | pyroutes.register('edit_repo_maintenance_execute', '/%(repo_name)s/settings/maintenance/execute', ['repo_name']); |
|
227 | 228 | pyroutes.register('edit_repo_fields', '/%(repo_name)s/settings/fields', ['repo_name']); |
|
228 | 229 | pyroutes.register('edit_repo_fields_create', '/%(repo_name)s/settings/fields/create', ['repo_name']); |
|
229 | 230 | pyroutes.register('edit_repo_fields_delete', '/%(repo_name)s/settings/fields/%(field_id)s/delete', ['repo_name', 'field_id']); |
|
230 | 231 | pyroutes.register('repo_edit_toggle_locking', '/%(repo_name)s/settings/toggle_locking', ['repo_name']); |
|
231 | 232 | pyroutes.register('edit_repo_remote', '/%(repo_name)s/settings/remote', ['repo_name']); |
|
232 | 233 | pyroutes.register('edit_repo_remote_pull', '/%(repo_name)s/settings/remote/pull', ['repo_name']); |
|
233 | 234 | pyroutes.register('edit_repo_statistics', '/%(repo_name)s/settings/statistics', ['repo_name']); |
|
234 | 235 | pyroutes.register('edit_repo_statistics_reset', '/%(repo_name)s/settings/statistics/update', ['repo_name']); |
|
235 | 236 | pyroutes.register('edit_repo_issuetracker', '/%(repo_name)s/settings/issue_trackers', ['repo_name']); |
|
236 | 237 | pyroutes.register('edit_repo_issuetracker_test', '/%(repo_name)s/settings/issue_trackers/test', ['repo_name']); |
|
237 | 238 | pyroutes.register('edit_repo_issuetracker_delete', '/%(repo_name)s/settings/issue_trackers/delete', ['repo_name']); |
|
238 | 239 | pyroutes.register('edit_repo_issuetracker_update', '/%(repo_name)s/settings/issue_trackers/update', ['repo_name']); |
|
239 | 240 | pyroutes.register('edit_repo_vcs', '/%(repo_name)s/settings/vcs', ['repo_name']); |
|
240 | 241 | pyroutes.register('edit_repo_vcs_update', '/%(repo_name)s/settings/vcs/update', ['repo_name']); |
|
241 | 242 | pyroutes.register('edit_repo_vcs_svn_pattern_delete', '/%(repo_name)s/settings/vcs/svn_pattern/delete', ['repo_name']); |
|
242 | 243 | pyroutes.register('repo_reviewers', '/%(repo_name)s/settings/review/rules', ['repo_name']); |
|
243 | 244 | pyroutes.register('repo_default_reviewers_data', '/%(repo_name)s/settings/review/default-reviewers', ['repo_name']); |
|
244 | 245 | pyroutes.register('edit_repo_strip', '/%(repo_name)s/settings/strip', ['repo_name']); |
|
245 | 246 | pyroutes.register('strip_check', '/%(repo_name)s/settings/strip_check', ['repo_name']); |
|
246 | 247 | pyroutes.register('strip_execute', '/%(repo_name)s/settings/strip_execute', ['repo_name']); |
|
247 | 248 | pyroutes.register('edit_repo_audit_logs', '/%(repo_name)s/settings/audit_logs', ['repo_name']); |
|
248 | 249 | pyroutes.register('rss_feed_home', '/%(repo_name)s/feed/rss', ['repo_name']); |
|
249 | 250 | pyroutes.register('atom_feed_home', '/%(repo_name)s/feed/atom', ['repo_name']); |
|
250 | 251 | pyroutes.register('repo_summary', '/%(repo_name)s', ['repo_name']); |
|
251 | 252 | pyroutes.register('repo_summary_slash', '/%(repo_name)s/', ['repo_name']); |
|
252 | 253 | pyroutes.register('edit_repo_group', '/%(repo_group_name)s/_edit', ['repo_group_name']); |
|
253 | 254 | pyroutes.register('edit_repo_group_advanced', '/%(repo_group_name)s/_settings/advanced', ['repo_group_name']); |
|
254 | 255 | pyroutes.register('edit_repo_group_advanced_delete', '/%(repo_group_name)s/_settings/advanced/delete', ['repo_group_name']); |
|
255 | 256 | pyroutes.register('edit_repo_group_perms', '/%(repo_group_name)s/_settings/permissions', ['repo_group_name']); |
|
256 | 257 | pyroutes.register('edit_repo_group_perms_update', '/%(repo_group_name)s/_settings/permissions/update', ['repo_group_name']); |
|
257 | 258 | pyroutes.register('repo_group_home', '/%(repo_group_name)s', ['repo_group_name']); |
|
258 | 259 | pyroutes.register('repo_group_home_slash', '/%(repo_group_name)s/', ['repo_group_name']); |
|
259 | 260 | pyroutes.register('user_group_members_data', '/_admin/user_groups/%(user_group_id)s/members', ['user_group_id']); |
|
260 | 261 | pyroutes.register('edit_user_group_perms_summary', '/_admin/user_groups/%(user_group_id)s/edit/permissions_summary', ['user_group_id']); |
|
261 | 262 | pyroutes.register('edit_user_group_perms_summary_json', '/_admin/user_groups/%(user_group_id)s/edit/permissions_summary/json', ['user_group_id']); |
|
262 | 263 | pyroutes.register('edit_user_group', '/_admin/user_groups/%(user_group_id)s/edit', ['user_group_id']); |
|
263 | 264 | pyroutes.register('user_groups_update', '/_admin/user_groups/%(user_group_id)s/update', ['user_group_id']); |
|
264 | 265 | pyroutes.register('edit_user_group_global_perms', '/_admin/user_groups/%(user_group_id)s/edit/global_permissions', ['user_group_id']); |
|
265 | 266 | pyroutes.register('edit_user_group_global_perms_update', '/_admin/user_groups/%(user_group_id)s/edit/global_permissions/update', ['user_group_id']); |
|
266 | 267 | pyroutes.register('edit_user_group_perms', '/_admin/user_groups/%(user_group_id)s/edit/permissions', ['user_group_id']); |
|
267 | 268 | pyroutes.register('edit_user_group_perms_update', '/_admin/user_groups/%(user_group_id)s/edit/permissions/update', ['user_group_id']); |
|
268 | 269 | pyroutes.register('edit_user_group_advanced', '/_admin/user_groups/%(user_group_id)s/edit/advanced', ['user_group_id']); |
|
269 | 270 | pyroutes.register('edit_user_group_advanced_sync', '/_admin/user_groups/%(user_group_id)s/edit/advanced/sync', ['user_group_id']); |
|
270 | 271 | pyroutes.register('user_groups_delete', '/_admin/user_groups/%(user_group_id)s/delete', ['user_group_id']); |
|
271 | 272 | pyroutes.register('search', '/_admin/search', []); |
|
272 | 273 | pyroutes.register('search_repo', '/%(repo_name)s/search', ['repo_name']); |
|
273 | 274 | pyroutes.register('user_profile', '/_profiles/%(username)s', ['username']); |
|
274 | 275 | pyroutes.register('my_account_profile', '/_admin/my_account/profile', []); |
|
275 | 276 | pyroutes.register('my_account_edit', '/_admin/my_account/edit', []); |
|
276 | 277 | pyroutes.register('my_account_update', '/_admin/my_account/update', []); |
|
277 | 278 | pyroutes.register('my_account_password', '/_admin/my_account/password', []); |
|
278 | 279 | pyroutes.register('my_account_password_update', '/_admin/my_account/password/update', []); |
|
279 | 280 | pyroutes.register('my_account_auth_tokens', '/_admin/my_account/auth_tokens', []); |
|
280 | 281 | pyroutes.register('my_account_auth_tokens_add', '/_admin/my_account/auth_tokens/new', []); |
|
281 | 282 | pyroutes.register('my_account_auth_tokens_delete', '/_admin/my_account/auth_tokens/delete', []); |
|
282 | 283 | pyroutes.register('my_account_ssh_keys', '/_admin/my_account/ssh_keys', []); |
|
283 | 284 | pyroutes.register('my_account_ssh_keys_generate', '/_admin/my_account/ssh_keys/generate', []); |
|
284 | 285 | pyroutes.register('my_account_ssh_keys_add', '/_admin/my_account/ssh_keys/new', []); |
|
285 | 286 | pyroutes.register('my_account_ssh_keys_delete', '/_admin/my_account/ssh_keys/delete', []); |
|
287 | pyroutes.register('my_account_user_group_membership', '/_admin/my_account/user_group_membership', []); | |
|
286 | 288 | pyroutes.register('my_account_emails', '/_admin/my_account/emails', []); |
|
287 | 289 | pyroutes.register('my_account_emails_add', '/_admin/my_account/emails/new', []); |
|
288 | 290 | pyroutes.register('my_account_emails_delete', '/_admin/my_account/emails/delete', []); |
|
289 | 291 | pyroutes.register('my_account_repos', '/_admin/my_account/repos', []); |
|
290 | 292 | pyroutes.register('my_account_watched', '/_admin/my_account/watched', []); |
|
291 | 293 | pyroutes.register('my_account_perms', '/_admin/my_account/perms', []); |
|
292 | 294 | pyroutes.register('my_account_notifications', '/_admin/my_account/notifications', []); |
|
293 | 295 | pyroutes.register('my_account_notifications_toggle_visibility', '/_admin/my_account/toggle_visibility', []); |
|
294 | 296 | pyroutes.register('my_account_pullrequests', '/_admin/my_account/pull_requests', []); |
|
295 | 297 | pyroutes.register('my_account_pullrequests_data', '/_admin/my_account/pull_requests/data', []); |
|
296 | 298 | pyroutes.register('notifications_show_all', '/_admin/notifications', []); |
|
297 | 299 | pyroutes.register('notifications_mark_all_read', '/_admin/notifications/mark_all_read', []); |
|
298 | 300 | pyroutes.register('notifications_show', '/_admin/notifications/%(notification_id)s', ['notification_id']); |
|
299 | 301 | pyroutes.register('notifications_update', '/_admin/notifications/%(notification_id)s/update', ['notification_id']); |
|
300 | 302 | pyroutes.register('notifications_delete', '/_admin/notifications/%(notification_id)s/delete', ['notification_id']); |
|
301 | 303 | pyroutes.register('my_account_notifications_test_channelstream', '/_admin/my_account/test_channelstream', []); |
|
302 | 304 | pyroutes.register('gists_show', '/_admin/gists', []); |
|
303 | 305 | pyroutes.register('gists_new', '/_admin/gists/new', []); |
|
304 | 306 | pyroutes.register('gists_create', '/_admin/gists/create', []); |
|
305 | 307 | pyroutes.register('gist_show', '/_admin/gists/%(gist_id)s', ['gist_id']); |
|
306 | 308 | pyroutes.register('gist_delete', '/_admin/gists/%(gist_id)s/delete', ['gist_id']); |
|
307 | 309 | pyroutes.register('gist_edit', '/_admin/gists/%(gist_id)s/edit', ['gist_id']); |
|
308 | 310 | pyroutes.register('gist_edit_check_revision', '/_admin/gists/%(gist_id)s/edit/check_revision', ['gist_id']); |
|
309 | 311 | pyroutes.register('gist_update', '/_admin/gists/%(gist_id)s/update', ['gist_id']); |
|
310 | 312 | pyroutes.register('gist_show_rev', '/_admin/gists/%(gist_id)s/%(revision)s', ['gist_id', 'revision']); |
|
311 | 313 | pyroutes.register('gist_show_formatted', '/_admin/gists/%(gist_id)s/%(revision)s/%(format)s', ['gist_id', 'revision', 'format']); |
|
312 | 314 | pyroutes.register('gist_show_formatted_path', '/_admin/gists/%(gist_id)s/%(revision)s/%(format)s/%(f_path)s', ['gist_id', 'revision', 'format', 'f_path']); |
|
313 | 315 | pyroutes.register('debug_style_home', '/_admin/debug_style', []); |
|
314 | 316 | pyroutes.register('debug_style_template', '/_admin/debug_style/t/%(t_path)s', ['t_path']); |
|
315 | 317 | pyroutes.register('apiv2', '/_admin/api', []); |
|
316 | 318 | } |
@@ -1,141 +1,109 b'' | |||
|
1 | 1 | |
|
2 | 2 | <div id="update_notice" style="display: none; margin: -40px 0px 20px 0px"> |
|
3 | 3 | <div>${_('Checking for updates...')}</div> |
|
4 | 4 | </div> |
|
5 | 5 | |
|
6 | 6 | |
|
7 | 7 | <div class="panel panel-default"> |
|
8 | 8 | <div class="panel-heading"> |
|
9 | 9 | <h3 class="panel-title">${_('Gunicorn process management')}</h3> |
|
10 | ||
|
10 | <div class="pull-right"> | |
|
11 | <a id="autoRefreshEnable" href="#autoRefreshEnable" onclick="enableAutoRefresh(); return false">${_('start auto refresh')}</a> | |
|
12 | <a id="autoRefreshDisable" href="#autoRefreshDisable" onclick="disableAutoRefresh(); return false" style="display: none">${_('stop auto refresh')}</a> | |
|
13 | </div> | |
|
11 | 14 | </div> |
|
12 | 15 | <div class="panel-body" id="app"> |
|
13 | 16 | <h3>List of Gunicorn processes on this machine</h3> |
|
14 | 17 | <% |
|
15 | 18 | def get_name(proc): |
|
16 | 19 | cmd = ' '.join(proc.cmdline()) |
|
17 | 20 | if 'vcsserver.ini' in cmd: |
|
18 | 21 | return 'VCSServer' |
|
19 | 22 | elif 'rhodecode.ini' in cmd: |
|
20 | 23 | return 'RhodeCode' |
|
21 | 24 | return proc.name() |
|
22 | 25 | %> |
|
23 | <table> | |
|
24 | % for proc in c.gunicorn_processes: | |
|
25 | <% mem = proc.memory_info()%> | |
|
26 | <% children = proc.children(recursive=True) %> | |
|
27 | % if children: | |
|
28 | ||
|
29 | <tr> | |
|
30 | <td> | |
|
31 | <code> | |
|
32 | ${proc.pid} - ${get_name(proc)} | |
|
33 | </code> | |
|
34 | </td> | |
|
35 | <td> | |
|
36 | <a href="#showCommand" onclick="$('#pid'+${proc.pid}).toggle();return false"> command </a> | |
|
37 | <code id="pid${proc.pid}" style="display: none"> | |
|
38 | ${' '.join(proc.cmdline())} | |
|
39 | </code> | |
|
40 | </td> | |
|
41 | <td></td> | |
|
42 | <td> | |
|
43 | RSS:${h.format_byte_size_binary(mem.rss)} | |
|
44 | </td> | |
|
45 | <td> | |
|
46 | VMS:${h.format_byte_size_binary(mem.vms)} | |
|
47 | </td> | |
|
48 | <td> | |
|
49 | AGE: ${h.age_component(h.time_to_utcdatetime(proc.create_time()))} | |
|
50 | </td> | |
|
51 | <td> | |
|
52 | MASTER | |
|
53 | </td> | |
|
54 | </tr> | |
|
55 | <% mem_sum = 0 %> | |
|
56 | % for proc_child in children: | |
|
57 | <% mem = proc_child.memory_info()%> | |
|
58 | <tr> | |
|
59 | <td> | |
|
60 | <code> | |
|
61 | | ${proc_child.pid} - ${get_name(proc_child)} | |
|
62 | </code> | |
|
63 | </td> | |
|
64 | <td> | |
|
65 | <a href="#showCommand" onclick="$('#pid'+${proc_child.pid}).toggle();return false"> command </a> | |
|
66 | <code id="pid${proc_child.pid}" style="display: none"> | |
|
67 | ${' '.join(proc_child.cmdline())} | |
|
68 | </code> | |
|
69 | </td> | |
|
70 | <td> | |
|
71 | CPU: ${proc_child.cpu_percent()} % | |
|
72 | </td> | |
|
73 | <td> | |
|
74 | RSS:${h.format_byte_size_binary(mem.rss)} | |
|
75 | <% mem_sum += mem.rss %> | |
|
76 | </td> | |
|
77 | <td> | |
|
78 | VMS:${h.format_byte_size_binary(mem.vms)} | |
|
79 | </td> | |
|
80 | <td> | |
|
81 | AGE: ${h.age_component(h.time_to_utcdatetime(proc_child.create_time()))} | |
|
82 | </td> | |
|
83 | <td> | |
|
84 | <a href="#restartProcess" onclick="restart(this, ${proc_child.pid});return false"> | |
|
85 | restart | |
|
86 | </a> | |
|
87 | </td> | |
|
88 | </tr> | |
|
89 | % endfor | |
|
90 | <tr> | |
|
91 | <td colspan="2"><code>| total processes: ${len(children)}</code></td> | |
|
92 | <td></td> | |
|
93 | <td><strong>RSS:${h.format_byte_size_binary(mem_sum)}</strong></td> | |
|
94 | <td></td> | |
|
95 | </tr> | |
|
96 | <tr><td> <code> -- </code> </td></tr> | |
|
97 | ||
|
98 | % endif | |
|
99 | % endfor | |
|
100 | </table> | |
|
26 | <%include file='settings_process_management_data.mako'/> | |
|
101 | 27 | </div> |
|
102 | 28 | </div> |
|
103 | 29 | |
|
104 | ||
|
105 | 30 | <script> |
|
106 | 31 | |
|
107 | 32 | |
|
108 | 33 | restart = function(elem, pid) { |
|
109 | 34 | |
|
110 | 35 | if ($(elem).hasClass('disabled')){ |
|
111 | 36 | return; |
|
112 | 37 | } |
|
113 | 38 | $(elem).addClass('disabled'); |
|
114 | 39 | $(elem).html('processing...'); |
|
115 | 40 | |
|
116 | 41 | $.ajax({ |
|
117 | 42 | url: pyroutes.url('admin_settings_process_management_signal'), |
|
118 | 43 | headers: { |
|
119 | 44 | "X-CSRF-Token": CSRF_TOKEN, |
|
120 | 45 | }, |
|
121 | 46 | data: JSON.stringify({'pids': [pid]}), |
|
122 | 47 | dataType: 'json', |
|
123 | 48 | type: 'POST', |
|
124 | 49 | contentType: "application/json; charset=utf-8", |
|
125 | 50 | success: function (data) { |
|
126 | 51 | $(elem).html(data.result); |
|
127 | 52 | $(elem).removeClass('disabled'); |
|
128 | 53 | }, |
|
129 | 54 | failure: function (data) { |
|
130 | 55 | $(elem).text('FAILED TO LOAD RESULT'); |
|
131 | 56 | $(elem).removeClass('disabled'); |
|
132 | 57 | }, |
|
133 | 58 | error: function (data) { |
|
134 | 59 | $(elem).text('FAILED TO LOAD RESULT'); |
|
135 | 60 | $(elem).removeClass('disabled'); |
|
136 | 61 | } |
|
137 | 62 | }) |
|
138 | } | |
|
63 | }; | |
|
64 | ||
|
65 | var intervalID = null; | |
|
66 | var currentRequest = null; | |
|
67 | ||
|
68 | autoRefresh = function(value) { | |
|
69 | var url = pyroutes.url('admin_settings_process_management_data'); | |
|
70 | var loadData = function() { | |
|
71 | currentRequest = $.get(url) | |
|
72 | .done(function(data) { | |
|
73 | currentRequest = null; | |
|
74 | $('#procList').html(data); | |
|
75 | timeagoActivate(); | |
|
76 | var beat = function(doCallback) { | |
|
77 | var callback = function () {}; | |
|
78 | if (doCallback){ | |
|
79 | var callback = function () {beat(false)}; | |
|
80 | } | |
|
81 | $('#processTimeStamp').animate({ | |
|
82 | opacity: $('#processTimeStamp').css('opacity') == '1' ? '0.3' : '1' | |
|
83 | }, 500, callback); | |
|
84 | }; | |
|
85 | beat(true) | |
|
86 | }); | |
|
87 | }; | |
|
88 | ||
|
89 | if (value) { | |
|
90 | intervalID = setInterval(loadData, 5000); | |
|
91 | } else { | |
|
92 | clearInterval(intervalID); | |
|
93 | } | |
|
94 | }; | |
|
95 | ||
|
96 | enableAutoRefresh = function() { | |
|
97 | $('#autoRefreshEnable').hide(); | |
|
98 | $('#autoRefreshDisable').show(); | |
|
99 | autoRefresh(true) | |
|
100 | }; | |
|
101 | ||
|
102 | disableAutoRefresh = function() { | |
|
103 | $('#autoRefreshEnable').show(); | |
|
104 | $('#autoRefreshDisable').hide(); | |
|
105 | autoRefresh(false) | |
|
106 | }; | |
|
139 | 107 | |
|
140 | 108 | |
|
141 | 109 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now