"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7878],{97589:(L,r,e)=>{e.r(r),e.d(r,{LibraryPanelsPage:()=>E,default:()=>O});var t=e(27702),d=e(44644),P=e(29427),a=e(56188);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},56188:(L,r,e)=>{e.d(r,{b:()=>g});var t=e(42844),d=e(56027),P=e.n(d),a=e(27702),E=e(78968),O=e(26129),c=e(66310),s=e(13741),f=e(28580),h=e(66670),C=e(75766);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:!_},_?`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:(0,t.css)``}}}}]);

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