3 * Copyright (C) 2009-2021 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 AllSetStep from '../components/AllSetStep';
28 import FinishButton from '../components/FinishButton';
29 import Step from '../components/Step';
30 import YamlFileStep from '../components/YamlFileStep';
31 import AnalysisCommand from './AnalysisCommand';
32 import RepositoryVariables from './RepositoryVariables';
35 REPOSITORY_VARIABLES = 1,
40 export interface BitbucketPipelinesTutorialProps {
41 almBinding?: AlmSettingsInstance;
43 component: T.Component;
44 currentUser: T.LoggedInUser;
45 projectBinding?: ProjectAlmBindingResponse;
46 willRefreshAutomatically?: boolean;
49 export default function BitbucketPipelinesTutorial(props: BitbucketPipelinesTutorialProps) {
56 willRefreshAutomatically
59 const [step, setStep] = React.useState<Steps>(Steps.REPOSITORY_VARIABLES);
63 finished={step > Steps.REPOSITORY_VARIABLES}
64 onOpen={() => setStep(Steps.REPOSITORY_VARIABLES)}
65 open={step === Steps.REPOSITORY_VARIABLES}
68 almBinding={almBinding}
71 currentUser={currentUser}
72 onDone={() => setStep(Steps.YAML)}
73 projectBinding={projectBinding}
76 stepNumber={Steps.REPOSITORY_VARIABLES}
77 stepTitle={translate('onboarding.tutorial.with.bitbucket_pipelines.create_secret.title')}
80 finished={step > Steps.YAML}
81 onOpen={() => setStep(Steps.YAML)}
82 open={step === Steps.YAML}
87 <AnalysisCommand buildTool={buildTool} component={component} />
88 <FinishButton onClick={() => setStep(Steps.ALL_SET)} />
93 stepNumber={Steps.YAML}
94 stepTitle={translate('onboarding.tutorial.with.bitbucket_pipelines.yaml.title')}
97 alm={almBinding?.alm || AlmKeys.BitbucketCloud}
98 open={step === Steps.ALL_SET}
99 stepNumber={Steps.ALL_SET}
100 willRefreshAutomatically={willRefreshAutomatically}