(window.data_bundle_jsonpfunction=window.data_bundle_jsonpfunction||[]).push([[3],{101:function(e,a,t){switch(window.__kbnThemeTag__){case"v8dark":return t(102);case"v8light":return t(104)}},102:function(e,a,t){var s=t(68),r=t(103);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.i,r,""]]);s(r,{insert:"head",singleton:!1}),e.exports=r.locals||{}},103:function(e,a,t){(a=t(69)(!1)).push([e.i,".shardFailureModal{min-height:75vh;width:768px}.shardFailureModal .kbnOverlayMountWrapper{flex-grow:1}.shardFailureModal .euiModalHeader{padding-bottom:0}.shardFailureModal__desc{max-width:686px}.shardFailureModal__descTitle{width:12%!important}.shardFailureModal__descValue{width:88%!important}@media only screen and (max-width:574px){.shardFailureModal__descTitle,.shardFailureModal__descValue{width:100%!important}}@media only screen and (min-width:575px) and (max-width:767px){.shardFailureModal__descTitle,.shardFailureModal__descValue{width:100%!important}}",""]),e.exports=a},104:function(e,a,t){var s=t(68),r=t(105);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[e.i,r,""]]);s(r,{insert:"head",singleton:!1}),e.exports=r.locals||{}},105:function(e,a,t){(a=t(69)(!1)).push([e.i,".shardFailureModal{min-height:75vh;width:768px}.shardFailureModal .kbnOverlayMountWrapper{flex-grow:1}.shardFailureModal .euiModalHeader{padding-bottom:0}.shardFailureModal__desc{max-width:686px}.shardFailureModal__descTitle{width:12%!important}.shardFailureModal__descValue{width:88%!important}@media only screen and (max-width:574px){.shardFailureModal__descTitle,.shardFailureModal__descValue{width:100%!important}}@media only screen and (min-width:575px) and (max-width:767px){.shardFailureModal__descTitle,.shardFailureModal__descValue{width:100%!important}}",""]),e.exports=a},120:function(e,a,t){"use strict";t.r(a),t.d(a,"default",(function(){return g}));var s=t(10),r=t.n(s),d=t(48),i=t(15),l=t(32),o=t(26),n=t(0),c=t(9),u=t(94);function h(e){return(e.charAt(0).toUpperCase()+e.slice(1)).replace(/[\._]/g," ")}function p(e,a){if("script"===a||"script_stack"===a){const a=Array.isArray(e)?e.join("\n"):String(e);return Object(c.jsx)(i.EuiCodeBlock,{language:"java",paddingSize:"s",isCopyable:!0},a)}return String(e)}var M={name:"xyzkeb",styles:"align-self:flex-start"};function j(e){const[a,t]=Object(s.useState)(!1),r=Object(u.getFlattenedObject)(e.reason),d=Object.entries(r).filter((([e])=>"type"!==e)).map((([e,a])=>({title:h(e),description:p(a,e)}))),l=[{title:n.i18n.translate("data.search.searchSource.fetch.shardsFailedModal.shardTitle",{defaultMessage:"Shard"}),description:e.shard},{title:n.i18n.translate("data.search.searchSource.fetch.shardsFailedModal.indexTitle",{defaultMessage:"Index"}),description:e.index},{title:n.i18n.translate("data.search.searchSource.fetch.shardsFailedModal.reasonTypeTitle",{defaultMessage:"Type"}),description:e.reason.type},...a?[{title:n.i18n.translate("data.search.searchSource.fetch.shardsFailedModal.nodeTitle",{defaultMessage:"Node"}),description:e.node},...d]:[]];return Object(c.jsx)(i.EuiFlexGroup,{direction:"column",gutterSize:"none",alignItems:"stretch"},Object(c.jsx)(i.EuiFlexItem,{grow:!1},Object(c.jsx)(i.EuiDescriptionList,{type:"responsiveColumn",gutterSize:"s",listItems:l,compressed:!0,className:"shardFailureModal__desc",titleProps:{className:"shardFailureModal__descTitle"},descriptionProps:{className:"shardFailureModal__descValue"}})),Object(c.jsx)(i.EuiFlexItem,{grow:!1,css:M},Object(c.jsx)(i.EuiButtonEmpty,{size:"s",onClick:()=>t((e=>!e)),flush:"left"},a?n.i18n.translate("data.search.searchSource.fetch.shardsFailedModal.showLessButtonLabel",{defaultMessage:"Show less"}):n.i18n.translate("data.search.searchSource.fetch.shardsFailedModal.showMoreButtonLabel",{defaultMessage:"Show details"}))))}const b={sort:{field:"index",direction:"desc"}};function f({failures:e}){const a=e.map(((e,a)=>({id:String(a),...e}))),t=[{name:n.i18n.translate("data.search.searchSource.fetch.shardsFailedModal.tableColReason",{defaultMessage:"Reason"}),render:e=>Object(c.jsx)(j,e),mobileOptions:{header:!1}}];return Object(c.jsx)(i.EuiInMemoryTable,{itemId:"id",items:a,columns:t,pagination:a.length>10,sorting:b,css:Object(c.css)("& .euiTableHeaderCell{",Object(i.euiScreenReaderOnly)(),";}& .euiTableRowCell{border-top:none;}","")})}function m({request:e,response:a,title:t,onClose:s}){if(!(a&&a._shards&&Array.isArray(a._shards.failures)&&e))return Object(c.jsx)(i.EuiCallOut,{title:"Sorry, there was an error",color:"danger",iconType:"warning"},"The ShardFailureModal component received invalid properties");const l=a._shards.failures,o=JSON.stringify(e,null,2),u=JSON.stringify(a,null,2),h=[{id:"table",name:n.i18n.translate("data.search.searchSource.fetch.shardsFailedModal.tabHeaderShardFailures",{defaultMessage:"Shard failures",description:"Name of the tab displaying shard failures"}),content:Object(c.jsx)(f,{failures:l}),"data-test-subj":"shardFailuresModalShardButton"},{id:"json-request",name:n.i18n.translate("data.search.searchSource.fetch.shardsFailedModal.tabHeaderRequest",{defaultMessage:"Request",description:"Name of the tab displaying the JSON request"}),content:Object(c.jsx)(i.EuiCodeBlock,{language:"json",isCopyable:!0,"data-test-subj":"shardsFailedModalRequestBlock"},o),"data-test-subj":"shardFailuresModalRequestButton"},{id:"json-response",name:n.i18n.translate("data.search.searchSource.fetch.shardsFailedModal.tabHeaderResponse",{defaultMessage:"Response",description:"Name of the tab displaying the JSON response"}),content:Object(c.jsx)(i.EuiCodeBlock,{language:"json",isCopyable:!0,"data-test-subj":"shardsFailedModalResponseBlock"},u),"data-test-subj":"shardFailuresModalResponseButton"}];return Object(c.jsx)(r.a.Fragment,null,Object(c.jsx)(i.EuiModalHeader,null,Object(c.jsx)(i.EuiModalHeaderTitle,{"data-test-subj":"shardFailureModalTitle",size:"xs"},t)),Object(c.jsx)(i.EuiModalBody,null,Object(c.jsx)(i.EuiTabbedContent,{tabs:h,initialSelectedTab:h[0],autoFocus:"selected"})),Object(c.jsx)(i.EuiModalFooter,null,Object(c.jsx)(i.EuiCopy,{textToCopy:u},(e=>Object(c.jsx)(i.EuiButtonEmpty,{onClick:e},Object(c.jsx)(d.FormattedMessage,{id:"data.search.searchSource.fetch.shardsFailedModal.copyToClipboard",defaultMessage:"Copy response to clipboard"})))),Object(c.jsx)(i.EuiButton,{onClick:()=>s(),fill:!0,"data-test-subj":"closeShardFailureModal"},Object(c.jsx)(d.FormattedMessage,{id:"data.search.searchSource.fetch.shardsFailedModal.close",defaultMessage:"Close",description:"Closing the Modal"}))))}function g({getRequestMeta:e,theme:a,title:t,size:r="s",color:n="warning",isButtonEmpty:u=!1}){const h=Object(s.useCallback)((()=>{const{request:s,response:r}=e(),d=Object(o.c)().openModal(Object(l.toMountPoint)(Object(c.jsx)(m,{request:s,response:r,title:t,onClose:()=>d.close()}),{theme$:a.theme$}),{className:"shardFailureModal"})}),[e,a.theme$,t]),p=u?i.EuiLink:i.EuiButton;return Object(c.jsx)(p,{color:n,size:r,onClick:h,"data-test-subj":"openShardFailureModalBtn"},Object(c.jsx)(d.FormattedMessage,{id:"data.search.searchSource.fetch.shardsFailedModal.showDetails",defaultMessage:"Show details",description:"Open the modal to show details"}))}t(101)}}]);