aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorKevin Silva <kevin.silva@sonarsource.com>2023-12-06 14:50:11 +0100
committersonartech <sonartech@sonarsource.com>2023-12-07 20:02:52 +0000
commite16ff4d2200a32df057d7b8baa682df0190f691e (patch)
tree907b4c41216332e12fe1ce181966a5642cf0b05f /server/sonar-web
parentbde5b0da90c05ef4128287a6062490046217cd2e (diff)
downloadsonarqube-e16ff4d2200a32df057d7b8baa682df0190f691e.tar.gz
sonarqube-e16ff4d2200a32df057d7b8baa682df0190f691e.zip
SONAR-19974 - Update hotspot search api payload
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/api/mocks/SecurityHotspotServiceMock.ts4
-rw-r--r--server/sonar-web/src/main/js/api/security-hotspots.ts12
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx4
4 files changed, 12 insertions, 14 deletions
diff --git a/server/sonar-web/src/main/js/api/mocks/SecurityHotspotServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/SecurityHotspotServiceMock.ts
index a71f7271513..70727896309 100644
--- a/server/sonar-web/src/main/js/api/mocks/SecurityHotspotServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/SecurityHotspotServiceMock.ts
@@ -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;
diff --git a/server/sonar-web/src/main/js/api/security-hotspots.ts b/server/sonar-web/src/main/js/api/security-hotspots.ts
index 5b481b8460d..635d6f00b75 100644
--- a/server/sonar-web/src/main/js/api/security-hotspots.ts
+++ b/server/sonar-web/src/main/js/api/security-hotspots.ts
@@ -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);
}
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx
index 52484985071..ceee5a273e1 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx
@@ -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,
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx
index 12aeddb6cca..97f5c5bfb6c 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx
@@ -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',