]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-12407 Do not disable facets with 0 results
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Tue, 22 Dec 2020 14:37:26 +0000 (15:37 +0100)
committersonartech <sonartech@sonarsource.com>
Mon, 4 Jan 2021 20:14:29 +0000 (20:14 +0000)
server/sonar-web/src/main/js/apps/coding-rules/components/Facet.tsx
server/sonar-web/src/main/js/apps/issues/sidebar/ResolutionFacet.tsx
server/sonar-web/src/main/js/apps/issues/sidebar/ScopeFacet.tsx
server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.tsx
server/sonar-web/src/main/js/apps/issues/sidebar/StatusFacet.tsx
server/sonar-web/src/main/js/apps/issues/sidebar/TypeFacet.tsx
server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/ScopeFacet-test.tsx.snap
server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/StatusFacet-test.tsx.snap
server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/TypeFacet-test.tsx.snap
server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx

index f5f9dbd741f970bc37405ad82897e7fcc0e76a6c..2b37791cb477b1c0093d970c031e15a85e0b0a98 100644 (file)
@@ -81,7 +81,6 @@ export default class Facet extends React.PureComponent<Props> {
     return (
       <FacetItem
         active={active}
-        disabled={stat === 0 && !active}
         halfWidth={this.props.halfWidth}
         key={value}
         name={renderName(value)}
index 6bae4439cf158e8c08c42b7a0e83e4fe36cf84bd..c531b5067d096930d367b0e2f59480d35cd6c117 100644 (file)
@@ -95,7 +95,6 @@ export default class ResolutionFacet extends React.PureComponent<Props> {
     return (
       <FacetItem
         active={active}
-        disabled={stat === 0 && !active}
         halfWidth={true}
         key={resolution}
         name={this.getFacetItemName(resolution)}
index 301a3c266dfc535295d4e0df01106351651f1a23..0cc9c879f0bebc12902377c386f19b6c00e529f1 100644 (file)
@@ -63,7 +63,6 @@ export default function ScopeFacet(props: ScopeFacetProps) {
               return (
                 <FacetItem
                   active={active}
-                  disabled={stat === 0 && !active}
                   key={scope}
                   name={
                     <span className="display-flex-center">
index 15e7530a135cf23d76d77ffcbf525cc896dfc681..0092ee39e0ab2af52b4c8ada5f4096529830ba7a 100644 (file)
@@ -80,7 +80,6 @@ export default class SeverityFacet extends React.PureComponent<Props> {
     return (
       <FacetItem
         active={active}
-        disabled={stat === 0 && !active}
         halfWidth={true}
         key={severity}
         name={<SeverityHelper severity={severity} />}
index 1f6d66bb6108034fa05de70dde94edc0c42d5ba7..6ff6c004b185d2798c7b37adda8b692919b82448 100644 (file)
@@ -78,7 +78,6 @@ export default class StatusFacet extends React.PureComponent<Props> {
     return (
       <FacetItem
         active={active}
-        disabled={stat === 0 && !active}
         halfWidth={true}
         key={status}
         name={<StatusHelper resolution={undefined} status={status} />}
index f7513f5879fc39633c71197c5a064a893fb3d2a6..81326fc2b638e3c94b6cabfe1c450b7983e3cdca 100644 (file)
@@ -83,7 +83,6 @@ export default class TypeFacet extends React.PureComponent<Props> {
     return (
       <FacetItem
         active={active}
-        disabled={stat === 0 && !active}
         key={type}
         name={
           <span className="display-flex-center">
index ca871a44fa6a3cacbfd1d639120e0fe9b80c3421..dab4fe20f21204f8e02159f9efe35c596b2e36e3 100644 (file)
@@ -97,7 +97,7 @@ exports[`should render correctly: disabled facet 1`] = `
   <FacetItemsList>
     <FacetItem
       active={false}
-      disabled={true}
+      disabled={false}
       halfWidth={false}
       key="MAIN"
       loading={false}
index 8a01c4c8a2a9b0ab412a9842cabaf2fbeba8e734..3b51ae596a60abf166d3240c392e192a04179160 100644 (file)
@@ -47,7 +47,7 @@ exports[`should render correctly 1`] = `
     />
     <FacetItem
       active={false}
-      disabled={true}
+      disabled={false}
       halfWidth={true}
       key="REOPENED"
       loading={false}
@@ -63,7 +63,7 @@ exports[`should render correctly 1`] = `
     />
     <FacetItem
       active={false}
-      disabled={true}
+      disabled={false}
       halfWidth={true}
       key="RESOLVED"
       loading={false}
index 534929cfa434cf088838322893ebbee8f1e1470a..c71e13dc2cd685e33dcb49d508d58327a9d55c9d 100644 (file)
@@ -20,7 +20,7 @@ exports[`should render open by default 1`] = `
   <FacetItemsList>
     <FacetItem
       active={false}
-      disabled={true}
+      disabled={false}
       halfWidth={false}
       key="BUG"
       loading={false}
index 70ab5b12cbb5c2bf2b650bc63d29c0cec8035f32..76c0d7b0736c0596919217eca121f3b672e790a4 100644 (file)
@@ -314,10 +314,6 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
   }
 
   renderSearch() {
-    if (!this.props.stats || !Object.keys(this.props.stats).length) {
-      return null;
-    }
-
     return (
       <SearchBox
         autoFocus={this.state.autoFocus}
@@ -370,11 +366,9 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
     const key = this.props.getSearchResultKey(result);
     const active = this.props.values.includes(key);
     const stat = this.getStat(key) || this.state.searchResultsCounts[key];
-    const disabled = !active && stat === 0;
     return (
       <FacetItem
         active={active}
-        disabled={disabled}
         key={key}
         name={this.props.renderSearchResult(result, this.state.query)}
         onClick={this.handleItemClick}