]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8552 WS api/navigation/settings returns the id instead of the url
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 20 Dec 2016 13:39:45 +0000 (14:39 +0100)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 20 Dec 2016 15:18:02 +0000 (16:18 +0100)
server/sonar-server/src/main/java/org/sonar/server/ui/ws/SettingsNavigationAction.java
server/sonar-server/src/test/java/org/sonar/server/ui/ws/SettingsNavigationActionTest.java
server/sonar-server/src/test/resources/org/sonar/server/ui/ws/SettingsNavigationActionTest/with_views.json

index 2503ed1c7534004864f171361f53f00a49d1c511..2e58109f484f7809060f8f6c2d0a003c8b99b38b 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.sonar.server.ui.ws;
 
+import java.util.Locale;
 import org.sonar.api.config.Settings;
 import org.sonar.api.i18n.I18n;
 import org.sonar.api.server.ws.Request;
@@ -73,8 +74,8 @@ public class SettingsNavigationAction implements NavigationWsAction {
     if (isAdmin) {
       for (ViewProxy<Page> page : views.getPages(NavigationSection.CONFIGURATION, null, null, null)) {
         json.beginObject()
-          .prop("name", i18n.message(userSession.locale(), String.format("%s.page", page.getTitle()), page.getTitle()))
-          .prop("url", getPageUrl(page))
+          .prop("id", page.getId())
+          .prop("name", i18n.message(Locale.ENGLISH, String.format("%s.page", page.getTitle()), page.getTitle()))
           .endObject();
       }
     }
@@ -82,8 +83,4 @@ public class SettingsNavigationAction implements NavigationWsAction {
 
     json.endObject().close();
   }
-
-  private static String getPageUrl(ViewProxy<Page> page) {
-    return page.isController() ? page.getId() : String.format("/plugins/configuration/%s", page.getId());
-  }
 }
index 3780956d13338c7e4465c1aed464940a25e1076d..d3d671be0557a6d4e8ab4e7ba5c7db02c5b69098 100644 (file)
@@ -130,7 +130,7 @@ public class SettingsNavigationActionTest {
 
       @Override
       public String getId() {
-        return "/second/page";
+        return "second_page";
       }
     }
 
index ae56996ba201f982ab199807d879d5ba6289139b..44d4bd3af977b4c3e736d19b57698ba0620c8b26 100644 (file)
@@ -3,12 +3,12 @@
   "showProvisioning": false,
   "extensions": [
     {
-      "name": "First Page",
-      "url": "/plugins/configuration/first_page"
+      "id": "first_page",
+      "name": "First Page"
     },
     {
-      "name": "Second Page",
-      "url": "/second/page"
+      "id": "second_page",
+      "name": "Second Page"
     }
   ]
 }