Commit 479fa989 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Submit form when change is confirmed

Manually submit the form using JS after
we confirm the visibility change.
parent 9002c838
...@@ -790,12 +790,9 @@ export default { ...@@ -790,12 +790,9 @@ export default {
button-variant="confirm" button-variant="confirm"
:disabled="false" :disabled="false"
:phrase="confirmationPhrase" :phrase="confirmationPhrase"
:confirm-danger-message="confirmDangerMessage"
:additional-information="additionalInformation"
:button-text="$options.i18n.confirmButtonText" :button-text="$options.i18n.confirmButtonText"
@confirm="$emit('confirm')" @confirm="$emit('confirm')"
/> />
<!-- confirmDangerMessage -->
<gl-button <gl-button
v-else v-else
type="submit" type="submit"
......
...@@ -7,12 +7,12 @@ export default function initProjectPermissionsSettings() { ...@@ -7,12 +7,12 @@ export default function initProjectPermissionsSettings() {
const componentProps = JSON.parse(componentPropsEl.innerHTML); const componentProps = JSON.parse(componentPropsEl.innerHTML);
const { const {
targetFormId,
additionalInformation, additionalInformation,
confirmDangerMessage, confirmDangerMessage,
confirmButtonText, confirmButtonText,
phrase: confirmationPhrase, phrase: confirmationPhrase,
} = mountPoint.dataset; } = mountPoint.dataset;
console.log('mountPoint', mountPoint.dataset);
return new Vue({ return new Vue({
el: mountPoint, el: mountPoint,
...@@ -28,6 +28,11 @@ export default function initProjectPermissionsSettings() { ...@@ -28,6 +28,11 @@ export default function initProjectPermissionsSettings() {
...componentProps, ...componentProps,
confirmationPhrase, confirmationPhrase,
}, },
on: {
confirm: () => {
if (targetFormId) document.getElementById(targetFormId)?.submit();
},
},
}), }),
}); });
} }
...@@ -672,13 +672,10 @@ module ProjectsHelper ...@@ -672,13 +672,10 @@ module ProjectsHelper
html_escape(message) % { strong_start: strong_start, strong_end: strong_end, project_name: project.name, group_name: project.group ? project.group.name : nil } html_escape(message) % { strong_start: strong_start, strong_end: strong_end, project_name: project.name, group_name: project.group ? project.group.name : nil }
end end
def visibility_confirm_modal_data(project, remove_form_id = nil) def visibility_confirm_modal_data(project, target_form_id = nil)
{ {
remove_form_id: remove_form_id, target_form_id: target_form_id,
qa_selector: 'visibility_features_permissions_save_button',
button_text: _('Save changes'),
button_testid: 'reduce-project-visibility-button', button_testid: 'reduce-project-visibility-button',
button_variant: 'confirm',
confirm_button_text: _('Reduce project visibility'), confirm_button_text: _('Reduce project visibility'),
confirm_danger_message: confirm_reduce_visibility_message(project), confirm_danger_message: confirm_reduce_visibility_message(project),
phrase: project.full_path, phrase: project.full_path,
......
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