diff --git a/web/e2e-tests/realm-linkifier.test.ts b/web/e2e-tests/realm-linkifier.test.ts index 3d11f20357..aaaf353ef4 100644 --- a/web/e2e-tests/realm-linkifier.test.ts +++ b/web/e2e-tests/realm-linkifier.test.ts @@ -26,10 +26,7 @@ async function test_add_linkifier(page: Page): Promise { "#(?P[0-9]+)", ); assert.strictEqual( - await common.get_text_from_selector( - page, - ".linkifier_row span.linkifier_url_format_string", - ), + await common.get_text_from_selector(page, ".linkifier_row span.linkifier_url_template"), "https://trac.example.com/ticket/{id}", ); } @@ -74,10 +71,7 @@ async function test_edit_linkifier(page: Page): Promise { () => document.querySelector(".linkifier_pattern")?.textContent === "(?P[0-9a-f]{40})", ); assert.strictEqual( - await common.get_text_from_selector( - page, - ".linkifier_row span.linkifier_url_format_string", - ), + await common.get_text_from_selector(page, ".linkifier_row span.linkifier_url_template"), "https://trac.example.com/commit/{num}", ); } @@ -102,13 +96,13 @@ async function test_edit_invalid_linkifier(page: Page): Promise { "Failed: Bad regular expression: bad repetition operator: ????", ); - const edit_linkifier_format_status_selector = "div#edit-linkifier-format-status"; - await page.waitForSelector(edit_linkifier_format_status_selector, {visible: true}); - const edit_linkifier_format_status = await common.get_text_from_selector( + const edit_linkifier_template_status_selector = "div#edit-linkifier-template-status"; + await page.waitForSelector(edit_linkifier_template_status_selector, {visible: true}); + const edit_linkifier_template_status = await common.get_text_from_selector( page, - edit_linkifier_format_status_selector, + edit_linkifier_template_status_selector, ); - assert.strictEqual(edit_linkifier_format_status, "Failed: Invalid URL template."); + assert.strictEqual(edit_linkifier_template_status, "Failed: Invalid URL template."); await page.click(".dialog_cancel_button"); await page.waitForSelector("#dialog_widget_modal", {hidden: true}); @@ -119,10 +113,7 @@ async function test_edit_invalid_linkifier(page: Page): Promise { "(?P[0-9a-f]{40})", ); assert.strictEqual( - await common.get_text_from_selector( - page, - ".linkifier_row span.linkifier_url_format_string", - ), + await common.get_text_from_selector(page, ".linkifier_row span.linkifier_url_template"), "https://trac.example.com/commit/{num}", ); } diff --git a/web/src/settings_linkifiers.js b/web/src/settings_linkifiers.js index 2f46d8a6e5..658c70a8fc 100644 --- a/web/src/settings_linkifiers.js +++ b/web/src/settings_linkifiers.js @@ -51,7 +51,7 @@ function open_linkifier_edit_form(linkifier_id) { const html_body = render_admin_linkifier_edit_form({ linkifier_id, pattern: linkifier.pattern, - url_format_string: linkifier.url_template, + url_template: linkifier.url_template, }); function submit_linkifier_form() { @@ -61,10 +61,10 @@ function open_linkifier_edit_form(linkifier_id) { const $modal = $("#dialog_widget_modal"); const url = "/json/realm/filters/" + encodeURIComponent(linkifier_id); const pattern = $modal.find("#edit-linkifier-pattern").val().trim(); - const url_format_string = $modal.find("#edit-linkifier-url-format-string").val().trim(); - const data = {pattern, url_format_string}; + const url_template = $modal.find("#edit-linkifier-url-template").val().trim(); + const data = {pattern, url_template}; const $pattern_status = $modal.find("#edit-linkifier-pattern-status").expectOne(); - const $format_status = $modal.find("#edit-linkifier-format-status").expectOne(); + const $template_status = $modal.find("#edit-linkifier-template-status").expectOne(); const $dialog_error_element = $modal.find("#dialog_error").expectOne(); const opts = { success_continuation() { @@ -78,7 +78,7 @@ function open_linkifier_edit_form(linkifier_id) { handle_linkifier_api_error( xhr, $pattern_status, - $format_status, + $template_status, $dialog_error_element, ); } else { @@ -109,7 +109,7 @@ function open_linkifier_edit_form(linkifier_id) { }); } -function handle_linkifier_api_error(xhr, pattern_status, format_status, linkifier_status) { +function handle_linkifier_api_error(xhr, pattern_status, template_status, linkifier_status) { // The endpoint uses the Django ValidationError system for error // handling, which returns somewhat complicated error // dictionaries. This logic parses them. @@ -120,7 +120,7 @@ function handle_linkifier_api_error(xhr, pattern_status, format_status, linkifie } if (errors.url_template !== undefined) { xhr.responseText = JSON.stringify({msg: errors.url_template}); - ui_report.error($t_html({defaultMessage: "Failed"}), xhr, format_status); + ui_report.error($t_html({defaultMessage: "Failed"}), xhr, template_status); } if (errors.__all__ !== undefined) { xhr.responseText = JSON.stringify({msg: errors.__all__}); @@ -140,7 +140,7 @@ export function populate_linkifiers(linkifiers_data) { return render_admin_linkifier_list({ linkifier: { pattern: linkifier.pattern, - url_format_string: linkifier.url_template, + url_template: linkifier.url_template, id: linkifier.id, }, can_modify: page_params.is_admin, @@ -211,12 +211,12 @@ export function build_page() { e.stopPropagation(); const $linkifier_status = $("#admin-linkifier-status"); const $pattern_status = $("#admin-linkifier-pattern-status"); - const $format_status = $("#admin-linkifier-format-status"); + const $template_status = $("#admin-linkifier-template-status"); const $add_linkifier_button = $(".new-linkifier-form button"); $add_linkifier_button.prop("disabled", true); $linkifier_status.hide(); $pattern_status.hide(); - $format_status.hide(); + $template_status.hide(); const linkifier = {}; for (const obj of $(this).serializeArray()) { @@ -228,7 +228,7 @@ export function build_page() { data: $(this).serialize(), success(data) { $("#linkifier_pattern").val(""); - $("#linkifier_format_string").val(""); + $("#linkifier_template").val(""); $add_linkifier_button.prop("disabled", false); linkifier.id = data.id; ui_report.success( @@ -241,7 +241,7 @@ export function build_page() { handle_linkifier_api_error( xhr, $pattern_status, - $format_status, + $template_status, $linkifier_status, ); }, diff --git a/web/styles/settings.css b/web/styles/settings.css index 55cf826b32..6807600dcd 100644 --- a/web/styles/settings.css +++ b/web/styles/settings.css @@ -246,7 +246,7 @@ h3, #linkifier-settings { #linkifier_pattern, - #linkifier_format_string { + #linkifier_template { width: calc(100% - 10em - 6em); } } @@ -726,7 +726,7 @@ input[type="checkbox"] { } #admin-linkifier-pattern-status, -#admin-linkifier-format-status { +#admin-linkifier-template-status { margin: 20px 0 0; } @@ -1899,7 +1899,7 @@ $option_title_width: 180px; #edit-linkifier-form { #edit-linkifier-pattern, - #edit-linkifier-url-format-string { + #edit-linkifier-url-template { width: 400px; } @@ -1908,7 +1908,7 @@ $option_title_width: 180px; } #edit-linkifier-pattern-status, - #edit-linkifier-format-status { + #edit-linkifier-template-status { margin-top: 10px; } diff --git a/web/templates/settings/admin_linkifier_edit_form.hbs b/web/templates/settings/admin_linkifier_edit_form.hbs index 18b856423a..4f09dcf952 100644 --- a/web/templates/settings/admin_linkifier_edit_form.hbs +++ b/web/templates/settings/admin_linkifier_edit_form.hbs @@ -6,9 +6,9 @@
- - -
+ + +
diff --git a/web/templates/settings/admin_linkifier_list.hbs b/web/templates/settings/admin_linkifier_list.hbs index 26aeb55a39..d8ba6d4efe 100644 --- a/web/templates/settings/admin_linkifier_list.hbs +++ b/web/templates/settings/admin_linkifier_list.hbs @@ -4,7 +4,7 @@ {{pattern}} - {{url_format_string}} + {{url_template}} {{#if ../can_modify}} diff --git a/web/templates/settings/linkifier_settings_admin.hbs b/web/templates/settings/linkifier_settings_admin.hbs index e3f17c78dc..90d46df634 100644 --- a/web/templates/settings/linkifier_settings_admin.hbs +++ b/web/templates/settings/linkifier_settings_admin.hbs @@ -44,9 +44,9 @@
- - -
+ + +