Skip to content

Commit 90f79f6

Browse files
Hartesicsonartech
authored andcommitted
SONAR-25926 Add Jira organization binding to SQS administration menu
GitOrigin-RevId: 77da2c8b0e777a75a10eef173d730c5e1b0c2fa3
1 parent 0d925bf commit 90f79f6

File tree

7 files changed

+104
-3
lines changed

7 files changed

+104
-3
lines changed

apps/sq-server/src/main/js/apps/settings/components/AdditionalCategories.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
AUTHENTICATION_CATEGORY,
3434
EARLY_ACCESS_FEATURES_CATEGORY,
3535
EMAIL_NOTIFICATION_CATEGORY,
36+
JIRA_INSTANCE_BINDING_CATEGORY,
3637
JIRA_PROJECT_BINDING_CATEGORY,
3738
LANGUAGES_CATEGORY,
3839
MODE_CATEGORY,
@@ -176,6 +177,15 @@ export const ADDITIONAL_CATEGORIES: AdditionalCategory[] = [
176177
availableForProject: false,
177178
displayTab: true,
178179
},
180+
{
181+
key: JIRA_INSTANCE_BINDING_CATEGORY,
182+
name: translate('project_settings.category.jira_binding'),
183+
renderComponent: getInstanceJiraBindingComponent,
184+
availableGlobally: true,
185+
availableForProject: false,
186+
displayTab: true,
187+
requiredFeatures: [Feature.JiraIntegration],
188+
},
179189
{
180190
key: JIRA_PROJECT_BINDING_CATEGORY,
181191
name: translate('project_settings.category.jira_binding'),
@@ -231,6 +241,14 @@ function getEarlyAccessFeaturesComponent() {
231241
return <EarlyAccessFeatures />;
232242
}
233243

244+
function getInstanceJiraBindingComponent() {
245+
if (addons.jira === undefined) {
246+
return null;
247+
}
248+
249+
return <addons.jira.InstanceJiraBinding />;
250+
}
251+
234252
function getProjectJiraBindingComponent({ component }: AdditionalCategoryComponentProps) {
235253
if (addons.jira === undefined || component === undefined) {
236254
return null;

apps/sq-server/src/main/js/apps/settings/constants.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const PULL_REQUEST_DECORATION_BINDING_CATEGORY = 'pull_request_decoration
3737
export const EMAIL_NOTIFICATION_CATEGORY = 'email_notification';
3838
export const MODE_CATEGORY = 'mode';
3939
export const EARLY_ACCESS_FEATURES_CATEGORY = 'early_access_features';
40+
export const JIRA_INSTANCE_BINDING_CATEGORY = 'jira_instance_binding';
4041
export const JIRA_PROJECT_BINDING_CATEGORY = 'jira_project_binding';
4142

4243
export const CATEGORY_OVERRIDES: Record<string, string> = {

libs/shared/src/helpers/urls.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,7 @@ export function getDeprecatedActiveRulesUrl(
6969
export function getProjectOverviewUrl(projectKey: string): Partial<Path> {
7070
return { pathname: PROJECT_BASE_URL, search: queryToSearchString({ id: projectKey }) };
7171
}
72+
73+
export function getCallbackUrl(): string {
74+
return `${getHostUrl()}/callback`;
75+
}

libs/sq-server-commons/src/l10n/default.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export const defaultMessages = {
6464
calendar: 'Calendar',
6565
cancel: 'Cancel',
6666
category: 'Category',
67+
connect: 'Connect',
6768
attribute: 'Attribute',
6869
see_changelog: 'See Changelog',
6970
changelog: 'Changelog',
@@ -302,6 +303,7 @@ export const defaultMessages = {
302303
unit_tests: 'Unit tests',
303304
unknown: 'Unknown',
304305
unresolved: 'Unresolved',
306+
update: 'Update',
305307
updated: 'Updated',
306308
updated_: 'updated',
307309
updated_on: 'Updated on',
@@ -8773,6 +8775,58 @@ export const defaultMessages = {
87738775
// ----------------------------------------------------------------------------
87748776

87758777
'jira_binding.server_error': 'Internal server error. Please try again later.',
8778+
8779+
'organization.jira.binding.header': 'Jira',
8780+
'organization.jira.binding.badge.connected': 'Connected',
8781+
'organization.jira.binding.badge.not_connected': 'Not Connected',
8782+
'organization.jira.binding.instance_details_title': 'Jira instance details',
8783+
'organization.jira.binding.not_connected.intro':
8784+
'<p>Setup and connect to your Jira application to push issues into Jira as work items. You will need to provide a Client ID and Secret to connect. To obtain them, <setupGuideDocLink>follow our setup guide</setupGuideDocLink></p>',
8785+
'organization.jira.binding.connected.intro':
8786+
"<p>To push issues, ensure you've <projectBindingDocLink>connected your projects</projectBindingDocLink> in your project settings.</p><p>If reauthorizing, always ensure you select the same instance in the app page to avoid potential errors. If an error occurs, please read and follow our <troubleshootingDocLink>troubleshooting steps.</troubleshootingDocLink></p>",
8787+
'organization.jira.binding.connected.callout.title':
8788+
'Almost done! Connect your projects to begin pushing issues',
8789+
'organization.jira.binding.connected.callout.text':
8790+
'Go to Administration > General settings > Jira, in the project you want to push issues from.',
8791+
'organization.jira.binding.connected.callout.documentation_link_text':
8792+
'How to connect projects to Jira',
8793+
'organization.jira.binding.connected.reauthorize': 'Reauthorize',
8794+
'organization.jira.binding.bind_success':
8795+
"You've successfully connected your Jira instance to this SonarQube Server instance",
8796+
'organization.jira.binding.unbind_success': "You've successfully deleted your Jira connection",
8797+
'organization.jira.binding.connected_by_on_label': 'Connected by: ',
8798+
'organization.jira.binding.connected_by_on_value': '{createdBy} on {createdAt}',
8799+
'organization.jira.binding.app_configuration.title': 'Client ID and Secret',
8800+
'organization.jira.binding.app_configuration.helper_intro':
8801+
'Follow the steps in our guide to <link>edit your Client ID and Secret</link>',
8802+
'organization.jira.binding.app_configuration.callback_url.label': 'Callback URL',
8803+
'organization.jira.binding.app_configuration.callback_url.copy': 'Copy callback URL to clipboard',
8804+
'organization.jira.binding.app_configuration.client_id.label': 'Client ID',
8805+
'organization.jira.binding.app_configuration.client_id.value':
8806+
'<label>Client ID:</label> {clientId}',
8807+
'organization.jira.binding.app_configuration.client_secret.label': 'Secret',
8808+
'organization.jira.binding.app_configuration.client_secret.value':
8809+
'<label>Secret:</label> <value>hidden for security</value>',
8810+
'organization.jira.binding.app_configuration.submit_note':
8811+
'Updating will redirect you to Atlassian to confirm your workspace.',
8812+
'organization.jira.binding.modal.confirmation.description':
8813+
"You've previously authorised multiple Jira instances to this SonarQube Server instance. Please confirm the Jira instance that you want to connect to:",
8814+
'organization.jira.binding.modal.confirmation.title': 'Confirm your Jira instance',
8815+
'organization.jira.binding.disconnect.modal.title':
8816+
'Delete Jira connection for this SonarQube instance?',
8817+
'organization.jira.binding.disconnect.modal.description.line1':
8818+
"<p>This action deletes all data (except Client ID & Secret) on SonarQube Server.</p><p>Revoke token permissions on Atlassian's connected apps page to completely delete the connection.</p>",
8819+
'organization.jira.binding.disconnect.modal.description.line2': 'By deleting, you will:',
8820+
'organization.jira.binding.disconnect.modal.description.bullet1':
8821+
'Lose access to all Jira features in this SonarQube Server instance',
8822+
'organization.jira.binding.disconnect.modal.description.bullet2':
8823+
"Delete this instance's project ↔ Jira project connections",
8824+
'organization.jira.binding.disconnect.modal.description.bullet3':
8825+
'Disconnect all SonarQube Server issues from Jira work items',
8826+
'organization.jira.binding.disconnect.modal.description.warning':
8827+
'You will not be able to restore or relink connections or issues even if you reconnect to the same Jira instance in the future',
8828+
'organization.jira.binding.disconnect.modal.link': 'Atlassian connected apps page',
8829+
87768830
'project_settings.category.jira_binding': 'Jira',
87778831
'project_settings.jira_binding.header': 'Jira',
87788832
'project_settings.jira_binding.bound': 'Connected',

libs/sq-server-commons/src/sq-server-adapters/helpers/__tests__/state-callback-handler-test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ describe('getStateCallbackRedirectTo', () => {
4848

4949
const navigation = getStateCallbackRedirectTo(new URLSearchParams(searchParams));
5050

51-
expect(navigation.pathname).toEqual(getGlobalSettingsUrl('jira').pathname);
51+
expect(navigation.pathname).toEqual(getGlobalSettingsUrl('jira_instance_binding').pathname);
5252
const navigationSearchParams = new URLSearchParams(navigation.search);
53-
expect(navigationSearchParams.get('category')).toEqual('jira');
53+
expect(navigationSearchParams.get('category')).toEqual('jira_instance_binding');
5454
expect(navigationSearchParams.get('state')).toEqual(stateObject);
5555
expect(navigationSearchParams.get('code')).toEqual('42');
5656
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* SonarQube
3+
* Copyright (C) 2009-2025 SonarSource Sàrl
4+
* mailto:info AT sonarsource DOT com
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 3 of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*/
20+
21+
export const SDLC_DATA_API_BASE_PATH = '';

libs/sq-server-commons/src/sq-server-adapters/helpers/state-callback-handler.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ export function getStateCallbackRedirectTo(searchParams: URLSearchParams): Parti
3535

3636
switch (stateObj.app) {
3737
case CallbackStateApp.Jira: {
38-
return getGlobalSettingsUrl('jira', Object.fromEntries(searchParams.entries()));
38+
return getGlobalSettingsUrl(
39+
'jira_instance_binding',
40+
Object.fromEntries(searchParams.entries()),
41+
);
3942
}
4043
default: {
4144
return { pathname: getBaseUrl() };

0 commit comments

Comments
 (0)