"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.PolicyEmptyState = exports.HostsEmptyState = void 0; var _react = _interopRequireWildcard(require("react")); var _eui = require("@elastic/eui"); var _i18n = require("@kbn/i18n"); var _i18nReact = require("@kbn/i18n-react"); var _user_privileges = require("../../common/components/user_privileges"); var _security_administration_onboarding = _interopRequireDefault(require("../images/security_administration_onboarding.svg")); var _kibana = require("../../common/lib/kibana"); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ const TEXT_ALIGN_CENTER = Object.freeze({ textAlign: 'center' }); const MAX_SIZE_ONBOARDING_LOGO = Object.freeze({ maxWidth: 550, maxHeight: 420 }); const MissingFleetAccessInfo = /*#__PURE__*/_react.default.memo(() => { const { services } = (0, _kibana.useKibana)(); return /*#__PURE__*/_react.default.createElement(_eui.EuiText, { size: "s", color: "subdued", "data-test-subj": "noFleetAccess" }, /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.onboarding.enableFleetAccess", defaultMessage: "Deploying Agents for the first time requires Fleet access. For more information, " }), /*#__PURE__*/_react.default.createElement(_eui.EuiLink, { external: true, href: `${services.docLinks.links.securitySolution.privileges}` }, /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.onboarding.onboardingDocsLink", defaultMessage: "view the Elastic Security documentation" }))); }); MissingFleetAccessInfo.displayName = 'MissingFleetAccessInfo'; const PolicyEmptyState = /*#__PURE__*/_react.default.memo(({ loading, onActionClick, actionDisabled, policyEntryPoint = false }) => { const docLinks = (0, _kibana.useKibana)().services.docLinks; const { canAccessFleet, loading: authzLoading } = (0, _user_privileges.useUserPrivileges)().endpointPrivileges; return /*#__PURE__*/_react.default.createElement("div", { "data-test-subj": "emptyPolicyTable" }, loading ? /*#__PURE__*/_react.default.createElement(_eui.EuiFlexGroup, { alignItems: "center", justifyContent: "center" }, /*#__PURE__*/_react.default.createElement(_eui.EuiFlexItem, { grow: false }, /*#__PURE__*/_react.default.createElement(_eui.EuiLoadingSpinner, { size: "xl", className: "essentialAnimation" }))) : /*#__PURE__*/_react.default.createElement(_eui.EuiFlexGroup, { "data-test-subj": "policyOnboardingInstructions", alignItems: "center" }, /*#__PURE__*/_react.default.createElement(_eui.EuiFlexItem, { grow: 1 }, /*#__PURE__*/_react.default.createElement(_eui.EuiText, null, /*#__PURE__*/_react.default.createElement("h1", null, /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.policyList.onboardingTitle", defaultMessage: "Get started with Elastic Defend" }))), /*#__PURE__*/_react.default.createElement(_eui.EuiSpacer, { size: "m" }), /*#__PURE__*/_react.default.createElement(_eui.EuiText, { size: "s", color: "subdued" }, /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.policyList.onboardingSectionOne", defaultMessage: "Protect your hosts with threat prevention, detection, and deep security data visibility." })), /*#__PURE__*/_react.default.createElement(_eui.EuiSpacer, { size: "m" }), /*#__PURE__*/_react.default.createElement(_eui.EuiText, { size: "s", color: "subdued" }, policyEntryPoint ? /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.policyList.onboardingSectionTwo.fromPolicyPage", defaultMessage: "From this page, you\u2019ll be able to view and manage the Elastic Defend Integration policies in your environment running Elastic Defend." }) : /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.policyList.onboardingSectionTwo.fromEndpointPage", defaultMessage: "From this page, you\u2019ll be able to view and manage the hosts in your environment running Elastic Defend." })), /*#__PURE__*/_react.default.createElement(_eui.EuiSpacer, { size: "m" }), /*#__PURE__*/_react.default.createElement(_eui.EuiText, { size: "s", color: "subdued" }, /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.policyList.onboardingSectionThree", defaultMessage: "To get started, add the Elastic Defend integration to your Agents. For more information, " }), /*#__PURE__*/_react.default.createElement(_eui.EuiLink, { external: true, href: `${docLinks.links.siem.guide}` }, /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.policyList.onboardingDocsLink", defaultMessage: "view the Elastic Security documentation" }))), /*#__PURE__*/_react.default.createElement(_eui.EuiSpacer, { size: "m" }), authzLoading && /*#__PURE__*/_react.default.createElement(_eui.EuiSkeletonText, { lines: 1 }), !authzLoading && canAccessFleet && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_eui.EuiSpacer, { size: "s" }), /*#__PURE__*/_react.default.createElement(_eui.EuiFlexGroup, null, /*#__PURE__*/_react.default.createElement(_eui.EuiFlexItem, { grow: false }, /*#__PURE__*/_react.default.createElement(_eui.EuiButton, { fill: true, iconType: "plusInCircle", onClick: onActionClick, isDisabled: actionDisabled, "data-test-subj": "onboardingStartButton" }, /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.policyList.actionButtonText", defaultMessage: "Add Elastic Defend" }))))), !authzLoading && !canAccessFleet && /*#__PURE__*/_react.default.createElement(MissingFleetAccessInfo, null)), /*#__PURE__*/_react.default.createElement(_eui.EuiFlexItem, { grow: 2 }, /*#__PURE__*/_react.default.createElement(_eui.EuiIcon, { type: _security_administration_onboarding.default, size: "original", style: MAX_SIZE_ONBOARDING_LOGO })))); }); exports.PolicyEmptyState = PolicyEmptyState; const EndpointsEmptyState = /*#__PURE__*/_react.default.memo(({ loading, onActionClick, actionDisabled, handleSelectableOnChange, selectionOptions }) => { const policySteps = (0, _react.useMemo)(() => [{ title: _i18n.i18n.translate('xpack.securitySolution.endpoint.list.stepOneTitle', { defaultMessage: 'Select the integration you want to use' }), children: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_eui.EuiText, { color: "subdued", size: "m", grow: false }, /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.list.stepOne", defaultMessage: "Select from existing integrations. This can be changed later." })), /*#__PURE__*/_react.default.createElement(_eui.EuiSpacer, { size: "xxl" }), /*#__PURE__*/_react.default.createElement(_eui.EuiSelectable, { options: selectionOptions, singleSelection: "always", isLoading: loading, height: 100, listProps: { bordered: true, singleSelection: true }, onChange: handleSelectableOnChange, "data-test-subj": "onboardingPolicySelect" }, list => { return loading ? /*#__PURE__*/_react.default.createElement(_eui.EuiSelectableMessage, null, /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.list.loadingPolicies", defaultMessage: "Loading integrations" })) : selectionOptions.length ? list : /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.list.noPolicies", defaultMessage: "There are no integrations." }); })) }, { title: _i18n.i18n.translate('xpack.securitySolution.endpoint.list.stepTwoTitle', { defaultMessage: 'Enroll your agents enabled with Elastic Defend through Fleet' }), status: actionDisabled ? 'disabled' : '', children: /*#__PURE__*/_react.default.createElement(_eui.EuiFlexGroup, { alignItems: "center" }, /*#__PURE__*/_react.default.createElement(_eui.EuiFlexItem, null, /*#__PURE__*/_react.default.createElement(_eui.EuiText, { color: "subdued", size: "m", grow: false }, /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.list.stepTwo", defaultMessage: "You\u2019ll be provided with the necessary commands to get started." }))), /*#__PURE__*/_react.default.createElement(_eui.EuiFlexItem, { grow: false }, /*#__PURE__*/_react.default.createElement(_eui.EuiButton, { fill: true, onClick: onActionClick, isDisabled: actionDisabled, "data-test-subj": "onboardingStartButton" }, /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.policyList.emptyCreateNewButton", defaultMessage: "Enroll Agent" })))) }], [selectionOptions, handleSelectableOnChange, loading, actionDisabled, onActionClick]); return /*#__PURE__*/_react.default.createElement(ManagementEmptyState, { loading: loading, dataTestSubj: "emptyHostsTable", steps: policySteps, headerComponent: /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.list.noEndpointsPrompt", defaultMessage: "Next step: Enroll an Agent with Elastic Defend" }), bodyComponent: /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, { id: "xpack.securitySolution.endpoint.list.noEndpointsInstructions", defaultMessage: "You\u2019ve added the Elastic Defend integration. Now enroll your agents using the steps below." }) }); }); exports.HostsEmptyState = EndpointsEmptyState; const ManagementEmptyState = /*#__PURE__*/_react.default.memo(({ loading, dataTestSubj, steps, headerComponent, bodyComponent }) => { return /*#__PURE__*/_react.default.createElement("div", { "data-test-subj": dataTestSubj }, loading ? /*#__PURE__*/_react.default.createElement(_eui.EuiFlexGroup, { alignItems: "center", justifyContent: "center" }, /*#__PURE__*/_react.default.createElement(_eui.EuiFlexItem, { grow: false }, /*#__PURE__*/_react.default.createElement(_eui.EuiLoadingSpinner, { size: "xl", className: "essentialAnimation" }))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_eui.EuiSpacer, { size: "xxl" }), /*#__PURE__*/_react.default.createElement(_eui.EuiTitle, { size: "m" }, /*#__PURE__*/_react.default.createElement("h2", { style: TEXT_ALIGN_CENTER }, headerComponent)), /*#__PURE__*/_react.default.createElement(_eui.EuiSpacer, { size: "xxl" }), /*#__PURE__*/_react.default.createElement(_eui.EuiText, { textAlign: "center", color: "subdued", size: "m" }, bodyComponent), /*#__PURE__*/_react.default.createElement(_eui.EuiSpacer, { size: "xxl" }), steps && /*#__PURE__*/_react.default.createElement(_eui.EuiFlexGroup, { alignItems: "center", justifyContent: "center" }, /*#__PURE__*/_react.default.createElement(_eui.EuiFlexItem, { grow: false }, /*#__PURE__*/_react.default.createElement(_eui.EuiSteps, { steps: steps, "data-test-subj": 'onboardingSteps' }))))); }); PolicyEmptyState.displayName = 'PolicyEmptyState'; EndpointsEmptyState.displayName = 'HostsEmptyState'; ManagementEmptyState.displayName = 'ManagementEmptyState';