(window.telemetryManagementSection_bundle_jsonpfunction=window.telemetryManagementSection_bundle_jsonpfunction||[]).push([[1,2],{12:function(e,t,s){e.exports=s(5)(1465)},13:function(e,t,s){"use strict";s.r(t),s.d(t,"OptInExampleFlyout",(function(){return opt_in_example_flyout_OptInExampleFlyout}));var a=s(12),i=s.n(a),l=s(0),n=s(3),r=s(9),o=s(1);const c=Object(o.jsx)(n.EuiFlexGroup,{justifyContent:"spaceAround"},Object(o.jsx)(n.EuiFlexItem,{grow:!1},Object(o.jsx)(n.EuiLoadingSpinner,{size:"xl"})));class opt_in_example_flyout_OptInExampleFlyout extends l.PureComponent{constructor(...e){super(...e),i()(this,"_isMounted",!1),i()(this,"state",{data:null,isLoading:!0,hasPrivilegeToRead:!1})}async componentDidMount(){this._isMounted=!0;try{const{fetchExample:e}=this.props,t=await e();this._isMounted&&this.setState({data:Array.isArray(t)?t:null,isLoading:!1,hasPrivilegeToRead:!0})}catch(e){this.setState({isLoading:!1,hasPrivilegeToRead:403!==e.status})}}componentWillUnmount(){this._isMounted=!1}renderBody({data:e,isLoading:t,hasPrivilegeToRead:s}){return t?c:s?null===e?Object(o.jsx)(n.EuiCallOut,{title:Object(o.jsx)(r.FormattedMessage,{id:"telemetry.callout.errorLoadingClusterStatisticsTitle",defaultMessage:"Error loading cluster statistics"}),color:"danger",iconType:"cross"},Object(o.jsx)(r.FormattedMessage,{id:"telemetry.callout.errorLoadingClusterStatisticsDescription",defaultMessage:"An unexpected error occurred while attempting to fetch the cluster statistics. This can occur because Elasticsearch failed, Kibana failed, or there is a network error. Check Kibana, then reload the page and try again."})):Object(o.jsx)(n.EuiCodeBlock,{language:"json",isCopyable:!0},JSON.stringify(e,null,2)):Object(o.jsx)(n.EuiCallOut,{title:Object(o.jsx)(r.FormattedMessage,{id:"telemetry.callout.errorUnprivilegedUserTitle",defaultMessage:"Error displaying cluster statistics"}),color:"danger",iconType:"cross"},Object(o.jsx)(r.FormattedMessage,{id:"telemetry.callout.errorUnprivilegedUserDescription",defaultMessage:"You do not have access to see unencrypted cluster statistics."}))}render(){return Object(o.jsx)(n.EuiPortal,null,Object(o.jsx)(n.EuiFlyout,{ownFocus:!0,onClose:this.props.onClose,maxWidth:!0},Object(o.jsx)(n.EuiFlyoutHeader,null,Object(o.jsx)(n.EuiTitle,null,Object(o.jsx)("h2",null,Object(o.jsx)(r.FormattedMessage,{id:"telemetry.callout.clusterStatisticsTitle",defaultMessage:"Cluster statistics"}))),Object(o.jsx)(n.EuiTextColor,{color:"subdued"},Object(o.jsx)(n.EuiText,null,Object(o.jsx)(r.FormattedMessage,{id:"telemetry.callout.clusterStatisticsDescription",defaultMessage:"This is an example of the basic cluster statistics that we'll collect. It includes the number of indices, shards, and nodes. It also includes high-level usage statistics, such as whether monitoring is turned on."})))),Object(o.jsx)(n.EuiFlyoutBody,null,this.renderBody(this.state))))}}},14:function(e,t,s){"use strict";s.r(t),s.d(t,"TelemetryManagementSection",(function(){return TelemetryManagementSection}));var a=s(12),i=s.n(a),l=s(0),n=s.n(l),r=s(3),o=s(9),c=s(2),u=s(10),d=s(11),p=s(13),g=s(1);class TelemetryManagementSection extends l.Component{constructor(e){super(e),i()(this,"maybeGetAppliesSettingMessage",(()=>this.props.showAppliesSettingMessage?Object(g.jsx)(r.EuiCallOut,{color:"primary",iconType:"spacesApp",title:Object(g.jsx)(o.FormattedMessage,{id:"telemetry.callout.appliesSettingTitle",defaultMessage:"Changes to this setting apply to {allOfKibanaText} and are saved automatically.",values:{allOfKibanaText:Object(g.jsx)("strong",null,Object(g.jsx)(o.FormattedMessage,{id:"telemetry.callout.appliesSettingTitle.allOfKibanaText",defaultMessage:"all of Kibana"}))}})}):null)),i()(this,"renderDescription",(()=>{const{docLinks:e}=this.props,t=Object(g.jsx)(r.EuiLink,{onClick:this.toggleExample,"data-test-id":"cluster_data_example"},Object(g.jsx)(o.FormattedMessage,{id:"telemetry.clusterData",defaultMessage:"cluster data"})),s=Object(g.jsx)(r.EuiLink,{href:"https://www.elastic.co/guide/en/security/current/advanced-settings.html#telemetry-settings","data-test-id":"endpoint_security_example",target:"_blank"},Object(g.jsx)(o.FormattedMessage,{id:"telemetry.securityData",defaultMessage:"security data"}));return Object(g.jsx)(l.Fragment,null,Object(g.jsx)("p",null,Object(g.jsx)(o.FormattedMessage,{id:"telemetry.telemetryConfigAndLinkDescription",defaultMessage:"Enabling usage collection allows us to learn what our users are most interested in, so we can improve our products and services. Refer to our {privacyStatementLink}.",values:{privacyStatementLink:Object(g.jsx)(r.EuiLink,{href:e.legal.privacyStatement,target:"_blank"},Object(g.jsx)(o.FormattedMessage,{id:"telemetry.readOurUsageDataPrivacyStatementLinkText",defaultMessage:"Privacy Statement"}))}})),Object(g.jsx)("p",null,Object(g.jsx)(o.FormattedMessage,{id:"telemetry.seeExampleOfClusterDataAndEndpointSecuity",defaultMessage:"See examples of the {clusterData} and {securityData} that we collect.",values:{clusterData:t,securityData:s}})))})),i()(this,"toggleOptIn",(async()=>{const{telemetryService:e,toasts:t}=this.props,s=!this.state.enabled;return new Promise(((a,i)=>{this.setState({processing:!0,enabled:s},(async()=>{try{await e.setOptIn(s),this.setState({processing:!1}),t.addSuccess(s?c.i18n.translate("telemetry.optInSuccessOn",{defaultMessage:"Sharing usage with Elastic is enabled."}):c.i18n.translate("telemetry.optInSuccessOff",{defaultMessage:"No longer sharing usage with Elastic."})),a(!0)}catch(e){this.setState({processing:!1}),i(e)}}))}))})),i()(this,"toggleExample",(()=>{this.setState({showExample:!this.state.showExample})})),this.state={processing:!1,showExample:!1,showSecurityExample:!1,enabled:this.props.telemetryService.getIsOptedIn()||!1}}render(){const{telemetryService:e}=this.props,{showExample:t,enabled:s,processing:a}=this.state;return e.getCanChangeOptInStatus()?Object(g.jsx)(l.Fragment,null,t&&Object(g.jsx)(d.TrackApplicationView,{viewId:"optInExampleFlyout"},Object(g.jsx)(n.a.Suspense,{fallback:Object(g.jsx)(r.EuiLoadingSpinner,null)},Object(g.jsx)(p.OptInExampleFlyout,{fetchExample:e.fetchExample,onClose:this.toggleExample}))),Object(g.jsx)(r.EuiSplitPanel.Outer,{hasBorder:!0},Object(g.jsx)(r.EuiForm,null,Object(g.jsx)(r.EuiSplitPanel.Inner,{color:"subdued"},Object(g.jsx)(r.EuiTitle,null,Object(g.jsx)("h2",null,Object(g.jsx)(o.FormattedMessage,{id:"telemetry.usageDataTitle",defaultMessage:"Usage collection"})))),Object(g.jsx)(r.EuiSplitPanel.Inner,null,this.maybeGetAppliesSettingMessage(),Object(g.jsx)(r.EuiSpacer,{size:"s"}),Object(g.jsx)(u.LazyField,{setting:{type:"boolean",name:"Usage collection",displayName:c.i18n.translate("telemetry.provideUsageDataTitle",{defaultMessage:"Share usage with Elastic"}),value:s,description:this.renderDescription(),defVal:!0,ariaName:c.i18n.translate("telemetry.provideUsageDataAriaName",{defaultMessage:"Share usage with Elastic"}),requiresPageReload:!1,category:[],isOverridden:!1,isCustom:!0},loading:a,docLinks:this.props.docLinks,toasts:this.props.toasts,handleChange:this.toggleOptIn,enableSaving:this.props.enableSaving}))))):null}}t.default=TelemetryManagementSection}}]);