##// END OF EJS Templates
fix(pyroutes): fixed generated JS routes for EE
super-admin -
r5257:557dc90c default
parent child Browse files
Show More
@@ -388,7 +388,7 b' def includeme(config, auth_resources=Non'
388 388
389 389 # Add subscribers.
390 390 if load_all:
391 log.debug('Adding subscribers....')
391 log.debug('Adding subscribers...')
392 392 config.add_subscriber(scan_repositories_if_enabled,
393 393 pyramid.events.ApplicationCreated)
394 394 config.add_subscriber(write_metadata_if_needed,
@@ -12,14 +12,16 b''
12 12 ******************************************************************************/
13 13 function registerRCRoutes() {
14 14 // routes registration
15 pyroutes.register('admin_artifacts', '/_admin/_admin/artifacts', []);
16 pyroutes.register('admin_artifacts_delete', '/_admin/_admin/artifacts/%(uid)s/delete', ['uid']);
17 pyroutes.register('admin_artifacts_show_all', '/_admin/_admin/artifacts', []);
18 pyroutes.register('admin_artifacts_show_info', '/_admin/_admin/artifacts/%(uid)s', ['uid']);
19 pyroutes.register('admin_artifacts_update', '/_admin/_admin/artifacts/%(uid)s/update', ['uid']);
15 pyroutes.register('admin_artifacts', '/_admin/artifacts', []);
16 pyroutes.register('admin_artifacts_data', '/_admin/artifacts-data', []);
17 pyroutes.register('admin_artifacts_delete', '/_admin/artifacts/%(uid)s/delete', ['uid']);
18 pyroutes.register('admin_artifacts_show_all', '/_admin/artifacts', []);
19 pyroutes.register('admin_artifacts_show_info', '/_admin/artifacts/%(uid)s', ['uid']);
20 pyroutes.register('admin_artifacts_update', '/_admin/artifacts/%(uid)s/update', ['uid']);
20 21 pyroutes.register('admin_audit_log_entry', '/_admin/audit_logs/%(audit_log_id)s', ['audit_log_id']);
21 22 pyroutes.register('admin_audit_logs', '/_admin/audit_logs', []);
22 pyroutes.register('admin_automation', '/_admin/_admin/automation', []);
23 pyroutes.register('admin_automation', '/_admin/automation', []);
24 pyroutes.register('admin_automation_update', '/_admin/automation/%(entry_id)s/update', ['entry_id']);
23 25 pyroutes.register('admin_defaults_repositories', '/_admin/defaults/repositories', []);
24 26 pyroutes.register('admin_defaults_repositories_update', '/_admin/defaults/repositories/update', []);
25 27 pyroutes.register('admin_home', '/_admin', []);
@@ -27,6 +29,7 b' function registerRCRoutes() {'
27 29 pyroutes.register('admin_permissions_application_update', '/_admin/permissions/application/update', []);
28 30 pyroutes.register('admin_permissions_auth_token_access', '/_admin/permissions/auth_token_access', []);
29 31 pyroutes.register('admin_permissions_branch', '/_admin/permissions/branch', []);
32 pyroutes.register('admin_permissions_branch_update', '/_admin/permissions/branch/update', []);
30 33 pyroutes.register('admin_permissions_global', '/_admin/permissions/global', []);
31 34 pyroutes.register('admin_permissions_global_update', '/_admin/permissions/global/update', []);
32 35 pyroutes.register('admin_permissions_ips', '/_admin/permissions/ips', []);
@@ -36,7 +39,8 b' function registerRCRoutes() {'
36 39 pyroutes.register('admin_permissions_ssh_keys', '/_admin/permissions/ssh_keys', []);
37 40 pyroutes.register('admin_permissions_ssh_keys_data', '/_admin/permissions/ssh_keys/data', []);
38 41 pyroutes.register('admin_permissions_ssh_keys_update', '/_admin/permissions/ssh_keys/update', []);
39 pyroutes.register('admin_scheduler', '/_admin/_admin/scheduler', []);
42 pyroutes.register('admin_scheduler', '/_admin/scheduler', []);
43 pyroutes.register('admin_scheduler_show_tasks', '/_admin/scheduler/_tasks', []);
40 44 pyroutes.register('admin_settings', '/_admin/settings', []);
41 45 pyroutes.register('admin_settings_email', '/_admin/settings/email', []);
42 46 pyroutes.register('admin_settings_email_update', '/_admin/settings/email/update', []);
@@ -55,6 +59,8 b' function registerRCRoutes() {'
55 59 pyroutes.register('admin_settings_issuetracker_update', '/_admin/settings/issue-tracker/update', []);
56 60 pyroutes.register('admin_settings_labs', '/_admin/settings/labs', []);
57 61 pyroutes.register('admin_settings_labs_update', '/_admin/settings/labs/update', []);
62 pyroutes.register('admin_settings_license', '/_admin/settings/license', []);
63 pyroutes.register('admin_settings_license_unlock', '/_admin/settings/license_unlock', []);
58 64 pyroutes.register('admin_settings_mapping', '/_admin/settings/mapping', []);
59 65 pyroutes.register('admin_settings_mapping_update', '/_admin/settings/mapping/update', []);
60 66 pyroutes.register('admin_settings_open_source', '/_admin/settings/open_source', []);
@@ -62,6 +68,12 b' function registerRCRoutes() {'
62 68 pyroutes.register('admin_settings_process_management_data', '/_admin/settings/process_management/data', []);
63 69 pyroutes.register('admin_settings_process_management_master_signal', '/_admin/settings/process_management/master_signal', []);
64 70 pyroutes.register('admin_settings_process_management_signal', '/_admin/settings/process_management/signal', []);
71 pyroutes.register('admin_settings_scheduler_create', '/_admin/scheduler/create', []);
72 pyroutes.register('admin_settings_scheduler_delete', '/_admin/scheduler/%(schedule_id)s/delete', ['schedule_id']);
73 pyroutes.register('admin_settings_scheduler_edit', '/_admin/scheduler/%(schedule_id)s', ['schedule_id']);
74 pyroutes.register('admin_settings_scheduler_execute', '/_admin/scheduler/%(schedule_id)s/execute', ['schedule_id']);
75 pyroutes.register('admin_settings_scheduler_new', '/_admin/scheduler/new', []);
76 pyroutes.register('admin_settings_scheduler_update', '/_admin/scheduler/%(schedule_id)s/update', ['schedule_id']);
65 77 pyroutes.register('admin_settings_search', '/_admin/settings/search', []);
66 78 pyroutes.register('admin_settings_sessions', '/_admin/settings/sessions', []);
67 79 pyroutes.register('admin_settings_sessions_cleanup', '/_admin/settings/sessions/cleanup', []);
@@ -83,6 +95,7 b' function registerRCRoutes() {'
83 95 pyroutes.register('channelstream_connect', '/_admin/channelstream/connect', []);
84 96 pyroutes.register('channelstream_proxy', '/_channelstream', []);
85 97 pyroutes.register('channelstream_subscribe', '/_admin/channelstream/subscribe', []);
98 pyroutes.register('commit_draft_comments_submit', '/%(repo_name)s/changeset/%(commit_id)s/draft_comments_submit', ['repo_name', 'commit_id']);
86 99 pyroutes.register('debug_style_email', '/_admin/debug_style/email/%(email_id)s', ['email_id']);
87 100 pyroutes.register('debug_style_email_plain_rendered', '/_admin/debug_style/email-rendered/%(email_id)s', ['email_id']);
88 101 pyroutes.register('debug_style_home', '/_admin/debug_style', []);
@@ -205,6 +218,8 b' function registerRCRoutes() {'
205 218 pyroutes.register('my_account_emails', '/_admin/my_account/emails', []);
206 219 pyroutes.register('my_account_emails_add', '/_admin/my_account/emails/new', []);
207 220 pyroutes.register('my_account_emails_delete', '/_admin/my_account/emails/delete', []);
221 pyroutes.register('my_account_external_identity', '/_admin/my_account/external-identity', []);
222 pyroutes.register('my_account_external_identity_delete', '/_admin/my_account/external-identity/delete', []);
208 223 pyroutes.register('my_account_goto_bookmark', '/_admin/my_account/bookmark/%(bookmark_id)s', ['bookmark_id']);
209 224 pyroutes.register('my_account_notifications', '/_admin/my_account/notifications', []);
210 225 pyroutes.register('my_account_notifications_test_channelstream', '/_admin/my_account/test_channelstream', []);
@@ -232,6 +247,7 b' function registerRCRoutes() {'
232 247 pyroutes.register('ops_healthcheck', '/_admin/ops/status', []);
233 248 pyroutes.register('ops_ping', '/_admin/ops/ping', []);
234 249 pyroutes.register('ops_redirect_test', '/_admin/ops/redirect', []);
250 pyroutes.register('plugin_admin_chat', '/_admin/plugin_admin_chat/%(action)s', ['action']);
235 251 pyroutes.register('pull_requests_global', '/_admin/pull-request/%(pull_request_id)s', ['pull_request_id']);
236 252 pyroutes.register('pull_requests_global_0', '/_admin/pull_requests/%(pull_request_id)s', ['pull_request_id']);
237 253 pyroutes.register('pull_requests_global_1', '/_admin/pull-requests/%(pull_request_id)s', ['pull_request_id']);
@@ -241,6 +257,7 b' function registerRCRoutes() {'
241 257 pyroutes.register('pullrequest_comments', '/%(repo_name)s/pull-request/%(pull_request_id)s/comments', ['repo_name', 'pull_request_id']);
242 258 pyroutes.register('pullrequest_create', '/%(repo_name)s/pull-request/create', ['repo_name']);
243 259 pyroutes.register('pullrequest_delete', '/%(repo_name)s/pull-request/%(pull_request_id)s/delete', ['repo_name', 'pull_request_id']);
260 pyroutes.register('pullrequest_draft_comments_submit', '/%(repo_name)s/pull-request/%(pull_request_id)s/draft_comments_submit', ['repo_name', 'pull_request_id']);
244 261 pyroutes.register('pullrequest_drafts', '/%(repo_name)s/pull-request/%(pull_request_id)s/drafts', ['repo_name', 'pull_request_id']);
245 262 pyroutes.register('pullrequest_merge', '/%(repo_name)s/pull-request/%(pull_request_id)s/merge', ['repo_name', 'pull_request_id']);
246 263 pyroutes.register('pullrequest_new', '/%(repo_name)s/pull-request/new', ['repo_name']);
@@ -253,8 +270,18 b' function registerRCRoutes() {'
253 270 pyroutes.register('pullrequest_update', '/%(repo_name)s/pull-request/%(pull_request_id)s/update', ['repo_name', 'pull_request_id']);
254 271 pyroutes.register('register', '/_admin/register', []);
255 272 pyroutes.register('repo_archivefile', '/%(repo_name)s/archive/%(fname)s', ['repo_name', 'fname']);
273 pyroutes.register('repo_artifacts_data', '/%(repo_name)s/artifacts_data', ['repo_name']);
274 pyroutes.register('repo_artifacts_delete', '/%(repo_name)s/artifacts/delete/%(uid)s', ['repo_name', 'uid']);
275 pyroutes.register('repo_artifacts_get', '/%(repo_name)s/artifacts/download/%(uid)s', ['repo_name', 'uid']);
276 pyroutes.register('repo_artifacts_info', '/%(repo_name)s/artifacts/info/%(uid)s', ['repo_name', 'uid']);
256 277 pyroutes.register('repo_artifacts_list', '/%(repo_name)s/artifacts', ['repo_name']);
278 pyroutes.register('repo_artifacts_new', '/%(repo_name)s/artifacts/new', ['repo_name']);
279 pyroutes.register('repo_artifacts_store', '/%(repo_name)s/artifacts/store', ['repo_name']);
280 pyroutes.register('repo_artifacts_stream_script', '/_file_store/stream-upload-script', []);
281 pyroutes.register('repo_artifacts_stream_store', '/_file_store/stream-upload', []);
282 pyroutes.register('repo_artifacts_update', '/%(repo_name)s/artifacts/update/%(uid)s', ['repo_name', 'uid']);
257 283 pyroutes.register('repo_automation', '/%(repo_name)s/settings/automation', ['repo_name']);
284 pyroutes.register('repo_automation_update', '/%(repo_name)s/settings/automation/%(entry_id)s/update', ['repo_name', 'entry_id']);
258 285 pyroutes.register('repo_changelog', '/%(repo_name)s/changelog', ['repo_name']);
259 286 pyroutes.register('repo_changelog_file', '/%(repo_name)s/changelog/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
260 287 pyroutes.register('repo_commit', '/%(repo_name)s/changeset/%(commit_id)s', ['repo_name', 'commit_id']);
@@ -331,6 +358,9 b' function registerRCRoutes() {'
331 358 pyroutes.register('repo_refs_changelog_data', '/%(repo_name)s/refs-data-changelog', ['repo_name']);
332 359 pyroutes.register('repo_refs_data', '/%(repo_name)s/refs-data', ['repo_name']);
333 360 pyroutes.register('repo_reviewers', '/%(repo_name)s/settings/review/rules', ['repo_name']);
361 pyroutes.register('repo_reviewers_review_rule_delete', '/%(repo_name)s/settings/review/rules/%(rule_id)s/delete', ['repo_name', 'rule_id']);
362 pyroutes.register('repo_reviewers_review_rule_edit', '/%(repo_name)s/settings/review/rules/%(rule_id)s', ['repo_name', 'rule_id']);
363 pyroutes.register('repo_reviewers_review_rule_new', '/%(repo_name)s/settings/review/rules/new', ['repo_name']);
334 364 pyroutes.register('repo_settings_quick_actions', '/%(repo_name)s/settings/quick-action', ['repo_name']);
335 365 pyroutes.register('repo_stats', '/%(repo_name)s/repo_stats/%(commit_id)s', ['repo_name', 'commit_id']);
336 366 pyroutes.register('repo_summary', '/%(repo_name)s', ['repo_name']);
@@ -271,7 +271,7 b' def write_js_routes_if_enabled(event):'
271 271 ('show_user', '/profile/%(username)s', ['username'])
272 272 """
273 273
274 routepath = route.pattern
274 route_path = route.pattern
275 275 pattern = route.pattern
276 276
277 277 def replace(matchobj):
@@ -280,16 +280,16 b' def write_js_routes_if_enabled(event):'
280 280 else:
281 281 return "%%(%s)s" % matchobj.group(2)
282 282
283 routepath = _argument_prog.sub(replace, routepath)
283 route_path = _argument_prog.sub(replace, route_path)
284 284
285 if not routepath.startswith('/'):
286 routepath = '/'+routepath
285 if not route_path.startswith('/'):
286 route_path = f'/{route_path}'
287 287
288 288 return (
289 289 route.name,
290 routepath,
290 route_path,
291 291 [(arg[0].split(':')[0] if arg[0] != '' else arg[1])
292 for arg in _argument_prog.findall(pattern)]
292 for arg in _argument_prog.findall(pattern)]
293 293 )
294 294
295 295 def get_routes():
@@ -308,6 +308,7 b' def write_js_routes_if_enabled(event):'
308 308 try:
309 309 with open(jsroutes_file_path, 'w', encoding='utf-8') as f:
310 310 f.write(jsroutes_file_content)
311 log.debug('generated JS files in %s', jsroutes_file_path)
311 312 except Exception:
312 313 log.exception('Failed to write routes.js into %s', jsroutes_file_path)
313 314
General Comments 0
You need to be logged in to leave comments. Login now