Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaulet committed Jun 29, 2021
1 parent 10d9e12 commit fb92cb4
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -541,13 +541,34 @@ export const AddFleetServerHostStepContent = ({
);
};

export const DeploymentModeStep = ({
export const deploymentModeStep = ({
deploymentMode,
setDeploymentMode,
}: {
deploymentMode: DeploymentMode;
setDeploymentMode: (v: DeploymentMode) => void;
}): EuiStepProps => {
return {
title: i18n.translate('xpack.fleet.fleetServerSetup.stepDeploymentModeTitle', {
defaultMessage: 'Choose a deployment mode for security',
}),
status: undefined,
children: (
<DeploymentModeStepContent
deploymentMode={deploymentMode}
setDeploymentMode={setDeploymentMode}
/>
),
};
};

const DeploymentModeStepContent = ({
deploymentMode,
setDeploymentMode,
}: {
deploymentMode: DeploymentMode;
setDeploymentMode: (v: DeploymentMode) => void;
}) => {
const onChangeCallback = useCallback(
(v: string) => {
if (v === 'production' || v === 'quickstart') {
Expand All @@ -557,68 +578,62 @@ export const DeploymentModeStep = ({
[setDeploymentMode]
);

return {
title: i18n.translate('xpack.fleet.fleetServerSetup.stepDeploymentModeTitle', {
defaultMessage: 'Choose a deployment mode for security',
}),
status: undefined,
children: (
<>
<EuiText>
<FormattedMessage
id="xpack.fleet.fleetServerSetup.stepDeploymentModeDescriptionText"
defaultMessage="Fleet uses Transport Layer Security (TLS) to encrypt traffic between Elastic Agents and other components in the Elastic Stack. Choose a deployment mode to determine how you wish to handle certificates. Your selection will affect the Fleet Server set up command shown in a later step."
/>
</EuiText>
<EuiSpacer size="m" />
<EuiRadioGroup
options={[
{
id: 'quickstart',
label: (
<FormattedMessage
id="xpack.fleet.fleetServerSetup.deploymentModeQuickStartOption"
defaultMessage="{quickStart} – Fleet Server will generate a self-signed certificate. Subsequent agents must be enrolled using the --insecure flag. Not recommended for production use cases."
values={{
quickStart: (
<strong>
<FormattedMessage
id="xpack.fleet.fleetServerSetup.quickStartText"
defaultMessage="Quick start"
/>
</strong>
),
}}
/>
),
},
{
id: 'production',
label: (
<FormattedMessage
id="xpack.fleet.fleetServerSetup.deploymentModeProductionOption"
defaultMessage="{production} – Provide your own certificates. This option will require agents to specify a cert key when enrolling with Fleet"
values={{
production: (
<strong>
<FormattedMessage
id="xpack.fleet.fleetServerSetup.productionText"
defaultMessage="Production"
/>
</strong>
),
}}
/>
),
},
]}
idSelected={deploymentMode}
onChange={onChangeCallback}
name="radio group"
return (
<>
<EuiText>
<FormattedMessage
id="xpack.fleet.fleetServerSetup.stepDeploymentModeDescriptionText"
defaultMessage="Fleet uses Transport Layer Security (TLS) to encrypt traffic between Elastic Agents and other components in the Elastic Stack. Choose a deployment mode to determine how you wish to handle certificates. Your selection will affect the Fleet Server set up command shown in a later step."
/>
</>
),
};
</EuiText>
<EuiSpacer size="m" />
<EuiRadioGroup
options={[
{
id: 'quickstart',
label: (
<FormattedMessage
id="xpack.fleet.fleetServerSetup.deploymentModeQuickStartOption"
defaultMessage="{quickStart} – Fleet Server will generate a self-signed certificate. Subsequent agents must be enrolled using the --insecure flag. Not recommended for production use cases."
values={{
quickStart: (
<strong>
<FormattedMessage
id="xpack.fleet.fleetServerSetup.quickStartText"
defaultMessage="Quick start"
/>
</strong>
),
}}
/>
),
},
{
id: 'production',
label: (
<FormattedMessage
id="xpack.fleet.fleetServerSetup.deploymentModeProductionOption"
defaultMessage="{production} – Provide your own certificates. This option will require agents to specify a cert key when enrolling with Fleet"
values={{
production: (
<strong>
<FormattedMessage
id="xpack.fleet.fleetServerSetup.productionText"
defaultMessage="Production"
/>
</strong>
),
}}
/>
),
},
]}
idSelected={deploymentMode}
onChange={onChangeCallback}
name="radio group"
/>
</>
);
};

const WaitingForFleetServerStep = ({
Expand Down Expand Up @@ -753,7 +768,7 @@ export const OnPremInstructions: React.FC = () => {
steps={[
DownloadStep(),
AgentPolicySelectionStep({ policyId, setPolicyId }),
DeploymentModeStep({ deploymentMode, setDeploymentMode }),
deploymentModeStep({ deploymentMode, setDeploymentMode }),
addFleetServerHostStep({ addFleetServerHost }),
ServiceTokenStep({
disabled: deploymentMode === 'production' && !fleetServerHost,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useGetOneEnrollmentAPIKey, useGetSettings, useLink, useFleetStatus } fr

import { ManualInstructions } from '../../components/enrollment_instructions';
import {
DeploymentModeStep,
deploymentModeStep,
ServiceTokenStep,
FleetServerCommandStep,
useFleetServerInstructions,
Expand Down Expand Up @@ -85,7 +85,7 @@ export const ManagedInstructions = React.memo<Props>(
} = fleetServerInstructions;

return [
DeploymentModeStep({ deploymentMode, setDeploymentMode }),
deploymentModeStep({ deploymentMode, setDeploymentMode }),
addFleetServerHostStep({ addFleetServerHost }),
ServiceTokenStep({ serviceToken, getServiceToken, isLoadingServiceToken }),
FleetServerCommandStep({ serviceToken, installCommand, platform, setPlatform }),
Expand Down

0 comments on commit fb92cb4

Please sign in to comment.