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/sidebar | |
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/sidebar')
-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 |
3 files changed, 28 insertions, 29 deletions
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', |