diff options
author | Pascal Mugnier <pascal.mugnier@sonarsource.com> | 2018-06-21 11:08:48 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2018-06-29 09:10:16 +0200 |
commit | e5827b3671013c14776ca189e400e3687bfa0983 (patch) | |
tree | 74bbf5d4f5bd10c1c214c7252b349df31137ce52 /server/sonar-web/src/main/js/apps/overview/components | |
parent | f94bc6f1b9be3b9180aef88abe1804b4aaaa194a (diff) | |
download | sonarqube-e5827b3671013c14776ca189e400e3687bfa0983.tar.gz sonarqube-e5827b3671013c14776ca189e400e3687bfa0983.zip |
SONAR-10813 Add project branches
Diffstat (limited to 'server/sonar-web/src/main/js/apps/overview/components')
3 files changed, 22 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/components/ApplicationLeakPeriodLegend.tsx b/server/sonar-web/src/main/js/apps/overview/components/ApplicationLeakPeriodLegend.tsx index eb230682fcb..0ac7464bcb3 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/ApplicationLeakPeriodLegend.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/ApplicationLeakPeriodLegend.tsx @@ -25,9 +25,11 @@ import DateTooltipFormatter from '../../../components/intl/DateTooltipFormatter' import { getApplicationLeak } from '../../../api/application'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import DateFromNow from '../../../components/intl/DateFromNow'; +import { LightComponent, LongLivingBranch } from '../../../app/types'; interface Props { - component: string; + branch?: LongLivingBranch; + component: LightComponent; } interface State { @@ -44,7 +46,7 @@ export default class ApplicationLeakPeriodLegend extends React.Component<Props, } componentWillReceiveProps(nextProps: Props) { - if (nextProps.component !== this.props.component) { + if (nextProps.component.key !== this.props.component.key) { this.setState({ leaks: undefined }); } } @@ -55,7 +57,10 @@ export default class ApplicationLeakPeriodLegend extends React.Component<Props, fetchLeaks = () => { if (!this.state.leaks) { - getApplicationLeak(this.props.component).then( + getApplicationLeak( + this.props.component.key, + this.props.branch ? this.props.branch.name : undefined + ).then( leaks => { if (this.mounted) { this.setState({ diff --git a/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.tsx b/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.tsx index 68a7d1bbb1d..df32445c412 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.tsx @@ -43,7 +43,11 @@ import { PROJECT_ACTIVITY_GRAPH, PROJECT_ACTIVITY_GRAPH_CUSTOM } from '../../projectActivity/utils'; -import { isSameBranchLike, getBranchLikeQuery } from '../../../helpers/branches'; +import { + isSameBranchLike, + getBranchLikeQuery, + isLongLivingBranch +} from '../../../helpers/branches'; import { fetchMetrics } from '../../../store/rootActions'; import { getMetrics } from '../../../store/rootReducer'; import { BranchLike, Component, Metric } from '../../../app/types'; @@ -213,7 +217,10 @@ export class OverviewApp extends React.PureComponent<Props, State> { return ( <div className="overview-main page-main"> {component.qualifier === 'APP' ? ( - <ApplicationQualityGate component={component} /> + <ApplicationQualityGate + branch={isLongLivingBranch(branchLike) ? branchLike : undefined} + component={component} + /> ) : ( <QualityGate branchLike={branchLike} component={component} measures={measures} /> )} diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/ApplicationLeakPeriodLegend-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/ApplicationLeakPeriodLegend-test.tsx index 27a71ac1851..1dba9c67b4b 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/ApplicationLeakPeriodLegend-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/ApplicationLeakPeriodLegend-test.tsx @@ -32,7 +32,11 @@ jest.mock('../../../../api/application', () => ({ })); it('renders', async () => { - const wrapper = shallow(<ApplicationLeakPeriodLegend component="foo" />); + const wrapper = shallow( + <ApplicationLeakPeriodLegend + component={{ key: 'foo', organization: 'bar', qualifier: 'APP' }} + /> + ); expect(wrapper).toMatchSnapshot(); await waitAndUpdate(wrapper); |