"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[152,5804],{25329(v,c,a){a.r(c),a.d(c,{BrowseFolderLibraryPanelsPage:()=>O,default:()=>p});var n=a(74848),C=a(96540),f=a(54148),o=a(28553),h=a(5246),e=a(38784),b=a(91410),u=a(65025),P=a(27848);function O(){const{uid:E=""}=(0,f.g)(),{data:r}=(0,o.u$)(E),[s,t]=(0,C.useState)(void 0),[_]=(0,o.HP)(),D=(0,e.C)(r,"panels"),l=E?async d=>{if(r){const i=await _({...r,title:d});if("error"in i)throw i.error}}:void 0;return(0,n.jsx)(h.Y,{navId:"dashboards/browse",pageNav:D,onEditTitle:l,actions:r&&(0,n.jsx)(P.A,{folderDTO:r}),children:(0,n.jsxs)(h.Y.Contents,{children:[(0,n.jsx)(b.j,{onClick:t,currentFolderUID:E,showSecondaryActions:!0,showSort:!0,showPanelFilter:!0}),s?(0,n.jsx)(u.F,{onDismiss:()=>t(void 0),libraryPanel:s}):null]})})}const p=O},65025(v,c,a){a.d(c,{F:()=>E});var n=a(74848),C=a(76459),f=a.n(C),o=a(96540),h=a(91715),e=a(52358),b=a(98391),u=a(8208),P=a(45270),O=a(87748),p=a(56997);function E({libraryPanel:s,onDismiss:t}){const[_,D]=(0,o.useState)(!1),[l,d]=(0,o.useState)(0),[i,g]=(0,o.useState)(void 0);(0,o.useEffect)(()=>{(async()=>{const m=await(0,p.GN)(s.uid);d(m.length)})()},[s.uid]);const L=(0,o.useCallback)(M=>r(s.uid,M,D),[s.uid]),y=(0,o.useMemo)(()=>f()(L,300,{leading:!0}),[L]),A=M=>{M.preventDefault(),b.Ny.push(h.kM.renderUrl(`/d/${i?.value?.uid}`,{}))};return(0,n.jsxs)(u.a,{title:(0,e.t)("library-panels.modal.title","View panel in dashboard"),onDismiss:t,onClickBackdrop:t,isOpen:!0,children:[(0,n.jsxs)("div",{children:[l===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,l>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{children:(0,n.jsxs)(e.x6,{i18nKey:"library-panels.modal.body",count:l,tOptions:{defaultValue_one:"This panel is being used in {{count}} dashboard. Please choose which dashboard to view the panel in:",defaultValue_other:"This panel is being used in {{count}} dashboard. Please choose which dashboard to view the panel in:"},children:["This panel is being used in ",{count:l}," dashboard. Please choose which dashboard to view the panel in:"]})}),(0,n.jsx)(O.DW,{isClearable:!0,isLoading:_,defaultOptions:!0,loadOptions:y,onChange:g,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)(u.a.ButtonRow,{children:[(0,n.jsx)(P.$n,{variant:"secondary",onClick:t,fill:"outline",children:(0,n.jsx)(e.x6,{i18nKey:"library-panels.modal.button-cancel",children:"Cancel"})}),(0,n.jsx)(P.$n,{onClick:A,disabled:!i,children:i?(0,e.t)("library-panels.modal.button-view-panel1","View panel in {{label}}...",{label:i?.label}):(0,e.t)("library-panels.modal.button-view-panel2","View panel in dashboard...")})]})]})}async function r(s,t,_){_(!0);const l=(await(0,p.xV)(s))?.filter(d=>d.name.toLowerCase().includes(t.toLowerCase())).map(d=>({label:d.name,value:d}));return _(!1),l||[]}},58033(v,c,a){v.exports=a.p+"static/img/user_profile.4d4fc140.png"}}]);

//# sourceMappingURL=FolderLibraryPanelsPage.e48fc03c003d40f673d0.js.map