"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[3778],{63268:(f,d,a)=>{a.r(d),a.d(d,{FolderLibraryPanelsPage:()=>i,default:()=>g});var l=a(65237),M=a(37149),D=a(15804),e=a(38992),C=a(85938),h=a(13732),v=a(2952),_=a(4036),L=a(18149);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)},2952:(f,d,a)=>{a.d(d,{b:()=>m});var l=a(60234),M=a(56027),D=a.n(M),e=a(65237),C=a(31667),h=a(38002),v=a(93048),_=a(90931),L=a(94795),E=a(48389),c=a(25961);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.0b1bcb39d2cf333c35e3.js.map