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