Commit c731e76a authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'fix-jira-connect-jquery-code' into 'master'

Resolve "Cannot remove namespace"

See merge request gitlab-org/gitlab!48973
parents 316359ae 4671763a
...@@ -10,19 +10,20 @@ const initJiraFormHandlers = () => { ...@@ -10,19 +10,20 @@ const initJiraFormHandlers = () => {
AP.navigator.reload(); AP.navigator.reload();
}; };
const reqFailed = res => { const reqFailed = (res, fallbackErrorMessage) => {
const { responseJSON: { error } = {} } = res || {};
// eslint-disable-next-line no-alert // eslint-disable-next-line no-alert
alert(res.responseJSON.error); alert(error || fallbackErrorMessage);
}; };
AP.getLocation(location => { AP.getLocation(location => {
$('.js-jira-connect-sign-in').each(() => { $('.js-jira-connect-sign-in').each(function updateSignInLink() {
const updatedLink = `${$(this).attr('href')}?return_to=${location}`; const updatedLink = `${$(this).attr('href')}?return_to=${location}`;
$(this).attr('href', updatedLink); $(this).attr('href', updatedLink);
}); });
}); });
$('#add-subscription-form').on('submit', e => { $('#add-subscription-form').on('submit', function onAddSubscriptionForm(e) {
const actionUrl = $(this).attr('action'); const actionUrl = $(this).attr('action');
e.preventDefault(); e.preventDefault();
...@@ -34,11 +35,11 @@ const initJiraFormHandlers = () => { ...@@ -34,11 +35,11 @@ const initJiraFormHandlers = () => {
format: 'json', format: 'json',
}) })
.done(reqComplete) .done(reqComplete)
.fail(reqFailed); .fail(err => reqFailed(err, 'Failed to add namespace. Please try again.'));
}); });
}); });
$('.remove-subscription').on('click', e => { $('.remove-subscription').on('click', function onRemoveSubscriptionClick(e) {
const href = $(this).attr('href'); const href = $(this).attr('href');
e.preventDefault(); e.preventDefault();
...@@ -53,7 +54,7 @@ const initJiraFormHandlers = () => { ...@@ -53,7 +54,7 @@ const initJiraFormHandlers = () => {
}, },
}) })
.done(reqComplete) .done(reqComplete)
.fail(reqFailed); .fail(err => reqFailed(err, 'Failed to remove namespace. Please try again.'));
}); });
}); });
}; };
......
---
title: Resolve Cannot remove namespace
merge_request: 48973
author:
type: fixed
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