From de2bda2ab67b29a71f1648e2afc0f12410ef8a71 Mon Sep 17 00:00:00 2001 From: Mathieu Suen Date: Mon, 29 Apr 2024 11:20:23 +0200 Subject: [PATCH] SONAR-20440 Update new code definition documentation links --- .../project/components/NewCodeDefinitionSelection.tsx | 6 +++++- .../main/js/apps/projectNewCode/components/AppHeader.tsx | 2 +- .../main/js/apps/settings/components/NewCodeDefinition.tsx | 2 +- .../components/embed-docs-modal/EmbedDocsSuggestions.json | 2 +- .../NewCodeDefinitionAnalysisWarning.tsx | 4 +++- .../org/sonar/server/newcodeperiod/ws/ListActionIT.java | 4 ++-- .../java/org/sonar/server/newcodeperiod/ws/SetActionIT.java | 4 ++-- .../org/sonar/server/newcodeperiod/ws/ShowActionIT.java | 4 ++-- .../org/sonar/server/newcodeperiod/ws/UnsetActionIT.java | 4 ++-- .../java/org/sonar/server/newcodeperiod/ws/ListAction.java | 2 +- .../org/sonar/server/newcodeperiod/ws/NewCodePeriodsWs.java | 2 +- .../java/org/sonar/server/newcodeperiod/ws/SetAction.java | 2 +- .../java/org/sonar/server/newcodeperiod/ws/ShowAction.java | 2 +- .../java/org/sonar/server/newcodeperiod/ws/UnsetAction.java | 2 +- 14 files changed, 24 insertions(+), 18 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/create/project/components/NewCodeDefinitionSelection.tsx b/server/sonar-web/src/main/js/apps/create/project/components/NewCodeDefinitionSelection.tsx index 30acdce33c6..12389b26b7c 100644 --- a/server/sonar-web/src/main/js/apps/create/project/components/NewCodeDefinitionSelection.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/components/NewCodeDefinitionSelection.tsx @@ -215,7 +215,11 @@ export default function NewCodeDefinitionSelection(props: Props) { id="onboarding.create_project.new_code_definition.description" values={{ link: ( - + {translate('onboarding.create_project.new_code_definition.description.link')} ), diff --git a/server/sonar-web/src/main/js/apps/projectNewCode/components/AppHeader.tsx b/server/sonar-web/src/main/js/apps/projectNewCode/components/AppHeader.tsx index 3155d4dc496..c8be13dc973 100644 --- a/server/sonar-web/src/main/js/apps/projectNewCode/components/AppHeader.tsx +++ b/server/sonar-web/src/main/js/apps/projectNewCode/components/AppHeader.tsx @@ -29,7 +29,7 @@ export interface AppHeaderProps { export default function AppHeader(props: AppHeaderProps) { const { canAdmin } = props; - const toUrl = useDocUrl('/project-administration/defining-new-code/'); + const toUrl = useDocUrl('/project-administration/clean-as-you-code-settings/defining-new-code/'); return (
diff --git a/server/sonar-web/src/main/js/apps/settings/components/NewCodeDefinition.tsx b/server/sonar-web/src/main/js/apps/settings/components/NewCodeDefinition.tsx index 6ee818fdb16..77f8b8ef96e 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/NewCodeDefinition.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/NewCodeDefinition.tsx @@ -102,7 +102,7 @@ export default function NewCodeDefinition() { id="settings.new_code_period.description3" values={{ link: ( - + {translate('settings.new_code_period.description3.link')} ), diff --git a/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsSuggestions.json b/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsSuggestions.json index 08d459b14ae..8901c50403c 100644 --- a/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsSuggestions.json +++ b/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsSuggestions.json @@ -55,7 +55,7 @@ "project_activity": [], "project_baseline": [ { - "link": "/project-administration/defining-new-code/", + "link": "/project-administration/clean-as-you-code-settings/defining-new-code/", "text": "Defining New Code" } ], diff --git a/server/sonar-web/src/main/js/components/new-code-definition/NewCodeDefinitionAnalysisWarning.tsx b/server/sonar-web/src/main/js/components/new-code-definition/NewCodeDefinitionAnalysisWarning.tsx index 71d95cda23d..95fe198617c 100644 --- a/server/sonar-web/src/main/js/components/new-code-definition/NewCodeDefinitionAnalysisWarning.tsx +++ b/server/sonar-web/src/main/js/components/new-code-definition/NewCodeDefinitionAnalysisWarning.tsx @@ -23,7 +23,9 @@ import { useDocUrl } from '../../helpers/docs'; import { translate } from '../../helpers/l10n'; export default function NewCodeDefinitionAnalysisWarning() { - const toStatic = useDocUrl('/project-administration/defining-new-code/'); + const toStatic = useDocUrl( + '/project-administration/clean-as-you-code-settings/defining-new-code/', + ); return (
diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/ListActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/ListActionIT.java index 4c31cfccde4..8e0dd56f64f 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/ListActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/ListActionIT.java @@ -74,7 +74,7 @@ public class ListActionIT { @Before public void setup() { - when(documentationLinkGenerator.getDocumentationLink(any())).thenReturn("https://docs.sonarsource.com/sonarqube/9.9/project-administration/defining-new-code/"); + when(documentationLinkGenerator.getDocumentationLink(any())).thenReturn("https://docs.sonarsource.com/someddoc"); ws = new WsActionTester(new ListAction(dbClient, userSession, componentFinder, dao, documentationLinkGenerator)); } @@ -83,7 +83,7 @@ public class ListActionIT { WebService.Action definition = ws.getDef(); - assertThat(definition.description()).contains("https://docs.sonarsource.com/sonarqube/9.9/project-administration/defining-new-code/"); + assertThat(definition.description()).contains("https://docs.sonarsource.com/someddoc"); assertThat(definition.key()).isEqualTo("list"); assertThat(definition.isInternal()).isFalse(); diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/SetActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/SetActionIT.java index 26638d9e966..e65d4c42860 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/SetActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/SetActionIT.java @@ -79,7 +79,7 @@ public class SetActionIT { @Before public void setup() { - when(documentationLinkGenerator.getDocumentationLink(any())).thenReturn("https://docs.sonarsource.com/sonarqube/9.9/project-administration/defining-new-code/"); + when(documentationLinkGenerator.getDocumentationLink(any())).thenReturn("https://docs.sonarsource.com/someddoc"); ws = new WsActionTester(new SetAction(dbClient, userSession, componentFinder, editionProvider, dao, documentationLinkGenerator)); } @@ -87,7 +87,7 @@ public class SetActionIT { public void test_definition() { WebService.Action definition = ws.getDef(); - assertThat(definition.description()).contains("https://docs.sonarsource.com/sonarqube/9.9/project-administration/defining-new-code/"); + assertThat(definition.description()).contains("https://docs.sonarsource.com/someddoc"); assertThat(definition.key()).isEqualTo("set"); assertThat(definition.isInternal()).isFalse(); diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/ShowActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/ShowActionIT.java index 34372cf07d4..6d82f5fa472 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/ShowActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/ShowActionIT.java @@ -65,7 +65,7 @@ public class ShowActionIT { @Before public void setup() { - when(documentationLinkGenerator.getDocumentationLink(any())).thenReturn("https://docs.sonarsource.com/sonarqube/latest/project-administration/defining-new-code/"); + when(documentationLinkGenerator.getDocumentationLink(any())).thenReturn("https://docs.sonarsource.com/someddoc"); ws = new WsActionTester(new ShowAction(dbClient, userSession, componentFinder, dao, documentationLinkGenerator)); } @@ -73,7 +73,7 @@ public class ShowActionIT { public void test_definition() { WebService.Action definition = ws.getDef(); - assertThat(definition.description()).contains("https://docs.sonarsource.com/sonarqube/latest/project-administration/defining-new-code/"); + assertThat(definition.description()).contains("https://docs.sonarsource.com/someddoc"); assertThat(definition.key()).isEqualTo("show"); assertThat(definition.isInternal()).isFalse(); diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/UnsetActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/UnsetActionIT.java index 60e87abf95b..bb7a5a75581 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/UnsetActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/UnsetActionIT.java @@ -69,7 +69,7 @@ public class UnsetActionIT { @Before public void setup(){ - when(documentationLinkGenerator.getDocumentationLink(any())).thenReturn("https://docs.sonarsource.com/sonarqube/9.9/project-administration/defining-new-code/"); + when(documentationLinkGenerator.getDocumentationLink(any())).thenReturn("https://docs.sonarsource.com/someddoc"); ws = new WsActionTester(new UnsetAction(dbClient, userSession, componentFinder, editionProvider, dao, documentationLinkGenerator)); } @@ -77,7 +77,7 @@ public class UnsetActionIT { public void test_definition() { WebService.Action definition = ws.getDef(); - assertThat(definition.description()).contains("https://docs.sonarsource.com/sonarqube/9.9/project-administration/defining-new-code/"); + assertThat(definition.description()).contains("https://docs.sonarsource.com/someddoc"); assertThat(definition.key()).isEqualTo("unset"); assertThat(definition.isInternal()).isFalse(); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/ListAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/ListAction.java index f6331320b5e..f67401985b1 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/ListAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/ListAction.java @@ -66,7 +66,7 @@ public class ListAction implements NewCodePeriodsWsAction { this.userSession = userSession; this.componentFinder = componentFinder; this.newCodePeriodDao = newCodePeriodDao; - this.newCodeDefinitionDocumentationUrl = documentationLinkGenerator.getDocumentationLink("/project-administration/defining-new-code/"); + this.newCodeDefinitionDocumentationUrl = documentationLinkGenerator.getDocumentationLink("/project-administration/clean-as-you-code-settings/defining-new-code/"); } @Override diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/NewCodePeriodsWs.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/NewCodePeriodsWs.java index 4661ad02ca5..7177add0739 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/NewCodePeriodsWs.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/NewCodePeriodsWs.java @@ -37,7 +37,7 @@ public class NewCodePeriodsWs implements WebService { @Override public void define(Context context) { NewController controller = context.createController("api/new_code_periods") - .setDescription("Manage "+ createHtmlExternalLink(documentationLinkGenerator.getDocumentationLink("/project-administration/defining-new-code/"), "new code definition") +".") + .setDescription("Manage "+ createHtmlExternalLink(documentationLinkGenerator.getDocumentationLink("/project-administration/clean-as-you-code-settings/defining-new-code/"), "new code definition") +".") .setSince("8.0"); for (NewCodePeriodsWsAction action : actions) { action.define(controller); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/SetAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/SetAction.java index dc5a067e5ba..8049446577b 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/SetAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/SetAction.java @@ -82,7 +82,7 @@ public class SetAction implements NewCodePeriodsWsAction { this.componentFinder = componentFinder; this.editionProvider = editionProvider; this.newCodePeriodDao = newCodePeriodDao; - this.newCodeDefinitionDocumentationUrl = documentationLinkGenerator.getDocumentationLink("/project-administration/defining-new-code/"); + this.newCodeDefinitionDocumentationUrl = documentationLinkGenerator.getDocumentationLink("/project-administration/clean-as-you-code-settings/defining-new-code/"); } @Override diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/ShowAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/ShowAction.java index db6d3ee447f..f21c938194e 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/ShowAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/ShowAction.java @@ -61,7 +61,7 @@ public class ShowAction implements NewCodePeriodsWsAction { this.userSession = userSession; this.componentFinder = componentFinder; this.newCodePeriodDao = newCodePeriodDao; - this.newCodeDefinitionDocumentationUrl = documentationLinkGenerator.getDocumentationLink("/project-administration/defining-new-code/"); + this.newCodeDefinitionDocumentationUrl = documentationLinkGenerator.getDocumentationLink("/project-administration/clean-as-you-code-settings/defining-new-code/"); } @Override diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/UnsetAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/UnsetAction.java index b656e4c2e23..73f1e82396d 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/UnsetAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/newcodeperiod/ws/UnsetAction.java @@ -61,7 +61,7 @@ public class UnsetAction implements NewCodePeriodsWsAction { this.componentFinder = componentFinder; this.editionProvider = editionProvider; this.newCodePeriodDao = newCodePeriodDao; - this.newCodeDefinitionDocumentationUrl = documentationLinkGenerator.getDocumentationLink("/project-administration/defining-new-code/"); + this.newCodeDefinitionDocumentationUrl = documentationLinkGenerator.getDocumentationLink("/project-administration/clean-as-you-code-settings/defining-new-code/"); } @Override -- 2.39.5