export interface AnalysisCommandProps {
appState: T.AppState;
- buildTool?: BuildTools;
+ buildTool: BuildTools;
component: T.Component;
}
AlmSettingsInstance,
ProjectAlmBindingResponse
} from '../../../types/alm-settings';
+import AllSetStep from '../components/AllSetStep';
+import FinishButton from '../components/FinishButton';
import Step from '../components/Step';
import YamlFileStep from '../components/YamlFileStep';
import AnalysisCommand from './AnalysisCommand';
export enum Steps {
REPOSITORY_VARIABLES = 1,
- YAML = 2
+ YAML = 2,
+ ALL_SET = 3
}
export interface BitbucketPipelinesTutorialProps {
stepTitle={translate('onboarding.tutorial.with.bitbucket_pipelines.create_secret.title')}
/>
<Step
+ finished={step > Steps.YAML}
onOpen={() => setStep(Steps.YAML)}
open={step === Steps.YAML}
renderForm={() => (
- <YamlFileStep alm={AlmKeys.BitbucketCloud}>
- {buildTool => <AnalysisCommand buildTool={buildTool} component={component} />}
+ <YamlFileStep>
+ {buildTool => (
+ <>
+ <AnalysisCommand buildTool={buildTool} component={component} />
+ <FinishButton onClick={() => setStep(Steps.ALL_SET)} />
+ </>
+ )}
</YamlFileStep>
)}
stepNumber={Steps.YAML}
stepTitle={translate('onboarding.tutorial.with.bitbucket_pipelines.yaml.title')}
/>
+ <AllSetStep
+ alm={almBinding?.alm || AlmKeys.BitbucketCloud}
+ open={step === Steps.ALL_SET}
+ stepNumber={Steps.ALL_SET}
+ />
</>
);
}
it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot('default');
+ expect(shallowRender({ almBinding: undefined })).toMatchSnapshot('no binding');
expect(renderStepContent(shallowRender())).toMatchSnapshot('repo variable step content');
expect(renderStepContent(shallowRender(), 1)).toMatchSnapshot('yaml file step content');
});
stepTitle="onboarding.tutorial.with.bitbucket_pipelines.create_secret.title"
/>
<Step
+ finished={false}
onOpen={[Function]}
open={false}
renderForm={[Function]}
stepNumber={2}
stepTitle="onboarding.tutorial.with.bitbucket_pipelines.yaml.title"
/>
+ <AllSetStep
+ alm="github"
+ open={false}
+ stepNumber={3}
+ />
+</Fragment>
+`;
+
+exports[`should render correctly: no binding 1`] = `
+<Fragment>
+ <Step
+ finished={false}
+ onOpen={[Function]}
+ open={true}
+ renderForm={[Function]}
+ stepNumber={1}
+ stepTitle="onboarding.tutorial.with.bitbucket_pipelines.create_secret.title"
+ />
+ <Step
+ finished={false}
+ onOpen={[Function]}
+ open={false}
+ renderForm={[Function]}
+ stepNumber={2}
+ stepTitle="onboarding.tutorial.with.bitbucket_pipelines.yaml.title"
+ />
+ <AllSetStep
+ alm="bitbucketcloud"
+ open={false}
+ stepNumber={3}
+ />
</Fragment>
`;
`;
exports[`should render correctly: yaml file step content 1`] = `
-<Connect(withCLanguageFeature(YamlFileStep))
- alm="bitbucketcloud"
->
+<Connect(withCLanguageFeature(YamlFileStep))>
[Function]
</Connect(withCLanguageFeature(YamlFileStep))>
`;
--- /dev/null
+/*
+ * 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 { Button } from 'sonar-ui-common/components/controls/buttons';
+import ChevronRightIcon from 'sonar-ui-common/components/icons/ChevronRightIcon';
+import { translate } from 'sonar-ui-common/helpers/l10n';
+import { rawSizes } from '../../../app/theme';
+
+export interface FinishButtonProps {
+ onClick: () => void;
+}
+
+export default function FinishButton(props: FinishButtonProps) {
+ return (
+ <Button className="big-spacer-top big-spacer-bottom" onClick={props.onClick}>
+ {translate('tutorials.finish')}
+ <ChevronRightIcon size={rawSizes.baseFontSizeRaw} />
+ </Button>
+ );
+}
*/
import * as React from 'react';
import { translate } from 'sonar-ui-common/helpers/l10n';
-import { AlmKeys } from '../../../types/alm-settings';
import { withCLanguageFeature } from '../../hoc/withCLanguageFeature';
import RenderOptions from '../components/RenderOptions';
import { BuildTools } from '../types';
-import AllSet from './AllSet';
export interface YamlFileStepProps {
- alm: AlmKeys;
- children?: (buildTool?: BuildTools) => React.ReactElement<{}>;
+ children?: (buildTool: BuildTools) => React.ReactElement<{}>;
hasCLanguageFeature: boolean;
}
}
export function YamlFileStep(props: YamlFileStepProps) {
- const { alm, children, hasCLanguageFeature } = props;
+ const { children, hasCLanguageFeature } = props;
const buildTools = [BuildTools.Maven, BuildTools.Gradle, BuildTools.DotNet];
if (hasCLanguageFeature) {
optionLabelKey="onboarding.build"
/>
</li>
- {children && children(buildToolSelected)}
+ {children && buildToolSelected && children(buildToolSelected)}
</ol>
- {buildToolSelected !== undefined && (
- <>
- <hr className="huge-spacer-top huge-spacer-bottom" />
- <AllSet alm={alm} />
- </>
- )}
</>
);
}
--- /dev/null
+/*
+ * 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 FinishButton, { FinishButtonProps } from '../FinishButton';
+
+it('should render correctly', () => {
+ expect(shallowRender()).toMatchSnapshot();
+});
+
+function shallowRender(props: Partial<FinishButtonProps> = {}) {
+ return shallow<FinishButtonProps>(<FinishButton onClick={jest.fn()} {...props} />);
+}
*/
import { shallow } from 'enzyme';
import * as React from 'react';
-import { AlmKeys } from '../../../../types/alm-settings';
+import { BuildTools } from '../../types';
+import RenderOptions from '../RenderOptions';
import { YamlFileStep, YamlFileStepProps } from '../YamlFileStep';
it('should render correctly', () => {
expect(shallowRender({ hasCLanguageFeature: true })).toMatchSnapshot('C available');
});
+it('should render child correctly', () => {
+ const children = jest.fn();
+ const wrapper = shallowRender({ children });
+ expect(wrapper).toMatchSnapshot('C unavailable');
+ wrapper.find(RenderOptions).simulate('check', BuildTools.DotNet);
+ expect(children).toBeCalledWith(BuildTools.DotNet);
+});
+
function shallowRender(props: Partial<YamlFileStepProps> = {}) {
- return shallow<YamlFileStepProps>(
- <YamlFileStep alm={AlmKeys.GitHub} hasCLanguageFeature={false} {...props} />
- );
+ return shallow<YamlFileStepProps>(<YamlFileStep hasCLanguageFeature={false} {...props} />);
}
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`should render correctly 1`] = `
+<Button
+ className="big-spacer-top big-spacer-bottom"
+ onClick={[MockFunction]}
+>
+ tutorials.finish
+ <ChevronRightIcon
+ size={13}
+ />
+</Button>
+`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`should render child correctly: C unavailable 1`] = `
+<Fragment>
+ <ol
+ className="list-styled big-spacer-top big-spacer-bottom"
+ >
+ <li>
+ onboarding.build
+ <RenderOptions
+ name="language"
+ onCheck={[Function]}
+ optionLabelKey="onboarding.build"
+ options={
+ Array [
+ "maven",
+ "gradle",
+ "dotnet",
+ "other",
+ ]
+ }
+ />
+ </li>
+ </ol>
+</Fragment>
+`;
+
exports[`should render correctly: C available 1`] = `
<Fragment>
<ol
export interface AnalysisCommandProps {
appState: T.AppState;
- buildTool?: BuildTools;
+ buildTool: BuildTools;
component: T.Component;
+ onDone: () => void;
}
export function AnalysisCommand(props: AnalysisCommandProps) {
switch (buildTool) {
case BuildTools.Maven:
- return <JavaMaven branchesEnabled={branchesEnabled} component={component} />;
+ return (
+ <JavaMaven branchesEnabled={branchesEnabled} component={component} onDone={props.onDone} />
+ );
case BuildTools.Gradle:
- return <Gradle branchesEnabled={branchesEnabled} component={component} />;
+ return (
+ <Gradle branchesEnabled={branchesEnabled} component={component} onDone={props.onDone} />
+ );
case BuildTools.DotNet:
- return <DotNet branchesEnabled={branchesEnabled} component={component} />;
+ return (
+ <DotNet branchesEnabled={branchesEnabled} component={component} onDone={props.onDone} />
+ );
case BuildTools.CFamily:
- return <CFamily branchesEnabled={branchesEnabled} component={component} />;
+ return (
+ <CFamily branchesEnabled={branchesEnabled} component={component} onDone={props.onDone} />
+ );
case BuildTools.Other:
- return <Others branchesEnabled={branchesEnabled} component={component} />;
+ return (
+ <Others branchesEnabled={branchesEnabled} component={component} onDone={props.onDone} />
+ );
}
return null;
}
AlmSettingsInstance,
ProjectAlmBindingResponse
} from '../../../types/alm-settings';
+import AllSetStep from '../components/AllSetStep';
import Step from '../components/Step';
import YamlFileStep from '../components/YamlFileStep';
import AnalysisCommand from './AnalysisCommand';
export enum Steps {
CREATE_SECRET = 1,
- YAML = 2
+ YAML = 2,
+ ALL_SET = 3
}
export interface GitHubActionTutorialProps {
stepTitle={translate('onboarding.tutorial.with.github_action.create_secret.title')}
/>
<Step
+ finished={step > Steps.YAML}
onOpen={() => setStep(Steps.YAML)}
open={step === Steps.YAML}
renderForm={() => (
- <YamlFileStep alm={AlmKeys.GitHub}>
- {buildTool => <AnalysisCommand buildTool={buildTool} component={component} />}
+ <YamlFileStep>
+ {buildTool => (
+ <AnalysisCommand
+ buildTool={buildTool}
+ component={component}
+ onDone={() => setStep(Steps.ALL_SET)}
+ />
+ )}
</YamlFileStep>
)}
stepNumber={Steps.YAML}
stepTitle={translate('onboarding.tutorial.with.github_action.yaml.title')}
/>
+ <AllSetStep
+ alm={almBinding?.alm || AlmKeys.GitHub}
+ open={step === Steps.ALL_SET}
+ stepNumber={Steps.ALL_SET}
+ />
</>
);
}
function shallowRender(props: Partial<AnalysisCommandProps> = {}) {
return shallow<AnalysisCommandProps>(
- <AnalysisCommand appState={mockAppState()} component={mockComponent()} {...props} />
+ <AnalysisCommand
+ appState={mockAppState()}
+ component={mockComponent()}
+ buildTool={BuildTools.DotNet}
+ onDone={jest.fn()}
+ {...props}
+ />
);
}
it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot('default');
+ expect(shallowRender({ almBinding: undefined })).toMatchSnapshot('no binding');
expect(renderStepContent(shallowRender())).toMatchSnapshot('secrets step content');
expect(renderStepContent(shallowRender(), 1)).toMatchSnapshot('yaml file step content');
});
"tags": Array [],
}
}
+ onDone={[MockFunction]}
/>
`;
"tags": Array [],
}
}
+ onDone={[MockFunction]}
/>
`;
"tags": Array [],
}
}
+ onDone={[MockFunction]}
/>
`;
"tags": Array [],
}
}
+ onDone={[MockFunction]}
/>
`;
"tags": Array [],
}
}
+ onDone={[MockFunction]}
/>
`;
stepTitle="onboarding.tutorial.with.github_action.create_secret.title"
/>
<Step
+ finished={false}
onOpen={[Function]}
open={false}
renderForm={[Function]}
stepNumber={2}
stepTitle="onboarding.tutorial.with.github_action.yaml.title"
/>
+ <AllSetStep
+ alm="github"
+ open={false}
+ stepNumber={3}
+ />
+</Fragment>
+`;
+
+exports[`should render correctly: no binding 1`] = `
+<Fragment>
+ <Step
+ finished={false}
+ onOpen={[Function]}
+ open={true}
+ renderForm={[Function]}
+ stepNumber={1}
+ stepTitle="onboarding.tutorial.with.github_action.create_secret.title"
+ />
+ <Step
+ finished={false}
+ onOpen={[Function]}
+ open={false}
+ renderForm={[Function]}
+ stepNumber={2}
+ stepTitle="onboarding.tutorial.with.github_action.yaml.title"
+ />
+ <AllSetStep
+ alm="github"
+ open={false}
+ stepNumber={3}
+ />
</Fragment>
`;
`;
exports[`should render correctly: yaml file step content 1`] = `
-<Connect(withCLanguageFeature(YamlFileStep))
- alm="github"
->
+<Connect(withCLanguageFeature(YamlFileStep))>
[Function]
</Connect(withCLanguageFeature(YamlFileStep))>
`;
import { CompilationInfo } from '../../components/CompilationInfo';
import CreateYmlFile from '../../components/CreateYmlFile';
import DefaultProjectKey from '../../components/DefaultProjectKey';
+import FinishButton from '../../components/FinishButton';
import RenderOptions from '../../components/RenderOptions';
import { OSs } from '../../types';
export interface CFamilyProps {
branchesEnabled?: boolean;
component: T.Component;
+ onDone: () => void;
}
const STEPS = {
yamlTemplate={cfamilyYamlTemplate(!!branchesEnabled, os)}
/>
<CompilationInfo className="abs-width-800" />
+ <FinishButton onClick={props.onDone} />
</>
)}
</>
*/
import * as React from 'react';
import CreateYmlFile from '../../components/CreateYmlFile';
+import FinishButton from '../../components/FinishButton';
export interface DotNetProps {
branchesEnabled?: boolean;
component: T.Component;
+ onDone: () => void;
}
const dotnetYamlTemplate = (projectKey: string, branchesEnabled: boolean) => `name: Build
export default function DotNet(props: DotNetProps) {
const { component, branchesEnabled } = props;
return (
- <CreateYmlFile
- yamlFileName=".github/workflows/build.yml"
- yamlTemplate={dotnetYamlTemplate(component.key, !!branchesEnabled)}
- />
+ <>
+ <CreateYmlFile
+ yamlFileName=".github/workflows/build.yml"
+ yamlTemplate={dotnetYamlTemplate(component.key, !!branchesEnabled)}
+ />
+ <FinishButton onClick={props.onDone} />
+ </>
);
}
import { translate } from 'sonar-ui-common/helpers/l10n';
import CodeSnippet from '../../../common/CodeSnippet';
import CreateYmlFile from '../../components/CreateYmlFile';
+import FinishButton from '../../components/FinishButton';
import { buildGradleSnippet } from '../../utils';
export interface GradleProps {
branchesEnabled?: boolean;
component: T.Component;
+ onDone: () => void;
}
const gradleYamlTemplate = (branchesEnabled: boolean) => `name: Build
on:
yamlFileName=".github/workflows/build.yml"
yamlTemplate={gradleYamlTemplate(!!branchesEnabled)}
/>
+ <FinishButton onClick={props.onDone} />
</>
);
}
import { translate } from 'sonar-ui-common/helpers/l10n';
import CodeSnippet from '../../../common/CodeSnippet';
import CreateYmlFile from '../../components/CreateYmlFile';
+import FinishButton from '../../components/FinishButton';
import { mavenPomSnippet } from '../../utils';
export interface JavaMavenProps {
branchesEnabled?: boolean;
component: T.Component;
+ onDone: () => void;
}
const mavenYamlTemplte = (branchesEnabled: boolean) => `name: Build
yamlFileName=".github/workflows/build.yml"
yamlTemplate={mavenYamlTemplte(!!branchesEnabled)}
/>
+ <FinishButton onClick={props.onDone} />
</>
);
}
import * as React from 'react';
import CreateYmlFile from '../../components/CreateYmlFile';
import DefaultProjectKey from '../../components/DefaultProjectKey';
+import FinishButton from '../../components/FinishButton';
export interface OthersProps {
branchesEnabled?: boolean;
component: T.Component;
+ onDone: () => void;
}
const yamlTemplate = (branchesEnabled: boolean) => {
yamlFileName=".github/workflows/build.yml"
yamlTemplate={yamlTemplate(!!branchesEnabled)}
/>
+ <FinishButton onClick={props.onDone} />
</>
);
}
function shallowRender(props: Partial<CFamilyProps> = {}) {
return shallow<CFamilyProps>(
- <CFamily branchesEnabled={true} component={mockComponent()} {...props} />
+ <CFamily branchesEnabled={true} component={mockComponent()} {...props} onDone={jest.fn()} />
);
}
function shallowRender(props: Partial<DotNetProps> = {}) {
return shallow<DotNetProps>(
- <DotNet branchesEnabled={true} component={mockComponent()} {...props} />
+ <DotNet branchesEnabled={true} component={mockComponent()} {...props} onDone={jest.fn()} />
);
}
function shallowRender(props: Partial<GradleProps> = {}) {
return shallow<GradleProps>(
- <Gradle branchesEnabled={true} component={mockComponent()} {...props} />
+ <Gradle branchesEnabled={true} component={mockComponent()} {...props} onDone={jest.fn()} />
);
}
function shallowRender(props: Partial<JavaMavenProps> = {}) {
return shallow<JavaMavenProps>(
- <JavaMaven branchesEnabled={true} component={mockComponent()} {...props} />
+ <JavaMaven branchesEnabled={true} component={mockComponent()} {...props} onDone={jest.fn()} />
);
}
function shallowRender(props: Partial<OthersProps> = {}) {
return shallow<OthersProps>(
- <Others branchesEnabled={true} component={mockComponent()} {...props} />
+ <Others branchesEnabled={true} component={mockComponent()} {...props} onDone={jest.fn()} />
);
}
<CompilationInfo
className="abs-width-800"
/>
+ <FinishButton
+ onClick={[MockFunction]}
+ />
</Fragment>
`;
<CompilationInfo
className="abs-width-800"
/>
+ <FinishButton
+ onClick={[MockFunction]}
+ />
</Fragment>
`;
<CompilationInfo
className="abs-width-800"
/>
+ <FinishButton
+ onClick={[MockFunction]}
+ />
</Fragment>
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`should render correctly 1`] = `
-<CreateYmlFile
- yamlFileName=".github/workflows/build.yml"
- yamlTemplate="name: Build
+<Fragment>
+ <CreateYmlFile
+ yamlFileName=".github/workflows/build.yml"
+ yamlTemplate="name: Build
on:
push:
branches:
.\\\\.sonar\\\\scanner\\\\dotnet-sonarscanner begin /k:\\"my-project\\" /d:sonar.login=\\"\${{ secrets.SONAR_TOKEN }}\\" /d:sonar.host.url=\\"\${{ secrets.SONAR_HOST_URL }}\\"
dotnet build
.\\\\.sonar\\\\scanner\\\\dotnet-sonarscanner end /d:sonar.login=\\"\${{ secrets.SONAR_TOKEN }}\\""
-/>
+ />
+ <FinishButton
+ onClick={[MockFunction]}
+ />
+</Fragment>
`;
exports[`should render correctly: without branch enabled 1`] = `
-<CreateYmlFile
- yamlFileName=".github/workflows/build.yml"
- yamlTemplate="name: Build
+<Fragment>
+ <CreateYmlFile
+ yamlFileName=".github/workflows/build.yml"
+ yamlTemplate="name: Build
on:
push:
branches:
.\\\\.sonar\\\\scanner\\\\dotnet-sonarscanner begin /k:\\"my-project\\" /d:sonar.login=\\"\${{ secrets.SONAR_TOKEN }}\\" /d:sonar.host.url=\\"\${{ secrets.SONAR_HOST_URL }}\\"
dotnet build
.\\\\.sonar\\\\scanner\\\\dotnet-sonarscanner end /d:sonar.login=\\"\${{ secrets.SONAR_TOKEN }}\\""
-/>
+ />
+ <FinishButton
+ onClick={[MockFunction]}
+ />
+</Fragment>
`;
SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
run: ./gradlew build sonarqube --info"
/>
+ <FinishButton
+ onClick={[MockFunction]}
+ />
</Fragment>
`;
SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
run: ./gradlew build sonarqube --info"
/>
+ <FinishButton
+ onClick={[MockFunction]}
+ />
</Fragment>
`;
SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar"
/>
+ <FinishButton
+ onClick={[MockFunction]}
+ />
</Fragment>
`;
SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar"
/>
+ <FinishButton
+ onClick={[MockFunction]}
+ />
</Fragment>
`;
# env:
# SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}"
/>
+ <FinishButton
+ onClick={[MockFunction]}
+ />
</Fragment>
`;
# env:
# SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}"
/>
+ <FinishButton
+ onClick={[MockFunction]}
+ />
</Fragment>
`;
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { Button } from 'sonar-ui-common/components/controls/buttons';
-import ChevronRightIcon from 'sonar-ui-common/components/icons/ChevronRightIcon';
import { Alert } from 'sonar-ui-common/components/ui/Alert';
import { translate } from 'sonar-ui-common/helpers/l10n';
-import { rawSizes } from '../../../app/theme';
import { withCLanguageFeature } from '../../hoc/withCLanguageFeature';
import RenderOptions from '../components/RenderOptions';
import Step from '../components/Step';
}
export interface LanguageProps {
+ onDone: () => void;
component: T.Component;
baseUrl: string;
}
)}
</li>
{buildTool !== undefined &&
- React.createElement(BUILDTOOL_COMPONENT_MAP[buildTool], { component, baseUrl })}
+ React.createElement(BUILDTOOL_COMPONENT_MAP[buildTool], {
+ component,
+ baseUrl,
+ onDone: props.onDone
+ })}
</ol>
- {buildTool !== undefined && (
- <Button className="big-spacer-top" onClick={props.onDone}>
- {translate('tutorials.finish')}
- <ChevronRightIcon size={rawSizes.baseFontSizeRaw} />
- </Button>
- )}
</div>
)}
stepNumber={3}
"tags": Array [],
}
}
+ onDone={[MockFunction]}
/>
</ol>
- <Button
- className="big-spacer-top"
- onClick={[MockFunction]}
- >
- tutorials.finish
- <ChevronRightIcon
- size={13}
- />
- </Button>
</div>
`;
"tags": Array [],
}
}
+ onDone={[MockFunction]}
/>
</ol>
- <Button
- className="big-spacer-top"
- onClick={[MockFunction]}
- >
- tutorials.finish
- <ChevronRightIcon
- size={13}
- />
- </Button>
</div>
`;
"tags": Array [],
}
}
+ onDone={[MockFunction]}
/>
</ol>
- <Button
- className="big-spacer-top"
- onClick={[MockFunction]}
- >
- tutorials.finish
- <ChevronRightIcon
- size={13}
- />
- </Button>
</div>
`;
"tags": Array [],
}
}
+ onDone={[MockFunction]}
/>
</ol>
- <Button
- className="big-spacer-top"
- onClick={[MockFunction]}
- >
- tutorials.finish
- <ChevronRightIcon
- size={13}
- />
- </Button>
</div>
`;
import { translate } from 'sonar-ui-common/helpers/l10n';
import { CompilationInfo } from '../../components/CompilationInfo';
import DefaultProjectKey from '../../components/DefaultProjectKey';
+import FinishButton from '../../components/FinishButton';
import RenderOptions from '../../components/RenderOptions';
import { OSs } from '../../types';
+import { LanguageProps } from '../JenkinsfileStep';
import CreateJenkinsfileBulletPoint from './CreateJenkinsfileBulletPoint';
-export interface CFamillyProps {
- component: T.Component;
- baseUrl: string;
-}
-
const YAML_MAP: Record<OSs, (baseUrl: string) => string> = {
[OSs.Linux]: baseUrl => `node {
stage('SCM') {
}`
};
-export default function CFamilly({ baseUrl, component }: CFamillyProps) {
+export default function CFamilly(props: LanguageProps) {
+ const { baseUrl, component } = props;
const [os, setOs] = React.useState<OSs>();
return (
<>
/>
</li>
{os && (
- <CreateJenkinsfileBulletPoint
- alertTranslationKeyPart="onboarding.tutorial.with.jenkins.jenkinsfile.other.step3"
- snippet={YAML_MAP[os](baseUrl)}>
- <CompilationInfo />
- </CreateJenkinsfileBulletPoint>
+ <>
+ <CreateJenkinsfileBulletPoint
+ alertTranslationKeyPart="onboarding.tutorial.with.jenkins.jenkinsfile.other.step3"
+ snippet={YAML_MAP[os](baseUrl)}>
+ <CompilationInfo />
+ </CreateJenkinsfileBulletPoint>
+ <FinishButton onClick={props.onDone} />
+ </>
)}
</>
);
*/
import * as React from 'react';
import { translate } from 'sonar-ui-common/helpers/l10n';
+import FinishButton from '../../components/FinishButton';
import RenderOptions from '../../components/RenderOptions';
import { OSs } from '../../types';
import { LanguageProps } from '../JenkinsfileStep';
linux_core: OSs.Linux
};
-export default function DotNet({ component }: LanguageProps) {
+export default function DotNet(props: LanguageProps) {
+ const { component } = props;
const [flavorComponent, setFlavorComponet] = React.useState<keyof typeof DotNetFlavor>();
const DotNetTutorial = flavorComponent && DotNetFlavor[flavorComponent];
return (
/>
</li>
{DotNetTutorial && flavorComponent && (
- <DotNetTutorial component={component} os={DotOS[flavorComponent]} />
+ <>
+ <DotNetTutorial component={component} os={DotOS[flavorComponent]} />
+ <FinishButton onClick={props.onDone} />
+ </>
)}
</>
);
*/
import * as React from 'react';
import CodeSnippet from '../../../common/CodeSnippet';
+import FinishButton from '../../components/FinishButton';
import SentenceWithFilename from '../../components/SentenceWithFilename';
import { buildGradleSnippet } from '../../utils';
import { LanguageProps } from '../JenkinsfileStep';
}
}`;
-export default function Gradle({ component }: LanguageProps) {
+export default function Gradle(props: LanguageProps) {
+ const { component } = props;
return (
<>
<li className="abs-width-600">
<CodeSnippet snippet={buildGradleSnippet(component.key)} />
</li>
<CreateJenkinsfileBulletPoint snippet={JENKINSFILE_SNIPPET} />
+ <FinishButton onClick={props.onDone} />
</>
);
}
*/
import * as React from 'react';
import CodeSnippet from '../../../common/CodeSnippet';
+import FinishButton from '../../components/FinishButton';
import SentenceWithFilename from '../../components/SentenceWithFilename';
import { mavenPomSnippet } from '../../utils';
import { LanguageProps } from '../JenkinsfileStep';
}
}`;
-export default function Maven({ component }: LanguageProps) {
+export default function Maven(props: LanguageProps) {
+ const { component } = props;
return (
<>
<li className="abs-width-600">
alertTranslationKeyPart="onboarding.tutorial.with.jenkins.jenkinsfile.maven.step3"
snippet={JENKINSFILE_SNIPPET}
/>
+ <FinishButton onClick={props.onDone} />
</>
);
}
*/
import * as React from 'react';
import DefaultProjectKey from '../../components/DefaultProjectKey';
+import FinishButton from '../../components/FinishButton';
import { LanguageProps } from '../JenkinsfileStep';
import CreateJenkinsfileBulletPoint from './CreateJenkinsfileBulletPoint';
}
}`;
-export default function Other({ component }: LanguageProps) {
+export default function Other(props: LanguageProps) {
+ const { component } = props;
return (
<>
<DefaultProjectKey component={component} />
alertTranslationKeyPart="onboarding.tutorial.with.jenkins.jenkinsfile.other.step3"
snippet={JENKINSFILE_SNIPPET}
/>
+ <FinishButton onClick={props.onDone} />
</>
);
}
import { mockComponent } from '../../../../../helpers/testMocks';
import RenderOptions from '../../../components/RenderOptions';
import { OSs } from '../../../types';
-import CFamilly, { CFamillyProps } from '../CFamilly';
+import { LanguageProps } from '../../JenkinsfileStep';
+import CFamilly from '../CFamilly';
it('should render correctly for', () => {
expect(shallowRender()).toMatchSnapshot();
expect(wrapper).toMatchSnapshot(os);
});
-function shallowRender(props: Partial<CFamillyProps> = {}) {
- return shallow<CFamillyProps>(
- <CFamilly component={mockComponent()} baseUrl="nice_url_sample" {...props} />
+function shallowRender(props: Partial<LanguageProps> = {}) {
+ return shallow<LanguageProps>(
+ <CFamilly onDone={jest.fn()} component={mockComponent()} baseUrl="nice_url_sample" {...props} />
);
}
});
function shallowRender(props: Partial<LanguageProps> = {}) {
- return shallow<LanguageProps>(<DotNet component={mockComponent()} baseUrl="" {...props} />);
+ return shallow<LanguageProps>(
+ <DotNet onDone={jest.fn()} component={mockComponent()} baseUrl="" {...props} />
+ );
}
});
function shallowRender(props: Partial<LanguageProps> = {}) {
- return shallow<LanguageProps>(<Gradle component={mockComponent()} baseUrl="" {...props} />);
+ return shallow<LanguageProps>(
+ <Gradle onDone={jest.fn()} component={mockComponent()} baseUrl="" {...props} />
+ );
}
});
function shallowRender(props: Partial<LanguageProps> = {}) {
- return shallow<LanguageProps>(<Maven component={mockComponent()} baseUrl="" {...props} />);
+ return shallow<LanguageProps>(
+ <Maven onDone={jest.fn()} component={mockComponent()} baseUrl="" {...props} />
+ );
}
});
function shallowRender(props: Partial<LanguageProps> = {}) {
- return shallow<LanguageProps>(<Other component={mockComponent()} baseUrl="" {...props} />);
+ return shallow<LanguageProps>(
+ <Other onDone={jest.fn()} component={mockComponent()} baseUrl="" {...props} />
+ );
}
>
<CompilationInfo />
</CreateJenkinsfileBulletPoint>
+ <FinishButton
+ onClick={[MockFunction]}
+ />
</Fragment>
`;
>
<CompilationInfo />
</CreateJenkinsfileBulletPoint>
+ <FinishButton
+ onClick={[MockFunction]}
+ />
</Fragment>
`;
>
<CompilationInfo />
</CreateJenkinsfileBulletPoint>
+ <FinishButton
+ onClick={[MockFunction]}
+ />
</Fragment>
`;
}
}"
/>
+ <FinishButton
+ onClick={[MockFunction]}
+ />
</Fragment>
`;
}
}"
/>
+ <FinishButton
+ onClick={[MockFunction]}
+ />
</Fragment>
`;
}
}"
/>
+ <FinishButton
+ onClick={[MockFunction]}
+ />
</Fragment>
`;