"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[5981],{9699:(J,L,t)=>{t.d(L,{e:()=>e});var e=(a=>(a.OpenSource="Open Source",a.Pro="Pro",a.Enterprise="Enterprise",a))(e||{})},67694:(J,L,t)=>{t.d(L,{Z:()=>u});var e=t(65237),a=t(27496),M=t(48389),T=t(66624);class u extends e.PureComponent{render(){const{searchQuery:g,linkButton:s,setSearchQuery:R,target:x,placeholder:A="Search by name or type",sortPicker:E}=this.props,S={href:s?.href,disabled:s?.disabled};return x&&(S.target=x),e.createElement("div",{className:"page-action-bar"},e.createElement("div",{className:"gf-form gf-form--grow"},e.createElement(a.H,{value:g,onChange:R,placeholder:A})),E&&e.createElement(T.P,{onChange:E.onChange,value:E.value,getSortOptions:E.getSortOptions}),s&&e.createElement(M.Qj,{...S},s.title))}}},87262:(J,L,t)=>{t.r(L),t.d(L,{default:()=>ne});var e=t(65237),a=t(60894),M=t(67427),T=t(66116),u=t(3315),o=t(50160),g=t(38992),s=t(60234),R=t(80610),x=t(93048),A=t(16693),E=t(63969),S=t(96263),Z=t(60631);const G=n=>({sourcesList:s.css`
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    list-style: none;
    margin-bottom: 80px;
  `,card:s.css`
    height: 90px;
    padding: 0px 24px;
    margin-bottom: 0;
  `,cardContent:s.css`
    display: flex;
    align-items: center;
  `,logoWrapper:s.css`
    display: flex;
    justify-content: center;
    margin-right: 8px;
    width: 32px;
    height: 32px;
    img {
      max-width: 100%;
      max-height: 100%;
      align-self: center;
    }
  `,label:s.css`
    color: ${n.colors.text.primary};
    margin-bottom: 0;
  `}),Y=({items:n,onClickItem:f})=>{const v=(0,x.wW)(G);return e.createElement("ul",{className:v.sourcesList},n.map(y=>e.createElement(Z.Z,{key:y.id,className:v.card,href:y.url,onClick:b=>{f&&f(b,y)}},e.createElement(Z.Z.Heading,null,e.createElement("div",{className:v.cardContent},y.logo&&e.createElement("div",{className:v.logoWrapper},e.createElement("img",{src:y.logo,alt:`logo of ${y.name}`})),e.createElement("h4",{className:v.label},y.name))))))};var m=t(6335);const z=n=>({categoryHeader:s.css`
    align-items: center;
    display: flex;
    margin-bottom: 24px;
  `,categoryLabel:s.css`
    margin-bottom: 0px;
    margin-left: 8px;
  `}),q=({iconName:n,label:f})=>{const v=(0,x.wW)(z);return e.createElement("div",{className:v.categoryHeader},e.createElement(m.J,{name:n,size:"xl"}),e.createElement("h3",{className:v.categoryLabel},f))};var U=t(90931),j=t(48389);const X=n=>({modal:s.css`
    width: 500px;
  `,modalContent:s.css`
    overflow: visible;
    color: ${n.colors.text.secondary};

    a {
      color: ${n.colors.text.link};
    }
  `,description:s.css`
    margin-bottom: ${n.spacing(2)};
  `,bottomSection:s.css`
    display: flex;
    border-top: 1px solid ${n.colors.border.weak};
    padding-top: ${n.spacing(3)};
    margin-top: ${n.spacing(3)};
  `,actionsSection:s.css`
    display: flex;
    justify-content: end;
    margin-top: ${n.spacing(3)};
  `,warningIcon:s.css`
    color: ${n.colors.warning.main};
    padding-right: ${n.spacing()};
    margin-top: ${n.spacing(.25)};
  `,header:s.css`
    display: flex;
    align-items: center;
  `,headerTitle:s.css`
    margin: 0;
  `,headerLogo:s.css`
    margin-right: ${n.spacing(2)};
    width: 32px;
    height: 32px;
  `});function w({item:n,isOpen:f,onDismiss:v}){const y=(0,x.wW)(X);return e.createElement(U.u,{className:y.modal,contentClassName:y.modalContent,title:e.createElement(O,{item:n}),isOpen:f,onDismiss:v},e.createElement("div",null,e.createElement("div",null,n.description&&e.createElement("div",{className:y.description},n.description),e.createElement("div",null,"Links",e.createElement("br",null),e.createElement("a",{href:`https://grafana.com/grafana/plugins/${n.id}`,title:`${n.name} on Grafana.com`,target:"_blank",rel:"noopener noreferrer"},n.name))),e.createElement("div",{className:y.bottomSection},e.createElement("div",{className:y.warningIcon},e.createElement(m.J,{name:"exclamation-triangle"})),e.createElement("div",null,e.createElement("p",null,"Editors cannot add new connections. You may check to see if it is already configured in"," ",e.createElement("a",{href:"/connections/your-connections"},"Your Connections"),"."),e.createElement("p",null,"To add a new connection, contact your Grafana admin."))),e.createElement("div",{className:y.actionsSection},e.createElement(j.zx,{onClick:v},"Okay"))))}function O({item:n}){const f=(0,x.wW)(X);return e.createElement("div",null,e.createElement("div",{className:f.header},n.logo&&e.createElement("img",{className:f.headerLogo,src:n.logo,alt:`logo of ${n.name}`}),e.createElement("h4",{className:f.headerTitle},n.name)))}const B=()=>({noResults:s.css`
    text-align: center;
    padding: 50px 0;
    font-style: italic;
  `}),H=()=>{const n=(0,x.wW)(B);return e.createElement("p",{className:n.noResults},"No results matching your query were found.")};var $=t(96682);const c=n=>({searchContainer:s.css`
    display: flex;
    margin: 16px 0;
    justify-content: space-between;

    position: sticky;
    top: 0;
    background-color: ${n.colors.background.primary};
    z-index: 2;
    padding: ${n.spacing(2)};
    margin: 0 -${n.spacing(2)};
  `}),p=({onChange:n})=>{const f=(0,x.wW)(c);return e.createElement("div",{className:f.searchContainer},e.createElement($.I,{onChange:n,prefix:e.createElement(m.J,{name:"search"}),placeholder:"Search all","aria-label":"Search all"}))},d=()=>({spacer:s.css`
    height: 16px;
  `,modal:s.css`
    width: 500px;
  `,modalContent:s.css`
    overflow: visible;
  `});function N(){const[n,f]=(0,e.useState)(""),[v,y]=(0,e.useState)(!1),[b,k]=(0,e.useState)(null),ee=(0,x.wW)(d),oe=E.Vt.hasPermission(u.AccessControlAction.DataSourcesCreate),de=K=>{f(K.currentTarget.value.toLowerCase())},{isLoading:se,error:Q,plugins:te}=(0,S.GE)({query:n,filterBy:"",filterByType:R.zV.datasource}),me=(0,e.useMemo)(()=>te.map(K=>({id:K.id,name:K.name,description:K.description,logo:K.info.logos.small,url:o.Z.DataSourcesDetails.replace(":id",K.id)})),[te]),ge=(K,fe)=>{oe||(K.preventDefault(),K.stopPropagation(),re(fe))},re=K=>{y(!0),k(K)},pe=()=>{y(!1),k(null)},Ee=(0,e.useMemo)(()=>!se&&!Q&&te.length<1,[se,Q,te]);return e.createElement(e.Fragment,null,b&&e.createElement(w,{item:b,isOpen:v,onDismiss:pe}),e.createElement(p,{onChange:de}),e.createElement("div",{className:ee.spacer}),e.createElement(q,{iconName:"database",label:"Data sources"}),se?e.createElement(A.u,{text:"Loading..."}):Q?e.createElement("p",null,"Error: ",Q.message):e.createElement(Y,{items:me,onClickItem:ge}),Ee&&e.createElement(H,null))}function C(){return e.createElement(g.T,{navId:"connections-connect-data"},e.createElement(g.T.Contents,null,e.createElement(N,null)))}var h=t(88347),D=t(66434),W=t(48644);function le(){const n="standalone-plugin-page-/connections/connect-data",{id:f}=(0,a.UO)(),v=(0,u.useSelector)(k=>k.navIndex),b=Boolean(v[n])?n:"connections-connect-data";return e.createElement(W.Q,{pluginId:f,navId:b,notFoundComponent:e.createElement(ce,null),notFoundNavModel:{text:"Unknown datasource",subTitle:"No datasource with this ID could be found.",active:!0}})}function ce(){const{id:n}=(0,a.UO)();return e.createElement(h.b,{severity:u.AppNotificationSeverity.Warning,title:""},"Maybe you mistyped the URL or the plugin with the id ",e.createElement(D.C,{text:n,color:"orange"})," is unavailable.",e.createElement("br",null),"To see a list of available datasources please ",e.createElement("a",{href:o.Z.ConnectData},"click here"),".")}var ie=t(49784),ue=t(28606),r=t(82986);function l(){const n=(0,u.useSelector)(({dataSources:v})=>(0,T.r7)(v)),f=ie.v.featureToggles.topnav&&n>0?e.createElement(ue.G,null):void 0;return e.createElement(g.T,{navId:"connections-your-connections-datasources",actions:f},e.createElement(g.T.Contents,null,e.createElement(r.c,null)))}var i=t(70320),P=t(7533);function I(){const{uid:n}=(0,a.UO)(),{navId:f,pageNav:v}=(0,P.M)("dashboards");return e.createElement(g.T,{navId:f,pageNav:v},e.createElement(g.T.Contents,null,e.createElement(i.Z,{uid:n})))}var F=t(42153);function V(){const{uid:n}=(0,a.UO)(),f=(0,a.TH)(),y=new URLSearchParams(f.search).get("page"),{navId:b,pageNav:k}=(0,P.M)();return e.createElement(g.T,{navId:b,pageNav:k},e.createElement(g.T.Contents,null,e.createElement(F.H,{uid:n,pageId:y})))}var _=t(69123);function ae(){return e.createElement(g.T,{navId:"connections-your-connections-datasources",pageNav:{text:"Add data source",subTitle:"Choose a data source type",active:!0}},e.createElement(g.T.Contents,null,e.createElement(_.x,null)))}function ne(){const n=(0,u.useSelector)(y=>y.navIndex),f=Boolean(n["standalone-plugin-page-/connections/connect-data"]),v=n["connections-your-connections"].children&&n["connections-your-connections"].children?.length>1?()=>e.createElement(M.G,{navId:"connections-your-connections"}):()=>e.createElement(a.l_,{to:o.Z.DataSources});return e.createElement(T.Vj.Provider,{value:{New:o.Z.DataSourcesNew,List:o.Z.DataSources,Edit:o.Z.DataSourcesEdit,Dashboards:o.Z.DataSourcesDashboards}},e.createElement(a.rs,null,e.createElement(a.AW,{exact:!0,sensitive:!0,path:o.Z.Base,component:()=>e.createElement(a.l_,{to:o.Z.ConnectData})}),e.createElement(a.AW,{exact:!0,sensitive:!0,path:o.Z.YourConnections,component:v}),e.createElement(a.AW,{exact:!0,sensitive:!0,path:o.Z.DataSources,component:l}),e.createElement(a.AW,{exact:!0,sensitive:!0,path:o.Z.DataSourcesDetails,component:le}),e.createElement(a.AW,{exact:!0,sensitive:!0,path:o.Z.DataSourcesNew,component:ae}),e.createElement(a.AW,{exact:!0,sensitive:!0,path:o.Z.DataSourcesEdit,component:V}),e.createElement(a.AW,{exact:!0,sensitive:!0,path:o.Z.DataSourcesDashboards,component:I}),!f&&e.createElement(a.AW,{exact:!0,sensitive:!0,path:o.Z.ConnectData,component:C}),e.createElement(a.AW,{component:()=>e.createElement(a.l_,{to:"/notfound"})})))}},28606:(J,L,t)=>{t.d(L,{G:()=>g});var e=t(65237),a=t(49784),M=t(48389),T=t(63969),u=t(3315),o=t(66116);function g(){const s=T.Vt.hasPermission(u.AccessControlAction.DataSourcesCreate),R=(0,o.d7)();return s?e.createElement(M.Qj,{icon:"plus",href:a.v.appSubUrl+R.New},"Add new data source"):null}},70320:(J,L,t)=>{t.d(L,{Z:()=>s});var e=t(65237),a=t(42702),M=t(24950),T=t(1100),u=t(3315),o=t(512),g=t(66116);function s({uid:x}){(0,g.wi)(x);const A=(0,u.useDispatch)(),E=(0,u.useSelector)(m=>m.dataSources.dataSource),S=(0,u.useSelector)(m=>m.plugins.dashboards),Z=(0,u.useSelector)(m=>m.plugins.isLoadingPluginDashboards);(0,e.useEffect)(()=>{E.id>0&&A((0,T.m3)())},[A,E]);const G=(m,z)=>{A((0,M.$j)({pluginId:m.pluginId,path:m.path,overwrite:z,inputs:[{name:"*",type:"datasource",pluginId:E.type,value:E.name}]},m.title))},Y=({uid:m})=>{A((0,M.fG)(m))};return e.createElement(R,{dashboards:S,isLoading:Z,onImportDashboard:G,onRemoveDashboard:Y})}const R=({isLoading:x,dashboards:A,onImportDashboard:E,onRemoveDashboard:S})=>x?e.createElement(a.Z,null):e.createElement(o.Z,{dashboards:A,onImport:E,onRemove:S})},82986:(J,L,t)=>{t.d(L,{c:()=>j});var e=t(60234),a=t(65237),M=t(60894),T=t(49784),u=t(93048),o=t(60631),g=t(69784),s=t(48389),R=t(76044),x=t(42702),A=t(63969),E=t(3315),S=t(66116),Z=t(57786),G=t(77393),Y=t(67694);const m="alpha-asc",z="alpha-desc",q=[{label:"Sort by A\u2013Z",value:m},{label:"Sort by Z\u2013A",value:z}];function U(){const O=(0,E.useDispatch)(),B=(0,a.useCallback)(D=>O((0,S.zT)(D)),[O]),H=(0,E.useSelector)(({dataSources:D})=>(0,S.IO)(D)),$=A.Vt.hasPermission(E.AccessControlAction.DataSourcesCreate),c=(0,S.d7)(),d=!T.v.featureToggles.topnav&&$?{href:c.New,title:"Add new data source"}:void 0,N=(0,a.useCallback)(D=>O((0,S.Nu)(D.value===m)),[O]),C=(0,E.useSelector)(({dataSources:D})=>(0,S.IA)(D)),h={onChange:N,value:C?m:z,getSortOptions:()=>Promise.resolve(q)};return a.createElement(Y.Z,{searchQuery:H,setSearchQuery:B,key:"action-bar",sortPicker:h,linkButton:d})}function j(){const{isLoading:O}=(0,S.zJ)(),B=(0,E.useSelector)(d=>(0,S.mt)(d.dataSources)),H=(0,E.useSelector)(({dataSources:d})=>(0,S.r7)(d)),$=A.Vt.hasPermission(E.AccessControlAction.DataSourcesCreate),c=A.Vt.hasPermission(E.AccessControlAction.DataSourcesWrite),p=A.Vt.hasPermission(E.AccessControlAction.DataSourcesExplore);return a.createElement(X,{dataSources:B,dataSourcesCount:H,isLoading:O,hasCreateRights:$,hasWriteRights:c,hasExploreRights:p})}function X({dataSources:O,dataSourcesCount:B,isLoading:H,hasCreateRights:$,hasWriteRights:c,hasExploreRights:p}){const d=(0,u.wW)(w),N=(0,S.d7)(),C=(0,M.TH)();return(0,a.useEffect)(()=>{(0,Z.dF)({grafana_version:T.v.buildInfo.version,path:C.pathname})},[C]),H?a.createElement(x.Z,null):B===0?a.createElement(R.Z,{buttonDisabled:!$,title:"No data sources defined",buttonIcon:"database",buttonLink:N.New,buttonTitle:"Add data source",proTip:"You can also define data sources through configuration files.",proTipLink:"http://docs.grafana.org/administration/provisioning/#datasources?utm_source=grafana_ds_list",proTipLinkTitle:"Learn more",proTipTarget:"_blank"}):a.createElement(a.Fragment,null,a.createElement(U,null),a.createElement("ul",{className:d.list},O.map(h=>{const D=T.v.appSubUrl+N.Edit.replace(/:uid/gi,h.uid);return a.createElement("li",{key:h.uid},a.createElement(o.Z,{href:c?D:void 0},a.createElement(o.Z.Heading,null,h.name),a.createElement(o.Z.Figure,null,a.createElement("img",{src:h.typeLogoUrl,alt:"",height:"40px",width:"40px",className:d.logo})),a.createElement(o.Z.Meta,null,[h.typeName,h.url,h.isDefault&&a.createElement(g.V,{key:"default-tag",name:"default",colorIndex:1})]),a.createElement(o.Z.Tags,null,a.createElement(s.Qj,{icon:"apps",fill:"outline",variant:"secondary",href:`dashboard/new-with-ds/${h.uid}`,onClick:()=>{(0,Z.hJ)({grafana_version:T.v.buildInfo.version,datasource_uid:h.uid,plugin_name:h.typeName,path:C.pathname})}},"Build a dashboard"),p&&a.createElement(s.Qj,{icon:"compass",fill:"outline",variant:"secondary",className:d.button,href:(0,G.iU)(h),onClick:()=>{(0,Z.U4)({grafana_version:T.v.buildInfo.version,datasource_uid:h.uid,plugin_name:h.typeName,path:C.pathname})}},"Explore"))))})))}const w=O=>({list:(0,e.css)({listStyle:"none",display:"grid"}),logo:(0,e.css)({objectFit:"contain"}),button:(0,e.css)({marginLeft:O.spacing(2)})})},42153:(J,L,t)=>{t.d(L,{H:()=>ie});var e=t(65237),a=t(32185),M=t(51031),T=t(42702),u=t(3315),o=t(66116),g=t(60234),s=t(92917),R=t(1163),x=t(96682),A=t(57313),E=t(93048),S=t(66434);function Z({dataSourceName:r,isDefault:l,onDefaultChange:i,onNameChange:P,alertingSupported:I,disabled:F}){return e.createElement(e.Fragment,null,e.createElement(G,{enabled:I}),e.createElement("div",{className:"gf-form-group","aria-label":"Datasource settings page basic settings"},e.createElement("div",{className:"gf-form-inline"},e.createElement("div",{className:"gf-form max-width-30"},e.createElement(R._,{label:"Name",tooltip:`The name is used when you select the data source in panels. The default data source is
              'preselected in new panels.`,grow:!0,disabled:F},e.createElement(x.I,{id:"basic-settings-name",type:"text",value:r,placeholder:"Name",onChange:V=>P(V.currentTarget.value),required:!0,"aria-label":s.wl.pages.DataSource.name}))),e.createElement(R._,{label:"Default",labelWidth:8,disabled:F},e.createElement(A.x,{id:"basic-settings-default",value:l,onChange:V=>{i(V.currentTarget.checked)}})))))}function G({enabled:r}){const l=(0,E.wW)(Y);return e.createElement("div",{className:l.badge},r?e.createElement(S.C,{color:"green",icon:"check-circle",text:"Alerting supported"}):e.createElement(S.C,{color:"orange",icon:"exclamation-triangle",text:"Alerting not supported"}))}const Y=r=>({badge:g.css`
    margin-bottom: ${r.spacing(2)};
  `});var m=t(48389),z=t(63969);function q({canSave:r,canDelete:l,onDelete:i,onSubmit:P,onTest:I,exploreUrl:F}){const V=z.Vt.hasPermission(u.AccessControlAction.DataSourcesExplore);return e.createElement("div",{className:"gf-form-button-row"},e.createElement(m.zx,{variant:"secondary",fill:"solid",type:"button",onClick:()=>history.back()},"Back"),e.createElement(m.Qj,{variant:"secondary",fill:"solid",href:F,disabled:!V},"Explore"),e.createElement(m.zx,{type:"button",variant:"destructive",disabled:!l,onClick:i,"aria-label":s.wl.pages.DataSource.delete},"Delete"),r&&e.createElement(m.zx,{type:"submit",variant:"primary",disabled:!r,onClick:_=>P(_),"aria-label":s.wl.pages.DataSource.saveAndTest},"Save & test"),!r&&e.createElement(m.zx,{variant:"primary",onClick:I},"Test"))}var U=t(9699),j=t(88347),X=t(69749),w=t(18819);const O="datasources.settings.cloudInfoBox.isDismissed";function B({dataSource:r}){let l="",i="";if(r.readOnly||(r.version??0)>2||w.vc.buildInfo.edition!==U.e.OpenSource)return null;switch(r.type){case"prometheus":l="Prometheus",i="Loki";break;case"loki":l="Loki",i="Prometheus";break;default:return null}return e.createElement(X.G,{storageKey:O,defaultValue:!1},(P,I)=>P?null:e.createElement(j.b,{title:`Configure your ${l} data source below`,severity:"info",bottomSpacing:4,onRemove:()=>{I(!0)}},"Or skip the effort and get ",l," (and ",i,") as fully-managed, scalable, and hosted data sources from Grafana Labs with the"," ",e.createElement("a",{className:"external-link",href:`https://grafana.com/signup/cloud/connect-account?src=grafana-oss&cnt=${r.type}-settings`,target:"_blank",rel:"noreferrer",title:"The free plan includes 10k active metrics and 50gb storage."},"free-forever Grafana Cloud plan"),"."))}const H="This data source was added by config and cannot be modified using the UI. Please contact your server admin to update this data source.";function $(){return e.createElement(j.b,{"aria-label":s.wl.pages.DataSource.readOnly,severity:"info",title:"Provisioned data source"},H)}function c({dataSourceRights:r,onDelete:l}){const{readOnly:i,hasDeleteRights:P}=r,I=!i&&P,F=()=>history.back();return e.createElement(e.Fragment,null,i&&e.createElement($,null),e.createElement("div",{className:"gf-form-button-row"},I&&e.createElement(m.zx,{type:"submit",variant:"destructive",onClick:l},"Delete"),e.createElement(m.zx,{variant:"secondary",fill:"outline",type:"button",onClick:F},"Back")))}const p="You are not allowed to modify this data source. Please contact your server admin to update this data source.";function d(){return e.createElement(j.b,{severity:"info",title:"Missing rights"},p)}function N({plugin:r,pageId:l}){if(!r||!r.configPages)return null;const i=r.configPages.find(({id:P})=>P===l);return i?e.createElement(i.body,{plugin:r,query:{}}):e.createElement("div",null,"Page not found: ",i)}var C=t(89949),h=t(41227);class D extends e.PureComponent{constructor(l){super(l),this.element=null,this.onModelChanged=i=>{this.props.onModelChange(i)},this.scopeProps={ctrl:{datasourceMeta:l.dataSourceMeta,current:(0,C.cloneDeep)(l.dataSource)},onModelChanged:this.onModelChanged},this.onModelChanged=this.onModelChanged.bind(this)}componentDidMount(){const{plugin:l}=this.props;if(this.element&&!l.components.ConfigEditor){const i=(0,h.w)(),P='<plugin-component type="datasource-config-ctrl" />';this.component=i.load(this.element,this.scopeProps,P)}}componentDidUpdate(l){const{plugin:i}=this.props;!i.components.ConfigEditor&&this.props.dataSource!==l.dataSource&&(this.scopeProps.ctrl.current=(0,C.cloneDeep)(this.props.dataSource),this.component?.digest())}componentWillUnmount(){this.component&&this.component.destroy()}render(){const{plugin:l,dataSource:i}=this.props;return l?e.createElement("div",{ref:P=>this.element=P},l.components.ConfigEditor&&e.createElement(l.components.ConfigEditor,{options:i,onOptionsChange:this.onModelChanged})):null}}var W=t(70825);function le({state:r}){return e.createElement("div",{className:"gf-form"},e.createElement("div",{className:"gf-form-label width-10"},"Plugin state"),e.createElement("div",{className:"gf-form-label gf-form-label--transparent"},e.createElement(W.u,{state:r})))}function ce({testingStatus:r}){const l=r?.status==="error",i=r?.message,P=r?.details?.message,I=r?.details?.verboseMessage;return i?e.createElement("div",{className:"gf-form-group p-t-2"},e.createElement(j.b,{severity:l?"error":"success",title:i,"aria-label":s.wl.pages.DataSource.alert},r?.details&&e.createElement(e.Fragment,null,P,I?e.createElement("details",{style:{whiteSpace:"pre-wrap"}},I):null))):null}function ie({uid:r,pageId:l}){(0,o.E)(r);const i=(0,u.useDispatch)(),P=(0,o.wl)(r),I=(0,o.Qs)(P.type),F=(0,o._l)(),V=(0,o.YY)(r),_=(0,o.Rz)(r),ae=(0,o.q6)(),ne=(0,o.hw)(r),n=(0,o.qj)(),f=b=>i((0,o.yr)(b)),v=b=>i((0,o.BX)(b)),y=b=>i((0,o.rl)(b));return e.createElement(ue,{pageId:l,dataSource:P,dataSourceMeta:I,dataSourceSettings:F,dataSourceRights:V,exploreUrl:_,onDelete:ae,onDefaultChange:f,onNameChange:v,onOptionsChange:y,onTest:ne,onUpdate:n})}function ue({pageId:r,dataSource:l,dataSourceMeta:i,dataSourceSettings:P,dataSourceRights:I,exploreUrl:F,onDelete:V,onDefaultChange:_,onNameChange:ae,onOptionsChange:ne,onTest:n,onUpdate:f}){const{plugin:v,loadError:y,testingStatus:b,loading:k}=P,{readOnly:ee,hasWriteRights:oe,hasDeleteRights:de}=I,se=l.id>0,Q=(0,M.F)()?.getInstanceSettings(l.uid),te=Boolean(Q?.meta?.alerting??!1),me=Q?.type==="alertmanager",ge=te||me,re=async pe=>{pe.preventDefault(),await f({...l}),n()};return y?e.createElement(c,{dataSourceRights:I,onDelete:V}):k?e.createElement(T.Z,null):!se||!Q?null:r?e.createElement(a.n,{instanceSettings:Q},e.createElement(N,{pageId:r,plugin:v})):e.createElement("form",{onSubmit:re},!oe&&e.createElement(d,null),ee&&e.createElement($,null),i.state&&e.createElement(le,{state:i.state}),e.createElement(B,{dataSource:l}),e.createElement(Z,{dataSourceName:l.name,isDefault:l.isDefault,onDefaultChange:_,onNameChange:ae,alertingSupported:ge,disabled:ee||!oe}),v&&e.createElement(a.n,{instanceSettings:Q},e.createElement(D,{plugin:v,dataSource:l,dataSourceMeta:i,onModelChange:ne})),e.createElement(ce,{testingStatus:b}),e.createElement(q,{onSubmit:re,onDelete:V,onTest:n,exploreUrl:F,canSave:!ee&&oe,canDelete:!ee&&de}))}},69123:(J,L,t)=>{t.d(L,{x:()=>H});var e=t(65237),a=t(27496),M=t(48389),T=t(42702),u=t(60234),o=t(80610),g=t(92917),s=t(93048),R=t(2623),x=t(14581),A=t(6741),E=t(16291),S=t(96263);function Z(){const c=(0,S.UQ)(),{isLoading:p}=(0,S.ZV)(),d=(0,s.wW)(Y);return p||c.length===0?null:e.createElement(R.v,{"aria-label":g.wl.pages.PluginsList.signatureErrorNotice,severity:"warning",urlTitle:"Read more about plugin signing",url:"https://grafana.com/docs/grafana/latest/plugins/plugin-signatures/"},e.createElement("div",null,e.createElement("p",null,"Unsigned plugins were found during plugin initialization. Grafana Labs cannot guarantee the integrity of these plugins. We recommend only using signed plugins."),"The following plugins are disabled and not shown in the list below:",e.createElement(x.a,{items:c,className:d.list,renderItem:N=>e.createElement("div",{className:d.wrapper},e.createElement(A.Lh,{spacing:"sm",justify:"flex-start",align:"center"},e.createElement("strong",null,N.pluginId),e.createElement(E.o,{status:G(N.errorCode),className:d.badge})))})))}function G(c){switch(c){case o.w2.invalidSignature:return o.Xy.invalid;case o.w2.missingSignature:return o.Xy.missing;case o.w2.modifiedSignature:return o.Xy.modified;default:return o.Xy.missing}}function Y(c){return{list:(0,u.css)({listStyleType:"circle"}),wrapper:(0,u.css)({marginTop:c.spacing(1)}),badge:(0,u.css)({marginTop:0})}}var m=t(3315),z=t(49784),q=t(50160),U=t(60631);function j({onClick:c,dataSourcePlugin:p}){const d=p.module==="phantom",N=!d&&!p.unlicensed,C=p.info?.links?.length>0?p.info.links[0]:null,h=C?.target??"_blank",D=(0,s.wW)(X);return e.createElement(U.Z,{className:(0,u.cx)(D.card,"card-parent"),onClick:N?c:()=>{}},e.createElement(U.Z.Heading,{className:D.heading,"aria-label":g.wl.pages.AddDataSource.dataSourcePluginsV2(p.name)},p.name),e.createElement(U.Z.Figure,{align:"center",className:D.figure},e.createElement("img",{className:D.logo,src:p.info.logos.small,alt:""})),e.createElement(U.Z.Description,{className:D.description},p.info.description),!d&&e.createElement(U.Z.Meta,{className:D.meta},e.createElement(E.o,{status:p.signature})),e.createElement(U.Z.Actions,{className:D.actions},C&&e.createElement(M.Qj,{"aria-label":`${p.name}, learn more.`,href:`${C.url}?utm_source=grafana_add_ds`,onClick:W=>W.stopPropagation(),rel:"noopener",target:h,variant:"secondary"},C.name)))}function X(c){return{heading:(0,u.css)({fontSize:c.v1.typography.heading.h5,fontWeight:"inherit"}),figure:(0,u.css)({width:"inherit",marginRight:"0px","> img":{width:c.spacing(7)}}),meta:(0,u.css)({marginTop:"6px",position:"relative"}),description:(0,u.css)({margin:"0px",fontSize:c.typography.size.sm}),actions:(0,u.css)({position:"relative",alignSelf:"center",marginTop:"0px",opacity:0,".card-parent:hover &, .card-parent:focus-within &":{opacity:1}}),card:(0,u.css)({gridTemplateAreas:`
        "Figure   Heading   Actions"
        "Figure Description Actions"
        "Figure    Meta     Actions"
        "Figure     -       Actions"`}),logo:(0,u.css)({marginRight:c.v1.spacing.lg,marginLeft:c.v1.spacing.sm,width:c.spacing(7),maxHeight:c.spacing(7)})}}function w({dataSourcePlugins:c,onClickDataSourceType:p}){return!c||!c.length?null:e.createElement(x.a,{items:c,getItemKey:d=>d.id.toString(),renderItem:d=>e.createElement(j,{dataSourcePlugin:d,onClick:()=>p(d)}),className:u.css`
        > li {
          margin-bottom: 2px;
        }
      `})}function O({categories:c,onClickDataSourceType:p}){const d=z.v.featureToggles.dataConnectionsConsole?`${q.Z.ConnectData}?cat=data-source`:"/plugins?filterBy=all&filterByType=datasource&utm_source=grafana_add_ds";return e.createElement(e.Fragment,null,c.map(({id:N,title:C,plugins:h})=>e.createElement("div",{className:"add-data-source-category",key:N},e.createElement("div",{className:"add-data-source-category__header",id:N},C),e.createElement(w,{dataSourcePlugins:h,onClickDataSourceType:p}))),e.createElement("div",{className:"add-data-source-more"},e.createElement(M.Qj,{variant:"secondary",href:d,target:"_self",rel:"noopener"},"Find more data source plugins")))}var B=t(66116);function H(){(0,B.OU)();const c=(0,m.useDispatch)(),p=(0,m.useSelector)(W=>(0,B.I5)(W.dataSources)),d=(0,m.useSelector)(W=>W.dataSources.dataSourceTypeSearchQuery),N=(0,m.useSelector)(W=>W.dataSources.isLoadingDataSourcePlugins),C=(0,m.useSelector)(W=>W.dataSources.categories),h=(0,B.nH)(),D=W=>c((0,B.Ht)(W));return e.createElement($,{dataSources:p,dataSourceCategories:C,searchQuery:d,isLoading:N,onAddDataSource:h,onSetSearchQuery:D})}function $({dataSources:c,dataSourceCategories:p,searchQuery:d,isLoading:N,onAddDataSource:C,onSetSearchQuery:h}){const D=(0,B.d7)();return N?e.createElement(T.Z,null):e.createElement(e.Fragment,null,e.createElement("div",{className:"page-action-bar"},e.createElement(a.H,{value:d,onChange:h,placeholder:"Filter by name or type"}),e.createElement("div",{className:"page-action-bar__spacer"}),e.createElement(M.Qj,{href:D.List,fill:"outline",variant:"secondary",icon:"arrow-left"},"Cancel")),!d&&e.createElement(Z,null),e.createElement("div",null,d&&e.createElement(w,{dataSourcePlugins:c,onClickDataSourceType:C}),!d&&e.createElement(O,{categories:p,onClickDataSourceType:C})))}},70825:(J,L,t)=>{t.d(L,{u:()=>T});var e=t(65237),a=t(80610),M=t(66434);const T=o=>{const g=u(o.state);return g?e.createElement(M.C,{color:g.color,title:g.tooltip,text:g.text,icon:g.icon}):null};function u(o){switch(o){case a.BV.deprecated:return{text:"Deprecated",color:"red",tooltip:"This feature is deprecated and will be removed in a future release"};case a.BV.alpha:return{text:"Alpha",color:"blue",tooltip:"This feature is experimental and future updates might not be backward compatible"};case a.BV.beta:return{text:"Beta",color:"blue",tooltip:"This feature is close to complete but not fully tested"};default:return null}}}}]);

//# sourceMappingURL=Connections.3f9c490643cf5a9b96d9.js.map