Commit 3cece301 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Address minor review comments

parent a8aae965
...@@ -10,8 +10,8 @@ export default () => { ...@@ -10,8 +10,8 @@ export default () => {
removeFormId = null, removeFormId = null,
phrase, phrase,
buttonText, buttonText,
buttonTestid = null,
confirmDangerMessage, confirmDangerMessage,
testid = null,
disabled = false, disabled = false,
} = el.dataset; } = el.dataset;
...@@ -25,12 +25,12 @@ export default () => { ...@@ -25,12 +25,12 @@ export default () => {
props: { props: {
phrase, phrase,
buttonText, buttonText,
testid, buttonTestid,
disabled: parseBoolean(disabled), disabled: parseBoolean(disabled),
}, },
on: { on: {
confirm: () => { confirm: () => {
if (removeFormId) document.getElementById(removeFormId).submit(); if (removeFormId) document.getElementById(removeFormId)?.submit();
}, },
}, },
}), }),
......
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
testid: { buttonTestid: {
type: String, type: String,
required: false, required: false,
default: 'confirm-danger-button', default: 'confirm-danger-button',
...@@ -42,7 +42,7 @@ export default { ...@@ -42,7 +42,7 @@ export default {
class="gl-button" class="gl-button"
variant="danger" variant="danger"
:disabled="disabled" :disabled="disabled"
:data-testid="testid" :data-testid="buttonTestid"
>{{ buttonText }}</gl-button >{{ buttonText }}</gl-button
> >
<confirm-danger-modal <confirm-danger-modal
......
...@@ -5,8 +5,14 @@ module Groups ...@@ -5,8 +5,14 @@ module Groups
include GroupsHelper include GroupsHelper
def group_settings_confirm_modal_data(group, remove_form_id = nil) def group_settings_confirm_modal_data(group, remove_form_id = nil)
base_data = { remove_form_id: remove_form_id, button_text: _('Remove group'), testid: 'remove-group-button' } {
base_data.merge!({ disabled: group.paid?.to_s, confirm_danger_message: remove_group_message(group), phrase: group.full_path }) remove_form_id: remove_form_id,
button_text: _('Remove group'),
button_testid: 'remove-group-button',
disabled: group.paid?.to_s,
confirm_danger_message: remove_group_message(group),
phrase: group.full_path
}
end end
end end
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module EE::Groups module EE
module SettingsHelper module Groups
def delayed_project_removal_help_text module SettingsHelper
html_escape(delayed_project_removal_i18n_string) % { def delayed_project_removal_help_text
waiting_period: ::Gitlab::CurrentSettings.deletion_adjourned_period, html_escape(delayed_project_removal_i18n_string) % {
link_start: '<a href="%{url}">'.html_safe % { url: general_admin_application_settings_path(anchor: 'js-visibility-settings') }, waiting_period: ::Gitlab::CurrentSettings.deletion_adjourned_period,
link_end: '</a>'.html_safe link_start: '<a href="%{url}">'.html_safe % { url: general_admin_application_settings_path(anchor: 'js-visibility-settings') },
} link_end: '</a>'.html_safe
end }
end
private private
def delayed_project_removal_i18n_string def delayed_project_removal_i18n_string
if current_user&.can_admin_all_resources? if current_user&.can_admin_all_resources?
s_('GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay. This delay can be %{link_start}customized by an admin%{link_end} in instance settings. Inherited by subgroups.') s_('GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay. This delay can be %{link_start}customized by an admin%{link_end} in instance settings. Inherited by subgroups.')
else else
s_('GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay. Inherited by subgroups.') s_('GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay. Inherited by subgroups.')
end
end end
end end
end end
......
...@@ -29,7 +29,7 @@ RSpec.describe Groups::SettingsHelper do ...@@ -29,7 +29,7 @@ RSpec.describe Groups::SettingsHelper do
confirm_danger_message: remove_group_message(group), confirm_danger_message: remove_group_message(group),
remove_form_id: form_value_id, remove_form_id: form_value_id,
phrase: group.full_path, phrase: group.full_path,
testid: "remove-group-button", button_testid: "remove-group-button",
disabled: is_button_disabled disabled: is_button_disabled
}) })
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment