3 * Copyright (C) 2009-2023 SonarSource SA
4 * mailto:info AT sonarsource DOT com
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 import * as React from 'react';
21 import { translate } from '../../../helpers/l10n';
25 ProjectAlmBindingResponse,
26 } from '../../../types/alm-settings';
27 import { Component } from '../../../types/types';
28 import { LoggedInUser } from '../../../types/users';
29 import AllSetStep from '../components/AllSetStep';
30 import FinishButton from '../components/FinishButton';
31 import GithubCFamilyExampleRepositories from '../components/GithubCFamilyExampleRepositories';
32 import Step from '../components/Step';
33 import YamlFileStep from '../components/YamlFileStep';
34 import { BuildTools, TutorialModes } from '../types';
35 import AnalysisCommand from './AnalysisCommand';
36 import RepositoryVariables from './RepositoryVariables';
39 REPOSITORY_VARIABLES = 1,
44 export interface BitbucketPipelinesTutorialProps {
45 almBinding?: AlmSettingsInstance;
48 currentUser: LoggedInUser;
49 mainBranchName: string;
50 projectBinding?: ProjectAlmBindingResponse;
51 willRefreshAutomatically?: boolean;
54 export default function BitbucketPipelinesTutorial(props: BitbucketPipelinesTutorialProps) {
61 willRefreshAutomatically,
65 const [step, setStep] = React.useState<Steps>(Steps.REPOSITORY_VARIABLES);
69 finished={step > Steps.REPOSITORY_VARIABLES}
70 onOpen={() => setStep(Steps.REPOSITORY_VARIABLES)}
71 open={step === Steps.REPOSITORY_VARIABLES}
74 almBinding={almBinding}
77 currentUser={currentUser}
78 onDone={() => setStep(Steps.YAML)}
79 projectBinding={projectBinding}
82 stepNumber={Steps.REPOSITORY_VARIABLES}
83 stepTitle={translate('onboarding.tutorial.with.bitbucket_pipelines.variables.title')}
86 finished={step > Steps.YAML}
87 onOpen={() => setStep(Steps.YAML)}
88 open={step === Steps.YAML}
93 {buildTool === BuildTools.CFamily && (
94 <GithubCFamilyExampleRepositories
95 className="big-spacer-top"
96 ci={TutorialModes.BitbucketPipelines}
100 buildTool={buildTool}
101 component={component}
102 mainBranchName={mainBranchName}
104 <FinishButton onClick={() => setStep(Steps.ALL_SET)} />
109 stepNumber={Steps.YAML}
110 stepTitle={translate('onboarding.tutorial.with.bitbucket_pipelines.yaml.title')}
113 alm={almBinding?.alm || AlmKeys.BitbucketCloud}
114 open={step === Steps.ALL_SET}
115 stepNumber={Steps.ALL_SET}
116 willRefreshAutomatically={willRefreshAutomatically}