]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10159 display sub-portfolios before projects
authorStas Vilchik <stas.vilchik@sonarsource.com>
Tue, 5 Dec 2017 16:02:00 +0000 (17:02 +0100)
committerStas Vilchik <stas.vilchik@sonarsource.com>
Mon, 11 Dec 2017 08:41:15 +0000 (09:41 +0100)
server/sonar-web/src/main/js/apps/portfolio/components/App.tsx
server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx

index ec7f35fc0b2efaba65c66c13ea09459d119da320..3ca9185e50c7cdb78777c0748072f0fb8a6ab5eb 100644 (file)
@@ -26,12 +26,12 @@ import ReliabilityBox from './ReliabilityBox';
 import SecurityBox from './SecurityBox';
 import MaintainabilityBox from './MaintainabilityBox';
 import Activity from './Activity';
+import { SubComponent } from '../types';
+import { PORTFOLIO_METRICS, SUB_COMPONENTS_METRICS, convertMeasures } from '../utils';
 import { getMeasures } from '../../../api/measures';
 import { getChildren } from '../../../api/components';
-import { PORTFOLIO_METRICS, SUB_COMPONENTS_METRICS, convertMeasures } from '../utils';
-import { SubComponent } from '../types';
-import '../styles.css';
 import { translate } from '../../../helpers/l10n';
+import '../styles.css';
 
 interface Props {
   component: { key: string; name: string };
@@ -75,7 +75,7 @@ export default class App extends React.PureComponent<Props, State> {
     this.setState({ loading: true });
     Promise.all([
       getMeasures(this.props.component.key, PORTFOLIO_METRICS),
-      getChildren(this.props.component.key, SUB_COMPONENTS_METRICS, { ps: 20 })
+      getChildren(this.props.component.key, SUB_COMPONENTS_METRICS, { ps: 20, s: 'qualifier' })
     ]).then(
       ([measures, subComponents]) => {
         if (this.mounted) {
@@ -98,10 +98,9 @@ export default class App extends React.PureComponent<Props, State> {
     );
   }
 
-  isEmpty = () => this.state.measures == undefined || this.state.measures['ncloc'] == undefined;
+  isEmpty = () => !this.state.measures || !this.state.measures['ncloc'];
 
-  isNotComputed = () =>
-    this.state.measures && this.state.measures['reliability_rating'] == undefined;
+  isNotComputed = () => this.state.measures && !this.state.measures['reliability_rating'];
 
   renderSpinner() {
     return (
@@ -151,8 +150,8 @@ export default class App extends React.PureComponent<Props, State> {
           <MaintainabilityBox component={component.key} measures={measures!} />
         </div>
 
-        {subComponents != undefined &&
-        totalSubComponents != undefined && (
+        {subComponents !== undefined &&
+        totalSubComponents !== undefined && (
           <WorstProjects
             component={component.key}
             subComponents={subComponents}
index e9c93fb7279ec5c75446815a7ac2d4d21ced2c98..6d6919373669851f2978c2a7d3d20cbafdd71d00 100644 (file)
@@ -101,6 +101,6 @@ it('fetches measures and children components', () => {
       'sqale_rating',
       'alert_status'
     ],
-    { ps: 20 }
+    { ps: 20, s: 'qualifier' }
   );
 });