Browse Source

SONAR-15033 Adding compilation info box

tags/9.0.0.45539
Mathieu Suen 3 years ago
parent
commit
38352a0684

+ 66
- 0
server/sonar-web/src/main/js/components/tutorials/components/CompilationInfo.tsx View File

@@ -0,0 +1,66 @@
/*
* SonarQube
* Copyright (C) 2009-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { Alert } from 'sonar-ui-common/components/ui/Alert';
import { translate } from 'sonar-ui-common/helpers/l10n';

export interface CompilationInfoProps {
className?: string;
}

export function CompilationInfo({ className = 'spacer-top spacer-bottom' }: CompilationInfoProps) {
return (
<Alert className={className} variant="info">
<p className="spacer-bottom">
<FormattedMessage
id="onboarding.tutorial.cfamilly.compilation_database_info"
defaultMessage={translate('onboarding.tutorial.cfamilly.compilation_database_info')}
values={{
link: (
<a
href="/documentation/analysis/languages/cfamily/"
rel="noopener noreferrer"
target="_blank">
{translate('onboarding.tutorial.cfamilly.compilation_database_info.link')}
</a>
)
}}
/>
</p>
<p>
<FormattedMessage
id="onboarding.tutorial.cfamilly.speed_caching"
defaultMessage={translate('onboarding.tutorial.cfamilly.speed_caching')}
values={{
link: (
<a
href="/documentation/analysis/languages/cfamily/#analysis-cache"
rel="noopener noreferrer"
target="_blank">
{translate('onboarding.tutorial.cfamilly.speed_caching.link')}
</a>
)
}}
/>
</p>
</Alert>
);
}

+ 30
- 0
server/sonar-web/src/main/js/components/tutorials/components/__tests__/CompilationInfo-test.tsx View File

@@ -0,0 +1,30 @@
/*
* SonarQube
* Copyright (C) 2009-2021 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { shallow } from 'enzyme';
import * as React from 'react';
import { CompilationInfo } from '../CompilationInfo';

it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot();
});

function shallowRender() {
return shallow(<CompilationInfo />);
}

+ 45
- 0
server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/CompilationInfo-test.tsx.snap View File

@@ -0,0 +1,45 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`should render correctly 1`] = `
<Alert
className="spacer-top spacer-bottom"
variant="info"
>
<p
className="spacer-bottom"
>
<FormattedMessage
defaultMessage="onboarding.tutorial.cfamilly.compilation_database_info"
id="onboarding.tutorial.cfamilly.compilation_database_info"
values={
Object {
"link": <a
href="/documentation/analysis/languages/cfamily/"
rel="noopener noreferrer"
target="_blank"
>
onboarding.tutorial.cfamilly.compilation_database_info.link
</a>,
}
}
/>
</p>
<p>
<FormattedMessage
defaultMessage="onboarding.tutorial.cfamilly.speed_caching"
id="onboarding.tutorial.cfamilly.speed_caching"
values={
Object {
"link": <a
href="/documentation/analysis/languages/cfamily/#analysis-cache"
rel="noopener noreferrer"
target="_blank"
>
onboarding.tutorial.cfamilly.speed_caching.link
</a>,
}
}
/>
</p>
</Alert>
`;

+ 4
- 0
sonar-core/src/main/resources/org/sonar/l10n/core.properties View File

@@ -3466,6 +3466,10 @@ onboarding.tutorial.ci_outro.commit.why.no_branches=Each new push you make on yo
onboarding.tutorial.ci_outro.refresh=This page will then refresh with your analysis results.
onboarding.tutorial.ci_outro.refresh.why=If the page doesn't refresh after a while, please double-check the analysis configuration.
onboarding.tutorial.other.project_key.sentence=Create a {file} file in your repository and paste the following code:
onboarding.tutorial.cfamilly.compilation_database_info=If you have trouble using the build wrapper, you can try using a {link}
onboarding.tutorial.cfamilly.compilation_database_info.link=compilation database
onboarding.tutorial.cfamilly.speed_caching=You can also speed up your analysis by enabling {link}.
onboarding.tutorial.cfamilly.speed_caching.link=multi-threading and caching

onboarding.tutorial.choose_method=How do you want to analyze your repository?
onboarding.tutorial.choose_method.manual=Locally

Loading…
Cancel
Save