]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10711 Add pagination object to api/qualityprofile/projects webservice
authorPascal Mugnier <pascal.mugnier@sonarsource.com>
Mon, 28 May 2018 09:55:56 +0000 (11:55 +0200)
committerSonarTech <sonartech@sonarsource.com>
Tue, 29 May 2018 18:20:47 +0000 (20:20 +0200)
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProjectsAction.java
server/sonar-server/src/main/resources/org/sonar/server/qualityprofile/ws/projects-example.json
server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx

index fb118ff5bff784d780b15409423828ca0c400491..0ddac92ca875746ef844f26c19b0eb2d1db32d28 100644 (file)
@@ -69,6 +69,7 @@ public class ProjectsAction implements QProfileWsAction {
       .setResponseExample(getClass().getResource("projects-example.json"));
 
     action.setChangelog(
+      new Change("7.2", "'more' response field is deprecated"),
       new Change("6.5", "'id' response field is deprecated"),
       new Change("6.0", "'uuid' response field is deprecated and replaced by 'id'"),
       new Change("6.0", "'key' response field has been added to return the project key"));
@@ -160,6 +161,12 @@ public class ProjectsAction implements QProfileWsAction {
         .endObject();
     }
     json.endArray();
+    json.name("paging").beginObject()
+      .prop("pageIndex", paging.pageIndex())
+      .prop("pageSize", paging.pageSize())
+      .prop("total", paging.total())
+      .endObject();
+    // more is deprecated since 7.2
     json.prop("more", paging.hasNextPage());
     json.endObject();
     json.close();
index 8da87945f8417d1bf948a0f44a93d7f85e44aaa6..d1993655b5773f9e71a38529f80fa39f39d64b25 100644 (file)
@@ -1,4 +1,9 @@
 {
+  "paging": {
+    "pageIndex": 1,
+    "pageSize": 100,
+    "total": 4
+  },
   "results": [
     {
       "id": "5eab015a-1f76-4ba4-bd89-bf547132d673",
@@ -24,6 +29,5 @@
       "name": "SonarQube Android Plugin",
       "selected": false
     }
-  ],
-  "more": false
+  ]
 }
index b73f69f04fcf06feaffd84e35d634acbd8efada8..29a1c9617dab8dd49a954bfab37218d12cae32c9 100644 (file)
@@ -55,7 +55,7 @@ export default class ProfileProjects extends React.PureComponent<Props, State> {
 
   componentDidUpdate(prevProps: Props) {
     if (prevProps.profile !== this.props.profile) {
-      this.loadProjects();
+      this.setState({ projects: null, page: 1 }, this.loadProjects);
     }
   }