diff options
author | Wouter Admiraal <wouter.admiraal@sonarsource.com> | 2023-08-15 09:32:41 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-08-18 20:02:49 +0000 |
commit | a932ac03d4cd9a3aae7bfc8c9e9a477e66116e27 (patch) | |
tree | c741b4db1ef7a2504b5816cc71f2dac20340a156 /server | |
parent | 50e4bafacd3e4dfe636f0ea5d95eb6a1d015eb58 (diff) | |
download | sonarqube-a932ac03d4cd9a3aae7bfc8c9e9a477e66116e27.tar.gz sonarqube-a932ac03d4cd9a3aae7bfc8c9e9a477e66116e27.zip |
SONAR-20023 Update naming for facet fields to be compatible with api
Diffstat (limited to 'server')
16 files changed, 77 insertions, 116 deletions
diff --git a/server/sonar-web/src/main/js/api/issues.ts b/server/sonar-web/src/main/js/api/issues.ts index 43191fea418..23e47c35d88 100644 --- a/server/sonar-web/src/main/js/api/issues.ts +++ b/server/sonar-web/src/main/js/api/issues.ts @@ -52,13 +52,6 @@ type FacetName = | 'types'; export function searchIssues(query: RequestData): Promise<RawIssuesResponse> { - // TODO: Remove this before final merge. Needed because backend sends an error - if (query.facets) { - query.facets = query.facets - .replace(/cleanCodeAttributeCategory/, '') - .replace(/impactSoftwareQuality/, '') - .replace(/impactSeverity/, ''); - } return getJSON('/api/issues/search', query).catch(throwGlobalError); } diff --git a/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts index fea034216dd..f40177f5444 100644 --- a/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts +++ b/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts @@ -270,7 +270,7 @@ export default class IssuesServiceMock { mockFacetDetailResponse = (query: RequestData): RawFacet[] => { const facets = (query.facets ?? '').split(','); const cleanCodeCategories: CleanCodeAttributeCategory[] = ( - query.cleanCodeAttributeCategory ?? Object.values(CleanCodeAttributeCategory).join(',') + query.cleanCodeAttributeCategories ?? Object.values(CleanCodeAttributeCategory).join(',') ).split(','); return facets.map((name: string): RawFacet => { if (name === 'owaspTop10-2021') { @@ -337,9 +337,9 @@ export default class IssuesServiceMock { types: ISSUE_TYPES, scopes: SOURCE_SCOPES.map(({ scope }) => scope), projects: ['org.project1', 'org.project2'], - impactSoftwareQuality: Object.values(SoftwareQuality), - impactSeverity: Object.values(SoftwareImpactSeverity), - cleanCodeAttributeCategory: cleanCodeCategories, + impactSoftwareQualities: Object.values(SoftwareQuality), + impactSeverities: Object.values(SoftwareImpactSeverity), + cleanCodeAttributeCategories: cleanCodeCategories, tags: ['unused', 'confusing'], rules: ['simpleRuleId', 'advancedRuleId', 'other'], assignees: ['email1@sonarsource.com', 'email2@sonarsource.com'], @@ -385,30 +385,30 @@ export default class IssuesServiceMock { // Filter list (only supports assignee, type and severity) const filteredList = this.list .filter((item) => { - if (!query.cleanCodeAttributeCategory) { + if (!query.cleanCodeAttributeCategories) { return true; } - return query.cleanCodeAttributeCategory + return query.cleanCodeAttributeCategories .split(',') .includes(item.issue.cleanCodeAttributeCategory); }) .filter((item) => { - if (!query.impactSoftwareQuality) { + if (!query.impactSoftwareQualities) { return true; } return item.issue.impacts.some(({ softwareQuality }) => - query.impactSoftwareQuality.split(',').includes(softwareQuality) + query.impactSoftwareQualities.split(',').includes(softwareQuality) ); }) .filter((item) => { - if (!query.impactSeverity) { + if (!query.impactSeverities) { return true; } return item.issue.impacts.some(({ severity }) => - query.impactSeverity.split(',').includes(severity) + query.impactSeverities.split(',').includes(severity) ); }) .filter((item) => { 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 6546cbc0b20..6f9dd64af3e 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 @@ -42,9 +42,9 @@ describe('serialize/deserialize', () => { assigned: true, assignees: ['a', 'b'], author: ['a', 'b'], - cleanCodeAttributeCategory: [CleanCodeAttributeCategory.Responsible], - impactSeverity: [SoftwareImpactSeverity.High], - impactSoftwareQuality: [SoftwareQuality.Security], + cleanCodeAttributeCategories: [CleanCodeAttributeCategory.Responsible], + impactSeverities: [SoftwareImpactSeverity.High], + impactSoftwareQualities: [SoftwareQuality.Security], codeVariants: ['variant1', 'variant2'], createdAfter: new Date(1000000), createdAt: 'a', @@ -77,9 +77,9 @@ describe('serialize/deserialize', () => { ).toStrictEqual({ assignees: 'a,b', author: ['a', 'b'], - cleanCodeAttributeCategory: CleanCodeAttributeCategory.Responsible, - impactSeverity: SoftwareImpactSeverity.High, - impactSoftwareQuality: SoftwareQuality.Security, + cleanCodeAttributeCategories: CleanCodeAttributeCategory.Responsible, + impactSeverities: SoftwareImpactSeverity.High, + impactSoftwareQualities: SoftwareQuality.Security, codeVariants: 'variant1,variant2', createdAt: 'a', createdBefore: '1970-01-01', @@ -115,16 +115,16 @@ describe('serialize/deserialize', () => { assigned: 'true', assignees: 'first,second', author: ['author'], - cleanCodeAttributeCategory: 'CONSISTENT', - impactSeverity: 'LOW', + cleanCodeAttributeCategories: 'CONSISTENT', + impactSeverities: 'LOW', severities: 'CRITICAL,MAJOR', - impactSoftwareQuality: 'MAINTAINABILITY', + impactSoftwareQualities: 'MAINTAINABILITY', }) ).toStrictEqual({ assigned: true, assignees: ['first', 'second'], author: ['author'], - cleanCodeAttributeCategory: [CleanCodeAttributeCategory.Consistent], + cleanCodeAttributeCategories: [CleanCodeAttributeCategory.Consistent], codeVariants: [], createdAfter: undefined, createdAt: '', @@ -133,12 +133,12 @@ describe('serialize/deserialize', () => { cwe: [], directories: [], files: [], - impactSeverity: [ + impactSeverities: [ SoftwareImpactSeverity.Low, SoftwareImpactSeverity.High, SoftwareImpactSeverity.Medium, ], - impactSoftwareQuality: [SoftwareQuality.Maintainability], + impactSoftwareQualities: [SoftwareQuality.Maintainability], inNewCodePeriod: false, issues: [], languages: [], 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 f600c62e668..a89cac0e8c8 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 @@ -180,8 +180,8 @@ export class App extends React.PureComponent<Props, State> { query, SecurityStandard.OWASP_TOP10_2021 ), - cleanCodeAttributeCategory: true, - impactSoftwareQuality: true, + cleanCodeAttributeCategories: true, + impactSoftwareQualities: true, sonarsourceSecurity: shouldOpenSonarSourceSecurityFacet({}, query), standards: shouldOpenStandardsFacet({}, query), }, diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/AttributeCategoryFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/AttributeCategoryFacet.tsx index 4797ecb36ad..30ba17e814d 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/AttributeCategoryFacet.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/AttributeCategoryFacet.tsx @@ -33,7 +33,7 @@ export function AttributeCategoryFacet(props: Props) { return ( <SimpleListStyleFacet - property="cleanCodeAttributeCategory" + property="cleanCodeAttributeCategories" itemNamePrefix="issue.clean_code_attribute_category" listItems={CATEGORIES} selectedItems={categories} diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.tsx index 5ada1e50f08..4d0329681a6 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.tsx @@ -35,7 +35,7 @@ export function SeverityFacet(props: Props) { return ( <SimpleListStyleFacet - property="impactSeverity" + property="impactSeverities" itemNamePrefix="severity" listItems={SEVERITIES} selectedItems={severities} @@ -44,8 +44,8 @@ export function SeverityFacet(props: Props) { placement="right" content={ <> - <p>{translate('issues.facet.impactSeverity.help.line1')}</p> - <p className="sw-mt-2">{translate('issues.facet.impactSeverity.help.line2')}</p> + <p>{translate('issues.facet.impactSeverities.help.line1')}</p> + <p className="sw-mt-2">{translate('issues.facet.impactSeverities.help.line2')}</p> </> } links={[ 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 b9a274df52d..82f02d48729 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 @@ -183,24 +183,24 @@ export class SidebarClass extends React.PureComponent<Props> { )} <AttributeCategoryFacet - fetching={this.props.loadingFacets.cleanCodeAttributeCategory === true} + fetching={this.props.loadingFacets.cleanCodeAttributeCategories === true} needIssueSync={needIssueSync} onChange={this.props.onFilterChange} onToggle={this.props.onFacetToggle} - open={!!openFacets.cleanCodeAttributeCategory} - stats={facets.cleanCodeAttributeCategory} - categories={query.cleanCodeAttributeCategory} + open={!!openFacets.cleanCodeAttributeCategories} + stats={facets.cleanCodeAttributeCategories} + categories={query.cleanCodeAttributeCategories} /> <BasicSeparator className="sw-my-4" /> <SoftwareQualityFacet - fetching={this.props.loadingFacets.impactSoftwareQuality === true} + fetching={this.props.loadingFacets.impactSoftwareQualities === true} needIssueSync={needIssueSync} onChange={this.props.onFilterChange} onToggle={this.props.onFacetToggle} - open={!!openFacets.impactSoftwareQuality} - stats={facets.impactSoftwareQuality} - qualities={query.impactSoftwareQuality} + open={!!openFacets.impactSoftwareQualities} + stats={facets.impactSoftwareQualities} + qualities={query.impactSoftwareQualities} /> <BasicSeparator className="sw-my-4" /> @@ -208,12 +208,12 @@ export class SidebarClass extends React.PureComponent<Props> { {!needIssueSync && ( <> <SeverityFacet - fetching={this.props.loadingFacets.impactSeverity === true} + fetching={this.props.loadingFacets.impactSeverities === true} onChange={this.props.onFilterChange} onToggle={this.props.onFacetToggle} - open={!!openFacets.impactSeverity} - severities={query.impactSeverity} - stats={facets.impactSeverity} + open={!!openFacets.impactSeverities} + severities={query.impactSeverities} + stats={facets.impactSeverities} /> <BasicSeparator className="sw-my-4" /> diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/SoftwareQualityFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/SoftwareQualityFacet.tsx index 2851cc06a60..fc829f08cc9 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/SoftwareQualityFacet.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/SoftwareQualityFacet.tsx @@ -33,7 +33,7 @@ export function SoftwareQualityFacet(props: Props) { return ( <SimpleListStyleFacet - property="impactSoftwareQuality" + property="impactSoftwareQualities" itemNamePrefix="issue.software_quality" listItems={QUALITIES} selectedItems={qualities} 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 f2aad1fba96..1056bcf7583 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 @@ -32,9 +32,9 @@ it('should render correct facets for Application', () => { renderSidebar({ component: mockComponent({ qualifier: ComponentQualifier.Application }) }); expect(screen.getAllByRole('button').map((button) => button.textContent)).toStrictEqual([ - 'issues.facet.cleanCodeAttributeCategory', - 'issues.facet.impactSoftwareQuality', - 'issues.facet.impactSeveritytooltip_is_interactiveissues.facet.impactSeverity.help.line1issues.facet.impactSeverity.help.line2opens_in_new_windowlearn_more', + 'issues.facet.cleanCodeAttributeCategories', + 'issues.facet.impactSoftwareQualities', + 'issues.facet.impactSeveritiestooltip_is_interactiveissues.facet.impactSeverities.help.line1issues.facet.impactSeverities.help.line2opens_in_new_windowlearn_more', 'issues.facet.types', 'issues.facet.scopes', 'issues.facet.resolutions', @@ -55,9 +55,9 @@ it('should render correct facets for Portfolio', () => { renderSidebar({ component: mockComponent({ qualifier: ComponentQualifier.Portfolio }) }); expect(screen.getAllByRole('button').map((button) => button.textContent)).toStrictEqual([ - 'issues.facet.cleanCodeAttributeCategory', - 'issues.facet.impactSoftwareQuality', - 'issues.facet.impactSeveritytooltip_is_interactiveissues.facet.impactSeverity.help.line1issues.facet.impactSeverity.help.line2opens_in_new_windowlearn_more', + 'issues.facet.cleanCodeAttributeCategories', + 'issues.facet.impactSoftwareQualities', + 'issues.facet.impactSeveritiestooltip_is_interactiveissues.facet.impactSeverities.help.line1issues.facet.impactSeverities.help.line2opens_in_new_windowlearn_more', 'issues.facet.types', 'issues.facet.scopes', 'issues.facet.resolutions', @@ -78,9 +78,9 @@ it('should render correct facets for SubPortfolio', () => { renderSidebar({ component: mockComponent({ qualifier: ComponentQualifier.SubPortfolio }) }); expect(screen.getAllByRole('button').map((button) => button.textContent)).toStrictEqual([ - 'issues.facet.cleanCodeAttributeCategory', - 'issues.facet.impactSoftwareQuality', - 'issues.facet.impactSeveritytooltip_is_interactiveissues.facet.impactSeverity.help.line1issues.facet.impactSeverity.help.line2opens_in_new_windowlearn_more', + 'issues.facet.cleanCodeAttributeCategories', + 'issues.facet.impactSoftwareQualities', + 'issues.facet.impactSeveritiestooltip_is_interactiveissues.facet.impactSeverities.help.line1issues.facet.impactSeverities.help.line2opens_in_new_windowlearn_more', 'issues.facet.types', 'issues.facet.scopes', 'issues.facet.resolutions', diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/SimpleListStyleFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/SimpleListStyleFacet-test.tsx index 35b4dbf5c16..35890aa9839 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/SimpleListStyleFacet-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/SimpleListStyleFacet-test.tsx @@ -27,7 +27,7 @@ import { SimpleListStyleFacet } from '../SimpleListStyleFacet'; it('handles single & multiple selections', async () => { const user = userEvent.setup(); - renderSidebar(); + renderSimpleListStyleFacet(); const firstCheckbox = byRole('checkbox', { name: 'prefix.first' }).get(); const secondCheckbox = byRole('checkbox', { name: 'prefix.second' }).get(); @@ -52,7 +52,7 @@ it('handles single & multiple selections', async () => { expect(secondCheckbox).not.toBeChecked(); }); -function renderSidebar(props: Partial<FCProps<typeof SimpleListStyleFacet>> = {}) { +function renderSimpleListStyleFacet(props: Partial<FCProps<typeof SimpleListStyleFacet>> = {}) { function Wrapper(props: Partial<FCProps<typeof SimpleListStyleFacet>> = {}) { const [selectedItems, setItems] = React.useState<string[]>([]); @@ -62,12 +62,12 @@ function renderSidebar(props: Partial<FCProps<typeof SimpleListStyleFacet>> = {} fetching={false} needIssueSync={false} onToggle={jest.fn()} - property="impactSeverity" + property="impactSeverities" itemNamePrefix="prefix" listItems={['first', 'second', 'third']} stats={{ first: 1, second: 2 }} {...props} - onChange={(query) => setItems(query.impactSeverity ?? [])} + onChange={(query) => setItems(query.impactSeverities ?? [])} selectedItems={selectedItems} /> ); 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 6fba1751ba3..0079ffca4b2 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 @@ -78,15 +78,15 @@ export const ui = { tagFacet: byRole('button', { name: 'issues.facet.tags' }), typeFacet: byRole('button', { name: 'issues.facet.types' }), cleanCodeAttributeCategoryFacet: byRole('button', { - name: 'issues.facet.cleanCodeAttributeCategory', + name: 'issues.facet.cleanCodeAttributeCategories', }), softwareQualityFacet: byRole('button', { - name: 'issues.facet.impactSoftwareQuality', + name: 'issues.facet.impactSoftwareQualities', }), - severityFacet: byRole('button', { name: 'issues.facet.impactSeverity' }), + severityFacet: byRole('button', { name: 'issues.facet.impactSeverities' }), - clearCodeCategoryFacet: byTestId('clear-issues.facet.cleanCodeAttributeCategory'), - clearSoftwareQualityFacet: byTestId('clear-issues.facet.impactSoftwareQuality'), + clearCodeCategoryFacet: byTestId('clear-issues.facet.cleanCodeAttributeCategories'), + clearSoftwareQualityFacet: byTestId('clear-issues.facet.impactSoftwareQualities'), clearAssigneeFacet: byTestId('clear-issues.facet.assignees'), clearAuthorFacet: byTestId('clear-issues.facet.authors'), clearCodeVariantsFacet: byTestId('clear-issues.facet.codeVariants'), @@ -96,7 +96,7 @@ export const ui = { clearResolutionFacet: byTestId('clear-issues.facet.resolutions'), clearRuleFacet: byTestId('clear-issues.facet.rules'), clearScopeFacet: byTestId('clear-issues.facet.scopes'), - clearSeverityFacet: byTestId('clear-issues.facet.impactSeverity'), + clearSeverityFacet: byTestId('clear-issues.facet.impactSeverities'), clearStatusFacet: byTestId('clear-issues.facet.statuses'), clearTagFacet: byTestId('clear-issues.facet.tags'), 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 e2344d58013..83a0507cc38 100644 --- a/server/sonar-web/src/main/js/apps/issues/utils.ts +++ b/server/sonar-web/src/main/js/apps/issues/utils.ts @@ -51,7 +51,7 @@ export interface Query { assigned: boolean; assignees: string[]; author: string[]; - cleanCodeAttributeCategory: CleanCodeAttributeCategory[]; + cleanCodeAttributeCategories: CleanCodeAttributeCategory[]; codeVariants: string[]; createdAfter: Date | undefined; createdAt: string; @@ -60,8 +60,8 @@ export interface Query { cwe: string[]; directories: string[]; files: string[]; - impactSeverity: SoftwareImpactSeverity[]; - impactSoftwareQuality: SoftwareQuality[]; + impactSeverities: SoftwareImpactSeverity[]; + impactSoftwareQualities: SoftwareQuality[]; issues: string[]; languages: string[]; owaspTop10: string[]; @@ -95,8 +95,8 @@ export function parseQuery(query: RawQuery): Query { assigned: parseAsBoolean(query.assigned), assignees: parseAsArray(query.assignees, parseAsString), author: isArray(query.author) ? query.author : [query.author].filter(isDefined), - cleanCodeAttributeCategory: parseAsArray<CleanCodeAttributeCategory>( - query.cleanCodeAttributeCategory, + cleanCodeAttributeCategories: parseAsArray<CleanCodeAttributeCategory>( + query.cleanCodeAttributeCategories, parseAsString ), createdAfter: parseAsDate(query.createdAfter), @@ -106,9 +106,9 @@ export function parseQuery(query: RawQuery): Query { cwe: parseAsArray(query.cwe, parseAsString), directories: parseAsArray(query.directories, parseAsString), files: parseAsArray(query.files, parseAsString), - impactSeverity: parseImpactSeverityQuery(query.impactSeverity, query.severities), - impactSoftwareQuality: parseAsArray<SoftwareQuality>( - query.impactSoftwareQuality, + impactSeverities: parseImpactSeverityQuery(query.impactSeverities, query.severities), + impactSoftwareQualities: parseAsArray<SoftwareQuality>( + query.impactSoftwareQualities, parseAsString ), inNewCodePeriod: parseAsBoolean(query.inNewCodePeriod, false), @@ -174,7 +174,7 @@ export function serializeQuery(query: Query): RawQuery { assigned: query.assigned ? undefined : 'false', assignees: serializeStringArray(query.assignees), author: query.author, - cleanCodeAttributeCategory: serializeStringArray(query.cleanCodeAttributeCategory), + cleanCodeAttributeCategories: serializeStringArray(query.cleanCodeAttributeCategories), createdAfter: serializeDateShort(query.createdAfter), createdAt: serializeString(query.createdAt), createdBefore: serializeDateShort(query.createdBefore), @@ -197,8 +197,8 @@ export function serializeQuery(query: Query): RawQuery { s: serializeString(query.sort), scopes: serializeStringArray(query.scopes), severities: undefined, - impactSeverity: serializeStringArray(query.impactSeverity), - impactSoftwareQuality: serializeStringArray(query.impactSoftwareQuality), + impactSeverities: serializeStringArray(query.impactSeverities), + impactSoftwareQualities: serializeStringArray(query.impactSoftwareQualities), inNewCodePeriod: query.inNewCodePeriod ? 'true' : undefined, sonarsourceSecurity: serializeStringArray(query.sonarsourceSecurity), statuses: serializeStringArray(query.statuses), diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/__snapshots__/loadIssues-test.ts.snap b/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/__snapshots__/loadIssues-test.ts.snap index 698b7a9aab1..20f82563531 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/__snapshots__/loadIssues-test.ts.snap +++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/__snapshots__/loadIssues-test.ts.snap @@ -10,8 +10,6 @@ exports[`loadIssues should load issues with listIssues if re-indexing 1`] = ` ], "assignee": "luke", "author": "luke@sonarsource.com", - "cleanCodeAttribute": "LAWFUL", - "cleanCodeAttributeCategory": "RESPONSIBLE", "comments": [], "component": "foo.java", "componentEnabled": true, @@ -24,12 +22,6 @@ exports[`loadIssues should load issues with listIssues if re-indexing 1`] = ` "flows": [], "flowsWithType": [], "hash": "78417dcee7ba927b7e7c9161e29e02b8", - "impacts": [ - { - "severity": "HIGH", - "softwareQuality": "MAINTAINABILITY", - }, - ], "key": "AWaqVGl3tut9VbnJvk6M", "line": 62, "message": "Make sure this file handling is safe here.", @@ -75,8 +67,6 @@ exports[`loadIssues should load issues with searchIssues if not re-indexing 1`] "assigneeLogin": "luke", "assigneeName": "Luke", "author": "luke@sonarsource.com", - "cleanCodeAttribute": "LAWFUL", - "cleanCodeAttributeCategory": "RESPONSIBLE", "comments": [], "component": "foo.java", "componentEnabled": true, @@ -89,12 +79,6 @@ exports[`loadIssues should load issues with searchIssues if not re-indexing 1`] "flows": [], "flowsWithType": [], "hash": "78417dcee7ba927b7e7c9161e29e02b8", - "impacts": [ - { - "severity": "HIGH", - "softwareQuality": "MAINTAINABILITY", - }, - ], "key": "AWaqVGl3tut9VbnJvk6M", "line": 62, "message": "Make sure this file handling is safe here.", diff --git a/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx b/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx index 50bce2d40af..b99f1ced825 100644 --- a/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx +++ b/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx @@ -59,7 +59,7 @@ describe('rendering', () => { expect(ui.effort('2 days').get()).toBeInTheDocument(); expect(ui.issueMessageLink.get()).toHaveAttribute( 'href', - '/issues?scopes=MAIN&impactSeverities=MINOR&types=VULNERABILITY&open=AVsae-CQS-9G3txfbFN2' + '/issues?scopes=MAIN&impactSeverities=LOW&types=VULNERABILITY&open=AVsae-CQS-9G3txfbFN2' ); await ui.clickIssueMessage(); @@ -411,7 +411,7 @@ function renderIssue( } return renderAppRoutes( - 'issues?scopes=MAIN&impactSeverity=LOW&types=VULNERABILITY', + 'issues?scopes=MAIN&impactSeverities=LOW&types=VULNERABILITY', () => ( <Route path="issues" diff --git a/server/sonar-web/src/main/js/helpers/issues.ts b/server/sonar-web/src/main/js/helpers/issues.ts index eaf21e703c3..7572276d6c4 100644 --- a/server/sonar-web/src/main/js/helpers/issues.ts +++ b/server/sonar-web/src/main/js/helpers/issues.ts @@ -19,14 +19,7 @@ */ import { BugIcon, CodeSmellIcon, SecurityHotspotIcon, VulnerabilityIcon } from 'design-system'; import { flatten, sortBy } from 'lodash'; -import { - CleanCodeAttribute, - CleanCodeAttributeCategory, - IssueType, - RawIssue, - SoftwareImpactSeverity, - SoftwareQuality, -} from '../types/issues'; +import { IssueType, RawIssue } from '../types/issues'; import { MetricKey } from '../types/metrics'; import { Dict, Flow, FlowLocation, FlowType, Issue, TextRange } from '../types/types'; import { UserBase } from '../types/users'; @@ -167,15 +160,6 @@ export function parseIssueFromResponse( ...splitFlows(issue, components), ...prepareClosed(issue), ...ensureTextRange(issue), - cleanCodeAttributeCategory: - issue.cleanCodeAttributeCategory || CleanCodeAttributeCategory.Responsible, - cleanCodeAttribute: issue.cleanCodeAttribute || CleanCodeAttribute.Lawful, - impacts: issue.impacts || [ - { - softwareQuality: SoftwareQuality.Maintainability, - severity: SoftwareImpactSeverity.High, - }, - ], } as Issue; } diff --git a/server/sonar-web/src/main/js/helpers/mocks/issues.ts b/server/sonar-web/src/main/js/helpers/mocks/issues.ts index b5d6fef9ddd..86a151ce234 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/issues.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/issues.ts @@ -81,7 +81,7 @@ export function mockQuery(overrides: Partial<Query> = {}): Query { assigned: false, assignees: [], author: [], - cleanCodeAttributeCategory: [], + cleanCodeAttributeCategories: [], codeVariants: [], createdAfter: undefined, createdAt: '', @@ -104,8 +104,8 @@ export function mockQuery(overrides: Partial<Query> = {}): Query { rules: [], scopes: [], severities: [], - impactSeverity: [], - impactSoftwareQuality: [], + impactSeverities: [], + impactSoftwareQualities: [], inNewCodePeriod: false, sonarsourceSecurity: [], sort: '', |