fix(pyroutes): fixed generated JS routes for EE
This commit is contained in:
parent
840ea1daef
commit
17e93a0136
3 changed files with 45 additions and 14 deletions
|
|
@ -388,7 +388,7 @@ def includeme(config, auth_resources=None):
|
|||
|
||||
# Add subscribers.
|
||||
if load_all:
|
||||
log.debug('Adding subscribers....')
|
||||
log.debug('Adding subscribers...')
|
||||
config.add_subscriber(scan_repositories_if_enabled,
|
||||
pyramid.events.ApplicationCreated)
|
||||
config.add_subscriber(write_metadata_if_needed,
|
||||
|
|
|
|||
|
|
@ -12,14 +12,16 @@
|
|||
******************************************************************************/
|
||||
function registerRCRoutes() {
|
||||
// routes registration
|
||||
pyroutes.register('admin_artifacts', '/_admin/_admin/artifacts', []);
|
||||
pyroutes.register('admin_artifacts_delete', '/_admin/_admin/artifacts/%(uid)s/delete', ['uid']);
|
||||
pyroutes.register('admin_artifacts_show_all', '/_admin/_admin/artifacts', []);
|
||||
pyroutes.register('admin_artifacts_show_info', '/_admin/_admin/artifacts/%(uid)s', ['uid']);
|
||||
pyroutes.register('admin_artifacts_update', '/_admin/_admin/artifacts/%(uid)s/update', ['uid']);
|
||||
pyroutes.register('admin_artifacts', '/_admin/artifacts', []);
|
||||
pyroutes.register('admin_artifacts_data', '/_admin/artifacts-data', []);
|
||||
pyroutes.register('admin_artifacts_delete', '/_admin/artifacts/%(uid)s/delete', ['uid']);
|
||||
pyroutes.register('admin_artifacts_show_all', '/_admin/artifacts', []);
|
||||
pyroutes.register('admin_artifacts_show_info', '/_admin/artifacts/%(uid)s', ['uid']);
|
||||
pyroutes.register('admin_artifacts_update', '/_admin/artifacts/%(uid)s/update', ['uid']);
|
||||
pyroutes.register('admin_audit_log_entry', '/_admin/audit_logs/%(audit_log_id)s', ['audit_log_id']);
|
||||
pyroutes.register('admin_audit_logs', '/_admin/audit_logs', []);
|
||||
pyroutes.register('admin_automation', '/_admin/_admin/automation', []);
|
||||
pyroutes.register('admin_automation', '/_admin/automation', []);
|
||||
pyroutes.register('admin_automation_update', '/_admin/automation/%(entry_id)s/update', ['entry_id']);
|
||||
pyroutes.register('admin_defaults_repositories', '/_admin/defaults/repositories', []);
|
||||
pyroutes.register('admin_defaults_repositories_update', '/_admin/defaults/repositories/update', []);
|
||||
pyroutes.register('admin_home', '/_admin', []);
|
||||
|
|
@ -27,6 +29,7 @@ function registerRCRoutes() {
|
|||
pyroutes.register('admin_permissions_application_update', '/_admin/permissions/application/update', []);
|
||||
pyroutes.register('admin_permissions_auth_token_access', '/_admin/permissions/auth_token_access', []);
|
||||
pyroutes.register('admin_permissions_branch', '/_admin/permissions/branch', []);
|
||||
pyroutes.register('admin_permissions_branch_update', '/_admin/permissions/branch/update', []);
|
||||
pyroutes.register('admin_permissions_global', '/_admin/permissions/global', []);
|
||||
pyroutes.register('admin_permissions_global_update', '/_admin/permissions/global/update', []);
|
||||
pyroutes.register('admin_permissions_ips', '/_admin/permissions/ips', []);
|
||||
|
|
@ -36,7 +39,8 @@ function registerRCRoutes() {
|
|||
pyroutes.register('admin_permissions_ssh_keys', '/_admin/permissions/ssh_keys', []);
|
||||
pyroutes.register('admin_permissions_ssh_keys_data', '/_admin/permissions/ssh_keys/data', []);
|
||||
pyroutes.register('admin_permissions_ssh_keys_update', '/_admin/permissions/ssh_keys/update', []);
|
||||
pyroutes.register('admin_scheduler', '/_admin/_admin/scheduler', []);
|
||||
pyroutes.register('admin_scheduler', '/_admin/scheduler', []);
|
||||
pyroutes.register('admin_scheduler_show_tasks', '/_admin/scheduler/_tasks', []);
|
||||
pyroutes.register('admin_settings', '/_admin/settings', []);
|
||||
pyroutes.register('admin_settings_email', '/_admin/settings/email', []);
|
||||
pyroutes.register('admin_settings_email_update', '/_admin/settings/email/update', []);
|
||||
|
|
@ -55,6 +59,8 @@ function registerRCRoutes() {
|
|||
pyroutes.register('admin_settings_issuetracker_update', '/_admin/settings/issue-tracker/update', []);
|
||||
pyroutes.register('admin_settings_labs', '/_admin/settings/labs', []);
|
||||
pyroutes.register('admin_settings_labs_update', '/_admin/settings/labs/update', []);
|
||||
pyroutes.register('admin_settings_license', '/_admin/settings/license', []);
|
||||
pyroutes.register('admin_settings_license_unlock', '/_admin/settings/license_unlock', []);
|
||||
pyroutes.register('admin_settings_mapping', '/_admin/settings/mapping', []);
|
||||
pyroutes.register('admin_settings_mapping_update', '/_admin/settings/mapping/update', []);
|
||||
pyroutes.register('admin_settings_open_source', '/_admin/settings/open_source', []);
|
||||
|
|
@ -62,6 +68,12 @@ function registerRCRoutes() {
|
|||
pyroutes.register('admin_settings_process_management_data', '/_admin/settings/process_management/data', []);
|
||||
pyroutes.register('admin_settings_process_management_master_signal', '/_admin/settings/process_management/master_signal', []);
|
||||
pyroutes.register('admin_settings_process_management_signal', '/_admin/settings/process_management/signal', []);
|
||||
pyroutes.register('admin_settings_scheduler_create', '/_admin/scheduler/create', []);
|
||||
pyroutes.register('admin_settings_scheduler_delete', '/_admin/scheduler/%(schedule_id)s/delete', ['schedule_id']);
|
||||
pyroutes.register('admin_settings_scheduler_edit', '/_admin/scheduler/%(schedule_id)s', ['schedule_id']);
|
||||
pyroutes.register('admin_settings_scheduler_execute', '/_admin/scheduler/%(schedule_id)s/execute', ['schedule_id']);
|
||||
pyroutes.register('admin_settings_scheduler_new', '/_admin/scheduler/new', []);
|
||||
pyroutes.register('admin_settings_scheduler_update', '/_admin/scheduler/%(schedule_id)s/update', ['schedule_id']);
|
||||
pyroutes.register('admin_settings_search', '/_admin/settings/search', []);
|
||||
pyroutes.register('admin_settings_sessions', '/_admin/settings/sessions', []);
|
||||
pyroutes.register('admin_settings_sessions_cleanup', '/_admin/settings/sessions/cleanup', []);
|
||||
|
|
@ -83,6 +95,7 @@ function registerRCRoutes() {
|
|||
pyroutes.register('channelstream_connect', '/_admin/channelstream/connect', []);
|
||||
pyroutes.register('channelstream_proxy', '/_channelstream', []);
|
||||
pyroutes.register('channelstream_subscribe', '/_admin/channelstream/subscribe', []);
|
||||
pyroutes.register('commit_draft_comments_submit', '/%(repo_name)s/changeset/%(commit_id)s/draft_comments_submit', ['repo_name', 'commit_id']);
|
||||
pyroutes.register('debug_style_email', '/_admin/debug_style/email/%(email_id)s', ['email_id']);
|
||||
pyroutes.register('debug_style_email_plain_rendered', '/_admin/debug_style/email-rendered/%(email_id)s', ['email_id']);
|
||||
pyroutes.register('debug_style_home', '/_admin/debug_style', []);
|
||||
|
|
@ -205,6 +218,8 @@ function registerRCRoutes() {
|
|||
pyroutes.register('my_account_emails', '/_admin/my_account/emails', []);
|
||||
pyroutes.register('my_account_emails_add', '/_admin/my_account/emails/new', []);
|
||||
pyroutes.register('my_account_emails_delete', '/_admin/my_account/emails/delete', []);
|
||||
pyroutes.register('my_account_external_identity', '/_admin/my_account/external-identity', []);
|
||||
pyroutes.register('my_account_external_identity_delete', '/_admin/my_account/external-identity/delete', []);
|
||||
pyroutes.register('my_account_goto_bookmark', '/_admin/my_account/bookmark/%(bookmark_id)s', ['bookmark_id']);
|
||||
pyroutes.register('my_account_notifications', '/_admin/my_account/notifications', []);
|
||||
pyroutes.register('my_account_notifications_test_channelstream', '/_admin/my_account/test_channelstream', []);
|
||||
|
|
@ -232,6 +247,7 @@ function registerRCRoutes() {
|
|||
pyroutes.register('ops_healthcheck', '/_admin/ops/status', []);
|
||||
pyroutes.register('ops_ping', '/_admin/ops/ping', []);
|
||||
pyroutes.register('ops_redirect_test', '/_admin/ops/redirect', []);
|
||||
pyroutes.register('plugin_admin_chat', '/_admin/plugin_admin_chat/%(action)s', ['action']);
|
||||
pyroutes.register('pull_requests_global', '/_admin/pull-request/%(pull_request_id)s', ['pull_request_id']);
|
||||
pyroutes.register('pull_requests_global_0', '/_admin/pull_requests/%(pull_request_id)s', ['pull_request_id']);
|
||||
pyroutes.register('pull_requests_global_1', '/_admin/pull-requests/%(pull_request_id)s', ['pull_request_id']);
|
||||
|
|
@ -241,6 +257,7 @@ function registerRCRoutes() {
|
|||
pyroutes.register('pullrequest_comments', '/%(repo_name)s/pull-request/%(pull_request_id)s/comments', ['repo_name', 'pull_request_id']);
|
||||
pyroutes.register('pullrequest_create', '/%(repo_name)s/pull-request/create', ['repo_name']);
|
||||
pyroutes.register('pullrequest_delete', '/%(repo_name)s/pull-request/%(pull_request_id)s/delete', ['repo_name', 'pull_request_id']);
|
||||
pyroutes.register('pullrequest_draft_comments_submit', '/%(repo_name)s/pull-request/%(pull_request_id)s/draft_comments_submit', ['repo_name', 'pull_request_id']);
|
||||
pyroutes.register('pullrequest_drafts', '/%(repo_name)s/pull-request/%(pull_request_id)s/drafts', ['repo_name', 'pull_request_id']);
|
||||
pyroutes.register('pullrequest_merge', '/%(repo_name)s/pull-request/%(pull_request_id)s/merge', ['repo_name', 'pull_request_id']);
|
||||
pyroutes.register('pullrequest_new', '/%(repo_name)s/pull-request/new', ['repo_name']);
|
||||
|
|
@ -253,8 +270,18 @@ function registerRCRoutes() {
|
|||
pyroutes.register('pullrequest_update', '/%(repo_name)s/pull-request/%(pull_request_id)s/update', ['repo_name', 'pull_request_id']);
|
||||
pyroutes.register('register', '/_admin/register', []);
|
||||
pyroutes.register('repo_archivefile', '/%(repo_name)s/archive/%(fname)s', ['repo_name', 'fname']);
|
||||
pyroutes.register('repo_artifacts_data', '/%(repo_name)s/artifacts_data', ['repo_name']);
|
||||
pyroutes.register('repo_artifacts_delete', '/%(repo_name)s/artifacts/delete/%(uid)s', ['repo_name', 'uid']);
|
||||
pyroutes.register('repo_artifacts_get', '/%(repo_name)s/artifacts/download/%(uid)s', ['repo_name', 'uid']);
|
||||
pyroutes.register('repo_artifacts_info', '/%(repo_name)s/artifacts/info/%(uid)s', ['repo_name', 'uid']);
|
||||
pyroutes.register('repo_artifacts_list', '/%(repo_name)s/artifacts', ['repo_name']);
|
||||
pyroutes.register('repo_artifacts_new', '/%(repo_name)s/artifacts/new', ['repo_name']);
|
||||
pyroutes.register('repo_artifacts_store', '/%(repo_name)s/artifacts/store', ['repo_name']);
|
||||
pyroutes.register('repo_artifacts_stream_script', '/_file_store/stream-upload-script', []);
|
||||
pyroutes.register('repo_artifacts_stream_store', '/_file_store/stream-upload', []);
|
||||
pyroutes.register('repo_artifacts_update', '/%(repo_name)s/artifacts/update/%(uid)s', ['repo_name', 'uid']);
|
||||
pyroutes.register('repo_automation', '/%(repo_name)s/settings/automation', ['repo_name']);
|
||||
pyroutes.register('repo_automation_update', '/%(repo_name)s/settings/automation/%(entry_id)s/update', ['repo_name', 'entry_id']);
|
||||
pyroutes.register('repo_changelog', '/%(repo_name)s/changelog', ['repo_name']);
|
||||
pyroutes.register('repo_changelog_file', '/%(repo_name)s/changelog/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']);
|
||||
pyroutes.register('repo_commit', '/%(repo_name)s/changeset/%(commit_id)s', ['repo_name', 'commit_id']);
|
||||
|
|
@ -331,6 +358,9 @@ function registerRCRoutes() {
|
|||
pyroutes.register('repo_refs_changelog_data', '/%(repo_name)s/refs-data-changelog', ['repo_name']);
|
||||
pyroutes.register('repo_refs_data', '/%(repo_name)s/refs-data', ['repo_name']);
|
||||
pyroutes.register('repo_reviewers', '/%(repo_name)s/settings/review/rules', ['repo_name']);
|
||||
pyroutes.register('repo_reviewers_review_rule_delete', '/%(repo_name)s/settings/review/rules/%(rule_id)s/delete', ['repo_name', 'rule_id']);
|
||||
pyroutes.register('repo_reviewers_review_rule_edit', '/%(repo_name)s/settings/review/rules/%(rule_id)s', ['repo_name', 'rule_id']);
|
||||
pyroutes.register('repo_reviewers_review_rule_new', '/%(repo_name)s/settings/review/rules/new', ['repo_name']);
|
||||
pyroutes.register('repo_settings_quick_actions', '/%(repo_name)s/settings/quick-action', ['repo_name']);
|
||||
pyroutes.register('repo_stats', '/%(repo_name)s/repo_stats/%(commit_id)s', ['repo_name', 'commit_id']);
|
||||
pyroutes.register('repo_summary', '/%(repo_name)s', ['repo_name']);
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ def write_js_routes_if_enabled(event):
|
|||
('show_user', '/profile/%(username)s', ['username'])
|
||||
"""
|
||||
|
||||
routepath = route.pattern
|
||||
route_path = route.pattern
|
||||
pattern = route.pattern
|
||||
|
||||
def replace(matchobj):
|
||||
|
|
@ -280,16 +280,16 @@ def write_js_routes_if_enabled(event):
|
|||
else:
|
||||
return "%%(%s)s" % matchobj.group(2)
|
||||
|
||||
routepath = _argument_prog.sub(replace, routepath)
|
||||
route_path = _argument_prog.sub(replace, route_path)
|
||||
|
||||
if not routepath.startswith('/'):
|
||||
routepath = '/'+routepath
|
||||
if not route_path.startswith('/'):
|
||||
route_path = f'/{route_path}'
|
||||
|
||||
return (
|
||||
route.name,
|
||||
routepath,
|
||||
route_path,
|
||||
[(arg[0].split(':')[0] if arg[0] != '' else arg[1])
|
||||
for arg in _argument_prog.findall(pattern)]
|
||||
for arg in _argument_prog.findall(pattern)]
|
||||
)
|
||||
|
||||
def get_routes():
|
||||
|
|
@ -308,6 +308,7 @@ def write_js_routes_if_enabled(event):
|
|||
try:
|
||||
with open(jsroutes_file_path, 'w', encoding='utf-8') as f:
|
||||
f.write(jsroutes_file_content)
|
||||
log.debug('generated JS files in %s', jsroutes_file_path)
|
||||
except Exception:
|
||||
log.exception('Failed to write routes.js into %s', jsroutes_file_path)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue