]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-19974 - Update hotspot search api payload
authorKevin Silva <kevin.silva@sonarsource.com>
Wed, 6 Dec 2023 13:50:11 +0000 (14:50 +0100)
committersonartech <sonartech@sonarsource.com>
Thu, 7 Dec 2023 20:02:52 +0000 (20:02 +0000)
server/sonar-web/src/main/js/api/mocks/SecurityHotspotServiceMock.ts
server/sonar-web/src/main/js/api/security-hotspots.ts
server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx
server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx

index a71f7271513b2f7d3fc511f44e75389aafd0c895..707278963090d0dd685f8abbb0746404b7816bc4 100644 (file)
@@ -134,7 +134,7 @@ export default class SecurityHotspotServiceMock {
   handleGetSecurityHotspotList = (
     hotspotKeys: string[],
     data: {
-      projectKey: string;
+      project: string;
       branch?: string;
     },
   ) => {
@@ -190,7 +190,7 @@ export default class SecurityHotspotServiceMock {
   };
 
   handleGetSecurityHotspots = (data: {
-    projectKey: string;
+    project: string;
     p: number;
     ps: number;
     status?: HotspotStatus;
index 5b481b8460d84cd4f5c2fe5d952cbe4f2e55fdb5..635d6f00b7556de830a53b5ba34935be9e14567e 100644 (file)
@@ -75,30 +75,28 @@ export function getSecurityHotspots(
     inNewCodePeriod?: boolean;
     onlyMine?: boolean;
     p: number;
-    projectKey: string;
+    project: string;
     ps: number;
     resolution?: HotspotResolution;
     status?: HotspotStatus;
   } & BranchParameters,
   projectIsIndexing = false,
 ): Promise<HotspotSearchResponse> {
-  return getJSON(
-    projectIsIndexing ? HOTSPOTS_LIST_URL : HOTSPOTS_SEARCH_URL,
-    projectIsIndexing ? { ...data, project: data.projectKey } : data,
-  ).catch(throwGlobalError);
+  return getJSON(projectIsIndexing ? HOTSPOTS_LIST_URL : HOTSPOTS_SEARCH_URL, data).catch(
+    throwGlobalError,
+  );
 }
 
 export function getSecurityHotspotList(
   hotspotKeys: string[],
   data: {
-    projectKey: string;
+    project: string;
   } & BranchParameters,
   projectIsIndexing = false,
 ): Promise<HotspotSearchResponse> {
   return getJSON(projectIsIndexing ? HOTSPOTS_LIST_URL : HOTSPOTS_SEARCH_URL, {
     ...data,
     hotspots: hotspotKeys.join(),
-    ...(projectIsIndexing ? { project: data.projectKey } : {}),
   }).catch(throwGlobalError);
 }
 
index 52484985071dbe5df41f65df9043193764d1488d..ceee5a273e1a48627372d00aeb963179eaff471e 100644 (file)
@@ -366,7 +366,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
         ...hotspotFilters,
         inNewCodePeriod: filters.inNewCodePeriod && Boolean(filterByFile), // only add new code period when filtering by file
         p: page,
-        projectKey: component.key,
+        project: component.key,
         ps: PAGE_SIZE,
         status: HotspotStatus.TO_REVIEW, // we're only interested in unresolved hotspots
         ...getBranchLikeQuery(branchLike),
@@ -401,7 +401,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
       return getSecurityHotspotList(
         hotspotKeys,
         {
-          projectKey: component.key,
+          project: component.key,
           ...getBranchLikeQuery(branchLike),
         },
         component.needIssueSync,
@@ -432,7 +432,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
         inNewCodePeriod: filters.inNewCodePeriod,
         ...(component.needIssueSync ? {} : { onlyMine: filters.assignedToMe }),
         p: page,
-        projectKey: component.key,
+        project: component.key,
         ps: PAGE_SIZE,
         resolution,
         status,
index 12aeddb6cca8809c588b42ed20437f7106d8665e..97f5c5bfb6c4c37b4d5670038f2e0d9635bf8d46 100644 (file)
@@ -442,7 +442,7 @@ it('should be able to filter the hotspot list', async () => {
       inNewCodePeriod: false,
       onlyMine: true,
       p: 1,
-      projectKey: 'guillaume-peoch-sonarsource_benflix_AYGpXq2bd8qy4i0eO9ed',
+      project: 'guillaume-peoch-sonarsource_benflix_AYGpXq2bd8qy4i0eO9ed',
       ps: 500,
       resolution: undefined,
       status: 'TO_REVIEW',
@@ -458,7 +458,7 @@ it('should be able to filter the hotspot list', async () => {
       inNewCodePeriod: true,
       onlyMine: true,
       p: 1,
-      projectKey: 'guillaume-peoch-sonarsource_benflix_AYGpXq2bd8qy4i0eO9ed',
+      project: 'guillaume-peoch-sonarsource_benflix_AYGpXq2bd8qy4i0eO9ed',
       ps: 500,
       resolution: undefined,
       status: 'TO_REVIEW',