aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/components/tutorials/other/ProjectAnalysisStep.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/components/tutorials/other/ProjectAnalysisStep.tsx')
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/ProjectAnalysisStep.tsx54
1 files changed, 21 insertions, 33 deletions
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/ProjectAnalysisStep.tsx b/server/sonar-web/src/main/js/components/tutorials/other/ProjectAnalysisStep.tsx
index 799135f27b5..9d5e24d711a 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/ProjectAnalysisStep.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/ProjectAnalysisStep.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import { translate } from '../../../helpers/l10n';
import { Component } from '../../../types/types';
import Step from '../components/Step';
-import { ManualTutorialConfig } from '../types';
+import { OSs, TutorialConfig } from '../types';
import BuildToolForm from './BuildToolForm';
import AnalysisCommand from './commands/AnalysisCommand';
@@ -30,58 +30,46 @@ interface Props {
baseUrl: string;
component: Component;
isLocal: boolean;
- onFinish?: (projectKey?: string) => void;
open: boolean;
stepNumber: number;
token?: string;
}
-interface State {
- config?: ManualTutorialConfig;
-}
-
-export default class ProjectAnalysisStep extends React.PureComponent<Props, State> {
- state: State = {};
+export default function ProjectAnalysisStep(props: Readonly<Props>) {
+ const { component, open, stepNumber, baseUrl, isLocal, token } = props;
- handleBuildToolSelect = (config: ManualTutorialConfig) => {
- const { component } = this.props;
- this.setState({ config });
- if (this.props.onFinish) {
- this.props.onFinish(component.key);
- }
- };
+ const [config, setConfig] = React.useState<TutorialConfig>({});
+ const [os, setOs] = React.useState<OSs>(OSs.Linux);
- renderForm = () => {
- const { component, baseUrl, isLocal, token } = this.props;
+ function renderForm() {
return (
<div className="sw-pb-4">
- <BuildToolForm onDone={this.handleBuildToolSelect} />
+ <BuildToolForm config={config} setConfig={setConfig} os={os} setOs={setOs} />
- {this.state.config && (
+ {config && (
<div className="sw-mt-4">
<AnalysisCommand
+ config={config}
+ os={os}
component={component}
baseUrl={baseUrl}
isLocal={isLocal}
- languageConfig={this.state.config}
token={token}
/>
</div>
)}
</div>
);
- };
-
- render() {
- return (
- <Step
- finished={false}
- onOpen={noop}
- open={this.props.open}
- renderForm={this.renderForm}
- stepNumber={this.props.stepNumber}
- stepTitle={translate('onboarding.analysis.header')}
- />
- );
}
+
+ return (
+ <Step
+ finished={false}
+ onOpen={noop}
+ open={open}
+ renderForm={renderForm}
+ stepNumber={stepNumber}
+ stepTitle={translate('onboarding.analysis.header')}
+ />
+ );
}