From 665208339e58abb91e63377ea947d44e643afb03 Mon Sep 17 00:00:00 2001 From: stanislavh Date: Thu, 4 Jan 2024 12:44:24 +0100 Subject: [PATCH] SONAR-21368 Use resolved param to issues list when reindexing --- .../js/apps/issues/__tests__/utils-test.ts | 1 + .../js/apps/issues/components/IssuesApp.tsx | 5 ++-- .../src/main/js/apps/issues/utils.ts | 8 +++++- .../overview/branches/AcceptedIssuesPanel.tsx | 2 ++ .../components/IssueMeasuresCardInner.tsx | 28 +++++++++++-------- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts index 7f580d8fe53..35e64f839fa 100644 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts +++ b/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts @@ -154,6 +154,7 @@ describe('serialize/deserialize', () => { tags: [], types: [], fixedInPullRequest: '', + resolved: undefined, }); }); diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx index 60362397ded..228297a622f 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx @@ -167,7 +167,7 @@ export class App extends React.PureComponent { constructor(props: Props) { super(props); - const query = parseQuery(props.location.query); + const query = parseQuery(props.location.query, props.component?.needIssueSync); this.bulkButtonRef = React.createRef(); this.state = { @@ -207,12 +207,13 @@ export class App extends React.PureComponent { static getDerivedStateFromProps(props: Props, state: State) { const { location: { query }, + component: { needIssueSync } = {}, } = props; return { myIssues: areMyIssuesSelected(query), openIssue: getOpenIssue(props, state.issues), - query: parseQuery(query), + query: parseQuery(query, needIssueSync), }; } diff --git a/server/sonar-web/src/main/js/apps/issues/utils.ts b/server/sonar-web/src/main/js/apps/issues/utils.ts index a2e303bfb5a..67e936bce8b 100644 --- a/server/sonar-web/src/main/js/apps/issues/utils.ts +++ b/server/sonar-web/src/main/js/apps/issues/utils.ts @@ -29,6 +29,7 @@ import { parseAsString, queriesEqual, serializeDateShort, + serializeOptionalBoolean, serializeString, serializeStringArray, } from '../../helpers/query'; @@ -87,6 +88,7 @@ export interface Query { issueStatuses: IssueStatus[]; tags: string[]; types: string[]; + resolved?: boolean; } export const STANDARDS = 'standards'; @@ -95,7 +97,7 @@ export const STANDARDS = 'standards'; const parseAsSort = (sort: string) => (sort === 'CREATION_DATE' ? 'CREATION_DATE' : ''); const ISSUES_DEFAULT = 'sonarqube.issues.default'; -export function parseQuery(query: RawQuery): Query { +export function parseQuery(query: RawQuery, needIssueSync = false): Query { return { assigned: parseAsBoolean(query.assigned), assignees: parseAsArray(query.assignees, parseAsString), @@ -136,6 +138,9 @@ export function parseQuery(query: RawQuery): Query { types: parseAsArray(query.types, parseAsString), codeVariants: parseAsArray(query.codeVariants, parseAsString), fixedInPullRequest: parseAsString(query.fixedInPullRequest), + // While reindexing, we need to use resolved param for issues/list endpoint + // False is used to show unresolved issues only + resolved: needIssueSync ? false : undefined, }; } @@ -246,6 +251,7 @@ export function serializeQuery(query: Query): RawQuery { tags: serializeStringArray(query.tags), types: serializeStringArray(query.types), codeVariants: serializeStringArray(query.codeVariants), + resolved: serializeOptionalBoolean(query.resolved), }; return cleanQuery(filter); diff --git a/server/sonar-web/src/main/js/apps/overview/branches/AcceptedIssuesPanel.tsx b/server/sonar-web/src/main/js/apps/overview/branches/AcceptedIssuesPanel.tsx index b33967891d7..e6afd9d5f3b 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/AcceptedIssuesPanel.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/AcceptedIssuesPanel.tsx @@ -91,6 +91,7 @@ function AcceptedIssuesPanel(props: Readonly) { > ) { <>
{value ? ( - } > - {value} - + + {value} + + ) : ( — -- 2.39.5