"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8644],{512:(Y,T,n)=>{n.d(T,{Z:()=>I});var i=n(65237),e=n(6335),h=n(48389);function g({dashboards:d,onImport:x,onRemove:M}){function y(S){return S.revision!==S.importedRevision?"Update":"Re-import"}return i.createElement("table",{className:"filter-table"},i.createElement("tbody",null,d.map((S,F)=>i.createElement("tr",{key:`${S.dashboardId}-${F}`},i.createElement("td",{className:"width-1"},i.createElement(e.J,{name:"apps"})),i.createElement("td",null,S.imported?i.createElement("a",{href:S.importedUrl},S.title):i.createElement("span",null,S.title)),i.createElement("td",{style:{textAlign:"right"}},S.imported?i.createElement(h.zx,{variant:"secondary",size:"sm",onClick:()=>x(S,!0)},y(S)):i.createElement(h.zx,{variant:"secondary",size:"sm",onClick:()=>x(S,!1)},"Import"),S.imported&&i.createElement(h.zx,{"aria-label":"Delete dashboard",icon:"trash-alt",variant:"destructive",size:"sm",onClick:()=>M(S)}))))))}const I=g},54648:(Y,T,n)=>{n.d(T,{V:()=>h});var i=n(65237),e=n(13431);const h=(0,i.createContext)(e.n)},7669:(Y,T,n)=>{n.d(T,{E:()=>X,IA:()=>re,MF:()=>q,OU:()=>R,Qs:()=>C,YY:()=>K,_l:()=>te,d7:()=>_,hw:()=>k,nH:()=>u,q6:()=>G,qj:()=>L,wi:()=>p,wl:()=>z,zJ:()=>J});var i=n(65237),e=n(43201),h=n(24901),g=n(63969),I=n(85938),d=n(3315),x=n(91063),M=n(77393),y=n(21527),S=n(54648),F=n(7298),w=n(50565),A=n(11541);const X=f=>{const E=(0,d.useDispatch)();(0,i.useEffect)(()=>(E((0,y.M9)(f)),function(){E((0,e.e)({cleanupAction:b=>b.dataSourceSettings=w.fk}))}),[f,E])},k=f=>{const E=(0,d.useDispatch)(),N=_();return()=>E((0,y.kY)(f,N.Edit))},J=()=>{const f=(0,d.useDispatch)(),E=(0,d.useSelector)(b=>b.dataSources.isLoadingDataSources),N=(0,d.useSelector)(b=>b.dataSources.dataSources);return(0,i.useEffect)(()=>{f((0,y.bZ)())},[f]),{isLoading:E,dataSources:N}},p=f=>{const E=(0,d.useDispatch)();(0,i.useEffect)(()=>{E((0,y.gv)(f))},[E,f])},R=()=>{const f=(0,d.useDispatch)();(0,i.useEffect)(()=>{f((0,y.Kj)())},[f])},u=()=>{const f=(0,d.useDispatch)(),E=_();return N=>{f((0,y.J_)(N,E.Edit))}},L=()=>{const f=(0,d.useDispatch)();return async E=>f((0,y.oe)(E))},G=()=>{const f=(0,d.useDispatch)(),{name:E}=(0,d.useSelector)(N=>N.dataSources.dataSource);return()=>{h.Z.publish(new x.VJ({title:"Delete",text:`Are you sure you want to delete the "${E}" data source?`,yesText:"Delete",icon:"trash-alt",onConfirm:()=>f((0,y.F5)())}))}},z=f=>(0,d.useSelector)(E=>(0,A.f6)(E.dataSources,f)),re=f=>{const E=z(f);return(0,M.iU)(E)},C=f=>(0,d.useSelector)(E=>(0,A.G4)(E.dataSources,f)),te=()=>(0,d.useSelector)(f=>f.dataSourceSettings),q=(f,E)=>{const N=z(f),{plugin:b,loadError:Q,loading:le}=te(),ne=(0,d.useSelector)(j=>j.navIndex),H=E?`datasource-${E}-${f}`:`datasource-settings-${f}`;if(Q){const j={text:Q,subTitle:"Data Source Error",icon:"exclamation-triangle"};return{node:j,main:j}}return le||!b?(0,I.ht)(ne,H,(0,F.xG)("settings")):(0,I.ht)(ne,H,(0,F.nI)((0,F.B1)(N,b),E||"settings"))},K=f=>{const E=z(f),N=E.readOnly===!0,b=g.Vt.hasPermissionInMetadata(d.AccessControlAction.DataSourcesWrite,E),Q=g.Vt.hasPermissionInMetadata(d.AccessControlAction.DataSourcesDelete,E);return{readOnly:N,hasWriteRights:b,hasDeleteRights:Q}},_=()=>(0,i.useContext)(S.V)},66116:(Y,T,n)=>{n.d(T,{BX:()=>I.BX,E:()=>h.E,Ht:()=>I.Ht,I5:()=>d.I5,IA:()=>d.IA,IO:()=>d.IO,J_:()=>i.J_,MF:()=>h.MF,Nu:()=>I.Nu,OU:()=>h.OU,Qs:()=>h.Qs,Rz:()=>h.IA,Vj:()=>e.V,YY:()=>h.YY,_l:()=>h._l,d7:()=>h.d7,hw:()=>h.hw,mt:()=>d.mt,nH:()=>h.nH,q6:()=>h.q6,qj:()=>h.qj,r7:()=>d.r7,rl:()=>I.rl,wi:()=>h.wi,wl:()=>h.wl,yr:()=>I.yr,zJ:()=>h.zJ,zT:()=>I.zT});var i=n(21527),e=n(54648),h=n(7669),g=n(7298),I=n(50565),d=n(11541)},22861:(Y,T,n)=>{n.d(T,{SX:()=>g,IF:()=>X,oZ:()=>y,xh:()=>k});var i=n(65237),e=n(80610),h=n(66434);function g({error:p}){const R=I(p);return i.createElement(h.C,{icon:"exclamation-triangle",text:"Disabled",color:"red",tooltip:R})}function I(p){switch(p){case e.w2.modifiedSignature:return"Plugin disabled due to modified content";case e.w2.invalidSignature:return"Plugin disabled due to invalid plugin signature";case e.w2.missingSignature:return"Plugin disabled due to missing plugin signature";case null:case void 0:return"Plugin disabled";default:return`Plugin disabled due to unknown error${p?`: ${p}`:""}`}}var d=n(93048),x=n(60234);const M=p=>x.css`
  background: ${p.colors.background.primary};
  border-color: ${p.colors.border.strong};
  color: ${p.colors.text.secondary};
`;function y(){const p=(0,d.wW)(M);return i.createElement(h.C,{text:"Installed",color:"orange",className:p})}var S=n(75764),F=n(6741),w=n(16291),A=n(48389);function X({plugin:p}){const R=(0,d.wW)(M),u=L=>{L.preventDefault(),window.open(`https://grafana.com/grafana/plugins/${p.id}?utm_source=grafana_catalog_learn_more`,"_blank","noopener,noreferrer")};return(0,S.v)("enterprise.plugins")?i.createElement(h.C,{text:"Enterprise",color:"blue"}):i.createElement(F.Lh,null,i.createElement(w.o,{status:p.signature}),i.createElement(h.C,{icon:"lock","aria-label":"lock icon",text:"Enterprise",color:"blue",className:R}),i.createElement(A.zx,{size:"sm",fill:"text",icon:"external-link-alt",onClick:u},"Learn more"))}function k({plugin:p}){const R=(0,d.wW)(J);return p.hasUpdate&&!p.isCore&&p.type!==e.zV.renderer?i.createElement("p",{className:R.hasUpdate},"Update available!"):null}const J=p=>({hasUpdate:x.css`
      color: ${p.colors.text.secondary};
      font-size: ${p.typography.bodySmall.fontSize};
      margin-bottom: 0;
    `})},20219:(Y,T,n)=>{n.d(T,{a:()=>h});var i=n(65237),e=n(16693);const h=({text:g="Loading..."})=>i.createElement("div",{className:"page-loader-wrapper"},i.createElement(e.u,{text:g}))},48644:(Y,T,n)=>{n.d(T,{Q:()=>st});var i=n(60234),e=n(65237),h=n(60894),g=n(93048),I=n(5565),d=n(88347),x=n(6741),M=n(38992),y=n(3315),S=n(20219),F=n(84262),w=n(25641),A=n(78993);const X=({versions:t=[],installedVersion:s})=>{const a=(0,g.wW)(k),l=(0,A.RU)(t);return t.length===0?e.createElement("p",null,"No version history was found."):e.createElement("table",{className:a.table},e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",null,"Version"),e.createElement("th",null,"Last updated"))),e.createElement("tbody",null,t.map(o=>{const m=s===o.version;return e.createElement("tr",{key:o.version},m?e.createElement("td",{className:a.currentVersion},o.version," (installed version)"):o.version===l?.version?e.createElement("td",null,o.version," (latest compatible version)"):e.createElement("td",null,o.version),e.createElement("td",{className:m?a.currentVersion:""},(0,w.E8)(o.createdAt)))})))},k=t=>({container:i.css`
    padding: ${t.spacing(2,4,3)};
  `,table:i.css`
    table-layout: fixed;
    width: 100%;
    td,
    th {
      padding: ${t.spacing()} 0;
    }
    th {
      font-size: ${t.typography.h5.fontSize};
    }
  `,currentVersion:i.css`
    font-weight: ${t.typography.fontWeightBold};
  `});var J=n(15804),p=n(77430);const R=t=>(0,J.Z)(async()=>t&&t.isInstalled&&!t.isDisabled?(0,p.O)(t.id):null,[t?.id,t?.isInstalled,t?.isDisabled]);var u=n(54081),L=n(89949),G=n(90806),z=n(55041),re=n(41227),C=n(48389);class te extends e.PureComponent{constructor(s){super(s),this.element=null,this.preUpdateHook=()=>Promise.resolve(),this.postUpdateHook=()=>Promise.resolve(),this.update=()=>{const a=this.model.id;this.preUpdateHook().then(()=>{const l=(0,L.extend)({enabled:this.model.enabled,pinned:this.model.pinned,jsonData:this.model.jsonData,secureJsonData:this.model.secureJsonData},{});return(0,z.i)().post(`/api/plugins/${a}/settings`,l)}).then(this.postUpdateHook).then(l=>{window.location.href=window.location.href})},this.setPreUpdateHook=a=>{this.preUpdateHook=a},this.setPostUpdateHook=a=>{this.postUpdateHook=a},this.importDashboards=()=>((0,G.d)("AppConfig","importDashboards()"),Promise.resolve()),this.enable=()=>{this.model.enabled=!0,this.model.pinned=!0,this.update()},this.disable=()=>{this.model.enabled=!1,this.model.pinned=!1,this.update()},this.state={angularCtrl:null,refresh:0}}componentDidMount(){setTimeout(()=>{this.setState({refresh:this.state.refresh+1})},5)}componentDidUpdate(s){if(!this.element||this.state.angularCtrl)return;this.model=(0,L.cloneDeep)(this.props.app.meta);const a=(0,re.w)(),l='<plugin-component type="app-config-ctrl"></plugin-component>',o={ctrl:this,isAppConfigCtrl:!0},m=a.load(this.element,o,l);this.setState({angularCtrl:m})}render(){const s=this.model,a=(0,i.css)({marginRight:"8px"});return e.createElement("div",null,e.createElement("div",{ref:l=>this.element=l}),e.createElement("br",null),e.createElement("br",null),s&&e.createElement("div",{className:"gf-form"},!s.enabled&&e.createElement(C.zx,{variant:"primary",onClick:this.enable,className:a},"Enable"),s.enabled&&e.createElement(C.zx,{variant:"primary",onClick:this.update,className:a},"Update"),s.enabled&&e.createElement(C.zx,{variant:"destructive",onClick:this.disable,className:a},"Disable")))}}var q=n(74154),K=n(63969),_=n(512);class f extends e.PureComponent{constructor(s){super(s),this.importAll=()=>{this.importNext(0)},this.importNext=a=>{const{dashboards:l}=this.state;return this.import(l[a],!0).then(()=>a+1<l.length?new Promise(o=>{setTimeout(()=>{this.importNext(a+1).then(()=>{o()})},500)}):Promise.resolve())},this.import=(a,l)=>{const{plugin:o,datasource:m}=this.props,v={pluginId:o.id,path:a.path,overwrite:l,inputs:[]};return m&&v.inputs.push({name:"*",type:"datasource",pluginId:m.meta.id,value:m.name}),(0,z.i)().post("/api/dashboards/import",v).then(P=>{K.h$.emit(q.SI.alertSuccess,["Dashboard Imported",a.title]),(0,L.extend)(a,P),this.setState({dashboards:[...this.state.dashboards]})})},this.remove=a=>{(0,z.i)().delete("/api/dashboards/uid/"+a.uid).then(()=>{a.imported=!1,this.setState({dashboards:[...this.state.dashboards]})})},this.state={loading:!0,dashboards:[]}}async componentDidMount(){const s=this.props.plugin.id;(0,z.i)().get(`/api/plugins/${s}/dashboards`).then(a=>{this.setState({dashboards:a,loading:!1})})}render(){const{loading:s,dashboards:a}=this.state;return s?e.createElement("div",null,"loading..."):!a||!a.length?e.createElement("div",null,"No dashboards are included with this plugin"):e.createElement("div",{className:"gf-form-group"},e.createElement(_.Z,{dashboards:a,onImport:this.import,onRemove:this.remove}))}}var E=n(55925),N=n(45383),b=n(49784),Q=n(44380),le=n(76044),ne=n(56540),H=n(5294);function j({plugin:t}){const s=(0,g.wW)(de),a=(0,e.useMemo)(()=>({query:"*",panel_type:t.id,kind:["panel"]}),[t]),l=(0,J.Z)(()=>(0,H.getGrafanaSearcher)().search(a),[a]),o=l.value;return o?.totalRows?e.createElement("div",{className:s.wrap},e.createElement("div",{className:s.info},t.name," is used ",e.createElement("b",null,o.totalRows)," times."),e.createElement(E.Z,null,({width:m,height:v})=>e.createElement(ne.Q,{response:o,width:m,height:v,clearSelection:()=>{},keyboardEvents:(0,N.of)(),onTagSelected:()=>{}}))):l.loading?e.createElement(Q.$,null):b.v.featureToggles.panelTitleSearch?e.createElement(le.Z,{title:`${t.name} is not used in any dashboards yet`,buttonIcon:"plus",buttonTitle:"Create Dashboard",buttonLink:`dashboard/new?panelType=${t.id}&editPanel=1`}):e.createElement(d.b,{title:"Missing feature toggle: panelTitleSearch"},"Plugin usage requires the new search index to find usage across dashboards")}const de=t=>({wrap:i.css`
      width: 100%;
      height: 100%;
    `,info:i.css`
      padding-bottom: 30px;
    `});function me({plugin:t,queryParams:s,pageId:a}){const l=(0,g.wW)(c),{value:o}=R(t);if(a===u.tu.OVERVIEW)return e.createElement("div",{className:(0,i.cx)(l.readme,l.container),dangerouslySetInnerHTML:{__html:t.details?.readme??"No plugin help or readme markdown file was found"}});if(a===u.tu.VERSIONS)return e.createElement("div",{className:l.container},e.createElement(X,{versions:t.details?.versions,installedVersion:t.installedVersion}));if(a===u.tu.CONFIG&&o?.angularConfigCtrl)return e.createElement("div",{className:l.container},e.createElement(te,{app:o}));if(o?.configPages){for(const m of o.configPages)if(a===m.id)return e.createElement("div",{className:l.container},e.createElement(F.b,{meta:o.meta},e.createElement(m.body,{plugin:o,query:s})))}return a===u.tu.USAGE&&o?e.createElement("div",{className:l.container},e.createElement(j,{plugin:o?.meta})):a===u.tu.DASHBOARDS&&o?e.createElement("div",{className:l.container},e.createElement(f,{plugin:o?.meta})):e.createElement("div",{className:l.container},e.createElement("p",null,"Page not found."))}const c=t=>({container:i.css``,readme:i.css`
    & img {
      max-width: 100%;
    }

    h1,
    h2,
    h3 {
      margin-top: ${t.spacing(3)};
      margin-bottom: ${t.spacing(2)};
    }

    *:first-child {
      margin-top: 0;
    }

    li {
      margin-left: ${t.spacing(2)};
      & > p {
        margin: ${t.spacing()} 0;
      }
    }

    a {
      color: ${t.colors.text.link};

      &:hover {
        color: ${t.colors.text.link};
        text-decoration: underline;
      }
    }

    table {
      table-layout: fixed;
      width: 100%;

      td,
      th {
        overflow-x: auto;
        padding: ${t.spacing(.5)} ${t.spacing(1)};
      }

      table,
      th,
      td {
        border: 1px solid ${t.colors.border.medium};
        border-collapse: collapse;
      }
    }
  `});var r=n(80610),D=n(92917);function O({className:t,plugin:s}){return s.isDisabled?e.createElement(d.b,{severity:"error",title:"Plugin disabled",className:t,"aria-label":D.wl.pages.PluginPage.disabledInfo},Z(s.error),e.createElement("p",null,"Please contact your server administrator to get this resolved."),e.createElement("a",{href:"https://grafana.com/docs/grafana/latest/administration/cli/#plugins-commands",className:"external-link",target:"_blank",rel:"noreferrer"},"Read more about managing plugins")):null}function Z(t){switch(t){case r.w2.modifiedSignature:return e.createElement("p",null,"Grafana Labs checks each plugin to verify that it has a valid digital signature. While doing this, we discovered that the content of this plugin does not match its signature. We can not guarantee the trustworthy of this plugin and have therefore disabled it. We recommend you to reinstall the plugin to make sure you are running a verified version of this plugin.");case r.w2.invalidSignature:return e.createElement("p",null,"Grafana Labs checks each plugin to verify that it has a valid digital signature. While doing this, we discovered that it was invalid. We can not guarantee the trustworthy of this plugin and have therefore disabled it. We recommend you to reinstall the plugin to make sure you are running a verified version of this plugin.");case r.w2.missingSignature:return e.createElement("p",null,"Grafana Labs checks each plugin to verify that it has a valid digital signature. While doing this, we discovered that there is no signature for this plugin. We can not guarantee the trustworthy of this plugin and have therefore disabled it. We recommend you to reinstall the plugin to make sure you are running a verified version of this plugin.");default:return e.createElement("p",null,"We failed to run this plugin due to an unkown reason and have therefore disabled it. We recommend you to reinstall the plugin to make sure you are running a working version of this plugin.")}}function oe({className:t,plugin:s}){const a=s.signature===r.Xy.valid,l=s.signature===r.Xy.internal,o=s.isDisabled&&ge(s.error);return a||l||o?null:e.createElement(d.b,{severity:"warning",title:"Invalid plugin signature","aria-label":D.wl.pages.PluginPage.signatureInfo,className:t},e.createElement("p",null,"Grafana Labs checks each plugin to verify that it has a valid digital signature. Plugin signature verification is part of our security measures to ensure plugins are safe and trustworthy. Grafana Labs can\u2019t guarantee the integrity of this unsigned plugin. Ask the plugin author to request it to be signed."),e.createElement("a",{href:"https://grafana.com/docs/grafana/latest/plugins/plugin-signatures/",className:"external-link",target:"_blank",rel:"noreferrer"},"Read more about plugins signing."))}function ge(t){switch(t){case r.w2.invalidSignature:case r.w2.missingSignature:case r.w2.modifiedSignature:return!0;default:return!1}}var ee=n(34138);const be=(t,s)=>{const{loading:a,error:l,value:o}=R(t),{pathname:m}=(0,h.TH)(),v=Ae(t,o),P=m.substring(0,m.lastIndexOf("/")),W=Boolean(t?.isPublished),U=s||v,ie=(0,e.useMemo)(()=>{const ce=t&&K.Vt.hasAccessInMetadata(y.AccessControlAction.PluginsWrite,t,(0,ee.RN)()),V=[];if(W&&V.push({text:u.xc.VERSIONS,id:u.tu.VERSIONS,icon:"history",url:`${m}?page=${u.tu.VERSIONS}`,active:u.tu.VERSIONS===U}),!o||(b.v.featureToggles.panelTitleSearch&&o.meta.type===r.zV.panel&&V.push({text:u.xc.USAGE,icon:"list-ul",id:u.tu.USAGE,url:`${m}?page=${u.tu.USAGE}`,active:u.tu.USAGE===U}),!ce))return V;if(o.meta.type===r.zV.app){if(o.angularConfigCtrl&&V.push({text:"Config",icon:"cog",id:u.tu.CONFIG,url:`${m}?page=${u.tu.CONFIG}`,active:u.tu.CONFIG===U}),o.configPages)for(const B of o.configPages)V.push({text:B.title,icon:B.icon,id:B.id,url:`${m}?page=${B.id}`,active:B.id===U});o.meta.includes?.find(B=>B.type===r.$_.dashboard)&&V.push({text:"Dashboards",icon:"apps",id:u.tu.DASHBOARDS,url:`${m}?page=${u.tu.DASHBOARDS}`,active:u.tu.DASHBOARDS===U})}return V},[t,o,m,W,U]),se={text:t?.name??"",img:t?.info.logos.small,breadcrumbs:[{title:"Plugins",url:P}],children:[{text:u.xc.OVERVIEW,icon:"file-alt",id:u.tu.OVERVIEW,url:`${m}?page=${u.tu.OVERVIEW}`,active:u.tu.OVERVIEW===U},...ie]};return{error:l,loading:a,navModel:se,activePageId:U}};function Ae(t,s){return!t||!s||!K.Vt.hasAccessInMetadata(y.AccessControlAction.PluginsWrite,t,(0,ee.RN)())||s.meta.type!==r.zV.app?u.tu.OVERVIEW:s.angularConfigCtrl?u.tu.CONFIG:s.configPages?.length?s.configPages[0].id:u.tu.OVERVIEW}var ae=n(6335),Ne=n(67327);function Ue({plugin:t}){const{value:s}=R(t);if(!s||!K.Vt.hasAccessInMetadata(y.AccessControlAction.PluginsWrite,t,(0,ee.RN)()))return null;const{enabled:a,jsonData:l}=s?.meta,o=()=>fe(t.id,{enabled:!0,pinned:!0,jsonData:l}),m=()=>{fe(t.id,{enabled:!1,pinned:!1,jsonData:l})};return e.createElement(e.Fragment,null,!a&&e.createElement(C.zx,{variant:"primary",onClick:o},"Enable"),a&&e.createElement(C.zx,{variant:"destructive",onClick:m},"Disable"))}const fe=async(t,s)=>{try{await(0,Ne.P6)(t,s),window.location.reload()}catch(a){console.error("Error while updating the plugin",a)}};var Ee=n(66116);function Te({plugin:t}){const s=(0,y.useDispatch)(),a=(0,Ee.d7)(),l=(0,e.useCallback)(()=>{const o={name:t.name,id:t.id};s((0,Ee.J_)(o,a.Edit))},[s,t,a]);return(0,ee.Gg)()?e.createElement(C.zx,{variant:"primary",onClick:l},"Create a ",t.name," data source"):null}function Me({plugin:t}){if(!t.isInstalled||t.isDisabled)return null;switch(t.type){case r.zV.datasource:return e.createElement(Te,{plugin:t});case r.zV.app:return e.createElement(Ue,{plugin:t});default:return null}}var Le=n(75764),$=n(96263);const Oe=({plugin:t,pluginStatus:s,latestCompatibleVersion:a})=>{const l=(0,g.wW)(Re),o=b.v.pluginAdminExternalManageEnabled,m=K.Vt.hasAccess(y.AccessControlAction.PluginsInstall,(0,ee.bO)()),v=(0,$.y9)(),P=Boolean(a);if(t.type===r.zV.renderer)return e.createElement("div",{className:l.message},"Renderer plugins cannot be managed by the Plugin Catalog.");if(t.type===r.zV.secretsmanager)return e.createElement("div",{className:l.message},"Secrets manager plugins cannot be managed by the Plugin Catalog.");if(t.isEnterprise&&!(0,Le.v)("enterprise.plugins"))return e.createElement(x.Lh,{height:"auto",align:"center"},e.createElement("span",{className:l.message},"No valid Grafana Enterprise license detected."),e.createElement(C.Qj,{href:`${(0,A.Uj)(t.id)}?utm_source=grafana_catalog_learn_more`,target:"_blank",rel:"noopener noreferrer",size:"sm",fill:"text",icon:"external-link-alt"},"Learn more"));if(t.isDev)return e.createElement("div",{className:l.message},"This is a development build of the plugin and can't be uninstalled.");if(!m&&!o){const W=`You do not have permission to ${s} this plugin.`;return e.createElement("div",{className:l.message},W)}return t.isPublished?P?v?null:e.createElement("div",{className:l.message},"The install controls have been disabled because the Grafana server cannot access grafana.com."):e.createElement("div",{className:l.message},e.createElement(ae.J,{name:"exclamation-triangle"}),"\xA0This plugin doesn't support your version of Grafana."):e.createElement("div",{className:l.message},e.createElement(ae.J,{name:"exclamation-triangle"})," This plugin is not published to"," ",e.createElement("a",{href:"https://www.grafana.com/plugins",target:"__blank",rel:"noreferrer"},"grafana.com/plugins")," ","and can't be managed via the catalog.")},Re=t=>({message:i.css`
      color: ${t.colors.text.secondary};
    `});var We=n(38002),Be=n(22324),he=n(24901),$e=n(68532),Ve=n(15037),pe=n(28704);const Fe=t=>{(0,pe.ff)("grafana_plugin_install_clicked",t)},ze=t=>{(0,pe.ff)("grafana_plugin_uninstall_clicked",t)};function we({plugin:t,pluginStatus:s,latestCompatibleVersion:a,setNeedReload:l}){const o=(0,y.useDispatch)(),[m]=(0,$e.K)(),v=(0,h.TH)(),{isInstalling:P,error:W}=(0,$.IS)(),{isUninstalling:U,error:ie}=(0,$.wq)(),se=(0,$.x3)(),ce=(0,$.S1)(),V=(0,$.kH)(),[B,Pe]=(0,e.useState)(!1),ot=()=>Pe(!0),Se=()=>Pe(!1),Ie=U?"Uninstalling":"Uninstall",xe={plugin_id:t.id,plugin_type:t.type,path:v.pathname};(0,e.useEffect)(()=>()=>{V()},[]);const it=async()=>{Fe(xe);const ue=await se(t.id,a?.version);!W&&!("error"in ue)&&(he.Z.emit(q.SI.alertSuccess,[`Installed ${t.name}`]),t.type==="app"&&l(!0))},Ce=async()=>{if(Se(),ze(xe),await ce(t.id),!ie){const ue=m.page;ue!==u.tu.OVERVIEW&&ue!==u.tu.VERSIONS&&We.E1.replace(`${v.pathname}?page=${u.tu.OVERVIEW}`),he.Z.emit(q.SI.alertSuccess,[`Uninstalled ${t.name}`]),t.type==="app"&&(o((0,Ve.Lk)({pluginID:t.id})),l(!1))}},ct=async()=>{await se(t.id,a?.version,!0),W||he.Z.emit(q.SI.alertSuccess,[`Updated ${t.name}`])};return s===u.vF.UNINSTALL?e.createElement(e.Fragment,null,e.createElement(Be.s,{isOpen:B,title:`Uninstall ${t.name}`,body:"Are you sure you want to uninstall this plugin?",confirmText:"Confirm",icon:"exclamation-triangle",onConfirm:Ce,onDismiss:Se}),e.createElement(x.Lh,{align:"flex-start",width:"auto",height:"auto"},e.createElement(C.zx,{variant:"destructive",disabled:U,onClick:ot},Ie))):s===u.vF.UPDATE?e.createElement(x.Lh,{align:"flex-start",width:"auto",height:"auto"},e.createElement(C.zx,{disabled:P,onClick:ct},P?"Updating":"Update"),e.createElement(C.zx,{variant:"destructive",disabled:U,onClick:Ce},Ie)):e.createElement(C.zx,{disabled:P||W,onClick:it},P?"Installing":"Install")}function Ge({pluginId:t,pluginStatus:s}){const a=`${(0,A.Uj)(t)}/?tab=installation`;return s===u.vF.UPDATE?e.createElement(x.Lh,{height:"auto"},e.createElement(C.Qj,{href:a,target:"_blank",rel:"noopener noreferrer"},"Update via grafana.com"),e.createElement(C.Qj,{variant:"destructive",href:a,target:"_blank",rel:"noopener noreferrer"},"Uninstall via grafana.com")):s===u.vF.UNINSTALL?e.createElement(C.Qj,{variant:"destructive",href:a,target:"_blank",rel:"noopener noreferrer"},"Uninstall via grafana.com"):e.createElement(C.Qj,{href:a,target:"_blank",rel:"noopener noreferrer"},"Install via grafana.com")}const Ke=({plugin:t})=>{const s=(0,g.wW)(He),a=(0,$.y9)(),l=(0,A.RU)(t?.details?.versions),[o,m]=(0,e.useState)(!1);if(!t)return null;const v=(0,A.HT)(t,a,l),P=b.v.pluginAdminExternalManageEnabled,W=t.isInstalled?t.hasUpdate?u.vF.UPDATE:u.vF.UNINSTALL:u.vF.INSTALL,U=t.isCore||t.isDisabled||!(0,A.fG)()||v;return e.createElement(x.wc,null,e.createElement(x.Lh,null,!U&&e.createElement(e.Fragment,null,P?e.createElement(Ge,{pluginId:t.id,pluginStatus:W}):e.createElement(we,{plugin:t,latestCompatibleVersion:l,pluginStatus:W,setNeedReload:m})),e.createElement(Me,{plugin:t})),o&&e.createElement(x.Lh,null,e.createElement(ae.J,{name:"exclamation-triangle"}),e.createElement("span",{className:s.message},"Refresh the page to see the changes")))},He=t=>({message:i.css`
      color: ${t.colors.text.secondary};
    `}),Ze=({plugin:t})=>{const s=(0,$.y9)(),a=(0,g.wW)(Je),{error:l}=(0,$.IS)();if(!t)return null;const o=(0,A.RU)(t.details?.versions),m=t.isInstalled?t.hasUpdate?u.vF.UPDATE:u.vF.UNINSTALL:u.vF.INSTALL;return e.createElement("div",{className:a.subtitle},l&&e.createElement(d.b,{title:"message"in l?l.message:""},typeof l=="string"?l:l.error),t?.description&&e.createElement("div",null,t?.description),t?.details?.links&&t.details.links.length>0&&e.createElement("span",null,t.details.links.map((v,P)=>e.createElement(e.Fragment,{key:P},P>0&&" | ",e.createElement("a",{href:v.url,className:"external-link"},v.name)))),(0,A.HT)(t,s,o)&&e.createElement(Oe,{plugin:t,pluginStatus:m,latestCompatibleVersion:o}))},Je=t=>({subtitle:i.css`
      display: flex;
      flex-direction: column;
      gap: ${t.spacing(1)};
    `});var Qe=n(22861),je=n(66917);function Ye({plugin:t,latestCompatibleVersion:s,className:a}){const l=(0,g.wW)(Xe),o=t.details?.pluginDependencies,m=t.isInstalled?t.details?.grafanaDependency:s?.grafanaDependency||t.details?.grafanaDependency;return!m&&(!o||!o.length)?null:e.createElement(je.Stack,{gap:1},Boolean(m)&&e.createElement("div",{className:l.depBadge},e.createElement(ae.J,{name:"grafana",className:l.icon}),"Grafana ",m),o&&o.length>0&&e.createElement("div",null,o.map(P=>e.createElement("span",{className:l.depBadge,key:P.name},e.createElement(ae.J,{name:u.Co[P.type],className:l.icon}),P.name," ",P.version))))}const Xe=t=>({dependencyTitle:i.css`
      margin-right: ${t.spacing(.5)};

      &::after {
        content: '';
        padding: 0;
      }
    `,depBadge:(0,i.css)({display:"flex",alignItems:"flex-start"}),icon:i.css`
      color: ${t.colors.text.secondary};
      margin-right: ${t.spacing(.5)};
    `});var ke=n(16291),qe=n(66434);const ve={[r._Z.grafana]:"grafana",[r._Z.commercial]:"shield",[r._Z.community]:"shield",DEFAULT:"shield-exclamation"};function _e({signatureType:t,signatureOrg:s=""}){const a=(0,g.wW)(De);if(!t&&!s)return null;const l=t===r._Z.grafana?"Grafana Labs":(0,L.capitalize)(t),o=ve[t||""]||ve.DEFAULT;return e.createElement(e.Fragment,null,e.createElement(ye,null,e.createElement("div",{className:a.detailsWrapper},e.createElement("strong",{className:a.strong},"Level:\xA0"),e.createElement(ae.J,{size:"xs",name:o}),"\xA0",l)),e.createElement(ye,null,e.createElement("strong",{className:a.strong},"Signed by:")," ",s))}const ye=({children:t})=>{const s=(0,g.wW)(De);return e.createElement(qe.C,{color:"green",className:s.badge,text:t})},De=t=>({badge:i.css`
    background-color: ${t.colors.background.canvas};
    border-color: ${t.colors.border.strong};
    color: ${t.colors.text.secondary};
    white-space: nowrap;
  `,detailsWrapper:i.css`
    align-items: center;
    display: flex;
  `,strong:i.css`
    color: ${t.colors.text.primary};
  `,icon:i.css`
    margin-right: ${t.spacing(.5)};
  `});function et({plugin:t}){const s=(0,g.wW)(tt),a=t.signature===r.Xy.valid;return e.createElement("div",{className:s.container},e.createElement("a",{href:"https://grafana.com/docs/grafana/latest/plugins/plugin-signatures/",target:"_blank",rel:"noreferrer",className:s.link},e.createElement(ke.o,{status:t.signature})),a&&e.createElement(_e,{signatureType:t.signatureType,signatureOrg:t.signatureOrg}))}const tt=t=>({container:i.css`
      display: flex;
      flex-wrap: wrap;
      gap: ${t.spacing(.5)};
    `,link:i.css`
      display: inline-flex;
      align-items: center;
    `}),nt=t=>{const s=[];if(!t)return s;const a=(0,A.RU)(t.details?.versions),l=t.installedVersion||a?.version;Boolean(l)&&s.push({label:"Version",value:l}),Boolean(t.orgName)&&s.push({label:"From",value:t.orgName}),(!t.signatureType||t.signatureType===r._Z.community||t.signatureType===r._Z.commercial)&&Boolean(t.downloads>0)&&s.push({label:"Downloads",value:new Intl.NumberFormat().format(t.downloads)});const m=t.details?.pluginDependencies;return!(t.isInstalled?t.details?.grafanaDependency:a?.grafanaDependency||t.details?.grafanaDependency)&&(!m||!m.length)||s.push({label:"Dependencies",value:e.createElement(Ye,{plugin:t,latestCompatibleVersion:a})}),t.isDisabled&&s.push({label:"Status",value:e.createElement(Qe.SX,{error:t.error})}),s.push({label:"Signature",value:e.createElement(et,{plugin:t})}),s},ut=t=>({subtitle:css`
      display: flex;
      flex-direction: column;
      gap: ${t.spacing(1)};
    `}),at=t=>{const s=nt(t);return{actions:e.createElement(Ke,{plugin:t}),info:s,subtitle:e.createElement(Ze,{plugin:t})}};function st({pluginId:t,navId:s="plugins",notFoundComponent:a=e.createElement(lt,null),notFoundNavModel:l={text:"Unknown plugin",subTitle:"The requested ID does not belong to any plugin",active:!0}}){const o=(0,h.TH)(),m=new URLSearchParams(o.search),v=(0,$.bJ)(t),{navModel:P,activePageId:W}=be(v,m.get("page")),{actions:U,info:ie,subtitle:se}=at(v),{isLoading:ce}=(0,$.ZV)(),{isLoading:V}=(0,$.bt)(),B=(0,g.wW)(rt);return ce||V?e.createElement(M.T,{navId:s,pageNav:{text:"",active:!0}},e.createElement(S.a,null)):v?e.createElement(M.T,{navId:s,pageNav:P,actions:U,subTitle:se,info:ie},e.createElement(M.T.Contents,null,e.createElement(I.I,{className:B.tabContent},e.createElement(oe,{plugin:v,className:B.alert}),e.createElement(O,{plugin:v,className:B.alert}),e.createElement(me,{queryParams:Object.fromEntries(m),plugin:v,pageId:W})))):e.createElement(M.T,{navId:s,pageNav:l},a)}const rt=t=>({alert:i.css`
      margin-bottom: ${t.spacing(2)};
    `,subtitle:i.css`
      display: flex;
      flex-direction: column;
      gap: ${t.spacing(1)};
    `,tabContent:i.css`
      overflow: auto;
      height: 100%;
    `});function lt(){return e.createElement(x.Ar,{justify:"center",align:"center"},e.createElement(d.b,{severity:y.AppNotificationSeverity.Warning,title:"Plugin not found"},"That plugin cannot be found. Please check the url is correct or ",e.createElement("br",null),"go to the ",e.createElement("a",{href:"/plugins"},"plugin catalog"),"."))}},96263:(Y,T,n)=>{n.d(T,{iY:()=>me,bt:()=>Q,ZV:()=>b,GE:()=>re,UQ:()=>K,bJ:()=>te,x3:()=>_,IS:()=>le,y9:()=>N,S1:()=>E,wq:()=>ne,kH:()=>f});var i=n(65237),e=n(3315),h=n(78993),g=n(1100),I=n(40530),d=n(75892),x=n(51444),M=n(54081);const y=c=>c.plugins,S=(0,d.P1)(y,({items:c})=>c),F=(0,d.P1)(y,({settings:c})=>c.displayMode),{selectAll:w,selectById:A}=I.CD.getSelectors(S),X=c=>(0,d.P1)(w,r=>r.filter(D=>c==="installed"?D.isInstalled:!D.isCore)),k=(c,r)=>(0,d.P1)(X(c),D=>D.filter(O=>r==="all"||O.type===r)),J=c=>(0,d.P1)(w,r=>c===""?[]:r.filter(D=>{const O=[];return D.name&&O.push(D.name.toLowerCase()),D.orgName&&O.push(D.orgName.toLowerCase()),O.some(Z=>Z.includes((0,x.x6)(c).toLowerCase()))})),p=(c,r,D)=>(0,d.P1)(k(r,D),J(c),(O,Z)=>c===""?O:Z),R=(0,d.P1)(w,c=>c?c.filter(r=>Boolean(r.error)).map(r=>({pluginId:r.id,errorCode:r.error})):[]),u=c=>(0,d.P1)(y,({requests:r={}})=>r[c]),L=c=>(0,d.P1)(u(c),r=>r?.status===M.eE.Pending),G=c=>(0,d.P1)(u(c),r=>r?.status===M.eE.Rejected?r?.error:null),z=c=>(0,d.P1)(u(c),r=>r===void 0),re=({query:c="",filterBy:r="installed",filterByType:D="all",sortBy:O=h.Nh.nameAsc})=>{H();const Z=(0,e.useSelector)(p(c,r,D)),{isLoading:oe,error:ge}=b(),ee=(0,h.AA)(Z,O);return{isLoading:oe,error:ge,plugins:ee}},C=()=>(H(),useSelector(selectAll)),te=c=>(H(),de(c),(0,e.useSelector)(r=>A(r,c))),q=c=>(j(),useSelector(r=>selectById(r,c))),K=()=>(H(),(0,e.useSelector)(R)),_=()=>{const c=(0,e.useDispatch)();return(r,D,O)=>c((0,g.N9)({id:r,version:D,isUpdating:O}))},f=()=>{const c=(0,e.useDispatch)();return()=>c((0,g.bQ)())},E=()=>{const c=(0,e.useDispatch)();return r=>c((0,g.Tz)(r))},N=()=>(0,e.useSelector)(G(g.tQ.typePrefix))===null,b=()=>{const c=(0,e.useSelector)(L(g.Qd.typePrefix)),r=(0,e.useSelector)(G(g.Qd.typePrefix));return{isLoading:c,error:r}},Q=()=>{const c=(0,e.useSelector)(L(g.DD.typePrefix)),r=(0,e.useSelector)(G(g.DD.typePrefix));return{isLoading:c,error:r}},le=()=>{const c=(0,e.useSelector)(L(g.N9.typePrefix)),r=(0,e.useSelector)(G(g.N9.typePrefix));return{isInstalling:c,error:r}},ne=()=>{const c=(0,e.useSelector)(L(g.Tz.typePrefix)),r=(0,e.useSelector)(G(g.Tz.typePrefix));return{isUninstalling:c,error:r}},H=()=>{const c=(0,e.useDispatch)(),r=(0,e.useSelector)(z(g.Qd.typePrefix));(0,i.useEffect)(()=>{r&&c((0,g.Qd)())},[])},j=()=>{const c=useDispatch(),r=useSelector(selectIsRequestNotFetched(fetchAllLocal.typePrefix));useEffect(()=>{r&&c(fetchAllLocal())},[])},de=c=>{const r=(0,e.useDispatch)(),D=(0,e.useSelector)(oe=>A(oe,c)),Z=!(0,e.useSelector)(L(g.DD.typePrefix))&&D&&!D.details;(0,i.useEffect)(()=>{Z&&r((0,g.DD)(c))},[D])},me=()=>{const c=(0,e.useDispatch)();return{displayMode:(0,e.useSelector)(F),setDisplayMode:D=>c((0,I.UC)(D))}}}}]);

//# sourceMappingURL=8644.bcb62300ec2289e9af2f.js.map