"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7878],{22803:(b,d,a)=>{a.r(d),a.d(d,{LibraryPanelsPage:()=>c,default:()=>m});var l=a(85960),i=a(20989),O=a(56408),e=a(10058);const c=()=>{const[E,s]=(0,l.useState)(void 0);return l.createElement(i.T,{navId:"dashboards/library-panels"},l.createElement(i.T.Contents,null,l.createElement(O.N,{onClick:s,showSecondaryActions:!0,showSort:!0,showPanelFilter:!0,showFolderFilter:!0}),E?l.createElement(e.b,{onDismiss:()=>s(void 0),libraryPanel:E}):null))},m=c},10058:(b,d,a)=>{a.d(d,{b:()=>L});var l=a(66681),i=a(97812),O=a.n(i),e=a(85960),c=a(173),m=a(91),E=a(47257),s=a(7288),v=a(27436),C=a(29165),t=a(95329),M=a(1706);function L({libraryPanel:o,onDismiss:r}){const _=(0,E.wW)(f),[h,p]=(0,e.useState)(!1),[n,g]=(0,e.useState)(0),[u,A]=(0,e.useState)(void 0);(0,e.useEffect)(()=>{(async()=>{const K=await(0,M.Ef)(o.uid);g(K.length)})()},[o.uid]);const D=(0,e.useCallback)(P=>y(o.uid,P,p),[o.uid]),T=(0,e.useMemo)(()=>O()(D,300,{leading:!0}),[D]),B=P=>{P.preventDefault(),m.E1.push(c.Cj.renderUrl(`/d/${u?.value?.uid}`,{}))};return e.createElement(s.u,{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.cC,{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.cC,{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(v.qb,{isClearable:!0,isLoading:h,defaultOptions:!0,loadOptions:T,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.u.ButtonRow,null,e.createElement(C.zx,{variant:"secondary",onClick:r,fill:"outline"},e.createElement(t.cC,{i18nKey:"library-panels.modal.button-cancel"},"Cancel")),e.createElement(C.zx,{onClick:B,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 y(o,r,_){_(!0);const p=(await(0,M.E8)(o)).filter(n=>n.title.toLowerCase().includes(r.toLowerCase())).map(n=>({label:n.title,value:n}));return _(!1),p}function f(o){return{container:(0,l.css)``}}}}]);

//# sourceMappingURL=LibraryPanelsPage.4dd382579a05a07372d6.js.map