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/sonar-web/src/main/js/apps | |
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/sonar-web/src/main/js/apps')
10 files changed, 61 insertions, 61 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 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), |