aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-12-05 17:02:00 +0100
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-12-11 09:41:15 +0100
commitdda0900b46b558e6cfe0479552852fc5c9456a22 (patch)
tree34aa8c2733606a1805da52ba175515b6e63c01c8
parent3989df8e94179f2e580db01eb7ed492dc120d596 (diff)
downloadsonarqube-dda0900b46b558e6cfe0479552852fc5c9456a22.tar.gz
sonarqube-dda0900b46b558e6cfe0479552852fc5c9456a22.zip
SONAR-10159 display sub-portfolios before projects
-rw-r--r--server/sonar-web/src/main/js/apps/portfolio/components/App.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx2
2 files changed, 9 insertions, 10 deletions
diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx
index ec7f35fc0b2..3ca9185e50c 100644
--- a/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx
@@ -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}
diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx
index e9c93fb7279..6d691937366 100644
--- a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx
@@ -101,6 +101,6 @@ it('fetches measures and children components', () => {
'sqale_rating',
'alert_status'
],
- { ps: 20 }
+ { ps: 20, s: 'qualifier' }
);
});