[Fleet] Small clean up on add agent instructions (#130193)

* Set selection type to undefined in the beginning

* Hide copy when doing radio selection

* Adjust policy selection spacing, hide API key selection when no policy is chosen
This commit is contained in:
Jen Huang 2022-04-14 08:59:50 -07:00 committed by GitHub
parent 4aedd6cd20
commit fae0afbd12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 12 deletions

View file

@ -119,6 +119,7 @@ export const AgentPolicySelection: React.FC<Props> = (props) => {
/>
)}
</EuiText>
<EuiSpacer size="m" />
<AgentPolicyFormRow
fullWidth={true}
label={
@ -165,14 +166,14 @@ export const AgentPolicySelection: React.FC<Props> = (props) => {
/>
</>
)}
{props.withKeySelection && props.onKeyChange && (
{props.withKeySelection && props.onKeyChange && selectedPolicy?.id && (
<>
<EuiSpacer />
<EuiSpacer size="m" />
<AdvancedAgentAuthenticationSettings
selectedApiKeyId={props.selectedApiKeyId}
onKeyChange={props.onKeyChange}
initialAuthenticationSettingsOpen={!props.selectedApiKeyId}
agentPolicyId={selectedPolicy?.id}
agentPolicyId={selectedPolicy.id}
/>
</>
)}

View file

@ -59,7 +59,7 @@ export const AgentEnrollmentFlyout: React.FunctionComponent<FlyOutProps> = ({
const [isFleetServerPolicySelected, setIsFleetServerPolicySelected] = useState<boolean>(false);
const [selectedApiKeyId, setSelectedAPIKeyId] = useState<string | undefined>();
const [mode, setMode] = useState<FlyoutMode>(defaultMode);
const [selectionType, setSelectionType] = useState<SelectionType>('tabs');
const [selectionType, setSelectionType] = useState<SelectionType>();
const {
agentPolicies,

View file

@ -32,6 +32,7 @@ export const Instructions = (props: InstructionProps) => {
isFleetServerPolicySelected,
settings,
isLoadingAgentPolicies,
selectionType,
setSelectionType,
mode,
isIntegrationFlow,
@ -89,13 +90,17 @@ export const Instructions = (props: InstructionProps) => {
} else if (showAgentEnrollment) {
return (
<>
<EuiText>
<FormattedMessage
id="xpack.fleet.agentEnrollment.managedDescription"
defaultMessage="Enroll an Elastic Agent in Fleet to automatically deploy updates and centrally manage the agent."
/>
</EuiText>
<EuiSpacer size="l" />
{selectionType === 'tabs' && (
<>
<EuiText>
<FormattedMessage
id="xpack.fleet.agentEnrollment.managedDescription"
defaultMessage="Enroll an Elastic Agent in Fleet to automatically deploy updates and centrally manage the agent."
/>
</EuiText>
<EuiSpacer size="l" />
</>
)}
{isFleetServerPolicySelected ? (
<FleetServerSteps {...props} />
) : (

View file

@ -11,7 +11,7 @@ import type { InstalledIntegrationPolicy } from './use_get_agent_incoming_data';
export type K8sMode = 'IS_LOADING' | 'IS_KUBERNETES' | 'IS_NOT_KUBERNETES';
export type FlyoutMode = 'managed' | 'standalone';
export type SelectionType = 'tabs' | 'radio';
export type SelectionType = 'tabs' | 'radio' | undefined;
export interface BaseProps {
/**