From bf22c169e9fb1080fb484ed057e91d6b094638cb Mon Sep 17 00:00:00 2001 From: John Schulz Date: Fri, 16 Apr 2021 12:56:46 -0400 Subject: [PATCH 1/4] Use for consistent name+icon lockup --- .../fleet/components/link_and_revision.tsx | 75 +++++++++++-------- .../sections/agent_policy/list_page/index.tsx | 14 +--- .../agent_details/agent_details_overview.tsx | 13 +--- .../sections/agents/agent_list_page/index.tsx | 46 +++--------- .../detail/policies/package_policies.tsx | 31 +------- .../translations/translations/ja-JP.json | 2 - .../translations/translations/zh-CN.json | 3 +- 7 files changed, 64 insertions(+), 120 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/link_and_revision.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/link_and_revision.tsx index 071a9dc5943b2..41ef63b23b564 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/link_and_revision.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/link_and_revision.tsx @@ -5,43 +5,54 @@ * 2.0. */ -import { EuiFlexGroup, EuiFlexItem, EuiLink, EuiText } from '@elastic/eui'; +import { EuiFlexGroup, EuiFlexItem, EuiIconTip, EuiLink, EuiText } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { CSSProperties } from 'react'; import React, { memo } from 'react'; -import type { EuiLinkProps } from '@elastic/eui/src/components/link/link'; +import type { AgentPolicy } from '../../../../common/types'; +import { useLink } from '../hooks'; const MIN_WIDTH: CSSProperties = { minWidth: 0 }; const NO_WRAP_WHITE_SPACE: CSSProperties = { whiteSpace: 'nowrap' }; -export type LinkAndRevisionProps = EuiLinkProps & { - revision?: string | number; -}; - -/** - * Components shows a link for a given value along with a revision number to its right. The display - * value is truncated if it is longer than the width of where it is displayed, while the revision - * always remain visible - */ -export const LinkAndRevision = memo( - ({ revision, className, ...euiLinkProps }) => { - return ( - - - +export const AgentPolicySummaryLine = memo<{ policy: AgentPolicy }>(({ policy }) => { + const { getHref } = useLink(); + const { name, id, revision, is_managed: isManaged } = policy; + return ( + + + + {name || id} + + + {isManaged && ( + + )} + {revision && ( + + + + - {revision && ( - - - - - - )} - - ); - } -); + )} + + ); +}); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.tsx index 55788da05bcea..48b9118d11566 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.tsx @@ -36,7 +36,7 @@ import { useUrlParams, useBreadcrumbs, } from '../../../hooks'; -import { LinkAndRevision, SearchBar } from '../../../components'; +import { AgentPolicySummaryLine, SearchBar } from '../../../components'; import { LinkedAgentCount, AgentPolicyActionMenu } from '../components'; import { CreateAgentPolicyFlyout } from './components'; @@ -74,7 +74,7 @@ const AgentPolicyListPageLayout: React.FunctionComponent = ({ children }) => ( export const AgentPolicyListPage: React.FunctionComponent<{}> = () => { useBreadcrumbs('policies_list'); - const { getHref, getPath } = useLink(); + const { getPath } = useLink(); const hasWriteCapabilites = useCapabilities().write; const { agents: { enabled: isFleetEnabled }, @@ -132,13 +132,7 @@ export const AgentPolicyListPage: React.FunctionComponent<{}> = () => { }), width: '20%', render: (name: string, agentPolicy: AgentPolicy) => ( - - {name || agentPolicy.id} - + ), }, { @@ -205,7 +199,7 @@ export const AgentPolicyListPage: React.FunctionComponent<{}> = () => { } return cols; - }, [getHref, isFleetEnabled, resendRequest]); + }, [isFleetEnabled, resendRequest]); const createAgentPolicyButton = useMemo( () => ( diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx index 482861b3db9e8..bf8385712dd23 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx @@ -21,10 +21,10 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import type { Agent, AgentPolicy } from '../../../../../types'; -import { useKibanaVersion, useLink } from '../../../../../hooks'; +import { useKibanaVersion } from '../../../../../hooks'; import { isAgentUpgradeable } from '../../../../../services'; import { AgentPolicyPackageBadges } from '../../../components/agent_policy_package_badges'; -import { LinkAndRevision } from '../../../../../components'; +import { AgentPolicySummaryLine } from '../../../../../components'; // Allows child text to be truncated const FlexItemWithMinWidth = styled(EuiFlexItem)` @@ -35,7 +35,6 @@ export const AgentDetailsOverviewSection: React.FunctionComponent<{ agent: Agent; agentPolicy?: AgentPolicy; }> = memo(({ agent, agentPolicy }) => { - const { getHref } = useLink(); const kibanaVersion = useKibanaVersion(); return ( @@ -52,13 +51,7 @@ export const AgentDetailsOverviewSection: React.FunctionComponent<{ defaultMessage: 'Agent policy', }), description: agentPolicy ? ( - - {agentPolicy.name || agentPolicy.id} - + ) : ( agent.policy_id || '-' ), diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx index 10f35aab44c5a..6dd1b8a9693e8 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx @@ -37,7 +37,7 @@ import { useKibanaVersion, useStartServices, } from '../../../hooks'; -import { ContextMenuActions } from '../../../components'; +import { AgentPolicySummaryLine, ContextMenuActions } from '../../../components'; import { AgentStatusKueryHelper, isAgentUpgradeable } from '../../../services'; import { AGENT_SAVED_OBJECT_TYPE } from '../../../constants'; import { @@ -374,48 +374,24 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { defaultMessage: 'Agent policy', }), render: (policyId: string, agent: Agent) => { - const policyName = agentPoliciesIndexedById[policyId]?.name; + const agentPolicy = agentPoliciesIndexedById[policyId]; + const showWarning = agent.policy_revision && agentPolicy?.revision > agent.policy_revision; + return ( - - - {policyName || policyId} - - - {agent.policy_revision && ( + + {showWarning && ( - + + +   )} - {agent.policy_id && - agent.policy_revision && - agentPoliciesIndexedById[agent.policy_id] && - agentPoliciesIndexedById[agent.policy_id].revision > agent.policy_revision && ( - - - -   - {true && ( - <> - - - )} - - - )} ); }, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/package_policies.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/package_policies.tsx index 94b4b748cb1bd..b14551098e688 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/package_policies.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/package_policies.tsx @@ -5,7 +5,6 @@ * 2.0. */ -import type { ReactNode } from 'react'; import React, { memo, useCallback, useMemo } from 'react'; import { Redirect } from 'react-router-dom'; import type { CriteriaWithPagination, EuiTableFieldDataColumnType } from '@elastic/eui'; @@ -16,8 +15,7 @@ import { FormattedRelative, FormattedMessage } from '@kbn/i18n/react'; import { InstallStatus } from '../../../../../types'; import { useLink, useUrlPagination } from '../../../../../hooks'; import { PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../../../../../constants'; -import type { LinkAndRevisionProps } from '../../../../../components'; -import { LinkAndRevision } from '../../../../../components'; +import { AgentPolicySummaryLine } from '../../../../../components'; import { LinkedAgentCount } from '../../../../../components/linked_agent_count'; import { useGetPackageInstallStatus } from '../../../hooks'; @@ -42,27 +40,6 @@ const IntegrationDetailsLink = memo<{ ); }); - -const AgentPolicyDetailLink = memo<{ - agentPolicyId: string; - revision: LinkAndRevisionProps['revision']; - children: ReactNode; -}>(({ agentPolicyId, revision, children }) => { - const { getHref } = useLink(); - - return ( - - {children} - - ); -}); - interface PackagePoliciesPanelProps { name: string; version: string; @@ -112,11 +89,7 @@ export const PackagePoliciesPage = ({ name, version }: PackagePoliciesPanelProps }), truncateText: true, render(id, { agentPolicy }) { - return ( - - {agentPolicy.name ?? id} - - ); + return ; }, }, { diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 29f162a005a98..ec604eaf255cb 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -8248,7 +8248,6 @@ "xpack.fleet.agentList.policyColumnTitle": "エージェントポリシー", "xpack.fleet.agentList.policyFilterText": "エージェントポリシー", "xpack.fleet.agentList.reassignActionText": "新しいポリシーに割り当てる", - "xpack.fleet.agentList.revisionNumber": "rev. {revNumber}", "xpack.fleet.agentList.showUpgradeableFilterLabel": "アップグレードが利用可能です", "xpack.fleet.agentList.statusColumnTitle": "ステータス", "xpack.fleet.agentList.statusFilterText": "ステータス", @@ -8666,7 +8665,6 @@ "xpack.fleet.policyForm.generalSettingsGroupDescription": "エージェントポリシーの名前と説明を選択してください。", "xpack.fleet.policyForm.generalSettingsGroupTitle": "一般設定", "xpack.fleet.policyForm.unableToDeleteDefaultPolicyText": "デフォルトポリシーは削除できません", - "xpack.fleet.policyNameLink.revisionNumber": "rev. {revNumber}", "xpack.fleet.securityRequiredErrorMessage": "Fleet を使用するには、Kibana と Elasticsearch でセキュリティを有効にする必要があります。", "xpack.fleet.securityRequiredErrorTitle": "セキュリティが有効ではありません", "xpack.fleet.settings.additionalYamlConfig": "Elasticsearch出力構成", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 0553e3c195532..729e32e11a5ff 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -8323,7 +8323,6 @@ "xpack.fleet.agentList.policyColumnTitle": "代理策略", "xpack.fleet.agentList.policyFilterText": "代理策略", "xpack.fleet.agentList.reassignActionText": "分配到新策略", - "xpack.fleet.agentList.revisionNumber": "修订版 {revNumber}", "xpack.fleet.agentList.showUpgradeableFilterLabel": "升级可用", "xpack.fleet.agentList.statusColumnTitle": "状态", "xpack.fleet.agentList.statusFilterText": "状态", @@ -8751,7 +8750,7 @@ "xpack.fleet.policyForm.generalSettingsGroupDescription": "为您的代理策略选择名称和描述。", "xpack.fleet.policyForm.generalSettingsGroupTitle": "常规设置", "xpack.fleet.policyForm.unableToDeleteDefaultPolicyText": "默认策略无法删除", - "xpack.fleet.policyNameLink.revisionNumber": "修订版 {revNumber}", + "xpack.fleet.agentPolicySummaryLine.revisionNumber": "修订版 {revNumber}", "xpack.fleet.securityRequiredErrorMessage": "必须在 Kibana 和 Elasticsearch 启用安全性,才能使用 Fleet。", "xpack.fleet.securityRequiredErrorTitle": "安全性未启用", "xpack.fleet.settings.additionalYamlConfig": "Elasticsearch 输出配置", From ac26604a4dc3ab2fd8aa25671bfe596e623d5305 Mon Sep 17 00:00:00 2001 From: John Schulz Date: Fri, 16 Apr 2021 14:06:13 -0400 Subject: [PATCH 2/4] Hide hosted agent policies from some menus --- .../step_select_agent_policy.tsx | 6 +++++- .../components/agent_enrollment_flyout/steps.tsx | 5 ++++- .../agent_reassign_policy_flyout/index.tsx | 14 ++++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_agent_policy.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_agent_policy.tsx index 53fab8bda4a8c..26d47cbff5b86 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_agent_policy.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_agent_policy.tsx @@ -94,7 +94,11 @@ export const StepSelectAgentPolicy: React.FunctionComponent<{ sortOrder: 'asc', full: true, }); - const agentPolicies = useMemo(() => agentPoliciesData?.items || [], [agentPoliciesData?.items]); + const agentPolicies = useMemo( + () => agentPoliciesData?.items.filter((policy) => !policy.is_managed) || [], + [agentPoliciesData?.items] + ); + const agentPoliciesById = useMemo(() => { return agentPolicies.reduce((acc: { [key: string]: GetAgentPoliciesResponseItem }, policy) => { acc[policy.id] = policy; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/steps.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/steps.tsx index 1d5e8cbfc5cd6..faa0461ed4773 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/steps.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_enrollment_flyout/steps.tsx @@ -53,13 +53,16 @@ export const AgentPolicySelectionStep = ({ setSelectedAPIKeyId?: (key: string) => void; setSelectedPolicyId?: (policyId: string) => void; }) => { + const regularAgentPolicies = Array.isArray(agentPolicies) + ? agentPolicies.filter((policy) => policy && !policy.is_managed) + : []; return { title: i18n.translate('xpack.fleet.agentEnrollment.stepChooseAgentPolicyTitle', { defaultMessage: 'Choose an agent policy', }), children: ( = ({ } }, [agentPolicies, selectedAgentPolicyId]); + const policySelectOptions = useMemo(() => { + return agentPolicies + .filter((policy) => !policy.is_managed) + .map((agentPolicy) => ({ + value: agentPolicy.id, + text: agentPolicy.name, + })); + }, [agentPolicies]); + const [isSubmitting, setIsSubmitting] = useState(false); async function onSubmit() { try { @@ -129,10 +138,7 @@ export const AgentReassignAgentPolicyFlyout: React.FunctionComponent = ({ ({ - value: agentPolicy.id, - text: agentPolicy.name, - }))} + options={policySelectOptions} value={selectedAgentPolicyId} onChange={(e) => setSelectedAgentPolicyId(e.target.value)} /> From 77b3906b68e4cfcc9898c7d901eef86081cf0d53 Mon Sep 17 00:00:00 2001 From: John Schulz Date: Fri, 16 Apr 2021 15:26:28 -0400 Subject: [PATCH 3/4] Move 'assign agent to new policy' from flyout to modal --- .../fleet/components/package_icon.tsx | 15 +- .../components/actions_menu.tsx | 4 +- .../components/bulk_actions.tsx | 4 +- .../sections/agents/agent_list_page/index.tsx | 6 +- .../index.tsx | 136 ++++++++---------- .../sections/agents/components/index.tsx | 2 +- 6 files changed, 80 insertions(+), 87 deletions(-) rename x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/{agent_reassign_policy_flyout => agent_reassign_policy_modal}/index.tsx (50%) diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/package_icon.tsx b/x-pack/plugins/fleet/public/applications/fleet/components/package_icon.tsx index cb0b02527f756..e7fd1da394bb3 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/package_icon.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/components/package_icon.tsx @@ -14,7 +14,18 @@ import { usePackageIconType } from '../hooks'; export const PackageIcon: React.FunctionComponent< UsePackageIconType & Omit -> = ({ packageName, version, icons, tryApi, ...euiIconProps }) => { +> = ({ size = 's', packageName, version, icons, tryApi, ...euiIconProps }) => { const iconType = usePackageIconType({ packageName, version, icons, tryApi }); - return ; + return ( + + // this collides with some EuiText (+img) CSS from the EuiIcon component + // which makes the button large, wide, and poorly layed out + // override those styles until the bug is fixed or we find a better approach + style={{ margin: 'unset', width: 'unset' }} + size={size} + type={iconType} + {...euiIconProps} + /> + ); }; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/actions_menu.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/actions_menu.tsx index e5ad131bd7e05..d814d2d0646a8 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/actions_menu.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/actions_menu.tsx @@ -14,7 +14,7 @@ import { useCapabilities, useKibanaVersion } from '../../../../hooks'; import { ContextMenuActions } from '../../../../components'; import { AgentUnenrollAgentModal, - AgentReassignAgentPolicyFlyout, + AgentReassignAgentPolicyModal, AgentUpgradeAgentModal, } from '../../components'; import { useAgentRefresh } from '../hooks'; @@ -45,7 +45,7 @@ export const AgentDetailsActionMenu: React.FunctionComponent<{ <> {isReassignFlyoutOpen && ( - + )} {isUnenrollModalOpen && ( diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.tsx index de27d5fada755..b59ef1f749fb2 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.tsx @@ -22,7 +22,7 @@ import { FormattedMessage, FormattedNumber } from '@kbn/i18n/react'; import { SO_SEARCH_LIMIT } from '../../../../constants'; import type { Agent } from '../../../../types'; import { - AgentReassignAgentPolicyFlyout, + AgentReassignAgentPolicyModal, AgentUnenrollAgentModal, AgentUpgradeAgentModal, } from '../../components'; @@ -161,7 +161,7 @@ export const AgentBulkActions: React.FunctionComponent<{ <> {isReassignFlyoutOpen && ( - { setIsReassignFlyoutOpen(false); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx index 6dd1b8a9693e8..b3c0cf93c88ef 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx @@ -41,7 +41,7 @@ import { AgentPolicySummaryLine, ContextMenuActions } from '../../../components' import { AgentStatusKueryHelper, isAgentUpgradeable } from '../../../services'; import { AGENT_SAVED_OBJECT_TYPE } from '../../../constants'; import { - AgentReassignAgentPolicyFlyout, + AgentReassignAgentPolicyModal, AgentHealth, AgentUnenrollAgentModal, AgentUpgradeAgentModal, @@ -379,7 +379,7 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { return ( - + {agentPolicy && } {showWarning && ( @@ -488,7 +488,7 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { ) : null} {agentToReassign && ( - { setAgentToReassign(undefined); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_flyout/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_modal/index.tsx similarity index 50% rename from x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_flyout/index.tsx rename to x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_modal/index.tsx index afba692548ae2..e0704b8419256 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_flyout/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_modal/index.tsx @@ -5,19 +5,16 @@ * 2.0. */ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { - EuiFlyout, - EuiFlyoutBody, - EuiFlyoutHeader, + EuiConfirmModal, EuiSpacer, EuiTitle, EuiFlexGroup, EuiFlexItem, EuiButtonEmpty, EuiButton, - EuiFlyoutFooter, EuiSelect, EuiFormRow, EuiText, @@ -38,7 +35,7 @@ interface Props { agents: Agent[] | string; } -export const AgentReassignAgentPolicyFlyout: React.FunctionComponent = ({ +export const AgentReassignAgentPolicyModal: React.FunctionComponent = ({ onClose, agents, }) => { @@ -62,7 +59,7 @@ export const AgentReassignAgentPolicyFlyout: React.FunctionComponent = ({ const policySelectOptions = useMemo(() => { return agentPolicies - .filter((policy) => !policy.is_managed) + .filter((policy) => policy && !policy.is_managed) .map((agentPolicy) => ({ value: agentPolicy.id, text: agentPolicy.name, @@ -105,77 +102,62 @@ export const AgentReassignAgentPolicyFlyout: React.FunctionComponent = ({ } return ( - - - -

- -

-
- - - - -
- - - - + } + onCancel={onClose} + onConfirm={onSubmit} + cancelButtonText={ + + } + confirmButtonDisabled={ + isSubmitting || (isSingleAgent && selectedAgentPolicyId === (agents[0] as Agent).policy_id) + } + confirmButtonText={ + + } + buttonColor="danger" + > +

+ +

+ + + + - setSelectedAgentPolicyId(e.target.value)} - /> - - - - + isLoading={agentPoliciesRequest.isLoading} + options={policySelectOptions} + value={selectedAgentPolicyId} + onChange={(e) => setSelectedAgentPolicyId(e.target.value)} + /> +
+
+
+ - {selectedAgentPolicyId && ( - - )} -
- - - - - - - - - - - - - - -
+ {selectedAgentPolicyId && } + ); }; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/index.tsx index 93425ba10413c..45f09c79d5533 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/index.tsx @@ -6,7 +6,7 @@ */ export * from './loading'; -export * from './agent_reassign_policy_flyout'; +export * from './agent_reassign_policy_modal'; export * from './agent_enrollment_flyout'; export * from './agent_health'; export * from './agent_unenroll_modal'; From fd94c9f6cf9af600ce991d9d9742215b4dc3da86 Mon Sep 17 00:00:00 2001 From: John Schulz Date: Fri, 16 Apr 2021 18:29:04 -0400 Subject: [PATCH 4/4] Remove unused components --- .../agents/components/agent_reassign_policy_modal/index.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_modal/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_modal/index.tsx index e0704b8419256..8ee401d3c4ddf 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_modal/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_reassign_policy_modal/index.tsx @@ -10,14 +10,10 @@ import { i18n } from '@kbn/i18n'; import { EuiConfirmModal, EuiSpacer, - EuiTitle, EuiFlexGroup, EuiFlexItem, - EuiButtonEmpty, - EuiButton, EuiSelect, EuiFormRow, - EuiText, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react';