"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7878],{85111:(L,r,e)=>{e.r(r),e.d(r,{LibraryPanelsPage:()=>E,default:()=>O});var t=e(65237),d=e(38992),P=e(13732),a=e(2952);const E=()=>{const[c,s]=(0,t.useState)(void 0);return t.createElement(d.T,{navId:"dashboards/library-panels"},t.createElement(d.T.Contents,null,t.createElement(P.N,{onClick:s,showSecondaryActions:!0,showSort:!0,showPanelFilter:!0,showFolderFilter:!0}),c?t.createElement(a.b,{onDismiss:()=>s(void 0),libraryPanel:c}):null))},O=E},2952:(L,r,e)=>{e.d(r,{b:()=>g});var t=e(60234),d=e(56027),P=e.n(d),a=e(65237),E=e(31667),O=e(38002),c=e(93048),s=e(90931),f=e(94795),h=e(48389),C=e(25961);function g({libraryPanel:o,onDismiss:l}){const i=(0,c.wW)(p),[D,M]=(0,a.useState)(!1),[n,A]=(0,a.useState)(0),[_,T]=(0,a.useState)(void 0);(0,a.useEffect)(()=>{(async()=>{const U=await(0,C.Ef)(o.uid);A(U.length)})()},[o.uid]);const m=(0,a.useCallback)(u=>v(o.uid,u,M),[o.uid]),B=(0,a.useMemo)(()=>P()(m,300,{leading:!0}),[m]),R=u=>{u.preventDefault(),O.E1.push(E.Cj.renderUrl(`/d/${_?.value?.uid}`,{}))};return a.createElement(s.u,{title:"View panel in dashboard",onDismiss:l,onClickBackdrop:l,isOpen:!0},a.createElement("div",{className:i.container},n===0?a.createElement("span",null,"Panel is not linked to a dashboard. Add the panel to a dashboard and retry."):null,n>0?a.createElement(a.Fragment,null,a.createElement("p",null,"This panel is being used in"," ",a.createElement("strong",null,n," ",n>1?"dashboards":"dashboard"),".Please choose which dashboard to view the panel in:"),a.createElement(f.qb,{isClearable:!0,isLoading:D,defaultOptions:!0,loadOptions:B,onChange:T,placeholder:"Start typing to search for dashboard",noOptionsMessage:"No dashboards found"})):null),a.createElement(s.u.ButtonRow,null,a.createElement(h.zx,{variant:"secondary",onClick:l,fill:"outline"},"Cancel"),a.createElement(h.zx,{onClick:R,disabled:!Boolean(_)},_?`View panel in ${_?.label}...`:"View panel in dashboard...")))}async function v(o,l,i){i(!0);const M=(await(0,C.E8)(o)).filter(n=>n.title.toLowerCase().includes(l.toLowerCase())).map(n=>({label:n.title,value:n}));return i(!1),M}function p(o){return{container:t.css``}}}}]);

//# sourceMappingURL=LibraryPanelsPage.de44303ae70506aead8d.js.map