"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[152,5804],{95576(L,c,a){a.r(c),a.d(c,{BrowseFolderLibraryPanelsPage:()=>M,default:()=>h});var n=a(14553),P=a(55501),y=a(54148),s=a(98970),u=a(13791),e=a(66198),b=a(24438),O=a(72327),D=a(12518);function M(){const{uid:E=""}=(0,y.g)(),{data:t}=(0,s.u$)(E),[l,d]=(0,P.useState)(void 0),[_]=(0,s.HP)(),p=(0,P.useMemo)(()=>{if(!t)return;const o=(0,e.R4)(t),r=(0,e.pq)(t.uid),v=o.children?.find(C=>C.id===r);return v&&(v.active=!0),o},[t]),i=E?async o=>{if(t){const r=await _({...t,title:o});if("error"in r)throw r.error}}:void 0;return(0,n.jsx)(u.Y,{navId:"dashboards/browse",pageNav:p,onEditTitle:i,actions:t&&(0,n.jsx)(D.A,{folderDTO:t}),children:(0,n.jsxs)(u.Y.Contents,{children:[(0,n.jsx)(b.j,{onClick:d,currentFolderUID:E,showSecondaryActions:!0,showSort:!0,showPanelFilter:!0}),l?(0,n.jsx)(O.F,{onDismiss:()=>d(void 0),libraryPanel:l}):null]})})}const h=M},72327(L,c,a){a.d(c,{F:()=>E});var n=a(14553),P=a(76459),y=a.n(P),s=a(55501),u=a(5556),e=a(92745),b=a(36490),O=a(22787),D=a(45861),M=a(54604),h=a(30124);function E({libraryPanel:l,onDismiss:d}){const[_,p]=(0,s.useState)(!1),[i,o]=(0,s.useState)(0),[r,v]=(0,s.useState)(void 0);(0,s.useEffect)(()=>{(async()=>{const A=await(0,h.GN)(l.uid);o(A.length)})()},[l.uid]);const C=(0,s.useCallback)(f=>t(l.uid,f,p),[l.uid]),m=(0,s.useMemo)(()=>y()(C,300,{leading:!0}),[C]),g=f=>{f.preventDefault(),b.Ny.push(u.kM.renderUrl(`/d/${r?.value?.uid}`,{}))};return(0,n.jsxs)(O.a,{title:(0,e.t)("library-panels.modal.title","View panel in dashboard"),onDismiss:d,onClickBackdrop:d,isOpen:!0,children:[(0,n.jsxs)("div",{children:[i===0?(0,n.jsx)("span",{children:(0,n.jsx)(e.x6,{i18nKey:"library-panels.modal.panel-not-linked",children:"Panel is not linked to a dashboard. Add the panel to a dashboard and retry."})}):null,i>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{children:(0,n.jsxs)(e.x6,{i18nKey:"library-panels.modal.body",count:i,children:["This panel is being used in ",{count:i}," dashboard. Please choose which dashboard to view the panel in:"]})}),(0,n.jsx)(M.DW,{isClearable:!0,isLoading:_,defaultOptions:!0,loadOptions:m,onChange:v,placeholder:(0,e.t)("library-panels.modal.select-placeholder","Start typing to search for dashboard"),noOptionsMessage:(0,e.t)("library-panels.modal.select-no-options-message","No dashboards found")})]}):null]}),(0,n.jsxs)(O.a.ButtonRow,{children:[(0,n.jsx)(D.$n,{variant:"secondary",onClick:d,fill:"outline",children:(0,n.jsx)(e.x6,{i18nKey:"library-panels.modal.button-cancel",children:"Cancel"})}),(0,n.jsx)(D.$n,{onClick:g,disabled:!r,children:r?(0,e.t)("library-panels.modal.button-view-panel1","View panel in {{label}}...",{label:r?.label}):(0,e.t)("library-panels.modal.button-view-panel2","View panel in dashboard...")})]})]})}async function t(l,d,_){_(!0);const i=(await(0,h.xV)(l))?.filter(o=>o.name.toLowerCase().includes(d.toLowerCase())).map(o=>({label:o.name,value:o}));return _(!1),i||[]}},58033(L,c,a){L.exports=a.p+"static/img/user_profile.4d4fc140.png"}}]);

//# sourceMappingURL=FolderLibraryPanelsPage-react19.ee1f57a7fd44f4455af2.js.map