From: Stas Vilchik Date: Tue, 27 Mar 2018 08:33:05 +0000 (+0200) Subject: SONAR-10221 Change message when project main branch is not analyzed (#3164) X-Git-Tag: 6.7.3~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=917359a23040adb556e0bfac2b3659d2f35706ab;p=sonarqube.git SONAR-10221 Change message when project main branch is not analyzed (#3164) --- diff --git a/server/sonar-web/src/main/js/apps/overview/components/App.js b/server/sonar-web/src/main/js/apps/overview/components/App.js index 8ce26596388..29235f1ed76 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/App.js +++ b/server/sonar-web/src/main/js/apps/overview/components/App.js @@ -28,6 +28,7 @@ import { getProjectBranchUrl, getCodeUrl } from '../../../helpers/urls'; /*:: type Props = { branch?: { name: string }, + branches: Array<*>, component: { analysisDate?: string, breadcrumbs: Array<{ key: string }>, @@ -75,14 +76,19 @@ export default class App extends React.PureComponent { } render() { - const { branch, component } = this.props; + const { branch, branches, component } = this.props; if (this.isPortfolio() || this.isFile() || isShortLivingBranch(branch)) { return null; } if (!component.analysisDate) { - return ; + return ( + 1} + /> + ); } return ( diff --git a/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.js b/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.js index f89d83cf480..a3bf2cd7872 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.js +++ b/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.js @@ -20,33 +20,53 @@ // @flow import React from 'react'; import { Link } from 'react-router'; +import { FormattedMessage } from 'react-intl'; import { translate } from '../../../helpers/l10n'; /*:: type Props = { - component: { key: string } + component: { key: string }, + hasBranches: bool }; */ -export default function EmptyOverview({ component } /*: Props */) { +export default function EmptyOverview({ component, hasBranches } /*: Props */) { const rawMessage = translate('provisioning.no_analysis.delete'); const head = rawMessage.substr(0, rawMessage.indexOf('{0}')); const tail = rawMessage.substr(rawMessage.indexOf('{0}') + 3); return (
-
{translate('provisioning.no_analysis')}
- -
- {head} - - {translate('provisioning.no_analysis.delete_project')} - - {tail} +
+ {hasBranches ? ( + + {translate('branches.main_branch')} +
+ ) + }} + /> + ) : ( + translate('provisioning.no_analysis') + )}
+ {!hasBranches && ( +
+ {head} + + {translate('provisioning.no_analysis.delete_project')} + + {tail} +
+ )} +

{translate('key')}

{component.key} diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.js b/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.js index f163dc8a969..9c959e11246 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.js +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.js @@ -21,12 +21,18 @@ import React from 'react'; import { shallow } from 'enzyme'; import EmptyOverview from '../EmptyOverview'; +const component = { + id: 'id', + key: 'abcd', + analysisDate: '2016-01-01' +}; + it('should render component key', () => { - const component = { - id: 'id', - key: 'abcd', - analysisDate: '2016-01-01' - }; const output = shallow(); expect(output.find('code').text()).toBe('abcd'); }); + +it('should render another message when there are branches', () => { + const wrapper = shallow(); + expect(wrapper).toMatchSnapshot(); +}); diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/EmptyOverview-test.js.snap b/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/EmptyOverview-test.js.snap new file mode 100644 index 00000000000..d4eb72e7513 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/EmptyOverview-test.js.snap @@ -0,0 +1,35 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render another message when there are branches 1`] = ` +
+
+ + branches.main_branch +
, + } + } + /> +
+
+

+ key +

+ + abcd + +
+
+`; diff --git a/server/sonar-web/src/main/less/init/type.less b/server/sonar-web/src/main/less/init/type.less index 643a52789a9..ac022e64f7c 100644 --- a/server/sonar-web/src/main/less/init/type.less +++ b/server/sonar-web/src/main/less/init/type.less @@ -161,6 +161,9 @@ small, .text-text-bottom { vertical-align: text-bottom !important; } +.text-baseline { + vertical-align: baseline !important; +} // Overflow diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index b70c333d508..2ee56009dfa 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -1396,6 +1396,7 @@ provisioning.no_analysis.delete=Either you should retry analysis or simply {0}. provisioning.no_analysis.delete_project=delete the project provisioning.only_provisioned=Only Provisioned provisioning.only_provisioned.tooltip=Provisioned projects are projects that have been created, but have not been analyzed yet. +provisioning.no_analysis_on_main_branch={branch} has not been analyzed yet. #------------------------------------------------------------------------------