"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8516],{45434:(v,d,a)=>{a.r(d),a.d(d,{LibraryPanelsPage:()=>c,default:()=>m});var l=a(96540),i=a(17205),O=a(16678),e=a(24643);const c=()=>{const[E,s]=(0,l.useState)(void 0);return l.createElement(i.Y,{navId:"dashboards/library-panels"},l.createElement(i.Y.Contents,null,l.createElement(O.j,{onClick:s,showSecondaryActions:!0,showSort:!0,showPanelFilter:!0,showFolderFilter:!0}),E?l.createElement(e.F,{onDismiss:()=>s(void 0),libraryPanel:E}):null))},m=c},24643:(v,d,a)=>{a.d(d,{F:()=>L});var l=a(32196),i=a(76459),O=a.n(i),e=a(96540),c=a(76885),m=a(12131),E=a(40845),s=a(37390),y=a(88323),p=a(55852),t=a(44836),D=a(57767);function L({libraryPanel:o,onDismiss:r}){const _=(0,E.of)(b),[h,M]=(0,e.useState)(!1),[n,g]=(0,e.useState)(0),[u,A]=(0,e.useState)(void 0);(0,e.useEffect)(()=>{(async()=>{const T=await(0,D.GN)(o.uid);g(T.length)})()},[o.uid]);const C=(0,e.useCallback)(P=>f(o.uid,P,M),[o.uid]),B=(0,e.useMemo)(()=>O()(C,300,{leading:!0}),[C]),K=P=>{P.preventDefault(),m.Ny.push(c.kM.renderUrl(`/d/${u?.value?.uid}`,{}))};return e.createElement(s.a,{title:(0,t.t)("library-panels.modal.title","View panel in dashboard"),onDismiss:r,onClickBackdrop:r,isOpen:!0},e.createElement("div",{className:_.container},n===0?e.createElement("span",null,e.createElement(t.x6,{i18nKey:"library-panels.modal.panel-not-linked"},"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,e.createElement(t.x6,{i18nKey:"library-panels.modal.body",count:n},"This panel is being used in ",{count:n}," dashboard. Please choose which dashboard to view the panel in:")),e.createElement(y.DW,{isClearable:!0,isLoading:h,defaultOptions:!0,loadOptions:B,onChange:A,placeholder:(0,t.t)("library-panels.modal.select-placeholder","Start typing to search for dashboard"),noOptionsMessage:(0,t.t)("library-panels.modal.select-no-options-message","No dashboards found")})):null),e.createElement(s.a.ButtonRow,null,e.createElement(p.$n,{variant:"secondary",onClick:r,fill:"outline"},e.createElement(t.x6,{i18nKey:"library-panels.modal.button-cancel"},"Cancel")),e.createElement(p.$n,{onClick:K,disabled:!u},u?(0,t.t)("library-panels.modal.button-view-panel1","View panel in {{label}}...",{label:u?.label}):(0,t.t)("library-panels.modal.button-view-panel2","View panel in dashboard..."))))}async function f(o,r,_){_(!0);const M=(await(0,D.xV)(o)).filter(n=>n.title.toLowerCase().includes(r.toLowerCase())).map(n=>({label:n.title,value:n}));return _(!1),M}function b(o){return{container:(0,l.css)``}}}}]);

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