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

Address minor review comments

parent a8aae965
......@@ -10,8 +10,8 @@ export default () => {
removeFormId = null,
phrase,
buttonText,
buttonTestid = null,
confirmDangerMessage,
testid = null,
disabled = false,
} = el.dataset;
......@@ -25,12 +25,12 @@ export default () => {
props: {
phrase,
buttonText,
testid,
buttonTestid,
disabled: parseBoolean(disabled),
},
on: {
confirm: () => {
if (removeFormId) document.getElementById(removeFormId).submit();
if (removeFormId) document.getElementById(removeFormId)?.submit();
},
},
}),
......
......@@ -26,7 +26,7 @@ export default {
type: String,
required: true,
},
testid: {
buttonTestid: {
type: String,
required: false,
default: 'confirm-danger-button',
......@@ -42,7 +42,7 @@ export default {
class="gl-button"
variant="danger"
:disabled="disabled"
:data-testid="testid"
:data-testid="buttonTestid"
>{{ buttonText }}</gl-button
>
<confirm-danger-modal
......
......@@ -5,8 +5,14 @@ module Groups
include GroupsHelper
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
......
# frozen_string_literal: true
module EE::Groups
module SettingsHelper
def delayed_project_removal_help_text
html_escape(delayed_project_removal_i18n_string) % {
waiting_period: ::Gitlab::CurrentSettings.deletion_adjourned_period,
link_start: '<a href="%{url}">'.html_safe % { url: general_admin_application_settings_path(anchor: 'js-visibility-settings') },
link_end: '</a>'.html_safe
}
end
module EE
module Groups
module SettingsHelper
def delayed_project_removal_help_text
html_escape(delayed_project_removal_i18n_string) % {
waiting_period: ::Gitlab::CurrentSettings.deletion_adjourned_period,
link_start: '<a href="%{url}">'.html_safe % { url: general_admin_application_settings_path(anchor: 'js-visibility-settings') },
link_end: '</a>'.html_safe
}
end
private
private
def delayed_project_removal_i18n_string
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.')
else
s_('GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay. Inherited by subgroups.')
def delayed_project_removal_i18n_string
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.')
else
s_('GroupSettings|Projects will be permanently deleted after a %{waiting_period}-day delay. Inherited by subgroups.')
end
end
end
end
......
......@@ -29,7 +29,7 @@ RSpec.describe Groups::SettingsHelper do
confirm_danger_message: remove_group_message(group),
remove_form_id: form_value_id,
phrase: group.full_path,
testid: "remove-group-button",
button_testid: "remove-group-button",
disabled: is_button_disabled
})
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