"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7217],{64611:(se,w,s)=>{s.d(w,{Z:()=>y});var o=s(85960),t=s(97666),b=s(29165);function m({dashboards:I,onImport:A,onRemove:N}){function L(h){return h.revision!==h.importedRevision?"Update":"Re-import"}return o.createElement("table",{className:"filter-table"},o.createElement("tbody",null,I.map((h,F)=>o.createElement("tr",{key:`${h.dashboardId}-${F}`},o.createElement("td",{className:"width-1"},o.createElement(t.J,{name:"apps"})),o.createElement("td",null,h.imported?o.createElement("a",{href:h.importedUrl},h.title):o.createElement("span",null,h.title)),o.createElement("td",{style:{textAlign:"right"}},h.imported?o.createElement(b.zx,{variant:"secondary",size:"sm",onClick:()=>A(h,!0)},L(h)):o.createElement(b.zx,{variant:"secondary",size:"sm",onClick:()=>A(h,!1)},"Import"),h.imported&&o.createElement(b.zx,{"aria-label":"Delete dashboard",icon:"trash-alt",variant:"destructive",size:"sm",onClick:()=>N(h)}))))))}const y=m},57636:(se,w,s)=>{s.d(w,{Nq:()=>V,Do:()=>S,SX:()=>m,IF:()=>Y,oZ:()=>L,xh:()=>Z});var o=s(85960),t=s(73667),b=s(67192);function m({error:v}){const R=y(v);return o.createElement(b.C,{icon:"exclamation-triangle",text:"Disabled",color:"red",tooltip:R})}function y(v){switch(v){case t.w2.modifiedSignature:return"Plugin disabled due to modified content";case t.w2.invalidSignature:return"Plugin disabled due to invalid plugin signature";case t.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${v?`: ${v}`:""}`}}var I=s(47257),A=s(66681);const N=v=>(0,A.css)`
  background: ${v.colors.background.primary};
  border-color: ${v.colors.border.strong};
  color: ${v.colors.text.secondary};
`;function L(){const v=(0,I.wW)(N);return o.createElement(b.C,{text:"Installed",color:"orange",className:v})}var h=s(11855),F=s(74042),k=s(15343),H=s(29165);function Y({plugin:v}){const R=(0,I.wW)(N),Q=te=>{te.preventDefault(),window.open(`https://grafana.com/grafana/plugins/${v.id}?utm_source=grafana_catalog_learn_more`,"_blank","noopener,noreferrer")};return(0,h.v)("enterprise.plugins")?o.createElement(b.C,{text:"Enterprise",color:"blue"}):o.createElement(F.Lh,null,o.createElement(k.o,{status:v.signature}),o.createElement(b.C,{icon:"lock","aria-label":"lock icon",text:"Enterprise",color:"blue",className:R}),o.createElement(H.zx,{size:"sm",fill:"text",icon:"external-link-alt",onClick:Q},"Learn more"))}function Z({plugin:v}){const R=(0,I.wW)(M);return o.createElement("p",{className:R.hasUpdate},"Update available!")}const M=v=>({hasUpdate:(0,A.css)`
      color: ${v.colors.text.secondary};
      font-size: ${v.typography.bodySmall.fontSize};
      margin-bottom: 0;
    `});function V(){return o.createElement(b.C,{icon:"exclamation-triangle",text:"Angular",color:"orange",tooltip:"This plugin uses deprecated functionality, support for which is being removed."})}function S(){return o.createElement(b.C,{icon:"exclamation-triangle",text:"Deprecated",color:"orange",tooltip:"This plugin is deprecated and no longer receives updates."})}},17217:(se,w,s)=>{s.d(w,{Q:()=>ft});var o=s(66681),t=s(85960),b=s(30694),m=s(90857),y=s(47257),I=s(10305),A=s(49199),N=s(74042),L=s(20989),h=s(95162),F=s(91032),k=s(79468);const H=({text:e="Loading..."})=>t.createElement("div",{className:"page-loader-wrapper"},t.createElement(k.u,{text:e}));var Y=s(77786),Z=s(13086),M=s(23940),V=s(12537),S=s(67187);const v=({versions:e=[],installedVersion:a})=>{const n=(0,y.wW)(R),r=(0,S.RU)(e);return e.length===0?t.createElement("p",null,"No version history was found."):t.createElement("table",{className:n.table},t.createElement("thead",null,t.createElement("tr",null,t.createElement("th",null,"Version"),t.createElement("th",null,"Last updated"),t.createElement("th",null,"Grafana Dependency"))),t.createElement("tbody",null,e.map(l=>{const u=a===l.version;return t.createElement("tr",{key:l.version},u?t.createElement("td",{className:n.currentVersion},l.version," (installed version)"):l.version===r?.version?t.createElement("td",null,l.version," (latest compatible version)"):t.createElement("td",null,l.version),t.createElement("td",{className:u?n.currentVersion:""},(0,V.E8)(l.createdAt)),t.createElement("td",{className:u?n.currentVersion:""},l.grafanaDependency||"N/A"))})))},R=e=>({container:(0,o.css)`
    padding: ${e.spacing(2,4,3)};
  `,table:(0,o.css)`
    table-layout: fixed;
    width: 100%;
    td,
    th {
      padding: ${e.spacing()} 0;
    }
    th {
      font-size: ${e.typography.h5.fontSize};
    }
  `,currentVersion:(0,o.css)`
    font-weight: ${e.typography.fontWeightBold};
  `});var Q=s(81445),te=s(84482);const q=e=>(0,Q.Z)(async()=>e&&e.isFullyInstalled&&!e.isDisabled?(0,te.O)(e.id):null,[e?.id,e?.isInstalled,e?.isDisabled]);var c=s(87809),j=s(56375),re=s(20440),J=s(85445),le=s(92289),D=s(29165);class ie extends t.PureComponent{constructor(a){super(a),this.element=null,this.preUpdateHook=()=>Promise.resolve(),this.postUpdateHook=()=>Promise.resolve(),this.update=()=>{const n=this.model.id;this.preUpdateHook().then(()=>{const r=(0,j.extend)({enabled:this.model.enabled,pinned:this.model.pinned,jsonData:this.model.jsonData,secureJsonData:this.model.secureJsonData},{});return(0,J.i)().post(`/api/plugins/${n}/settings`,r)}).then(this.postUpdateHook).then(r=>{window.location.href=window.location.href})},this.setPreUpdateHook=n=>{this.preUpdateHook=n},this.setPostUpdateHook=n=>{this.postUpdateHook=n},this.importDashboards=()=>((0,re.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(a){if(!this.element||this.state.angularCtrl)return;this.model=(0,j.cloneDeep)(this.props.app.meta);const n=(0,le.w)(),r='<plugin-component type="app-config-ctrl"></plugin-component>',l={ctrl:this,isAppConfigCtrl:!0},u=n.load(this.element,l,r);this.setState({angularCtrl:u})}render(){const a=this.model,n=(0,o.css)({marginRight:"8px"});return t.createElement("div",null,t.createElement("div",{ref:r=>this.element=r}),t.createElement("br",null),t.createElement("br",null),a&&t.createElement("div",{className:"gf-form"},!a.enabled&&t.createElement(D.zx,{variant:"primary",onClick:this.enable,className:n},"Enable"),a.enabled&&t.createElement(D.zx,{variant:"primary",onClick:this.update,className:n},"Update"),a.enabled&&t.createElement(D.zx,{variant:"destructive",onClick:this.disable,className:n},"Disable")))}}var K=s(47475),B=s(49683),_=s(64611);class oe extends t.PureComponent{constructor(a){super(a),this.importAll=()=>{this.importNext(0)},this.importNext=n=>{const{dashboards:r}=this.state;return this.import(r[n],!0).then(()=>n+1<r.length?new Promise(l=>{setTimeout(()=>{this.importNext(n+1).then(()=>{l()})},500)}):Promise.resolve())},this.import=(n,r)=>{const{plugin:l,datasource:u}=this.props,g={pluginId:l.id,path:n.path,overwrite:r,inputs:u?[{name:"*",type:"datasource",pluginId:u.meta.id,value:u.name}]:[]};return(0,J.i)().post("/api/dashboards/import",g).then(E=>{B.h$.emit(K.SI.alertSuccess,["Dashboard Imported",n.title]),(0,j.extend)(n,E),this.setState({dashboards:[...this.state.dashboards]})})},this.remove=n=>{(0,J.i)().delete("/api/dashboards/uid/"+n.uid).then(()=>{n.imported=!1,this.setState({dashboards:[...this.state.dashboards]})})},this.state={loading:!0,dashboards:[]}}async componentDidMount(){const a=this.props.plugin.id;(0,J.i)().get(`/api/plugins/${a}/dashboards`).then(n=>{this.setState({dashboards:n,loading:!1})})}render(){const{loading:a,dashboards:n}=this.state;return a?t.createElement("div",null,"loading..."):!n||!n.length?t.createElement("div",null,"No dashboards are included with this plugin"):t.createElement(_.Z,{dashboards:n,onImport:this.import,onRemove:this.remove})}}var ce=s(53565),ue=s(21964),de=s(75682),i=s(64409),d=s(57544),x=s(30824);function P({plugin:e}){const a=(0,y.wW)(O),n=(0,t.useMemo)(()=>({query:"*",panel_type:e.id,kind:["panel"]}),[e]),r=(0,Q.Z)(()=>(0,x.getGrafanaSearcher)().search(n),[n]),l=r.value;return l?.totalRows?t.createElement("div",{className:a.wrap},t.createElement("div",{className:a.info},e.name," is used ",t.createElement("b",null,l.totalRows)," times."),t.createElement(ce.Z,null,({width:u,height:g})=>t.createElement(d.Q,{response:l,width:u,height:g,clearSelection:()=>{},keyboardEvents:(0,ue.of)(),onTagSelected:()=>{}}))):r.loading?t.createElement(de.$,null):m.config.featureToggles.panelTitleSearch?t.createElement(i.Z,{title:`${e.name} is not used in any dashboards yet`,buttonIcon:"plus",buttonTitle:"Create Dashboard",buttonLink:`dashboard/new?panelType=${e.id}&editPanel=1`}):t.createElement(A.b,{title:"Missing feature toggle: panelTitleSearch"},"Plugin usage requires the new search index to find usage across dashboards")}const O=e=>({wrap:(0,o.css)`
      width: 100%;
      height: 100%;
    `,info:(0,o.css)`
      padding-bottom: 30px;
    `});function W({plugin:e,queryParams:a,pageId:n}){const r=(0,y.wW)(me),{value:l}=q(e),u=(0,t.useMemo)(()=>[{id:"action",header:"Action",cell:({cell:{value:f}})=>f},{id:"scope",header:"Scope",cell:({cell:{value:f}})=>f}],[]);if(n===c.tu.OVERVIEW)return t.createElement("div",{className:(0,o.cx)(r.readme,r.container),dangerouslySetInnerHTML:{__html:e.details?.readme??"No plugin help or readme markdown file was found"}});if(n===c.tu.VERSIONS)return t.createElement("div",{className:r.container},t.createElement(v,{versions:e.details?.versions,installedVersion:e.installedVersion}));if(n===c.tu.CONFIG&&l?.angularConfigCtrl)return t.createElement("div",{className:r.container},t.createElement(ie,{app:l}));const g=e.iam?.permissions||e.details?.iam?.permissions;if(m.config.featureToggles.externalServiceAccounts&&n===c.tu.IAM&&g&&g.length>0)return t.createElement(t.Fragment,null,t.createElement(Z.K,{direction:"row"},"The ",e.name," plugin needs a service account to be able to query Grafana. The following list contains the permissions available to the service account:"),t.createElement(M.e,{columns:u,data:g,getRowId:f=>String(f.action)}));if(l?.configPages){for(const f of l.configPages)if(n===f.id)return t.createElement("div",{className:r.container},t.createElement(Y.b,{meta:l.meta},t.createElement(f.body,{plugin:l,query:a})))}return n===c.tu.USAGE&&l?t.createElement("div",{className:r.container},t.createElement(P,{plugin:l?.meta})):n===c.tu.DASHBOARDS&&l?t.createElement("div",{className:r.container},t.createElement(oe,{plugin:l?.meta})):t.createElement("div",{className:r.container},t.createElement("p",null,"Page not found."))}const me=e=>({container:(0,o.css)({height:"100%"}),readme:(0,o.css)({"& img":{maxWidth:"100%"},"h1, h2, h3":{marginTop:e.spacing(3),marginBottom:e.spacing(2)},"*:first-child":{marginTop:0},li:{marginLeft:e.spacing(2),"& > p":{margin:e.spacing(1,0)}},a:{color:e.colors.text.link,"&:hover":{color:e.colors.text.link,textDecoration:"underline"}},table:{tableLayout:"fixed",width:"100%","td, th":{overflowX:"auto",padding:e.spacing(.5,1)},"table, th, td":{border:`1px solid ${e.colors.border.medium}`,borderCollapse:"collapse"}}})});var p=s(73667),he=s(92369);function Te({className:e,plugin:a}){return a.isDisabled?t.createElement(A.b,{severity:"error",title:"Plugin disabled",className:e,"data-testid":he.wl.pages.PluginPage.disabledInfo},Le(a.error),t.createElement("p",null,"Please contact your server administrator to get this resolved."),t.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 Le(e){switch(e){case p.w2.modifiedSignature:return t.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 p.w2.invalidSignature:return t.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 p.w2.missingSignature:return t.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 t.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 Ue({className:e,plugin:a}){const n=a.signature===p.Xy.valid,r=a.signature===p.Xy.internal,l=a.isDisabled&&Ve(a.error);return n||r||l?null:t.createElement(A.b,{severity:"warning",title:"Invalid plugin signature","data-testid":he.wl.pages.PluginPage.signatureInfo,className:e},t.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."),t.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 Ve(e){switch(e){case p.w2.invalidSignature:case p.w2.missingSignature:case p.w2.modifiedSignature:return!0;default:return!1}}const Re=(e,a)=>{const{loading:n,error:r,value:l}=q(e),{pathname:u}=(0,b.TH)(),g=We(e,l),E=!!e?.isPublished,f=a||g,$=(0,t.useMemo)(()=>{const ee=e&&B.Vt.hasPermissionInMetadata(h.AccessControlAction.PluginsWrite,e),C=[];if(E&&C.push({text:c.xc.VERSIONS,id:c.tu.VERSIONS,icon:"history",url:`${u}?page=${c.tu.VERSIONS}`,active:c.tu.VERSIONS===f}),!l||(m.config.featureToggles.externalServiceAccounts&&(e?.iam||e?.details?.iam)&&C.push({text:c.xc.IAM,icon:"shield",id:c.tu.IAM,url:`${u}?page=${c.tu.IAM}`,active:c.tu.IAM===f}),m.config.featureToggles.panelTitleSearch&&l.meta.type===p.zV.panel&&C.push({text:c.xc.USAGE,icon:"list-ul",id:c.tu.USAGE,url:`${u}?page=${c.tu.USAGE}`,active:c.tu.USAGE===f}),!ee))return C;if(l.meta.type===p.zV.app){if(l.angularConfigCtrl&&C.push({text:"Config",icon:"cog",id:c.tu.CONFIG,url:`${u}?page=${c.tu.CONFIG}`,active:c.tu.CONFIG===f}),l.configPages)for(const U of l.configPages)C.push({text:U.title,icon:U.icon,id:U.id,url:`${u}?page=${U.id}`,active:U.id===f});l.meta.includes?.find(U=>U.type===p.$_.dashboard)&&C.push({text:"Dashboards",icon:"apps",id:c.tu.DASHBOARDS,url:`${u}?page=${c.tu.DASHBOARDS}`,active:c.tu.DASHBOARDS===f})}return C},[e,l,u,E,f]),z={text:e?.name??"",img:e?.info.logos.small,children:[{text:c.xc.OVERVIEW,icon:"file-alt",id:c.tu.OVERVIEW,url:`${u}?page=${c.tu.OVERVIEW}`,active:c.tu.OVERVIEW===f},...$]};return{error:r,loading:n,navModel:z,activePageId:f}};function We(e,a){return!e||!a||!B.Vt.hasPermissionInMetadata(h.AccessControlAction.PluginsWrite,e)||a.meta.type!==p.zV.app?c.tu.OVERVIEW:a.angularConfigCtrl?c.tu.CONFIG:a.configPages?.length?a.configPages[0].id:c.tu.OVERVIEW}var X=s(97666),ne=s(67954),$e=s(3453);function we({plugin:e}){const{value:a}=q(e);if(!a||!B.Vt.hasPermissionInMetadata(h.AccessControlAction.PluginsWrite,e))return null;const{enabled:n,jsonData:r}=a?.meta,l=()=>pe(e.id,{enabled:!0,pinned:!0,jsonData:r}),u=()=>{pe(e.id,{enabled:!1,pinned:!1,jsonData:r})};return t.createElement(t.Fragment,null,!n&&t.createElement(D.zx,{variant:"primary",onClick:l},"Enable"),n&&t.createElement(D.zx,{variant:"destructive",onClick:u},"Disable"))}const pe=async(e,a)=>{try{await(0,$e.P6)(e,a),window.location.reload()}catch(n){console.error("Error while updating the plugin",n)}};var ve=s(80150),Ee=s(41879);function Dt(){return config.bootData.user.isGrafanaAdmin}function xt(){return contextSrv.hasRole("Admin")}function Fe(){return Ee.contextSrv.hasPermission(h.AccessControlAction.DataSourcesCreate)&&Ee.contextSrv.hasPermission(h.AccessControlAction.DataSourcesWrite)}function Me({plugin:e}){const a=(0,h.useDispatch)(),n=(0,ve.d7)(),r=(0,t.useCallback)(()=>{const u={name:e.name,id:e.id};a((0,ve.J_)(u,n.Edit))},[a,e,n]);if(!Fe())return null;const l=ne.default.featureToggles.managedPluginsInstall&&m.config.pluginAdminExternalManageEnabled&&!e.isFullyInstalled;return t.createElement(D.zx,{variant:"primary",onClick:r,disabled:l,title:l?"The plugin isn't usable yet, it may take some time to complete the installation.":void 0},"Add new data source")}function Be({plugin:e}){if(!e.isInstalled||e.isDisabled)return null;switch(e.type){case p.zV.datasource:return t.createElement(Me,{plugin:e});case p.zV.app:return t.createElement(we,{plugin:e});default:return null}}var Oe=s(11855),T=s(95991);const ze=({plugin:e,pluginStatus:a,latestCompatibleVersion:n})=>{const r=(0,y.wW)(Ge),l=m.config.pluginAdminExternalManageEnabled,u=B.Vt.hasPermission(h.AccessControlAction.PluginsInstall),g=(0,T.y9)(),E=!!n;return e.type===p.zV.renderer?t.createElement("div",{className:r.message},"Renderer plugins cannot be managed by the Plugin Catalog."):e.type===p.zV.secretsmanager?t.createElement("div",{className:r.message},"Secrets manager plugins cannot be managed by the Plugin Catalog."):e.isEnterprise&&!(0,Oe.v)("enterprise.plugins")?t.createElement(N.Lh,{height:"auto",align:"center"},t.createElement("span",{className:r.message},"No valid Grafana Enterprise license detected."),t.createElement(D.Qj,{href:`${(0,S.Uj)(e.id)}?utm_source=grafana_catalog_learn_more`,target:"_blank",rel:"noopener noreferrer",size:"sm",fill:"text",icon:"external-link-alt"},"Learn more")):e.isDev?t.createElement("div",{className:r.message},"This is a development build of the plugin and can't be uninstalled."):!u&&!l?t.createElement("div",{className:r.message},ke(a)):e.isPublished?E?g?null:t.createElement("div",{className:r.message},"The install controls have been disabled because the Grafana server cannot access grafana.com."):t.createElement("div",{className:r.message},t.createElement(X.J,{name:"exclamation-triangle"}),"\xA0This plugin doesn't support your version of Grafana."):t.createElement("div",{className:r.message},t.createElement(X.J,{name:"exclamation-triangle"})," This plugin is not published to"," ",t.createElement("a",{href:"https://www.grafana.com/plugins",target:"__blank",rel:"noreferrer"},"grafana.com/plugins")," ","and can't be managed via the catalog.")},Ge=e=>({message:(0,o.css)`
      color: ${e.colors.text.secondary};
    `});function ke(e){switch(e){case c.vF.INSTALL:case c.vF.REINSTALL:return"You do not have permission to install this plugin.";case c.vF.UNINSTALL:return"You do not have permission to uninstall this plugin.";case c.vF.UPDATE:return"You do not have permission to update this plugin.";default:return"You do not have permission to manage this plugin."}}var He=s(91),Ze=s(77980),ge=s(60484),Qe=s(763),je=s(62293),ye=s(43183);const Je=e=>{(0,ye.ff)("grafana_plugin_install_clicked",e)},Ke=e=>{(0,ye.ff)("grafana_plugin_uninstall_clicked",e)};function Xe({plugin:e,pluginStatus:a,latestCompatibleVersion:n,hasInstallWarning:r,setNeedReload:l}){const u=(0,h.useDispatch)(),[g]=(0,Qe.K)(),E=(0,b.TH)(),{isInstalling:f,error:$}=(0,T.IS)(),{isUninstalling:z,error:ee}=(0,T.wq)(),C=(0,T.x3)(),U=(0,T.S1)(),G=(0,T.kH)(),vt=(0,T.or)(),[Et,De]=(0,t.useState)(!1),yt=()=>De(!0),xe=()=>De(!1),Ie=z?"Uninstalling":"Uninstall",Ne={plugin_id:e.id,plugin_type:e.type,path:E.pathname};(0,t.useEffect)(()=>()=>{G()},[]);const St=async()=>{Je(Ne);const ae=await C(e.id,n?.version);if(!$&&!("error"in ae)){let fe=`Installed ${e.name}`;m.config.pluginAdminExternalManageEnabled&&ne.default.featureToggles.managedPluginsInstall&&(fe="Install requested, this may take a few minutes."),ge.Z.emit(K.SI.alertSuccess,[fe]),e.type==="app"&&l?.(!0),await vt(e.id)}},Ae=async()=>{if(xe(),Ke(Ne),await U(e.id),!ee){const ae=g.page;ae!==c.tu.OVERVIEW&&ae!==c.tu.VERSIONS&&He.E1.replace(`${E.pathname}?page=${c.tu.OVERVIEW}`);let Ce=`Uninstalled ${e.name}`;m.config.pluginAdminExternalManageEnabled&&ne.default.featureToggles.managedPluginsInstall&&(Ce="Uninstall requested, this may take a few minutes."),ge.Z.emit(K.SI.alertSuccess,[Ce]),e.type==="app"&&(u((0,je.Lk)({pluginID:e.id})),l?.(!1))}},Pt=async()=>{await C(e.id,n?.version,!0),$||ge.Z.emit(K.SI.alertSuccess,[`Updated ${e.name}`])};if(a===c.vF.UNINSTALL)return t.createElement(t.Fragment,null,t.createElement(Ze.s,{isOpen:Et,title:`Uninstall ${e.name}`,body:"Are you sure you want to uninstall this plugin?",confirmText:"Confirm",icon:"exclamation-triangle",onConfirm:Ae,onDismiss:xe}),t.createElement(N.Lh,{align:"flex-start",width:"auto",height:"auto"},t.createElement(D.zx,{variant:"destructive",disabled:z,onClick:yt},Ie)));if(!e.isPublished||r)return null;if(a===c.vF.UPDATE)return t.createElement(N.Lh,{align:"flex-start",width:"auto",height:"auto"},t.createElement(D.zx,{disabled:f,onClick:Pt},f?"Updating":"Update"),t.createElement(D.zx,{variant:"destructive",disabled:z,onClick:Ae},Ie));const bt=f||$||!m.config.angularSupportEnabled&&e.angularDetected;return t.createElement(D.zx,{disabled:bt,onClick:St},f?"Installing":"Install")}function Ye({pluginId:e,pluginStatus:a,angularDetected:n}){const r=`${(0,S.Uj)(e)}/?tab=installation`;return a===c.vF.UPDATE?t.createElement(N.Lh,{height:"auto"},t.createElement(D.Qj,{href:r,target:"_blank",rel:"noopener noreferrer"},"Update via grafana.com"),t.createElement(D.Qj,{variant:"destructive",href:r,target:"_blank",rel:"noopener noreferrer"},"Uninstall via grafana.com")):a===c.vF.UNINSTALL?t.createElement(D.Qj,{variant:"destructive",href:r,target:"_blank",rel:"noopener noreferrer"},"Uninstall via grafana.com"):t.createElement(D.Qj,{disabled:!m.config.angularSupportEnabled&&n,href:r,target:"_blank",rel:"noopener noreferrer"},"Install via grafana.com")}const qe=({plugin:e})=>{const a=(0,y.wW)(_e),n=(0,T.y9)(),r=(0,S.RU)(e?.details?.versions),[l,u]=(0,t.useState)(!1);if(!e)return null;const g=(0,S.HT)(e,n,r),E=m.config.pluginAdminExternalManageEnabled,f=e.isInstalled?e.hasUpdate?c.vF.UPDATE:c.vF.UNINSTALL:c.vF.INSTALL,$=e.isCore||e.isDisabled||!(0,S.fG)();return t.createElement(N.wc,null,t.createElement(N.Lh,null,!$&&t.createElement(t.Fragment,null,E&&!g&&!ne.default.featureToggles.managedPluginsInstall?t.createElement(Ye,{pluginId:e.id,pluginStatus:f,angularDetected:e.angularDetected}):t.createElement(Xe,{plugin:e,latestCompatibleVersion:r,pluginStatus:f,setNeedReload:u,hasInstallWarning:g})),t.createElement(Be,{plugin:e})),l&&t.createElement(N.Lh,null,t.createElement(X.J,{name:"exclamation-triangle"}),t.createElement("span",{className:a.message},"Refresh the page to see the changes")))},_e=e=>({message:(0,o.css)`
      color: ${e.colors.text.secondary};
    `}),et=({plugin:e})=>{const a=(0,T.y9)(),n=(0,y.wW)(tt),{error:r}=(0,T.IS)();if(!e)return null;const l=(0,S.RU)(e.details?.versions),u=e.isInstalled?e.hasUpdate?c.vF.UPDATE:c.vF.UNINSTALL:c.vF.INSTALL;return t.createElement("div",{className:n.subtitle},r&&t.createElement(A.b,{title:"message"in r?r.message:""},typeof r=="string"?r:r.error),e?.description&&t.createElement("div",null,e?.description),e?.details?.links&&e.details.links.length>0&&t.createElement("span",null,e.details.links.map((g,E)=>t.createElement(t.Fragment,{key:E},E>0&&" | ",t.createElement("a",{href:g.url,className:"external-link"},g.name)))),(0,S.HT)(e,a,l)&&t.createElement(ze,{plugin:e,pluginStatus:u,latestCompatibleVersion:l}))},tt=e=>({subtitle:(0,o.css)`
      display: flex;
      flex-direction: column;
      gap: ${e.spacing(1)};
    `});var nt=s(57636);function at({plugin:e,grafanaDependency:a}){const n=(0,y.wW)(st),r=e.details?.pluginDependencies;return!a&&(!r||!r.length)?null:t.createElement(Z.K,{gap:1},!!a&&t.createElement("div",{className:n.depBadge},t.createElement(X.J,{name:"grafana",className:n.icon}),"Grafana ",a),r&&r.length>0&&t.createElement("div",null,r.map(u=>t.createElement("span",{className:n.depBadge,key:u.name},t.createElement(X.J,{name:c.Co[u.type],className:n.icon}),u.name," ",u.version))))}const st=e=>({dependencyTitle:(0,o.css)`
      margin-right: ${e.spacing(.5)};

      &::after {
        content: '';
        padding: 0;
      }
    `,depBadge:(0,o.css)({display:"flex",alignItems:"flex-start"}),icon:(0,o.css)`
      color: ${e.colors.text.secondary};
      margin-right: ${e.spacing(.5)};
    `});var rt=s(15343),lt=s(67192);const Se={[p._Z.grafana]:"grafana",[p._Z.commercial]:"shield",[p._Z.community]:"shield",DEFAULT:"shield-exclamation"};function it({signatureType:e,signatureOrg:a=""}){const n=(0,y.wW)(be);if(!e&&!a)return null;const r=e===p._Z.grafana?"Grafana Labs":(0,j.capitalize)(e),l=Se[e||""]||Se.DEFAULT;return t.createElement(t.Fragment,null,t.createElement(Pe,null,t.createElement("div",{className:n.detailsWrapper},t.createElement("strong",{className:n.strong},"Level:\xA0"),t.createElement(X.J,{size:"xs",name:l}),"\xA0",r)),t.createElement(Pe,null,t.createElement("strong",{className:n.strong},"Signed by:")," ",a))}const Pe=({children:e})=>{const a=(0,y.wW)(be);return t.createElement(lt.C,{color:"green",className:a.badge,text:e})},be=e=>({badge:(0,o.css)`
    background-color: ${e.colors.background.canvas};
    border-color: ${e.colors.border.strong};
    color: ${e.colors.text.secondary};
    white-space: nowrap;
  `,detailsWrapper:(0,o.css)`
    align-items: center;
    display: flex;
  `,strong:(0,o.css)`
    color: ${e.colors.text.primary};
  `,icon:(0,o.css)`
    margin-right: ${e.spacing(.5)};
  `});function ot({plugin:e}){const a=(0,y.wW)(ct),n=e.signature===p.Xy.valid;return t.createElement("div",{className:a.container},t.createElement("a",{href:"https://grafana.com/docs/grafana/latest/plugins/plugin-signatures/",target:"_blank",rel:"noreferrer",className:a.link},t.createElement(rt.o,{status:e.signature})),n&&t.createElement(it,{signatureType:e.signatureType,signatureOrg:e.signatureOrg}))}const ct=e=>({container:(0,o.css)`
      display: flex;
      flex-wrap: wrap;
      gap: ${e.spacing(.5)};
    `,link:(0,o.css)`
      display: inline-flex;
      align-items: center;
    `}),ut=e=>{const a=[];if(!e)return a;const n=(0,S.RU)(e.details?.versions),r=!e.isInstalled;let l=e.installedVersion;!l&&r&&n?.version&&(l=n?.version),l&&a.push({label:"Version",value:l}),e.orgName&&a.push({label:"From",value:e.orgName}),(!e.signatureType||e.signatureType===p._Z.community||e.signatureType===p._Z.commercial)&&e.downloads>0&&a.push({label:"Downloads",value:new Intl.NumberFormat().format(e.downloads)});const g=e.details?.pluginDependencies;let E=e.details?.grafanaDependency;return r&&n?.grafanaDependency&&(E=n?.grafanaDependency),!E&&(!g||!g.length)||a.push({label:"Dependencies",value:t.createElement(at,{plugin:e,grafanaDependency:E})}),e.isDisabled&&a.push({label:"Status",value:t.createElement(nt.SX,{error:e.error})}),a.push({label:"Signature",value:t.createElement(ot,{plugin:e})}),a},It=e=>({subtitle:css`
      display: flex;
      flex-direction: column;
      gap: ${e.spacing(1)};
    `}),dt=e=>{const a=ut(e);return{actions:t.createElement(qe,{plugin:e}),info:a,subtitle:t.createElement(et,{plugin:e})}};var mt=s(55583);function gt(e){const{className:a,plugin:n}=e,[r,l]=(0,t.useState)(!1);return n.isDeprecated&&!r?t.createElement(A.b,{severity:"warning",title:"Deprecated",className:a,onRemove:()=>l(!0)},t.createElement("p",null,"This ",n.type," plugin is"," ",t.createElement("a",{className:"external-link",href:"https://grafana.com/legal/plugin-deprecation/",rel:"noreferrer",target:"_blank"},"deprecated")," ","and has been removed from the catalog."),n.details?.statusContext&&t.createElement("div",{className:"markdown-html",dangerouslySetInnerHTML:{__html:(0,mt.a)(n.details.statusContext)}})):null}function ft({pluginId:e,navId:a="plugins",notFoundComponent:n=t.createElement(pt,null),notFoundNavModel:r={text:"Unknown plugin",subTitle:"The requested ID does not belong to any plugin",active:!0}}){const l=(0,b.TH)(),u=new URLSearchParams(l.search),g=(0,T.bJ)(e),{navModel:E,activePageId:f}=Re(g,u.get("page")),{actions:$,info:z,subtitle:ee}=dt(g),{isLoading:C}=(0,T.ZV)(),{isLoading:U}=(0,T.bt)(),G=(0,y.wW)(ht);return C||U?t.createElement(L.T,{navId:a,pageNav:{text:"",active:!0}},t.createElement(H,null)):g?t.createElement(L.T,{navId:a,pageNav:E,actions:$,subTitle:ee,info:z},t.createElement(L.T.Contents,null,t.createElement(I.I,{className:G.tabContent},g.angularDetected&&t.createElement(F.Y,{className:G.alert,angularSupportEnabled:m.config?.angularSupportEnabled,pluginId:g.id,pluginType:g.type,showPluginDetailsLink:!1,interactionElementId:"plugin-details-page"}),t.createElement(Ue,{plugin:g,className:G.alert}),t.createElement(Te,{plugin:g,className:G.alert}),t.createElement(gt,{plugin:g,className:G.alert}),t.createElement(W,{queryParams:Object.fromEntries(u),plugin:g,pageId:f})))):t.createElement(L.T,{navId:a,pageNav:r},n)}const ht=e=>({alert:(0,o.css)`
      margin-bottom: ${e.spacing(2)};
    `,subtitle:(0,o.css)`
      display: flex;
      flex-direction: column;
      gap: ${e.spacing(1)};
    `,tabContent:(0,o.css)`
      overflow: auto;
      height: 100%;
      padding-left: 5px;
    `});function pt(){return t.createElement(N.Ar,{justify:"center",align:"center"},t.createElement(A.b,{severity:h.AppNotificationSeverity.Warning,title:"Plugin not found"},"That plugin cannot be found. Please check the url is correct or ",t.createElement("br",null),"go to the ",t.createElement("a",{href:"/plugins"},"plugin catalog"),"."))}},95991:(se,w,s)=>{s.d(w,{iY:()=>de,or:()=>ue,bt:()=>ie,ZV:()=>D,Pj:()=>R,UQ:()=>q,bJ:()=>Q,x3:()=>c,IS:()=>K,y9:()=>J,S1:()=>re,wq:()=>B,kH:()=>j});var o=s(85960),t=s(95162),b=s(67187),m=s(69396),y=s(14746),I=s(8111),A=s(49531),N=s(87809);const L=i=>i.plugins,h=(0,I.P1)(L,({items:i})=>i),F=(0,I.P1)(L,({settings:i})=>i.displayMode),{selectAll:k,selectById:H}=y.CD.getSelectors(h),Y=i=>(0,I.P1)(k,d=>{const x=i.keyword?(0,A.x6)(i.keyword.toLowerCase()):"";return d.filter(P=>{const O=[P.name,P.orgName].filter(Boolean).map(W=>W.toLowerCase());return!(x&&!O.some(W=>W.includes(x))||i.type&&P.type!==i.type||i.isInstalled!==void 0&&P.isInstalled!==i.isInstalled||i.isEnterprise!==void 0&&P.isEnterprise!==i.isEnterprise)})}),Z=i=>(0,I.P1)(k,d=>{const x=[];for(const P of d)P.error&&(!i||P.type===i)&&x.push({pluginId:P.id,errorCode:P.error,pluginType:P.type});return x}),M=i=>(0,I.P1)(L,({requests:d={}})=>d[i]),V=i=>(0,I.P1)(M(i),d=>d?.status===N.eE.Pending),S=i=>(0,I.P1)(M(i),d=>d?.status===N.eE.Rejected?d?.error:null),v=i=>(0,I.P1)(M(i),d=>d===void 0),R=(i,d=b.Nh.nameAsc)=>{_();const x=(0,o.useMemo)(()=>Y(i),[i]),P=(0,t.useSelector)(x),{isLoading:O,error:W}=le(),me=(0,b.AA)(P,d);return{isLoading:O,error:W,plugins:me}},Q=i=>(_(),ce(i),(0,t.useSelector)(d=>H(d,i))),te=i=>(oe(),useSelector(d=>selectById(d,i))),q=i=>(_(),(0,t.useSelector)(Z(i))),c=()=>{const i=(0,t.useDispatch)();return(d,x,P)=>i((0,m.N9)({id:d,version:x,isUpdating:P}))},j=()=>{const i=(0,t.useDispatch)();return()=>i((0,m.bQ)())},re=()=>{const i=(0,t.useDispatch)();return d=>i((0,m.Tz)(d))},J=()=>(0,t.useSelector)(S(m.tQ.typePrefix))===null,le=()=>{const i=(0,t.useSelector)(V("plugins/fetchLocal")),d=(0,t.useSelector)(S("plugins/fetchLocal"));return{isLoading:i,error:d}},D=()=>{const i=(0,t.useSelector)(V(m.Qd.typePrefix)),d=(0,t.useSelector)(S(m.Qd.typePrefix));return{isLoading:i,error:d}},ie=()=>{const i=(0,t.useSelector)(V(m.DD.typePrefix)),d=(0,t.useSelector)(S(m.DD.typePrefix));return{isLoading:i,error:d}},K=()=>{const i=(0,t.useSelector)(V(m.N9.typePrefix)),d=(0,t.useSelector)(S(m.N9.typePrefix));return{isInstalling:i,error:d}},B=()=>{const i=(0,t.useSelector)(V(m.Tz.typePrefix)),d=(0,t.useSelector)(S(m.Tz.typePrefix));return{isUninstalling:i,error:d}},_=()=>{const i=(0,t.useDispatch)(),d=(0,t.useSelector)(v(m.Qd.typePrefix));(0,o.useEffect)(()=>{d&&i((0,m.Qd)())},[])},oe=()=>{const i=useDispatch(),d=useSelector(selectIsRequestNotFetched(fetchAllLocal.typePrefix));useEffect(()=>{d&&i(fetchAllLocal())},[])},ce=i=>{const d=(0,t.useDispatch)(),x=(0,t.useSelector)(W=>H(W,i)),O=!(0,t.useSelector)(V(m.DD.typePrefix))&&x&&!x.details;(0,o.useEffect)(()=>{O&&d((0,m.DD)(i))},[x])},ue=()=>{const i=(0,t.useDispatch)();return d=>i((0,m.DD)(d))},de=()=>{const i=(0,t.useDispatch)();return{displayMode:(0,t.useSelector)(F),setDisplayMode:x=>i((0,y.UC)(x))}}}}]);

//# sourceMappingURL=7217.cc2eeaa98bdc7354748e.js.map