PluginPage.35821bcc5f6830ed7e8b.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. "use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2417],{53149:(e,n,t)=>{t.d(n,{Z:()=>r});t(68404);var a,i=t(69783),s=t(45916);const r=e=>{let{dashboards:n,onImport:t,onRemove:r}=e;function l(e){return e.revision!==e.importedRevision?"Update":"Re-import"}return(0,s.jsx)("table",{className:"filter-table",children:(0,s.jsx)("tbody",{children:n.map(((e,n)=>(0,s.jsxs)("tr",{children:[a||(a=(0,s.jsx)("td",{className:"width-1",children:(0,s.jsx)(i.Icon,{name:"apps"})})),(0,s.jsx)("td",{children:e.imported?(0,s.jsx)("a",{href:e.importedUrl,children:e.title}):(0,s.jsx)("span",{children:e.title})}),(0,s.jsxs)("td",{style:{textAlign:"right"},children:[e.imported?(0,s.jsx)(i.Button,{variant:"secondary",size:"sm",onClick:()=>t(e,!0),children:l(e)}):(0,s.jsx)(i.Button,{variant:"secondary",size:"sm",onClick:()=>t(e,!1),children:"Import"}),e.imported&&(0,s.jsx)(i.Button,{icon:"trash-alt",variant:"destructive",size:"sm",onClick:()=>r(e)})]})]},`${e.dashboardId}-${n}`)))})})}},13548:(e,n,t)=>{t.d(n,{SX:()=>r,IF:()=>g,oZ:()=>d,xh:()=>h});t(68404);var a=t(43215),i=t(69783),s=t(45916);function r(e){let{error:n}=e;const t=function(e){switch(e){case a.PluginErrorCode.modifiedSignature:return"Plugin disabled due to modified content";case a.PluginErrorCode.invalidSignature:return"Plugin disabled due to invalid plugin signature";case a.PluginErrorCode.missingSignature:return"Plugin disabled due to missing plugin signature";default:return`Plugin disabled due to unkown error: ${e}`}}(n);return(0,s.jsx)(i.Badge,{icon:"exclamation-triangle",text:"Disabled",color:"red",tooltip:t})}var l=t(36636);const o=e=>l.css`
  2. background: ${e.colors.background.primary};
  3. border-color: ${e.colors.border.strong};
  4. color: ${e.colors.text.secondary};
  5. `;function d(){const e=(0,i.useStyles2)(o);return(0,s.jsx)(i.Badge,{text:"Installed",color:"orange",className:e})}var c,u=t(90923);function g(e){let{plugin:n}=e;const t=(0,i.useStyles2)(o);return(0,u.featureEnabled)("enterprise.plugins")?c||(c=(0,s.jsx)(i.Badge,{text:"Enterprise",color:"blue"})):(0,s.jsxs)(i.HorizontalGroup,{children:[(0,s.jsx)(i.PluginSignatureBadge,{status:n.signature}),(0,s.jsx)(i.Badge,{icon:"lock","aria-label":"lock icon",text:"Enterprise",color:"blue",className:t}),(0,s.jsx)(i.Button,{size:"sm",fill:"text",icon:"external-link-alt",onClick:e=>{e.preventDefault(),window.open(`https://grafana.com/grafana/plugins/${n.id}?utm_source=grafana_catalog_learn_more`,"_blank","noopener,noreferrer")},children:"Learn more"})]})}function h(e){let{plugin:n}=e;const t=(0,i.useStyles2)(p);return n.hasUpdate&&!n.isCore&&n.type!==a.PluginType.renderer?(0,s.jsx)("p",{className:t.hasUpdate,children:"Update available!"}):null}const p=e=>({hasUpdate:l.css`
  6. color: ${e.colors.text.secondary};
  7. font-size: ${e.typography.bodySmall.fontSize};
  8. margin-bottom: 0;
  9. `})},845:(e,n,t)=>{t.d(n,{E:()=>i});t(68404);var a=t(45916);function i(e){let{alt:n,className:t,src:i,height:s}=e;return(0,a.jsx)("img",{src:i,className:t,alt:n,loading:"lazy",height:s})}},20040:(e,n,t)=>{t.r(n),t.d(n,{default:()=>De,getStyles:()=>Ee});var a,i,s=t(36636),r=t(68404),l=t(20002),o=t(90923),d=t(69783),c=t(92565),u=t(33801),g=t(58170),h=t(56008),p=t(43215),m=t(4936),f=t(45916);const x=e=>{let{versions:n=[],installedVersion:t}=e;const s=(0,d.useStyles2)(v),r=(0,m.RU)(n);return 0===n.length?a||(a=(0,f.jsx)("p",{children:"No version history was found."})):(0,f.jsxs)("table",{className:s.table,children:[i||(i=(0,f.jsx)("thead",{children:(0,f.jsxs)("tr",{children:[(0,f.jsx)("th",{children:"Version"}),(0,f.jsx)("th",{children:"Last updated"})]})})),(0,f.jsx)("tbody",{children:n.map((e=>{const n=t===e.version;return(0,f.jsxs)("tr",{children:[n?(0,f.jsxs)("td",{className:s.currentVersion,children:[e.version," (installed version)"]}):e.version===(null==r?void 0:r.version)?(0,f.jsxs)("td",{children:[e.version," (latest compatible version)"]}):(0,f.jsx)("td",{children:e.version}),(0,f.jsx)("td",{className:n?s.currentVersion:"",children:(0,p.dateTimeFormatTimeAgo)(e.createdAt)})]},e.version)}))})]})},v=e=>({container:s.css`
  10. padding: ${e.spacing(2,4,3)};
  11. `,table:s.css`
  12. table-layout: fixed;
  13. width: 100%;
  14. td,
  15. th {
  16. padding: ${e.spacing()} 0;
  17. }
  18. th {
  19. font-size: ${e.typography.h5.fontSize};
  20. }
  21. `,currentVersion:s.css`
  22. font-weight: ${e.typography.fontWeightBold};
  23. `});var b=t(94087),j=t(75064),y=t(32569),S=t(92808);const P=e=>(0,b.Z)((async()=>e&&e.isInstalled&&!e.isDisabled?async function(e){const n=await(0,y.a)(e);let t;n.type===p.PluginType.app&&(t=await(0,S.Av)(n)),n.type===p.PluginType.datasource&&(t=await(0,S.nL)(n)),n.type===p.PluginType.panel&&(t=await(0,j._)(n));if(n.type===p.PluginType.renderer&&(t={meta:n}),!t)throw new Error("Unknown Plugin type: "+n.type);return t}(e.id):null),[null==e?void 0:e.id,null==e?void 0:e.isInstalled,null==e?void 0:e.isDisabled]);var N,k,w=t(79729),C=t(82897);function I(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}class $ extends r.PureComponent{constructor(e){super(e),I(this,"element",null),I(this,"model",void 0),I(this,"preUpdateHook",(()=>Promise.resolve())),I(this,"postUpdateHook",(()=>Promise.resolve())),I(this,"update",(()=>{const e=this.model.id;this.preUpdateHook().then((()=>{const n=(0,C.extend)({enabled:this.model.enabled,pinned:this.model.pinned,jsonData:this.model.jsonData,secureJsonData:this.model.secureJsonData},{});return(0,o.getBackendSrv)().post(`/api/plugins/${e}/settings`,n)})).then(this.postUpdateHook).then((e=>{window.location.href=window.location.href}))})),I(this,"setPreUpdateHook",(e=>{this.preUpdateHook=e})),I(this,"setPostUpdateHook",(e=>{this.postUpdateHook=e})),I(this,"importDashboards",(()=>((0,p.deprecationWarning)("AppConfig","importDashboards()"),Promise.resolve()))),I(this,"enable",(()=>{this.model.enabled=!0,this.model.pinned=!0,this.update()})),I(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(e){if(!this.element||this.state.angularCtrl)return;this.model=(0,C.cloneDeep)(this.props.app.meta);const n={ctrl:this,isAppConfigCtrl:!0},t=(0,o.getAngularLoader)().load(this.element,n,'<plugin-component type="app-config-ctrl"></plugin-component>');this.setState({angularCtrl:t})}render(){const e=this.model,n=(0,s.css)({marginRight:"8px"});return(0,f.jsxs)("div",{children:[(0,f.jsx)("div",{ref:e=>this.element=e}),N||(N=(0,f.jsx)("br",{})),k||(k=(0,f.jsx)("br",{})),e&&(0,f.jsxs)("div",{className:"gf-form",children:[!e.enabled&&(0,f.jsx)(d.Button,{variant:"primary",onClick:this.enable,className:n,children:"Enable"}),e.enabled&&(0,f.jsx)(d.Button,{variant:"primary",onClick:this.update,className:n,children:"Update"}),e.enabled&&(0,f.jsx)(d.Button,{variant:"destructive",onClick:this.disable,className:n,children:"Disable"})]})]})}}var D,E,T,U=t(98163),B=t(53149);function A(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}class L extends r.PureComponent{constructor(e){super(e),A(this,"importAll",(()=>{this.importNext(0)})),A(this,"importNext",(e=>{const{dashboards:n}=this.state;return this.import(n[e],!0).then((()=>e+1<n.length?new Promise((n=>{setTimeout((()=>{this.importNext(e+1).then((()=>{n()}))}),500)})):Promise.resolve()))})),A(this,"import",((e,n)=>{const{plugin:t,datasource:a}=this.props,i={pluginId:t.id,path:e.path,overwrite:n,inputs:[]};return a&&i.inputs.push({name:"*",type:"datasource",pluginId:a.meta.id,value:a.name}),(0,o.getBackendSrv)().post("/api/dashboards/import",i).then((n=>{U.h$.emit(p.AppEvents.alertSuccess,["Dashboard Imported",e.title]),(0,C.extend)(e,n),this.setState({dashboards:[...this.state.dashboards]})}))})),A(this,"remove",(e=>{(0,o.getBackendSrv)().delete("/api/dashboards/uid/"+e.uid).then((()=>{e.imported=!1,this.setState({dashboards:[...this.state.dashboards]})}))})),this.state={loading:!0,dashboards:[]}}async componentDidMount(){const e=this.props.plugin.id;(0,o.getBackendSrv)().get(`/api/plugins/${e}/dashboards`).then((e=>{this.setState({dashboards:e,loading:!1})}))}render(){const{loading:e,dashboards:n}=this.state;return e?D||(D=(0,f.jsx)("div",{children:"loading..."})):n&&n.length?(0,f.jsx)("div",{className:"gf-form-group",children:(0,f.jsx)(B.Z,{dashboards:n,onImport:this.import,onRemove:this.remove})}):E||(E=(0,f.jsx)("div",{children:"No dashboards are included with this plugin"}))}}function V(e){let{plugin:n,queryParams:t,pageId:a}=e;const i=(0,d.useStyles2)(R),{value:r}=P(n);var l,o,c;if(a===w.tu.OVERVIEW)return(0,f.jsx)("div",{className:(0,s.cx)(i.readme,i.container),dangerouslySetInnerHTML:{__html:null!==(l=null===(o=n.details)||void 0===o?void 0:o.readme)&&void 0!==l?l:"No plugin help or readme markdown file was found"}});if(a===w.tu.VERSIONS)return(0,f.jsx)("div",{className:i.container,children:(0,f.jsx)(x,{versions:null===(c=n.details)||void 0===c?void 0:c.versions,installedVersion:n.installedVersion})});if(a===w.tu.CONFIG&&null!=r&&r.angularConfigCtrl)return(0,f.jsx)("div",{className:i.container,children:(0,f.jsx)($,{app:r})});if(null!=r&&r.configPages)for(const e of r.configPages)if(a===e.id)return(0,f.jsx)("div",{className:i.container,children:(0,f.jsx)(e.body,{plugin:r,query:t})});return a===w.tu.DASHBOARDS&&r?(0,f.jsx)("div",{className:i.container,children:(0,f.jsx)(L,{plugin:null==r?void 0:r.meta})}):(0,f.jsx)("div",{className:i.container,children:T||(T=(0,f.jsx)("p",{children:"Page not found."}))})}const R=e=>({container:s.css`
  24. padding: ${e.spacing(3,4)};
  25. `,readme:s.css`
  26. & img {
  27. max-width: 100%;
  28. }
  29. h1,
  30. h2,
  31. h3 {
  32. margin-top: ${e.spacing(3)};
  33. margin-bottom: ${e.spacing(2)};
  34. }
  35. *:first-child {
  36. margin-top: 0;
  37. }
  38. li {
  39. margin-left: ${e.spacing(2)};
  40. & > p {
  41. margin: ${e.spacing()} 0;
  42. }
  43. }
  44. a {
  45. color: ${e.colors.text.link};
  46. &:hover {
  47. color: ${e.colors.text.link};
  48. text-decoration: underline;
  49. }
  50. }
  51. `});var z,O,W,G,_,F,H=t(16695);function Z(e){let{className:n,plugin:t}=e;return t.isDisabled?(0,f.jsxs)(d.Alert,{severity:"error",title:"Plugin disabled",className:n,"aria-label":H.wl.pages.PluginPage.disabledInfo,children:[q(t.error),z||(z=(0,f.jsx)("p",{children:"Please contact your server administrator to get this resolved."})),O||(O=(0,f.jsx)("a",{href:"https://grafana.com/docs/grafana/latest/administration/cli/#plugins-commands",className:"external-link",target:"_blank",rel:"noreferrer",children:"Read more about managing plugins"}))]}):null}function q(e){switch(e){case p.PluginErrorCode.modifiedSignature:return W||(W=(0,f.jsx)("p",{children:"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.PluginErrorCode.invalidSignature:return G||(G=(0,f.jsx)("p",{children:"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.PluginErrorCode.missingSignature:return _||(_=(0,f.jsx)("p",{children:"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 F||(F=(0,f.jsx)("p",{children:"We failed to run this plugin due to an unkown reason and have therefor disabled it. We recommend you to reinstall the plugin to make sure you are running a working version of this plugin."}))}}var M=t(13548),Q=t(7784);function J(e){let{plugin:n}=e;const{value:t}=P(n);if(!t)return null;const{enabled:a,jsonData:i}=null==t?void 0:t.meta;return(0,f.jsxs)(f.Fragment,{children:[!a&&(0,f.jsx)(d.Button,{variant:"primary",onClick:()=>X(n.id,{enabled:!0,pinned:!0,jsonData:i}),children:"Enable"}),a&&(0,f.jsx)(d.Button,{variant:"destructive",onClick:()=>{X(n.id,{enabled:!1,pinned:!1,jsonData:i})},children:"Disable"})]})}const X=async(e,n)=>{try{await(0,Q.P6)(e,n),window.location.reload()}catch(e){console.error("Error while updating the plugin",e)}};var Y=t(18745),K=t(87993),ee=t(41266);function ne(e){let{plugin:n}=e;const t=(0,Y.useDispatch)(),a=(0,r.useCallback)((()=>{const e={name:n.name,id:n.id};t((0,K.J_)(e))}),[t,n]);return(0,ee.Gg)()?(0,f.jsxs)(d.Button,{variant:"primary",onClick:a,children:["Create a ",n.name," data source"]}):null}function te(e){let{plugin:n}=e;if(!n.isInstalled||n.isDisabled)return null;switch(n.type){case p.PluginType.datasource:return(0,f.jsx)(ne,{plugin:n});case p.PluginType.app:return(0,f.jsx)(J,{plugin:n});default:return null}}var ae=t(30110);function ie(e){let{pluginId:n,pluginStatus:t}=e;const a=`${(0,m.Uj)(n)}/?tab=installation`;return t===w.vF.UPDATE?(0,f.jsxs)(d.HorizontalGroup,{height:"auto",children:[(0,f.jsx)(d.LinkButton,{href:a,target:"_blank",rel:"noopener noreferrer",children:"Update via grafana.com"}),(0,f.jsx)(d.LinkButton,{variant:"destructive",href:a,target:"_blank",rel:"noopener noreferrer",children:"Uninstall via grafana.com"})]}):t===w.vF.UNINSTALL?(0,f.jsx)(d.LinkButton,{variant:"destructive",href:a,target:"_blank",rel:"noopener noreferrer",children:"Uninstall via grafana.com"}):(0,f.jsx)(d.LinkButton,{href:a,target:"_blank",rel:"noopener noreferrer",children:"Install via grafana.com"})}var se,re,le,oe=t(5831);function de(e){let{plugin:n,pluginStatus:t,latestCompatibleVersion:a}=e;const{isInstalling:i,error:s}=(0,ae.IS)(),{isUninstalling:l,error:o}=(0,ae.wq)(),c=(0,ae.x3)(),u=(0,ae.S1)(),[g,h]=(0,r.useState)(!1),m=()=>h(!0),x=()=>h(!1),v=l?"Uninstalling":"Uninstall",b=async()=>{x(),await u(n.id),o||oe.Z.emit(p.AppEvents.alertSuccess,[`Uninstalled ${n.name}`])},j=async()=>{await c(n.id,null==a?void 0:a.version,!0),s||oe.Z.emit(p.AppEvents.alertSuccess,[`Updated ${n.name}`])};return t===w.vF.UNINSTALL?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(d.ConfirmModal,{isOpen:g,title:`Uninstall ${n.name}`,body:"Are you sure you want to uninstall this plugin?",confirmText:"Confirm",icon:"exclamation-triangle",onConfirm:b,onDismiss:x}),(0,f.jsx)(d.HorizontalGroup,{height:"auto",children:(0,f.jsx)(d.Button,{variant:"destructive",disabled:l,onClick:m,children:v})})]}):t===w.vF.UPDATE?(0,f.jsxs)(d.HorizontalGroup,{height:"auto",children:[(0,f.jsx)(d.Button,{disabled:i,onClick:j,children:i?"Updating":"Update"}),(0,f.jsx)(d.Button,{variant:"destructive",disabled:l,onClick:b,children:v})]}):(0,f.jsx)(d.Button,{disabled:i,onClick:async()=>{await c(n.id,null==a?void 0:a.version),s||oe.Z.emit(p.AppEvents.alertSuccess,[`Installed ${n.name}`])},children:i?"Installing":"Install"})}const ce=e=>{let{plugin:n,latestCompatibleVersion:t}=e;const a=(0,d.useStyles2)(ue),i=o.config.pluginAdminExternalManageEnabled,s=(0,ee.bO)(),r=(0,ae.y9)(),l=Boolean(t),c=n.isCore||n.isDisabled||!(0,m.fG)(),u=n.isInstalled?n.hasUpdate?w.vF.UPDATE:w.vF.UNINSTALL:w.vF.INSTALL;if(c)return null;if(n.type===p.PluginType.renderer)return(0,f.jsx)("div",{className:a.message,children:"Renderer plugins cannot be managed by the Plugin Catalog."});if(n.isEnterprise&&!(0,o.featureEnabled)("enterprise.plugins"))return(0,f.jsxs)(d.HorizontalGroup,{height:"auto",align:"center",children:[(0,f.jsx)("span",{className:a.message,children:"No valid Grafana Enterprise license detected."}),(0,f.jsx)(d.LinkButton,{href:`${(0,m.Uj)(n.id)}?utm_source=grafana_catalog_learn_more`,target:"_blank",rel:"noopener noreferrer",size:"sm",fill:"text",icon:"external-link-alt",children:"Learn more"})]});if(n.isDev)return(0,f.jsx)("div",{className:a.message,children:"This is a development build of the plugin and can't be uninstalled."});if(!s&&!i){const e=`You do not have permission to ${u} this plugin.`;return(0,f.jsx)("div",{className:a.message,children:e})}return n.isPublished?l?i?(0,f.jsx)(ie,{pluginId:n.id,pluginStatus:u}):r?(0,f.jsx)(de,{plugin:n,pluginStatus:u,latestCompatibleVersion:t}):(0,f.jsx)("div",{className:a.message,children:"The install controls have been disabled because the Grafana server cannot access grafana.com."}):(0,f.jsxs)("div",{className:a.message,children:[le||(le=(0,f.jsx)(d.Icon,{name:"exclamation-triangle"}))," This plugin doesn't support your version of Grafana."]}):(0,f.jsxs)("div",{className:a.message,children:[se||(se=(0,f.jsx)(d.Icon,{name:"exclamation-triangle"}))," This plugin is not published to"," ",re||(re=(0,f.jsx)("a",{href:"https://www.grafana.com/plugins",target:"__blank",rel:"noreferrer",children:"grafana.com/plugins"}))," ","and can't be managed via the catalog."]})},ue=e=>({message:s.css`
  52. color: ${e.colors.text.secondary};
  53. `});function ge(e){var n,t,a;let{plugin:i,latestCompatibleVersion:s,className:r}=e;const l=(0,d.useStyles2)(he),o=null===(n=i.details)||void 0===n?void 0:n.pluginDependencies,c=i.isInstalled?null===(t=i.details)||void 0===t?void 0:t.grafanaDependency:(null==s?void 0:s.grafanaDependency)||(null===(a=i.details)||void 0===a?void 0:a.grafanaDependency);return!(c||o&&o.length)?null:(0,f.jsxs)("div",{className:r,children:[(0,f.jsx)("div",{className:l.dependencyTitle,children:"Dependencies:"}),Boolean(c)&&(0,f.jsxs)("div",{children:[(0,f.jsx)(d.Icon,{name:"grafana",className:l.icon}),"Grafana ",c]}),o&&o.length>0&&(0,f.jsx)("div",{children:o.map((e=>(0,f.jsxs)("span",{children:[(0,f.jsx)(d.Icon,{name:w.Co[e.type],className:l.icon}),e.name," ",e.version]},e.name)))})]})}const he=e=>({dependencyTitle:s.css`
  54. font-weight: ${e.typography.fontWeightBold};
  55. margin-right: ${e.spacing(.5)};
  56. &::after {
  57. content: '';
  58. padding: 0;
  59. }
  60. `,icon:s.css`
  61. color: ${e.colors.text.secondary};
  62. margin-right: ${e.spacing(.5)};
  63. `}),pe={[p.PluginSignatureType.grafana]:"grafana",[p.PluginSignatureType.commercial]:"shield",[p.PluginSignatureType.community]:"shield",DEFAULT:"shield-exclamation"};function me(e){let{signatureType:n,signatureOrg:t=""}=e;const a=(0,d.useStyles2)(xe);if(!n&&!t)return null;const i=n===p.PluginSignatureType.grafana?"Grafana Labs":(0,C.capitalize)(n),s=pe[n||""]||pe.DEFAULT;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(fe,{children:[(0,f.jsx)("strong",{className:a.strong,children:"Level: "}),(0,f.jsx)(d.Icon,{size:"xs",name:s})," ",i]}),(0,f.jsxs)(fe,{children:[(0,f.jsx)("strong",{className:a.strong,children:"Signed by:"})," ",t]})]})}const fe=e=>{let{children:n}=e;const t=(0,d.useStyles2)(xe);return(0,f.jsx)(d.Badge,{color:"green",className:t.badge,text:(0,f.jsx)(f.Fragment,{children:n})})},xe=e=>({badge:s.css`
  64. background-color: ${e.colors.background.canvas};
  65. border-color: ${e.colors.border.strong};
  66. color: ${e.colors.text.secondary};
  67. margin-left: ${e.spacing()};
  68. `,strong:s.css`
  69. color: ${e.colors.text.primary};
  70. `,icon:s.css`
  71. margin-right: ${e.spacing(.5)};
  72. `});function ve(e){let{plugin:n}=e;const t=(0,d.useStyles2)(be),a=n.signature===p.PluginSignatureStatus.valid;return(0,f.jsxs)("div",{className:t.container,children:[(0,f.jsx)("a",{href:"https://grafana.com/docs/grafana/latest/plugins/plugin-signatures/",target:"_blank",rel:"noreferrer",className:t.link,children:(0,f.jsx)(d.PluginSignatureBadge,{status:n.signature})}),a&&(0,f.jsx)(me,{signatureType:n.signatureType,signatureOrg:n.signatureOrg})]})}const be=e=>({container:s.css`
  73. display: flex;
  74. `,link:s.css`
  75. display: inline-flex;
  76. align-items: center;
  77. `});var je,ye=t(845);function Se(e){var n,t;let{plugin:a,currentUrl:i,parentUrl:r}=e;const l=(0,d.useStyles2)(Pe),o=(0,m.RU)(null===(n=a.details)||void 0===n?void 0:n.versions),c=a.installedVersion||(null==o?void 0:o.version);return(0,f.jsx)("div",{children:(0,f.jsx)("div",{className:"page-container",children:(0,f.jsxs)("div",{className:l.headerContainer,children:[(0,f.jsx)(ye.E,{alt:`${a.name} logo`,src:a.info.logos.small,className:s.css`
  78. object-fit: contain;
  79. width: 100%;
  80. height: 68px;
  81. max-width: 68px;
  82. `}),(0,f.jsxs)("div",{className:l.headerWrapper,children:[(0,f.jsx)("nav",{className:l.breadcrumb,"aria-label":"Breadcrumb",children:(0,f.jsxs)("ol",{children:[(0,f.jsx)("li",{children:(0,f.jsx)("a",{className:l.textUnderline,href:r,children:"Plugins"})}),(0,f.jsx)("li",{children:(0,f.jsx)("a",{href:i,"aria-current":"page",children:a.name})})]})}),(0,f.jsxs)("div",{className:l.headerInformationRow,children:[(0,f.jsx)("span",{children:a.orgName}),null===(t=a.details)||void 0===t?void 0:t.links.map((e=>(0,f.jsx)("a",{href:e.url,children:e.name},e.name))),a.downloads>0&&(0,f.jsxs)("span",{children:[je||(je=(0,f.jsx)(d.Icon,{name:"cloud-download"})),` ${(new Intl.NumberFormat).format(a.downloads)}`," "]}),Boolean(c)&&(0,f.jsx)("span",{children:c}),(0,f.jsx)(ve,{plugin:a}),a.isDisabled&&(0,f.jsx)(M.SX,{error:a.error})]}),(0,f.jsx)(ge,{plugin:a,latestCompatibleVersion:o,className:(0,s.cx)(l.headerInformationRow,l.headerInformationRowSecondary)}),(0,f.jsx)("p",{children:a.description}),(0,f.jsxs)(d.HorizontalGroup,{height:"auto",children:[(0,f.jsx)(ce,{plugin:a,latestCompatibleVersion:o}),(0,f.jsx)(te,{plugin:a})]})]})]})})})}const Pe=e=>({headerContainer:s.css`
  83. display: flex;
  84. margin-bottom: ${e.spacing(3)};
  85. margin-top: ${e.spacing(3)};
  86. min-height: 120px;
  87. `,headerWrapper:s.css`
  88. margin-left: ${e.spacing(3)};
  89. `,breadcrumb:s.css`
  90. font-size: ${e.typography.h2.fontSize};
  91. li {
  92. display: inline;
  93. list-style: none;
  94. &::after {
  95. content: '/';
  96. padding: 0 0.25ch;
  97. }
  98. &:last-child::after {
  99. content: '';
  100. }
  101. }
  102. `,headerInformationRow:s.css`
  103. display: flex;
  104. align-items: center;
  105. margin-top: ${e.spacing()};
  106. margin-bottom: ${e.spacing()};
  107. flex-flow: wrap;
  108. & > * {
  109. &::after {
  110. content: '|';
  111. padding: 0 ${e.spacing()};
  112. }
  113. &:last-child::after {
  114. content: '';
  115. padding-right: 0;
  116. }
  117. }
  118. font-size: ${e.typography.h4.fontSize};
  119. a {
  120. &:hover {
  121. text-decoration: underline;
  122. }
  123. }
  124. `,headerInformationRowSecondary:s.css`
  125. font-size: ${e.typography.body.fontSize};
  126. `,headerOrgName:s.css`
  127. font-size: ${e.typography.h4.fontSize};
  128. `,signature:s.css`
  129. margin: ${e.spacing(3)};
  130. margin-bottom: 0;
  131. `,textUnderline:s.css`
  132. text-decoration: underline;
  133. `});var Ne,ke;function we(e){let{className:n,plugin:t}=e;const a=t.signature===p.PluginSignatureStatus.valid,i=t.signature===p.PluginSignatureStatus.internal,s=t.isDisabled&&function(e){switch(e){case p.PluginErrorCode.invalidSignature:case p.PluginErrorCode.missingSignature:case p.PluginErrorCode.modifiedSignature:return!0;default:return!1}}(t.error);return a||i||s?null:(0,f.jsxs)(d.Alert,{severity:"warning",title:"Invalid plugin signature","aria-label":H.wl.pages.PluginPage.signatureInfo,className:n,children:[Ne||(Ne=(0,f.jsx)("p",{children:"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’t guarantee the integrity of this unsigned plugin. Ask the plugin author to request it to be signed."})),ke||(ke=(0,f.jsx)("a",{href:"https://grafana.com/docs/grafana/latest/plugins/plugin-signatures/",className:"external-link",target:"_blank",rel:"noreferrer",children:"Read more about plugins signing."}))]})}var Ce=t(42326);var Ie,$e;function De(e){let{match:n,queryParams:t}=e;const{params:{pluginId:a=""},url:i}=n,s=i.substring(0,i.lastIndexOf("/")),m=[{label:w.xc.OVERVIEW,icon:"file-alt",id:w.tu.OVERVIEW,href:`${i}?page=${w.tu.OVERVIEW}`}],x=(0,ae.bJ)(a),{tabs:v,defaultTab:b}=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const{loading:t,error:a,value:i}=P(e),s=Boolean(null==e?void 0:e.isPublished),{pathname:l}=(0,Ce.TH)(),[o,d]=(0,r.useMemo)((()=>{const e=(0,ee.RN)(),t=[...n];let a;if(s&&t.push({label:w.xc.VERSIONS,icon:"history",id:w.tu.VERSIONS,href:`${l}?page=${w.tu.VERSIONS}`}),!i)return a=w.tu.OVERVIEW,[t,a];if(e&&i.meta.type===p.PluginType.app){var r;if(i.angularConfigCtrl&&(t.push({label:"Config",icon:"cog",id:w.tu.CONFIG,href:`${l}?page=${w.tu.CONFIG}`}),a=w.tu.CONFIG),i.configPages)for(const e of i.configPages)t.push({label:e.title,icon:e.icon,id:e.id,href:`${l}?page=${e.id}`}),a||(a=e.id);null!==(r=i.meta.includes)&&void 0!==r&&r.find((e=>e.type===p.PluginIncludeType.dashboard))&&t.push({label:"Dashboards",icon:"apps",id:w.tu.DASHBOARDS,href:`${l}?page=${w.tu.DASHBOARDS}`})}return a||(a=w.tu.OVERVIEW),[t,a]}),[i,n,l,s]);return{error:a,loading:t,tabs:o,defaultTab:d}}(x,m),{isLoading:j}=(0,ae.ZV)(),{isLoading:y}=(0,ae.bt)(),S=(0,d.useStyles2)(Ee),N=(0,l.Z)(v),k=t.page||b;return(0,r.useEffect)((()=>{const e=N&&N.length>v.length,n=k!==w.tu.OVERVIEW&&k!==w.tu.VERSIONS;e&&n&&o.locationService.replace(`${i}?page=${w.tu.OVERVIEW}`)}),[k,i,v,N]),j||y?Ie||(Ie=(0,f.jsx)(u.T,{children:(0,f.jsx)(h.a,{})})):x?(0,f.jsxs)(u.T,{children:[(0,f.jsx)(Se,{currentUrl:`${i}?page=${k}`,parentUrl:s,plugin:x}),(0,f.jsx)("div",{children:(0,f.jsx)("div",{className:"page-container",children:(0,f.jsx)(d.TabsBar,{hideBorder:!0,children:v.map((e=>(0,f.jsx)(d.Tab,{label:e.label,href:e.href,icon:e.icon,active:e.id===k},e.label)))})})}),(0,f.jsx)(u.T.Contents,{children:(0,f.jsxs)(d.TabContent,{className:S.tabContent,children:[(0,f.jsx)(we,{plugin:x,className:S.alert}),(0,f.jsx)(Z,{plugin:x,className:S.alert}),(0,f.jsx)(V,{queryParams:t,plugin:x,pageId:k})]})})]}):(0,f.jsx)(c.Ar,{justify:"center",align:"center",children:(0,f.jsxs)(d.Alert,{severity:g.F1.Warning,title:"Plugin not found",children:["That plugin cannot be found. Please check the url is correct or ",$e||($e=(0,f.jsx)("br",{})),"go to the ",(0,f.jsx)("a",{href:s,children:"plugin catalog"}),"."]})})}const Ee=e=>({alert:s.css`
  134. margin: ${e.spacing(3)};
  135. margin-bottom: 0;
  136. `,tabContent:s.css`
  137. overflow: auto;
  138. `})},30110:(e,n,t)=>{t.d(n,{iY:()=>U,bt:()=>I,ZV:()=>C,GE:()=>y,UQ:()=>P,bJ:()=>S,x3:()=>N,IS:()=>$,y9:()=>w,S1:()=>k,wq:()=>D});var a=t(68404),i=t(18745),s=t(4936),r=t(72192),l=t(1250),o=t(98335),d=t(79729);const c=e=>e.plugins,u=(0,o.P1)(c,(e=>{let{items:n}=e;return n})),g=(0,o.P1)(c,(e=>{let{settings:n}=e;return n.displayMode})),{selectAll:h,selectById:p}=l.CD.getSelectors(u),m=(e,n)=>(0,o.P1)((e=>(0,o.P1)(h,(n=>n.filter((n=>"installed"===e?n.isInstalled:!n.isCore)))))(e),(e=>e.filter((e=>"all"===n||e.type===n)))),f=(e,n,t)=>(0,o.P1)(m(n,t),(e=>(0,o.P1)(h,(n=>""===e?[]:n.filter((n=>{const t=[];return n.name&&t.push(n.name.toLowerCase()),n.orgName&&t.push(n.orgName.toLowerCase()),t.some((n=>n.includes(e.toLowerCase())))})))))(e),((n,t)=>""===e?n:t)),x=(0,o.P1)(h,(e=>e?e.filter((e=>Boolean(e.error))).map((e=>({pluginId:e.id,errorCode:e.error}))):[])),v=e=>(0,o.P1)(c,(n=>{let{requests:t={}}=n;return t[e]})),b=e=>(0,o.P1)(v(e),(e=>(null==e?void 0:e.status)===d.eE.Pending)),j=e=>(0,o.P1)(v(e),(e=>(null==e?void 0:e.status)===d.eE.Rejected?null==e?void 0:e.error:null)),y=e=>{let{query:n="",filterBy:t="installed",filterByType:a="all",sortBy:r=s.Nh.nameAsc}=e;E();const l=(0,i.useSelector)(f(n,t,a)),{isLoading:o,error:d}=C();return{isLoading:o,error:d,plugins:(0,s.AA)(l,r)}},S=e=>(E(),T(e),(0,i.useSelector)((n=>p(n,e)))),P=()=>(E(),(0,i.useSelector)(x)),N=()=>{const e=(0,i.useDispatch)();return(n,t,a)=>e((0,r.N9)({id:n,version:t,isUpdating:a}))},k=()=>{const e=(0,i.useDispatch)();return n=>e((0,r.Tz)(n))},w=()=>null===(0,i.useSelector)(j(r.tQ.typePrefix)),C=()=>({isLoading:(0,i.useSelector)(b(r.Qd.typePrefix)),error:(0,i.useSelector)(j(r.Qd.typePrefix))}),I=()=>({isLoading:(0,i.useSelector)(b(r.DD.typePrefix)),error:(0,i.useSelector)(j(r.DD.typePrefix))}),$=()=>({isInstalling:(0,i.useSelector)(b(r.N9.typePrefix)),error:(0,i.useSelector)(j(r.N9.typePrefix))}),D=()=>({isUninstalling:(0,i.useSelector)(b(r.Tz.typePrefix)),error:(0,i.useSelector)(j(r.Tz.typePrefix))}),E=()=>{const e=(0,i.useDispatch)(),n=(0,i.useSelector)((t=r.Qd.typePrefix,(0,o.P1)(v(t),(e=>void 0===e))));var t;(0,a.useEffect)((()=>{n&&e((0,r.Qd)())}),[])},T=e=>{const n=(0,i.useDispatch)(),t=(0,i.useSelector)((n=>p(n,e))),s=!(0,i.useSelector)(b(r.DD.typePrefix))&&t&&!t.details;(0,a.useEffect)((()=>{s&&n((0,r.DD)(e))}),[t])},U=()=>{const e=(0,i.useDispatch)();return{displayMode:(0,i.useSelector)(g),setDisplayMode:n=>e((0,l.UC)(n))}}},20002:(e,n,t)=>{t.d(n,{Z:()=>i});var a=t(68404);function i(e){var n=(0,a.useRef)();return(0,a.useEffect)((function(){n.current=e})),n.current}}}]);
  139. //# sourceMappingURL=PluginPage.35821bcc5f6830ed7e8b.js.map