"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[5981],{55887:(J,L,t)=>{t.d(L,{e:()=>e});var e=(a=>(a.OpenSource="Open Source",a.Pro="Pro",a.Enterprise="Enterprise",a))(e||{})},78014:(J,L,t)=>{t.d(L,{Z:()=>u});var e=t(68404),a=t(14747),M=t(31403),T=t(95509);class u extends e.PureComponent{render(){const{searchQuery:E,linkButton:s,setSearchQuery:R,target:x,placeholder:A="Search by name or type",sortPicker:v}=this.props,D={href:s?.href,disabled:s?.disabled};return x&&(D.target=x),e.createElement("div",{className:"page-action-bar"},e.createElement("div",{className:"gf-form gf-form--grow"},e.createElement(a.H,{value:E,onChange:R,placeholder:A})),v&&e.createElement(T.P,{onChange:v.onChange,value:v.value,getSortOptions:v.getSortOptions}),s&&e.createElement(M.Qj,{...D},s.title))}}},66040:(J,L,t)=>{t.r(L),t.d(L,{default:()=>te});var e=t(68404),a=t(70356),M=t(31953),T=t(25e3),u=t(81168),o=t(86475),E=t(79396),s=t(9892),R=t(24699),x=t(72648),A=t(61744),v=t(77582),D=t(74509),Z=t(72948);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:g})=>{const h=(0,x.wW)(G);return e.createElement("ul",{className:h.sourcesList},n.map(p=>e.createElement(Z.Z,{key:p.id,className:h.card,href:p.url,onClick:K=>{g&&g(K,p)}},e.createElement(Z.Z.Heading,null,e.createElement("div",{className:h.cardContent},p.logo&&e.createElement("div",{className:h.logoWrapper},e.createElement("img",{src:p.logo,alt:`logo of ${p.name}`})),e.createElement("h4",{className:h.label},p.name))))))};var m=t(39904);const j=n=>({categoryHeader:s.css`
    align-items: center;
    display: flex;
    margin-bottom: 24px;
  `,categoryLabel:s.css`
    margin-bottom: 0px;
    margin-left: 8px;
  `}),_=({iconName:n,label:g})=>{const h=(0,x.wW)(j);return e.createElement("div",{className:h.categoryHeader},e.createElement(m.J,{name:n,size:"xl"}),e.createElement("h3",{className:h.categoryLabel},g))};var U=t(35029),Q=t(31403);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 k({item:n,isOpen:g,onDismiss:h}){const p=(0,x.wW)(X);return e.createElement(U.u,{className:p.modal,contentClassName:p.modalContent,title:e.createElement(O,{item:n}),isOpen:g,onDismiss:h},e.createElement("div",null,e.createElement("div",null,n.description&&e.createElement("div",{className:p.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:p.bottomSection},e.createElement("div",{className:p.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:p.actionsSection},e.createElement(Q.zx,{onClick:h},"Okay"))))}function O({item:n}){const g=(0,x.wW)(X);return e.createElement("div",null,e.createElement("div",{className:g.header},n.logo&&e.createElement("img",{className:g.headerLogo,src:n.logo,alt:`logo of ${n.name}`}),e.createElement("h4",{className:g.headerTitle},n.name)))}const b=()=>({noResults:s.css`
    text-align: center;
    padding: 50px 0;
    font-style: italic;
  `}),z=()=>{const n=(0,x.wW)(b);return e.createElement("p",{className:n.noResults},"No results matching your query were found.")};var $=t(46967);const l=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)};
  `}),f=({onChange:n})=>{const g=(0,x.wW)(l);return e.createElement("div",{className:g.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,g]=(0,e.useState)(""),[h,p]=(0,e.useState)(!1),[K,W]=(0,e.useState)(null),q=(0,x.wW)(d),ce=v.Vt.hasPermission(u.AccessControlAction.DataSourcesCreate),ae=H=>{g(H.currentTarget.value.toLowerCase())},{isLoading:w,error:ne,plugins:oe}=(0,D.GE)({query:n,filterBy:"",filterByType:R.zV.datasource}),ge=(0,e.useMemo)(()=>oe.map(H=>({id:H.id,name:H.name,description:H.description,logo:H.info.logos.small,url:o.Z.DataSourcesDetails.replace(":id",H.id)})),[oe]),le=(H,ve)=>{ce||(H.preventDefault(),H.stopPropagation(),pe(ve))},pe=H=>{p(!0),W(H)},Ee=()=>{p(!1),W(null)},fe=(0,e.useMemo)(()=>!w&&!ne&&oe.length<1,[w,ne,oe]);return e.createElement(e.Fragment,null,K&&e.createElement(k,{item:K,isOpen:h,onDismiss:Ee}),e.createElement(f,{onChange:ae}),e.createElement("div",{className:q.spacer}),e.createElement(_,{iconName:"database",label:"Data sources"}),w?e.createElement(A.u,{text:"Loading..."}):ne?e.createElement("p",null,"Error: ",ne.message):e.createElement(Y,{items:ge,onClickItem:le}),fe&&e.createElement(z,null))}function C(){return e.createElement(E.T,{navId:"connections-connect-data"},e.createElement(E.T.Contents,null,e.createElement(N,null)))}var y=t(45253),S=t(19985),B=t(59426);function ie(){const n="standalone-plugin-page-/connections/connect-data",{id:g}=(0,a.UO)(),h=(0,u.useSelector)(W=>W.navIndex),K=Boolean(h[n])?n:"connections-connect-data";return e.createElement(B.Q,{pluginId:g,navId:K,notFoundComponent:e.createElement(ue,null),notFoundNavModel:{text:"Unknown datasource",subTitle:"No datasource with this ID could be found.",active:!0}})}function ue(){const{id:n}=(0,a.UO)();return e.createElement(y.b,{severity:u.AppNotificationSeverity.Warning,title:""},"Maybe you mistyped the URL or the plugin with the id ",e.createElement(S.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 de=t(35645),me=t(19703),r=t(81955);function c(){const n=(0,u.useSelector)(({dataSources:h})=>(0,T.r7)(h)),g=de.v.featureToggles.topnav&&n>0?e.createElement(me.G,null):void 0;return e.createElement(E.T,{navId:"connections-your-connections-datasources",actions:g},e.createElement(E.T.Contents,null,e.createElement(r.c,null)))}var i=t(81960),P=t(24231);function I(n){const{uid:g}=(0,a.UO)(),h=(0,a.TH)(),p=(0,P.wl)(g),K=(0,D.bJ)(p.type),W=new URLSearchParams(h.search),q=(0,P.MF)(g,n||W.get("page"));return{navId:"connections-your-connections-datasources",pageNav:{...q.main,text:p.name,subTitle:`Type: ${K?.name}`,active:!0,children:(q.main.children||[]).map(ae=>({...ae,url:ae.url?.replace("datasources/edit/","/connections/your-connections/datasources/edit/")}))}}}function F(){const{uid:n}=(0,a.UO)(),{navId:g,pageNav:h}=I("dashboards");return e.createElement(E.T,{navId:g,pageNav:h},e.createElement(E.T.Contents,null,e.createElement(i.Z,{uid:n})))}var V=t(77632);function ee(){const{uid:n}=(0,a.UO)(),g=(0,a.TH)(),p=new URLSearchParams(g.search).get("page"),{navId:K,pageNav:W}=I();return e.createElement(E.T,{navId:K,pageNav:W},e.createElement(E.T.Contents,null,e.createElement(V.H,{uid:n,pageId:p})))}var se=t(86218);function re(){return e.createElement(E.T,{navId:"connections-your-connections-datasources",pageNav:{text:"Add data source",subTitle:"Choose a data source type",active:!0}},e.createElement(E.T.Contents,null,e.createElement(se.x,null)))}function te(){const n=(0,u.useSelector)(p=>p.navIndex),g=Boolean(n["standalone-plugin-page-/connections/connect-data"]),h=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:h}),e.createElement(a.AW,{exact:!0,sensitive:!0,path:o.Z.DataSources,component:c}),e.createElement(a.AW,{exact:!0,sensitive:!0,path:o.Z.DataSourcesDetails,component:ie}),e.createElement(a.AW,{exact:!0,sensitive:!0,path:o.Z.DataSourcesNew,component:re}),e.createElement(a.AW,{exact:!0,sensitive:!0,path:o.Z.DataSourcesEdit,component:ee}),e.createElement(a.AW,{exact:!0,sensitive:!0,path:o.Z.DataSourcesDashboards,component:F}),!g&&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"})})))}},19703:(J,L,t)=>{t.d(L,{G:()=>E});var e=t(68404),a=t(35645),M=t(31403),T=t(77582),u=t(81168),o=t(25e3);function E(){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}},81960:(J,L,t)=>{t.d(L,{Z:()=>s});var e=t(68404),a=t(2555),M=t(86977),T=t(85805),u=t(81168),o=t(44034),E=t(25e3);function s({uid:x}){(0,E.wi)(x);const A=(0,u.useDispatch)(),v=(0,u.useSelector)(m=>m.dataSources.dataSource),D=(0,u.useSelector)(m=>m.plugins.dashboards),Z=(0,u.useSelector)(m=>m.plugins.isLoadingPluginDashboards);(0,e.useEffect)(()=>{v.id>0&&A((0,T.m3)())},[A,v]);const G=(m,j)=>{A((0,M.$j)({pluginId:m.pluginId,path:m.path,overwrite:j,inputs:[{name:"*",type:"datasource",pluginId:v.type,value:v.name}]},m.title))},Y=({uid:m})=>{A((0,M.fG)(m))};return e.createElement(R,{dashboards:D,isLoading:Z,onImportDashboard:G,onRemoveDashboard:Y})}const R=({isLoading:x,dashboards:A,onImportDashboard:v,onRemoveDashboard:D})=>x?e.createElement(a.Z,null):e.createElement(o.Z,{dashboards:A,onImport:v,onRemove:D})},81955:(J,L,t)=>{t.d(L,{c:()=>Q});var e=t(9892),a=t(68404),M=t(70356),T=t(35645),u=t(72648),o=t(72948),E=t(34719),s=t(31403),R=t(69142),x=t(2555),A=t(77582),v=t(81168),D=t(25e3),Z=t(63065),G=t(85597),Y=t(78014);const m="alpha-asc",j="alpha-desc",_=[{label:"Sort by A\u2013Z",value:m},{label:"Sort by Z\u2013A",value:j}];function U(){const O=(0,v.useDispatch)(),b=(0,a.useCallback)(S=>O((0,D.zT)(S)),[O]),z=(0,v.useSelector)(({dataSources:S})=>(0,D.IO)(S)),$=A.Vt.hasPermission(v.AccessControlAction.DataSourcesCreate),l=(0,D.d7)(),d=!T.v.featureToggles.topnav&&$?{href:l.New,title:"Add new data source"}:void 0,N=(0,a.useCallback)(S=>O((0,D.Nu)(S.value===m)),[O]),C=(0,v.useSelector)(({dataSources:S})=>(0,D.IA)(S)),y={onChange:N,value:C?m:j,getSortOptions:()=>Promise.resolve(_)};return a.createElement(Y.Z,{searchQuery:z,setSearchQuery:b,key:"action-bar",sortPicker:y,linkButton:d})}function Q(){const{isLoading:O}=(0,D.zJ)(),b=(0,v.useSelector)(d=>(0,D.mt)(d.dataSources)),z=(0,v.useSelector)(({dataSources:d})=>(0,D.r7)(d)),$=A.Vt.hasPermission(v.AccessControlAction.DataSourcesCreate),l=A.Vt.hasPermission(v.AccessControlAction.DataSourcesWrite),f=A.Vt.hasPermission(v.AccessControlAction.DataSourcesExplore);return a.createElement(X,{dataSources:b,dataSourcesCount:z,isLoading:O,hasCreateRights:$,hasWriteRights:l,hasExploreRights:f})}function X({dataSources:O,dataSourcesCount:b,isLoading:z,hasCreateRights:$,hasWriteRights:l,hasExploreRights:f}){const d=(0,u.wW)(k),N=(0,D.d7)(),C=(0,M.TH)();return(0,a.useEffect)(()=>{(0,Z.dF)({grafana_version:T.v.buildInfo.version,path:C.pathname})},[C]),z?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(y=>{const S=T.v.appSubUrl+N.Edit.replace(/:uid/gi,y.uid);return a.createElement("li",{key:y.uid},a.createElement(o.Z,{href:l?S:void 0},a.createElement(o.Z.Heading,null,y.name),a.createElement(o.Z.Figure,null,a.createElement("img",{src:y.typeLogoUrl,alt:"",height:"40px",width:"40px",className:d.logo})),a.createElement(o.Z.Meta,null,[y.typeName,y.url,y.isDefault&&a.createElement(E.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/${y.uid}`,onClick:()=>{(0,Z.hJ)({grafana_version:T.v.buildInfo.version,datasource_uid:y.uid,plugin_name:y.typeName,path:C.pathname})}},"Build a dashboard"),f&&a.createElement(s.Qj,{icon:"compass",fill:"outline",variant:"secondary",className:d.button,href:(0,G.iU)(y),onClick:()=>{(0,Z.U4)({grafana_version:T.v.buildInfo.version,datasource_uid:y.uid,plugin_name:y.typeName,path:C.pathname})}},"Explore"))))})))}const k=O=>({list:(0,e.css)({listStyle:"none",display:"grid"}),logo:(0,e.css)({objectFit:"contain"}),button:(0,e.css)({marginLeft:O.spacing(2)})})},77632:(J,L,t)=>{t.d(L,{H:()=>de});var e=t(68404),a=t(94929),M=t(86647),T=t(2555),u=t(81168),o=t(25e3),E=t(9892),s=t(68183),R=t(81764),x=t(46967),A=t(8944),v=t(72648),D=t(19985);function Z({dataSourceName:r,isDefault:c,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:c,onChange:V=>{i(V.currentTarget.checked)}})))))}function G({enabled:r}){const c=(0,v.wW)(Y);return e.createElement("div",{className:c.badge},r?e.createElement(D.C,{color:"green",icon:"check-circle",text:"Alerting supported"}):e.createElement(D.C,{color:"orange",icon:"exclamation-triangle",text:"Alerting not supported"}))}const Y=r=>({badge:E.css`
    margin-bottom: ${r.spacing(2)};
  `});var m=t(31403),j=t(77582);function _({canSave:r,canDelete:c,onDelete:i,onSubmit:P,onTest:I,exploreUrl:F}){const V=j.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:!c,onClick:i,"aria-label":s.wl.pages.DataSource.delete},"Delete"),r&&e.createElement(m.zx,{type:"submit",variant:"primary",disabled:!r,onClick:ee=>P(ee),"aria-label":s.wl.pages.DataSource.saveAndTest},"Save & test"),!r&&e.createElement(m.zx,{variant:"primary",onClick:I},"Test"))}var U=t(55887),Q=t(45253),X=t(59796),k=t(47694);const O="datasources.settings.cloudInfoBox.isDismissed";function b({dataSource:r}){let c="",i="";if(r.readOnly||(r.version??0)>2||k.vc.buildInfo.edition!==U.e.OpenSource)return null;switch(r.type){case"prometheus":c="Prometheus",i="Loki";break;case"loki":c="Loki",i="Prometheus";break;default:return null}return e.createElement(X.G,{storageKey:O,defaultValue:!1},(P,I)=>P?null:e.createElement(Q.b,{title:`Configure your ${c} data source below`,severity:"info",bottomSpacing:4,onRemove:()=>{I(!0)}},"Or skip the effort and get ",c," (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 z="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(Q.b,{"aria-label":s.wl.pages.DataSource.readOnly,severity:"info",title:"Provisioned data source"},z)}function l({dataSourceRights:r,onDelete:c}){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:c},"Delete"),e.createElement(m.zx,{variant:"secondary",fill:"outline",type:"button",onClick:F},"Back")))}const f="You are not allowed to modify this data source. Please contact your server admin to update this data source.";function d(){return e.createElement(Q.b,{severity:"info",title:"Missing rights"},f)}function N({plugin:r,pageId:c}){if(!r||!r.configPages)return null;const i=r.configPages.find(({id:P})=>P===c);return i?e.createElement(i.body,{plugin:r,query:{}}):e.createElement("div",null,"Page not found: ",i)}var C=t(82897),y=t(11484);class S extends e.PureComponent{constructor(c){super(c),this.element=null,this.onModelChanged=i=>{this.props.onModelChange(i)},this.scopeProps={ctrl:{datasourceMeta:c.dataSourceMeta,current:(0,C.cloneDeep)(c.dataSource)},onModelChanged:this.onModelChanged},this.onModelChanged=this.onModelChanged.bind(this)}componentDidMount(){const{plugin:c}=this.props;if(this.element&&!c.components.ConfigEditor){const i=(0,y.w)(),P='<plugin-component type="datasource-config-ctrl" />';this.component=i.load(this.element,this.scopeProps,P)}}componentDidUpdate(c){const{plugin:i}=this.props;!i.components.ConfigEditor&&this.props.dataSource!==c.dataSource&&(this.scopeProps.ctrl.current=(0,C.cloneDeep)(this.props.dataSource),this.component?.digest())}componentWillUnmount(){this.component&&this.component.destroy()}render(){const{plugin:c,dataSource:i}=this.props;return c?e.createElement("div",{ref:P=>this.element=P},c.components.ConfigEditor&&e.createElement(c.components.ConfigEditor,{options:i,onOptionsChange:this.onModelChanged})):null}}var B=t(81731);function ie({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(B.u,{state:r})))}function ue({testingStatus:r}){const c=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(Q.b,{severity:c?"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 de({uid:r,pageId:c}){(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),ee=(0,o.Rz)(r),se=(0,o.q6)(),re=(0,o.hw)(r),te=(0,o.qj)(),n=p=>i((0,o.yr)(p)),g=p=>i((0,o.BX)(p)),h=p=>i((0,o.rl)(p));return e.createElement(me,{pageId:c,dataSource:P,dataSourceMeta:I,dataSourceSettings:F,dataSourceRights:V,exploreUrl:ee,onDelete:se,onDefaultChange:n,onNameChange:g,onOptionsChange:h,onTest:re,onUpdate:te})}function me({pageId:r,dataSource:c,dataSourceMeta:i,dataSourceSettings:P,dataSourceRights:I,exploreUrl:F,onDelete:V,onDefaultChange:ee,onNameChange:se,onOptionsChange:re,onTest:te,onUpdate:n}){const{plugin:g,loadError:h,testingStatus:p,loading:K}=P,{readOnly:W,hasWriteRights:q,hasDeleteRights:ce}=I,ae=c.id>0,w=(0,M.F)()?.getInstanceSettings(c.uid),ne=Boolean(w?.meta?.alerting??!1),oe=w?.type==="alertmanager",ge=ne||oe,le=async pe=>{pe.preventDefault(),await n({...c}),te()};return h?e.createElement(l,{dataSourceRights:I,onDelete:V}):K?e.createElement(T.Z,null):!ae||!w?null:r?e.createElement(a.n,{instanceSettings:w},e.createElement(N,{pageId:r,plugin:g})):e.createElement("form",{onSubmit:le},!q&&e.createElement(d,null),W&&e.createElement($,null),i.state&&e.createElement(ie,{state:i.state}),e.createElement(b,{dataSource:c}),e.createElement(Z,{dataSourceName:c.name,isDefault:c.isDefault,onDefaultChange:ee,onNameChange:se,alertingSupported:ge,disabled:W||!q}),g&&e.createElement(a.n,{instanceSettings:w},e.createElement(S,{plugin:g,dataSource:c,dataSourceMeta:i,onModelChange:re})),e.createElement(ue,{testingStatus:p}),e.createElement(_,{onSubmit:le,onDelete:V,onTest:te,exploreUrl:F,canSave:!W&&q,canDelete:!W&&ce}))}},86218:(J,L,t)=>{t.d(L,{x:()=>z});var e=t(68404),a=t(14747),M=t(31403),T=t(2555),u=t(9892),o=t(24699),E=t(68183),s=t(72648),R=t(17784),x=t(56766),A=t(52081),v=t(51613),D=t(74509);function Z(){const l=(0,D.UQ)(),{isLoading:f}=(0,D.ZV)(),d=(0,s.wW)(Y);return f||l.length===0?null:e.createElement(R.v,{"aria-label":E.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:l,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(v.o,{status:G(N.errorCode),className:d.badge})))})))}function G(l){switch(l){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(l){return{list:(0,u.css)({listStyleType:"circle"}),wrapper:(0,u.css)({marginTop:l.spacing(1)}),badge:(0,u.css)({marginTop:0})}}var m=t(81168),j=t(35645),_=t(86475),U=t(72948);function Q({onClick:l,dataSourcePlugin:f}){const d=f.module==="phantom",N=!d&&!f.unlicensed,C=f.info?.links?.length>0?f.info.links[0]:null,y=C?.target??"_blank",S=(0,s.wW)(X);return e.createElement(U.Z,{className:(0,u.cx)(S.card,"card-parent"),onClick:N?l:()=>{}},e.createElement(U.Z.Heading,{className:S.heading,"aria-label":E.wl.pages.AddDataSource.dataSourcePluginsV2(f.name)},f.name),e.createElement(U.Z.Figure,{align:"center",className:S.figure},e.createElement("img",{className:S.logo,src:f.info.logos.small,alt:""})),e.createElement(U.Z.Description,{className:S.description},f.info.description),!d&&e.createElement(U.Z.Meta,{className:S.meta},e.createElement(v.o,{status:f.signature})),e.createElement(U.Z.Actions,{className:S.actions},C&&e.createElement(M.Qj,{"aria-label":`${f.name}, learn more.`,href:`${C.url}?utm_source=grafana_add_ds`,onClick:B=>B.stopPropagation(),rel:"noopener",target:y,variant:"secondary"},C.name)))}function X(l){return{heading:(0,u.css)({fontSize:l.v1.typography.heading.h5,fontWeight:"inherit"}),figure:(0,u.css)({width:"inherit",marginRight:"0px","> img":{width:l.spacing(7)}}),meta:(0,u.css)({marginTop:"6px",position:"relative"}),description:(0,u.css)({margin:"0px",fontSize:l.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:l.v1.spacing.lg,marginLeft:l.v1.spacing.sm,width:l.spacing(7),maxHeight:l.spacing(7)})}}function k({dataSourcePlugins:l,onClickDataSourceType:f}){return!l||!l.length?null:e.createElement(x.a,{items:l,getItemKey:d=>d.id.toString(),renderItem:d=>e.createElement(Q,{dataSourcePlugin:d,onClick:()=>f(d)}),className:u.css`
        > li {
          margin-bottom: 2px;
        }
      `})}function O({categories:l,onClickDataSourceType:f}){const d=j.v.featureToggles.dataConnectionsConsole?`${_.Z.ConnectData}?cat=data-source`:"/plugins?filterBy=all&filterByType=datasource&utm_source=grafana_add_ds";return e.createElement(e.Fragment,null,l.map(({id:N,title:C,plugins:y})=>e.createElement("div",{className:"add-data-source-category",key:N},e.createElement("div",{className:"add-data-source-category__header",id:N},C),e.createElement(k,{dataSourcePlugins:y,onClickDataSourceType:f}))),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(25e3);function z(){(0,b.OU)();const l=(0,m.useDispatch)(),f=(0,m.useSelector)(B=>(0,b.I5)(B.dataSources)),d=(0,m.useSelector)(B=>B.dataSources.dataSourceTypeSearchQuery),N=(0,m.useSelector)(B=>B.dataSources.isLoadingDataSourcePlugins),C=(0,m.useSelector)(B=>B.dataSources.categories),y=(0,b.nH)(),S=B=>l((0,b.Ht)(B));return e.createElement($,{dataSources:f,dataSourceCategories:C,searchQuery:d,isLoading:N,onAddDataSource:y,onSetSearchQuery:S})}function $({dataSources:l,dataSourceCategories:f,searchQuery:d,isLoading:N,onAddDataSource:C,onSetSearchQuery:y}){const S=(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:y,placeholder:"Filter by name or type"}),e.createElement("div",{className:"page-action-bar__spacer"}),e.createElement(M.Qj,{href:S.List,fill:"outline",variant:"secondary",icon:"arrow-left"},"Cancel")),!d&&e.createElement(Z,null),e.createElement("div",null,d&&e.createElement(k,{dataSourcePlugins:l,onClickDataSourceType:C}),!d&&e.createElement(O,{categories:f,onClickDataSourceType:C})))}},81731:(J,L,t)=>{t.d(L,{u:()=>T});var e=t(68404),a=t(24699),M=t(19985);const T=o=>{const E=u(o.state);return E?e.createElement(M.C,{color:E.color,title:E.tooltip,text:E.text,icon:E.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.0e146ac311628bb44de3.js.map