/*! 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. */ (window.ml_bundle_jsonpfunction=window.ml_bundle_jsonpfunction||[]).push([[29],{666:function(e,t,n){"use strict";n.r(t);var a=n(2),o=n.n(a),l=n(28),s=n(15),i=n(21),d=n(30),c=n(12),r=n(25),u=n(17),j=n(4);function m(e){return void 0===e.node&&e.state===d.c.OPENING}t.default=({jobIds:e})=>{const{http:t}=Object(i.useKibana)().services,n=Object(a.useMemo)((()=>Object(c.mlApiServicesProvider)(new r.a(t))),[t]),[d,b]=Object(a.useState)(0),[g,p]=Object(a.useState)(null),O=Object(a.useCallback)((async()=>{try{if(0===e.length)return void b(0);const{lazyNodeCount:t}=await n.mlNodeCount();if(0===t)return void b(0);const{jobs:a}=await n.getJobStats({jobId:e.join(",")}),o=a.filter(m);b(o.length)}catch(e){b(0),console.error("Could not determine ML node information",e)}}),[e]),f=Object(a.useCallback)((async()=>{if(0!==d)try{var e;const t=await n.mlInfo(),a=null!==(e=t.cloudId)&&void 0!==e?e:null,o=!0===t.isCloudTrial;p({isCloud:null!==a,cloudId:a,isCloudTrial:o,deploymentId:null===a?null:Object(u.a)(a)})}catch(e){p(null),console.error("Could not determine cloud information",e)}}),[d]);return Object(a.useEffect)((()=>{f()}),[d]),Object(a.useEffect)((()=>{O()}),[e]),0===d?null:Object(j.jsx)(o.a.Fragment,null,Object(j.jsx)(l.EuiCallOut,{title:Object(j.jsx)(s.FormattedMessage,{id:"xpack.ml.jobsAwaitingNodeWarningShared.title",defaultMessage:"Awaiting machine learning node"}),color:"primary",iconType:"iInCircle"},Object(j.jsx)("div",null,Object(j.jsx)(s.FormattedMessage,{id:"xpack.ml.jobsAwaitingNodeWarningShared.noMLNodesAvailableDescription",defaultMessage:"There {jobCount, plural, one {is} other {are}} {jobCount, plural, one {# job} other {# jobs}} waiting for machine learning nodes to start.",values:{jobCount:d}}),Object(j.jsx)(l.EuiSpacer,{size:"s"}),g&&(g.isCloud?Object(j.jsx)(o.a.Fragment,null,Object(j.jsx)(s.FormattedMessage,{id:"xpack.ml.jobsAwaitingNodeWarningShared.isCloud",defaultMessage:"Elastic Cloud deployments can autoscale to add more ML capacity. This may take 5-20 minutes. "}),null===g.deploymentId?null:Object(j.jsx)(s.FormattedMessage,{id:"xpack.ml.jobsAwaitingNodeWarningShared.isCloud.link",defaultMessage:"You can monitor progress in the {link}.",values:{link:Object(j.jsx)(l.EuiLink,{href:`https://cloud.elastic.co/deployments?q=${g.deploymentId}`},Object(j.jsx)(s.FormattedMessage,{id:"xpack.ml.jobsAwaitingNodeWarningShared.linkToCloud.linkText",defaultMessage:"Elastic Cloud admin console"}))}})):Object(j.jsx)(s.FormattedMessage,{id:"xpack.ml.jobsAwaitingNodeWarningShared.notCloud",defaultMessage:"Only Elastic Cloud deployments can autoscale; you must add machine learning nodes. {link}",values:{link:Object(j.jsx)(l.EuiLink,{href:"https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-node.html#ml-node"},Object(j.jsx)(s.FormattedMessage,{id:"xpack.ml.jobsAwaitingNodeWarningShared.linkToCloud.learnMore",defaultMessage:"Learn more."}))}})))),Object(j.jsx)(l.EuiSpacer,{size:"m"}))}}}]);