"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[3778],{42029:(f,d,a)=>{a.r(d),a.d(d,{FolderLibraryPanelsPage:()=>i,default:()=>g});var l=a(68404),M=a(36635),D=a(22350),e=a(79396),C=a(86245),h=a(23189),v=a(7725),_=a(61986),L=a(60492);const E=(t,s)=>{const o=s.match.params.uid;return{pageNav:(0,C.ht)(t.navIndex,`folder-library-panels-${o}`,(0,L._)(1)),folderUid:o}},c={getFolderByUid:_.Pb},m=(0,M.connect)(E,c);function i({pageNav:t,getFolderByUid:s,folderUid:o}){const{loading:P}=(0,D.Z)(async()=>await s(o),[s,o]),[r,n]=(0,l.useState)(void 0);return l.createElement(e.T,{navId:"dashboards/browse",pageNav:t.main},l.createElement(e.T.Contents,{isLoading:P},l.createElement(h.N,{onClick:n,currentFolderUID:o,showSecondaryActions:!0,showSort:!0,showPanelFilter:!0}),r?l.createElement(v.b,{onDismiss:()=>n(void 0),libraryPanel:r}):null))}const g=m(i)},7725:(f,d,a)=>{a.d(d,{b:()=>m});var l=a(52423),M=a(99151),D=a.n(M),e=a(68404),C=a(27677),h=a(37932),v=a(72648),_=a(35029),L=a(53217),E=a(31403),c=a(86648);function m({libraryPanel:t,onDismiss:s}){const o=(0,v.wW)(g),[P,r]=(0,e.useState)(!1),[n,T]=(0,e.useState)(0),[u,A]=(0,e.useState)(void 0);(0,e.useEffect)(()=>{(async()=>{const U=await(0,c.Ef)(t.uid);T(U.length)})()},[t.uid]);const p=(0,e.useCallback)(O=>i(t.uid,O,r),[t.uid]),B=(0,e.useMemo)(()=>D()(p,300,{leading:!0}),[p]),I=O=>{O.preventDefault(),h.E1.push(C.Cj.renderUrl(`/d/${u?.value?.uid}`,{}))};return e.createElement(_.u,{title:"View panel in dashboard",onDismiss:s,onClickBackdrop:s,isOpen:!0},e.createElement("div",{className:o.container},n===0?e.createElement("span",null,"Panel is not linked to a dashboard. Add the panel to a dashboard and retry."):null,n>0?e.createElement(e.Fragment,null,e.createElement("p",null,"This panel is being used in"," ",e.createElement("strong",null,n," ",n>1?"dashboards":"dashboard"),".Please choose which dashboard to view the panel in:"),e.createElement(L.qb,{isClearable:!0,isLoading:P,defaultOptions:!0,loadOptions:B,onChange:A,placeholder:"Start typing to search for dashboard",noOptionsMessage:"No dashboards found"})):null),e.createElement(_.u.ButtonRow,null,e.createElement(E.zx,{variant:"secondary",onClick:s,fill:"outline"},"Cancel"),e.createElement(E.zx,{onClick:I,disabled:!Boolean(u)},u?`View panel in ${u?.label}...`:"View panel in dashboard...")))}async function i(t,s,o){o(!0);const r=(await(0,c.E8)(t)).filter(n=>n.title.toLowerCase().includes(s.toLowerCase())).map(n=>({label:n.title,value:n}));return o(!1),r}function g(t){return{container:l.css``}}}}]);

//# sourceMappingURL=FolderLibraryPanelsPage.876c792dd5e95d9fc0a8.js.map