]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-14483 Don't show new code filter on issues page for portfolios
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Mon, 22 Feb 2021 11:30:21 +0000 (12:30 +0100)
committersonartech <sonartech@sonarsource.com>
Tue, 23 Feb 2021 20:07:26 +0000 (20:07 +0000)
server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx
server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/CreationDateFacet-test.tsx
server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/__snapshots__/CreationDateFacet-test.tsx.snap

index 4c7b00194a71d5091d6e927876e7ccde28dc0315..b05c71c38d3dfed7dc94ed7444f8cf86db764a1c 100644 (file)
@@ -34,6 +34,7 @@ import DateRangeInput from '../../../components/controls/DateRangeInput';
 import FacetBox from '../../../components/facet/FacetBox';
 import FacetHeader from '../../../components/facet/FacetHeader';
 import FacetItem from '../../../components/facet/FacetItem';
+import { isPortfolioLike } from '../../../types/component';
 import { Query } from '../utils';
 
 interface Props {
@@ -229,7 +230,7 @@ export class CreationDateFacet extends React.PureComponent<Props & InjectedIntlP
           tooltip={translate('issues.facet.createdAt.all')}
           value=""
         />
-        {component ? (
+        {component && !isPortfolioLike(component.qualifier) ? (
           <FacetItem
             active={sinceLeakPeriod}
             name={translate('issues.new_code')}
index ee3978c0934608c06b38447f6a7d63a55e0ce430..a03b532f38f0784ca8e9a1ce2f85b0ac0127f0de 100644 (file)
@@ -21,6 +21,7 @@ import { shallow } from 'enzyme';
 import * as React from 'react';
 import { InjectedIntlProps } from 'react-intl';
 import { mockComponent } from '../../../../helpers/testMocks';
+import { ComponentQualifier } from '../../../../types/component';
 import { CreationDateFacet } from '../CreationDateFacet';
 
 it('should render correctly', () => {
@@ -40,6 +41,9 @@ it('should render correctly', () => {
     })
   ).toMatchSnapshot('created after timestamp');
   expect(shallowRender({ component: mockComponent() })).toMatchSnapshot('project');
+  expect(
+    shallowRender({ component: mockComponent({ qualifier: ComponentQualifier.Portfolio }) })
+  ).toMatchSnapshot('portfolio');
 });
 
 it.each([
index e073a3a2358b3e90c5f9962188e453157d59688d..d3936e2f771cc578839ec52cd1381521ff12fd5b 100644 (file)
@@ -357,6 +357,80 @@ exports[`should render correctly: created at 1`] = `
 </FacetBox>
 `;
 
+exports[`should render correctly: portfolio 1`] = `
+<FacetBox
+  property="createdAt"
+>
+  <FacetHeader
+    fetching={false}
+    name="issues.facet.createdAt"
+    onClear={[Function]}
+    onClick={[Function]}
+    open={true}
+    values={Array []}
+  />
+  <div>
+    <div
+      className="search-navigator-date-facet-selection"
+    >
+      <DateRangeInput
+        onChange={[Function]}
+        value={
+          Object {
+            "from": undefined,
+            "to": undefined,
+          }
+        }
+      />
+    </div>
+    <div
+      className="spacer-top issues-predefined-periods"
+    >
+      <FacetItem
+        active={true}
+        disabled={false}
+        halfWidth={false}
+        loading={false}
+        name="issues.facet.createdAt.all"
+        onClick={[Function]}
+        tooltip="issues.facet.createdAt.all"
+        value=""
+      />
+      <FacetItem
+        active={false}
+        disabled={false}
+        halfWidth={false}
+        loading={false}
+        name="issues.facet.createdAt.last_week"
+        onClick={[Function]}
+        tooltip="issues.facet.createdAt.last_week"
+        value="1w"
+      />
+      <FacetItem
+        active={false}
+        disabled={false}
+        halfWidth={false}
+        loading={false}
+        name="issues.facet.createdAt.last_month"
+        onClick={[Function]}
+        tooltip="issues.facet.createdAt.last_month"
+        value="1m"
+      />
+      <FacetItem
+        active={false}
+        disabled={false}
+        halfWidth={false}
+        loading={false}
+        name="issues.facet.createdAt.last_year"
+        onClick={[Function]}
+        tooltip="issues.facet.createdAt.last_year"
+        value="1y"
+      />
+    </div>
+  </div>
+</FacetBox>
+`;
+
 exports[`should render correctly: project 1`] = `
 <FacetBox
   property="createdAt"