diff options
author | Léo Geoffroy <leo.geoffroy@sonarsource.com> | 2023-11-06 14:18:31 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-11-08 20:02:53 +0000 |
commit | 9f451cb3fb66e618e48278de7104e204b8695ef1 (patch) | |
tree | df9b39d8845af59e02e7ed1ff67f456b148ce78e /server/sonar-web/src/main/js/apps/issues | |
parent | 34dffa98cc400f52b59826670c765a77e07316e9 (diff) | |
download | sonarqube-9f451cb3fb66e618e48278de7104e204b8695ef1.tar.gz sonarqube-9f451cb3fb66e618e48278de7104e204b8695ef1.zip |
SONAR-20877 Update naming to issueStatus
Diffstat (limited to 'server/sonar-web/src/main/js/apps/issues')
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx | 10 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-Filtering-it.tsx | 4 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts | 81 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx | 4 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx | 4 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/sidebar/IssueStatusFacet.tsx (renamed from server/sonar-web/src/main/js/apps/issues/sidebar/SimpleStatusFacet.tsx) | 39 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx | 12 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/Sidebar-it.tsx | 6 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/test-utils.tsx | 8 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/utils.ts | 67 |
10 files changed, 113 insertions, 122 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx index d333b922e69..cb66cd3775f 100644 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx @@ -154,10 +154,10 @@ describe('issue app', () => { // Get a specific issue list item const listItem = within(await screen.findByRole('region', { name: 'Fix that' })); - expect(listItem.getByText('issue.simple_status.OPEN')).toBeInTheDocument(); + expect(listItem.getByText('issue.issue_status.OPEN')).toBeInTheDocument(); await act(async () => { - await user.click(listItem.getByText('issue.simple_status.OPEN')); + await user.click(listItem.getByText('issue.issue_status.OPEN')); }); expect(listItem.getByText('issue.transition.accept')).toBeInTheDocument(); expect(listItem.getByText('issue.transition.confirm')).toBeInTheDocument(); @@ -175,20 +175,20 @@ describe('issue app', () => { expect( listItem.getByLabelText( - 'issue.transition.status_x_click_to_change.issue.simple_status.CONFIRMED', + 'issue.transition.status_x_click_to_change.issue.issue_status.CONFIRMED', ), ).toBeInTheDocument(); // Change status again await act(async () => { - await user.click(listItem.getByText('issue.simple_status.CONFIRMED')); + await user.click(listItem.getByText('issue.issue_status.CONFIRMED')); await user.click(listItem.getByText('issue.transition.accept')); await user.click(listItem.getByText('resolve')); }); expect( listItem.getByLabelText( - 'issue.transition.status_x_click_to_change.issue.simple_status.ACCEPTED', + 'issue.transition.status_x_click_to_change.issue.issue_status.ACCEPTED', ), ).toBeInTheDocument(); diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-Filtering-it.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-Filtering-it.tsx index ce0e9931252..2e2320f6f0b 100644 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-Filtering-it.tsx +++ b/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-Filtering-it.tsx @@ -90,7 +90,7 @@ describe('issues app filtering', () => { expect(ui.issueItem6.get()).toBeInTheDocument(); // Status - await user.click(ui.simpleStatusFacet.get()); + await user.click(ui.issueStatusFacet.get()); await user.click(ui.openStatusFilter.get()); expect(ui.issueItem6.query()).not.toBeInTheDocument(); // Issue 6 should vanish @@ -350,7 +350,7 @@ describe('issues app when reindexing', () => { expect(ui.resolutionFacet.query()).not.toBeInTheDocument(); expect(ui.ruleFacet.query()).not.toBeInTheDocument(); expect(ui.scopeFacet.query()).not.toBeInTheDocument(); - expect(ui.simpleStatusFacet.query()).not.toBeInTheDocument(); + expect(ui.issueStatusFacet.query()).not.toBeInTheDocument(); expect(ui.tagFacet.query()).not.toBeInTheDocument(); // Indexation message 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 7f55fb9c1e2..0be574f9806 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 @@ -22,7 +22,7 @@ import { SoftwareImpactSeverity, SoftwareQuality, } from '../../../types/clean-code-taxonomy'; -import { IssueSimpleStatus } from '../../../types/issues'; +import { IssueStatus } from '../../../types/issues'; import { SecurityStandard } from '../../../types/security'; import { parseQuery, @@ -69,7 +69,7 @@ describe('serialize/deserialize', () => { severities: ['a', 'b'], inNewCodePeriod: true, sonarsourceSecurity: ['a', 'b'], - simpleStatuses: [IssueSimpleStatus.Accepted, IssueSimpleStatus.Confirmed], + issueStatuses: [IssueStatus.Accepted, IssueStatus.Confirmed], tags: ['a', 'b'], types: ['a', 'b'], }), @@ -102,7 +102,7 @@ describe('serialize/deserialize', () => { inNewCodePeriod: 'true', severities: 'a,b', sonarsourceSecurity: 'a,b', - simpleStatuses: 'ACCEPTED,CONFIRMED', + issueStatuses: 'ACCEPTED,CONFIRMED', tags: 'a,b', types: 'a,b', }); @@ -149,73 +149,64 @@ describe('serialize/deserialize', () => { severities: ['CRITICAL', 'MAJOR'], sonarsourceSecurity: [], sort: '', - simpleStatuses: [], + issueStatuses: [], tags: [], types: [], }); }); - it('should map deprecated status and resolution query to new simple statuses', () => { - expect(parseQuery({ statuses: 'OPEN' }).simpleStatuses).toEqual([IssueSimpleStatus.Open]); - expect(parseQuery({ statuses: 'REOPENED' }).simpleStatuses).toEqual([IssueSimpleStatus.Open]); - expect(parseQuery({ statuses: 'CONFIRMED' }).simpleStatuses).toEqual([ - IssueSimpleStatus.Confirmed, + it('should map deprecated status and resolution query to new issue statuses', () => { + expect(parseQuery({ statuses: 'OPEN' }).issueStatuses).toEqual([IssueStatus.Open]); + expect(parseQuery({ statuses: 'REOPENED' }).issueStatuses).toEqual([IssueStatus.Open]); + expect(parseQuery({ statuses: 'CONFIRMED' }).issueStatuses).toEqual([IssueStatus.Confirmed]); + expect(parseQuery({ statuses: 'RESOLVED' }).issueStatuses).toEqual([ + IssueStatus.Fixed, + IssueStatus.Accepted, + IssueStatus.FalsePositive, ]); - expect(parseQuery({ statuses: 'RESOLVED' }).simpleStatuses).toEqual([ - IssueSimpleStatus.Fixed, - IssueSimpleStatus.Accepted, - IssueSimpleStatus.FalsePositive, - ]); - expect(parseQuery({ statuses: 'OPEN,REOPENED' }).simpleStatuses).toEqual([ - IssueSimpleStatus.Open, - ]); - expect(parseQuery({ statuses: 'OPEN,CONFIRMED' }).simpleStatuses).toEqual([ - IssueSimpleStatus.Open, - IssueSimpleStatus.Confirmed, + expect(parseQuery({ statuses: 'OPEN,REOPENED' }).issueStatuses).toEqual([IssueStatus.Open]); + expect(parseQuery({ statuses: 'OPEN,CONFIRMED' }).issueStatuses).toEqual([ + IssueStatus.Open, + IssueStatus.Confirmed, ]); // Resolutions - expect(parseQuery({ resolutions: 'FALSE-POSITIVE' }).simpleStatuses).toEqual([ - IssueSimpleStatus.FalsePositive, - ]); - expect(parseQuery({ resolutions: 'WONTFIX' }).simpleStatuses).toEqual([ - IssueSimpleStatus.Accepted, - ]); - expect(parseQuery({ resolutions: 'REMOVED' }).simpleStatuses).toEqual([ - IssueSimpleStatus.Fixed, + expect(parseQuery({ resolutions: 'FALSE-POSITIVE' }).issueStatuses).toEqual([ + IssueStatus.FalsePositive, ]); - expect(parseQuery({ resolutions: 'REMOVED,WONTFIX,FALSE-POSITIVE' }).simpleStatuses).toEqual([ - IssueSimpleStatus.Fixed, - IssueSimpleStatus.Accepted, - IssueSimpleStatus.FalsePositive, + expect(parseQuery({ resolutions: 'WONTFIX' }).issueStatuses).toEqual([IssueStatus.Accepted]); + expect(parseQuery({ resolutions: 'REMOVED' }).issueStatuses).toEqual([IssueStatus.Fixed]); + expect(parseQuery({ resolutions: 'REMOVED,WONTFIX,FALSE-POSITIVE' }).issueStatuses).toEqual([ + IssueStatus.Fixed, + IssueStatus.Accepted, + IssueStatus.FalsePositive, ]); // Both statuses and resolutions expect( - parseQuery({ resolutions: 'FALSE-POSITIVE', statuses: 'RESOLVED' }).simpleStatuses, - ).toEqual([IssueSimpleStatus.FalsePositive]); - expect(parseQuery({ resolutions: 'WONTFIX', statuses: 'RESOLVED' }).simpleStatuses).toEqual([ - IssueSimpleStatus.Accepted, + parseQuery({ resolutions: 'FALSE-POSITIVE', statuses: 'RESOLVED' }).issueStatuses, + ).toEqual([IssueStatus.FalsePositive]); + expect(parseQuery({ resolutions: 'WONTFIX', statuses: 'RESOLVED' }).issueStatuses).toEqual([ + IssueStatus.Accepted, ]); // With resolved=false expect( - parseQuery({ resolutions: 'WONTFIX', statuses: 'RESOLVED', resolved: 'false' }) - .simpleStatuses, - ).toEqual([IssueSimpleStatus.Accepted, IssueSimpleStatus.Open, IssueSimpleStatus.Confirmed]); - expect(parseQuery({ statuses: 'OPEN', resolved: 'false' }).simpleStatuses).toEqual([ - IssueSimpleStatus.Open, + parseQuery({ resolutions: 'WONTFIX', statuses: 'RESOLVED', resolved: 'false' }).issueStatuses, + ).toEqual([IssueStatus.Accepted, IssueStatus.Open, IssueStatus.Confirmed]); + expect(parseQuery({ statuses: 'OPEN', resolved: 'false' }).issueStatuses).toEqual([ + IssueStatus.Open, ]); - // With simple status + // With new status expect( parseQuery({ resolutions: 'WONTFIX', statuses: 'RESOLVED', resolved: 'false', - simpleStatuses: 'FIXED', - }).simpleStatuses, - ).toEqual([IssueSimpleStatus.Fixed]); + issueStatuses: 'FIXED', + }).issueStatuses, + ).toEqual([IssueStatus.Fixed]); }); }); diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx index 6505066761a..d409919df58 100644 --- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx +++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx @@ -29,7 +29,7 @@ import { getBranchLikeQuery } from '../../../helpers/branch-like'; import { translate } from '../../../helpers/l10n'; import { BranchLike } from '../../../types/branch-like'; import { isFile } from '../../../types/component'; -import { IssueStatus } from '../../../types/issues'; +import { IssueDeprecatedStatus } from '../../../types/issues'; import { Dict, Duplication, @@ -272,7 +272,7 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone ...additionalLines, }); - const issueIsClosed = issue.status === IssueStatus.Closed; + const issueIsClosed = issue.status === IssueDeprecatedStatus.Closed; const issueIsFileLevel = isFile(issue.componentQualifier) && issue.componentEnabled; const closedIssueMessageKey = issueIsFileLevel ? 'issue.closed.file_level' diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx index c5c2dfcb4f7..12817ba7163 100644 --- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx +++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx @@ -41,7 +41,7 @@ import { translate } from '../../../helpers/l10n'; import { HttpStatus } from '../../../helpers/request'; import { BranchLike } from '../../../types/branch-like'; import { isFile } from '../../../types/component'; -import { IssueStatus } from '../../../types/issues'; +import { IssueDeprecatedStatus } from '../../../types/issues'; import { Dict, DuplicatedFile, @@ -124,7 +124,7 @@ export default class CrossComponentSourceViewer extends React.PureComponent<Prop try { const components = - issue.status === IssueStatus.Closed ? {} : await getIssueFlowSnippets(issue.key); + issue.status === IssueDeprecatedStatus.Closed ? {} : await getIssueFlowSnippets(issue.key); if (components[issue.component] === undefined) { const issueComponent = await getComponentForSourceViewer({ // If the issue's component doesn't exist anymore (typically a deleted file), use the project diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/SimpleStatusFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/IssueStatusFacet.tsx index 5889d9fc2c2..0af47923198 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/SimpleStatusFacet.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/IssueStatusFacet.tsx @@ -19,36 +19,35 @@ */ import { FacetBox, FacetItem } from 'design-system'; -import { FacetItemsList } from './FacetItemsList'; - import { isEqual, sortBy, without } from 'lodash'; import * as React from 'react'; import { useIntl } from 'react-intl'; import { DEFAULT_ISSUES_QUERY } from '../../../components/shared/utils'; -import { SIMPLE_STATUSES } from '../../../helpers/constants'; -import { IssueSimpleStatus } from '../../../types/issues'; +import { ISSUE_STATUSES } from '../../../helpers/constants'; +import { IssueStatus } from '../../../types/issues'; import { formatFacetStat } from '../utils'; +import { FacetItemsList } from './FacetItemsList'; import { MultipleSelectionHint } from './MultipleSelectionHint'; import { CommonProps } from './SimpleListStyleFacet'; interface Props extends CommonProps { - simpleStatuses: Array<IssueSimpleStatus>; + issueStatuses: Array<IssueStatus>; } -const property = 'simpleStatuses'; +const property = 'issueStatuses'; const headerId = `facet_${property}`; -const defaultStatuses = DEFAULT_ISSUES_QUERY.simpleStatuses.split(',') as IssueSimpleStatus[]; +const defaultStatuses = DEFAULT_ISSUES_QUERY.issueStatuses.split(',') as IssueStatus[]; -export function SimpleStatusFacet(props: Readonly<Props>) { - const { simpleStatuses = [], stats = {}, fetching, open, help, needIssueSync } = props; +export function IssueStatusFacet(props: Readonly<Props>) { + const { issueStatuses = [], stats = {}, fetching, open, help, needIssueSync } = props; const intl = useIntl(); - const nbSelectableItems = SIMPLE_STATUSES.filter( + const nbSelectableItems = ISSUE_STATUSES.filter( (item) => !defaultStatuses.includes(item) && stats[item], ).length; - const hasDefaultSelection = isEqual(sortBy(simpleStatuses), sortBy(defaultStatuses)); - const nbSelectedItems = hasDefaultSelection ? 0 : simpleStatuses.length; + const hasDefaultSelection = isEqual(sortBy(issueStatuses), sortBy(defaultStatuses)); + const nbSelectedItems = hasDefaultSelection ? 0 : issueStatuses.length; return ( <FacetBox @@ -70,8 +69,8 @@ export function SimpleStatusFacet(props: Readonly<Props>) { help={help} > <FacetItemsList labelledby={headerId}> - {SIMPLE_STATUSES.map((item) => { - const active = simpleStatuses.includes(item); + {ISSUE_STATUSES.map((item) => { + const active = issueStatuses.includes(item); const stat = stats[item]; return ( @@ -79,17 +78,17 @@ export function SimpleStatusFacet(props: Readonly<Props>) { active={active} className="it__search-navigator-facet" key={item} - name={intl.formatMessage({ id: `issue.simple_status.${item}` })} - onClick={(itemValue: IssueSimpleStatus, multiple) => { + name={intl.formatMessage({ id: `issue.issue_status.${item}` })} + onClick={(itemValue: IssueStatus, multiple) => { if (multiple) { props.onChange({ [property]: active - ? without(simpleStatuses, itemValue) - : [...simpleStatuses, itemValue], + ? without(issueStatuses, itemValue) + : [...issueStatuses, itemValue], }); } else { props.onChange({ - [property]: active && simpleStatuses.length === 1 ? [] : [itemValue], + [property]: active && issueStatuses.length === 1 ? [] : [itemValue], }); } }} @@ -102,7 +101,7 @@ export function SimpleStatusFacet(props: Readonly<Props>) { <MultipleSelectionHint nbSelectableItems={nbSelectableItems} - nbSelectedItems={simpleStatuses.length} + nbSelectedItems={issueStatuses.length} /> </FacetBox> ); diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx index 141cb21fe1b..54c8082ca81 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx @@ -49,13 +49,13 @@ import { AuthorFacet } from './AuthorFacet'; import { CreationDateFacet } from './CreationDateFacet'; import { DirectoryFacet } from './DirectoryFacet'; import { FileFacet } from './FileFacet'; +import { IssueStatusFacet } from './IssueStatusFacet'; import { LanguageFacet } from './LanguageFacet'; import { PeriodFilter } from './PeriodFilter'; import { ProjectFacet } from './ProjectFacet'; import { RuleFacet } from './RuleFacet'; import { ScopeFacet } from './ScopeFacet'; import { SeverityFacet } from './SeverityFacet'; -import { SimpleStatusFacet } from './SimpleStatusFacet'; import { SoftwareQualityFacet } from './SoftwareQualityFacet'; import { StandardFacet } from './StandardFacet'; import { TagFacet } from './TagFacet'; @@ -245,13 +245,13 @@ export class SidebarClass extends React.PureComponent<Props> { <BasicSeparator className="sw-my-4" /> - <SimpleStatusFacet - fetching={this.props.loadingFacets.simpleStatuses === true} + <IssueStatusFacet + fetching={this.props.loadingFacets.issueStatuses === true} onChange={this.props.onFilterChange} onToggle={this.props.onFacetToggle} - open={!!openFacets.simpleStatuses} - simpleStatuses={query.simpleStatuses} - stats={facets.simpleStatuses} + open={!!openFacets.issueStatuses} + issueStatuses={query.issueStatuses} + stats={facets.issueStatuses} /> <BasicSeparator className="sw-my-4" /> diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/Sidebar-it.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/Sidebar-it.tsx index cd19d2908bb..58a518e30ec 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/Sidebar-it.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/Sidebar-it.tsx @@ -51,7 +51,7 @@ it('should render correct facets for Application', () => { 'issues.facet.impactSeverities', 'issues.facet.types', 'issues.facet.scopes', - 'issues.facet.simpleStatuses', + 'issues.facet.issueStatuses', 'issues.facet.standards', 'issues.facet.createdAt', 'issues.facet.languages', @@ -73,7 +73,7 @@ it('should render correct facets for Portfolio', () => { 'issues.facet.impactSeverities', 'issues.facet.types', 'issues.facet.scopes', - 'issues.facet.simpleStatuses', + 'issues.facet.issueStatuses', 'issues.facet.standards', 'issues.facet.createdAt', 'issues.facet.languages', @@ -95,7 +95,7 @@ it('should render correct facets for SubPortfolio', () => { 'issues.facet.impactSeverities', 'issues.facet.types', 'issues.facet.scopes', - 'issues.facet.simpleStatuses', + 'issues.facet.issueStatuses', 'issues.facet.standards', 'issues.facet.createdAt', 'issues.facet.languages', diff --git a/server/sonar-web/src/main/js/apps/issues/test-utils.tsx b/server/sonar-web/src/main/js/apps/issues/test-utils.tsx index 5079125b95f..20514054359 100644 --- a/server/sonar-web/src/main/js/apps/issues/test-utils.tsx +++ b/server/sonar-web/src/main/js/apps/issues/test-utils.tsx @@ -74,7 +74,7 @@ export const ui = { resolutionFacet: byRole('button', { name: 'issues.facet.resolutions' }), ruleFacet: byRole('button', { name: 'issues.facet.rules' }), scopeFacet: byRole('button', { name: 'issues.facet.scopes' }), - simpleStatusFacet: byRole('button', { name: 'issues.facet.simpleStatuses' }), + issueStatusFacet: byRole('button', { name: 'issues.facet.issueStatuses' }), tagFacet: byRole('button', { name: 'issues.facet.tags' }), typeFacet: byRole('button', { name: 'issues.facet.types' }), cleanCodeAttributeCategoryFacet: byRole('button', { @@ -97,7 +97,7 @@ export const ui = { clearRuleFacet: byTestId('clear-issues.facet.rules'), clearScopeFacet: byTestId('clear-issues.facet.scopes'), clearSeverityFacet: byTestId('clear-issues.facet.impactSeverities'), - clearSimpleStatusFacet: byTestId('clear-issues.facet.simpleStatuses'), + clearIssueStatusFacet: byTestId('clear-issues.facet.issueStatuses'), clearTagFacet: byTestId('clear-issues.facet.tags'), responsibleCategoryFilter: byRole('checkbox', { @@ -110,11 +110,11 @@ export const ui = { name: `software_quality.${SoftwareQuality.Maintainability}`, }), codeSmellIssueTypeFilter: byRole('checkbox', { name: 'issue.type.CODE_SMELL' }), - confirmedStatusFilter: byRole('checkbox', { name: 'issue.simple_status.CONFIRMED' }), + confirmedStatusFilter: byRole('checkbox', { name: 'issue.issue_status.CONFIRMED' }), fixedResolutionFilter: byRole('checkbox', { name: 'issue.resolution.FIXED' }), mainScopeFilter: byRole('checkbox', { name: 'issue.scope.MAIN' }), mediumSeverityFilter: byRole('checkbox', { name: `severity.${SoftwareImpactSeverity.Medium}` }), - openStatusFilter: byRole('checkbox', { name: 'issue.simple_status.OPEN' }), + openStatusFilter: byRole('checkbox', { name: 'issue.issue_status.OPEN' }), vulnerabilityIssueTypeFilter: byRole('checkbox', { name: 'issue.type.VULNERABILITY' }), bulkChangeComment: byRole('textbox', { name: /issue_bulk_change.resolution_comment/ }), 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 85ebc2f8d99..664a01d2515 100644 --- a/server/sonar-web/src/main/js/apps/issues/utils.ts +++ b/server/sonar-web/src/main/js/apps/issues/utils.ts @@ -41,8 +41,8 @@ import { } from '../../types/clean-code-taxonomy'; import { Facet, + IssueDeprecatedStatus, IssueResolution, - IssueSimpleStatus, IssueStatus, RawFacet, } from '../../types/issues'; @@ -83,7 +83,7 @@ export interface Query { inNewCodePeriod: boolean; sonarsourceSecurity: string[]; sort: string; - simpleStatuses: IssueSimpleStatus[]; + issueStatuses: IssueStatus[]; tags: string[]; types: string[]; } @@ -130,44 +130,47 @@ export function parseQuery(query: RawQuery): Query { severities: parseAsArray(query.severities, parseAsString), sonarsourceSecurity: parseAsArray(query.sonarsourceSecurity, parseAsString), sort: parseAsSort(query.s), - simpleStatuses: parseSimpleStatuses(query), + issueStatuses: parseIssueStatuses(query), tags: parseAsArray(query.tags, parseAsString), types: parseAsArray(query.types, parseAsString), codeVariants: parseAsArray(query.codeVariants, parseAsString), }; } -function parseSimpleStatuses(query: RawQuery) { - let result: Array<IssueSimpleStatus> = []; +function parseIssueStatuses(query: RawQuery) { + let result: Array<IssueStatus> = []; - if (query.simpleStatuses) { - return parseAsArray<IssueSimpleStatus>(query.simpleStatuses, parseAsString); + if (query.issueStatuses) { + return parseAsArray<IssueStatus>(query.issueStatuses, parseAsString); } const deprecatedStatusesMap = { - [IssueStatus.Open]: [IssueSimpleStatus.Open], - [IssueStatus.Confirmed]: [IssueSimpleStatus.Confirmed], - [IssueStatus.Reopened]: [IssueSimpleStatus.Open], - [IssueStatus.Resolved]: [ - IssueSimpleStatus.Fixed, - IssueSimpleStatus.Accepted, - IssueSimpleStatus.FalsePositive, + [IssueDeprecatedStatus.Open]: [IssueStatus.Open], + [IssueDeprecatedStatus.Confirmed]: [IssueStatus.Confirmed], + [IssueDeprecatedStatus.Reopened]: [IssueStatus.Open], + [IssueDeprecatedStatus.Resolved]: [ + IssueStatus.Fixed, + IssueStatus.Accepted, + IssueStatus.FalsePositive, ], - [IssueStatus.Closed]: [IssueSimpleStatus.Fixed], + [IssueDeprecatedStatus.Closed]: [IssueStatus.Fixed], }; const deprecatedResolutionsMap = { - [IssueResolution.FalsePositive]: [IssueSimpleStatus.FalsePositive], - [IssueResolution.WontFix]: [IssueSimpleStatus.Accepted], - [IssueResolution.Fixed]: [IssueSimpleStatus.Fixed], - [IssueResolution.Removed]: [IssueSimpleStatus.Fixed], - [IssueResolution.Unresolved]: [IssueSimpleStatus.Open, IssueSimpleStatus.Confirmed], + [IssueResolution.FalsePositive]: [IssueStatus.FalsePositive], + [IssueResolution.WontFix]: [IssueStatus.Accepted], + [IssueResolution.Fixed]: [IssueStatus.Fixed], + [IssueResolution.Removed]: [IssueStatus.Fixed], + [IssueResolution.Unresolved]: [IssueStatus.Open, IssueStatus.Confirmed], }; - const simpleStatusesFromStatuses = parseAsArray<IssueStatus>(query.statuses, parseAsString) + const issuesStatusesFromDeprecatedStatuses = parseAsArray<IssueDeprecatedStatus>( + query.statuses, + parseAsString, + ) .map((status) => deprecatedStatusesMap[status]) .filter(Boolean) .flat(); - const simpleStatusesFromResolutions = parseAsArray<IssueResolution>( + const issueStatusesFromResolutions = parseAsArray<IssueResolution>( query.resolutions, parseAsString, ) @@ -175,22 +178,20 @@ function parseSimpleStatuses(query: RawQuery) { .filter(Boolean) .flat(); - const intesectedSimpleStatuses = intersection( - simpleStatusesFromStatuses, - simpleStatusesFromResolutions, + const intesectedIssueStatuses = intersection( + issuesStatusesFromDeprecatedStatuses, + issueStatusesFromResolutions, ); - result = intesectedSimpleStatuses.length - ? intesectedSimpleStatuses - : simpleStatusesFromResolutions.concat(simpleStatusesFromStatuses); + result = intesectedIssueStatuses.length + ? intesectedIssueStatuses + : issueStatusesFromResolutions.concat(issuesStatusesFromDeprecatedStatuses); if ( query.resolved === 'false' && - [IssueSimpleStatus.Open, IssueSimpleStatus.Confirmed].every( - (status) => !result.includes(status), - ) + [IssueStatus.Open, IssueStatus.Confirmed].every((status) => !result.includes(status)) ) { result = result.concat( - parseAsArray<IssueSimpleStatus>(DEFAULT_ISSUES_QUERY.simpleStatuses, parseAsString), + parseAsArray<IssueStatus>(DEFAULT_ISSUES_QUERY.issueStatuses, parseAsString), ); } @@ -238,7 +239,7 @@ export function serializeQuery(query: Query): RawQuery { impactSoftwareQualities: serializeStringArray(query.impactSoftwareQualities), inNewCodePeriod: query.inNewCodePeriod ? 'true' : undefined, sonarsourceSecurity: serializeStringArray(query.sonarsourceSecurity), - simpleStatuses: serializeStringArray(query.simpleStatuses), + issueStatuses: serializeStringArray(query.issueStatuses), tags: serializeStringArray(query.tags), types: serializeStringArray(query.types), codeVariants: serializeStringArray(query.codeVariants), |