"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[5981],{96757:(Q,L,s)=>{s.d(L,{Z:()=>E});var e=s(27702),g=s(48024),d=s(33716),m=s(66670),f=s(5336);class E extends e.PureComponent{render(){const{searchQuery:x,linkButton:h,setSearchQuery:M,target:N,placeholder:I="Search by name or type",sortPicker:b}=this.props,v={href:h?.href,disabled:h?.disabled};return N&&(v.target=N),e.createElement("div",{className:"page-action-bar"},e.createElement(g._,{grow:!0},e.createElement(d.H,{value:x,onChange:M,placeholder:I})),b&&e.createElement(f.P,{onChange:b.onChange,value:b.value,getSortOptions:b.getSortOptions}),h&&e.createElement(m.Qj,{...v},h.title))}}},5336:(Q,L,s)=>{s.d(L,{P:()=>x});var e=s(27702),g=s(25111),d=s(28580),m=s(73453),f=s(15758),E=s(63064);const r=()=>(0,E.getGrafanaSearcher)().getSortOptions();function x({onChange:h,value:M,placeholder:N,filter:I,getSortOptions:b,isClearable:v}){const U=(0,g.Z)(async()=>{const W=await(b??r)();return I?W.filter(F=>I.includes(F.value)):W},[b,I]);if(U.loading)return null;const G=!!(M?.includes("desc")||M?.startsWith("-"));return e.createElement(d.Ph,{key:M,width:28,onChange:h,value:U.value?.find(W=>W.value===M)??null,options:U.value,"aria-label":"Sort",placeholder:N??`Sort (Default ${f.yw.label})`,prefix:e.createElement(m.J,{name:G?"sort-amount-down":"sort-amount-up"}),isClearable:v})}},46236:(Q,L,s)=>{s.r(L),s.d(L,{default:()=>Ht});var e=s(27702),g=s(7662),d=s(9906),m=s(18771),f=s(90131),E=s(44644),r=s(42844),x=s(9232),h=s(66310),M=s(52419),N=s(66574),I=s(65322),b=s(64248),v=s(50230),U=s(76901);const G=t=>({sourcesList:(0,r.css)`
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 12px;
    list-style: none;
    margin-bottom: 80px;
  `,heading:(0,r.css)({fontSize:t.typography.h5.fontSize,fontWeight:"inherit"}),figure:(0,r.css)({width:"inherit",marginRight:"0px","> img":{width:t.spacing(7)}}),meta:(0,r.css)({marginTop:"6px",position:"relative"}),description:(0,r.css)({margin:"0px",fontSize:t.typography.bodySmall.fontSize}),card:(0,r.css)({gridTemplateAreas:`
        "Figure   Heading   Actions"
        "Figure Description Actions"
        "Figure    Meta     Actions"
        "Figure     -       Actions"`}),logo:(0,r.css)({marginRight:t.spacing(3),marginLeft:t.spacing(1),width:t.spacing(7),maxHeight:t.spacing(7)})}),W=({items:t,onClickItem:a})=>{const n=(0,h.wW)(G);return e.createElement("ul",{className:n.sourcesList},t.map(o=>e.createElement(v.Z,{key:o.id,className:n.card,href:o.url,onClick:c=>{a&&a(c,o)}},e.createElement(v.Z.Heading,{className:n.heading},o.name),e.createElement(v.Z.Figure,{align:"center",className:n.figure},e.createElement("img",{className:n.logo,src:o.logo,alt:""})),o.angularDetected?e.createElement(v.Z.Meta,{className:n.meta},e.createElement(U.Nq,null)):null)))};var F=s(73453);const ve=t=>({categoryHeader:(0,r.css)`
    align-items: center;
    display: flex;
    margin-bottom: 24px;
  `,categoryLabel:(0,r.css)`
    margin-bottom: 0px;
    margin-left: 8px;
  `}),ye=({iconName:t,label:a})=>{const n=(0,h.wW)(ve);return e.createElement("div",{className:n.categoryHeader},e.createElement(F.J,{name:t,size:"xl"}),e.createElement("h3",{className:n.categoryLabel},a))};var Se=s(13741),D=s(66670);const ee=t=>({modal:(0,r.css)`
    width: 500px;
  `,modalContent:(0,r.css)`
    overflow: visible;
    color: ${t.colors.text.secondary};

    a {
      color: ${t.colors.text.link};
    }
  `,description:(0,r.css)`
    margin-bottom: ${t.spacing(2)};
  `,bottomSection:(0,r.css)`
    display: flex;
    border-top: 1px solid ${t.colors.border.weak};
    padding-top: ${t.spacing(3)};
    margin-top: ${t.spacing(3)};
  `,actionsSection:(0,r.css)`
    display: flex;
    justify-content: end;
    margin-top: ${t.spacing(3)};
  `,warningIcon:(0,r.css)`
    color: ${t.colors.warning.main};
    padding-right: ${t.spacing()};
    margin-top: ${t.spacing(.25)};
  `,header:(0,r.css)`
    display: flex;
    align-items: center;
  `,headerTitle:(0,r.css)`
    margin: 0;
  `,headerLogo:(0,r.css)`
    margin-right: ${t.spacing(2)};
    width: 32px;
    height: 32px;
  `});function De({item:t,isOpen:a,onDismiss:n}){const o=(0,h.wW)(ee);return e.createElement(Se.u,{className:o.modal,contentClassName:o.modalContent,title:e.createElement(Ce,{item:t}),isOpen:a,onDismiss:n},e.createElement("div",null,e.createElement("div",null,t.description&&e.createElement("div",{className:o.description},t.description),e.createElement("div",null,"Links",e.createElement("br",null),e.createElement("a",{href:`https://grafana.com/grafana/plugins/${t.id}`,title:`${t.name} on Grafana.com`,target:"_blank",rel:"noopener noreferrer"},t.name))),e.createElement("div",{className:o.bottomSection},e.createElement("div",{className:o.warningIcon},e.createElement(F.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/datasources"},"Data sources"),"."),e.createElement("p",null,"To add a new connection, contact your Grafana admin."))),e.createElement("div",{className:o.actionsSection},e.createElement(D.zx,{onClick:n},"Okay"))))}function Ce({item:t}){const a=(0,h.wW)(ee);return e.createElement("div",null,e.createElement("div",{className:a.header},t.logo&&e.createElement("img",{className:a.headerLogo,src:t.logo,alt:`logo of ${t.name}`}),e.createElement("h4",{className:a.headerTitle},t.name)))}const xe=()=>({noResults:(0,r.css)`
    text-align: center;
    padding: 50px 0;
    font-style: italic;
  `}),Ne=()=>{const t=(0,h.wW)(xe);return e.createElement("p",{className:t.noResults},"No results matching your query were found.")};var te=s(1128);const be=t=>({searchContainer:(0,r.css)`
    display: flex;
    margin: 16px 0;
    justify-content: space-between;

    position: sticky;
    top: 0;
    background-color: ${t.colors.background.primary};
    z-index: 2;
    padding: ${t.spacing(2)};
    margin: 0 -${t.spacing(2)};
  `}),Pe=(0,I.t)("connections.search.placeholder","Search all"),Te=({onChange:t})=>{const a=(0,h.wW)(be);return e.createElement("div",{className:a.searchContainer},e.createElement(te.I,{onChange:t,prefix:e.createElement(F.J,{name:"search"}),placeholder:Pe,"aria-label":"Search all"}))},Ae=()=>({spacer:(0,r.css)`
    height: 16px;
  `,modal:(0,r.css)`
    width: 500px;
  `,modalContent:(0,r.css)`
    overflow: visible;
  `});function Ie(){const[t,a]=(0,e.useState)(""),[n,o]=(0,e.useState)(!1),[c,i]=(0,e.useState)(null),l=(0,h.wW)(Ae),u=N.Vt.hasPermission(m.AccessControlAction.DataSourcesCreate),y=S=>{a(S.currentTarget.value.toLowerCase())},{isLoading:p,error:P,plugins:w}=(0,b.Pj)({keyword:t,type:x.zV.datasource}),R=(0,e.useMemo)(()=>w.map(S=>({id:S.id,name:S.name,description:S.description,logo:S.info.logos.small,url:f.Z.DataSourcesDetails.replace(":id",S.id),angularDetected:S.angularDetected})),[w]),V=(S,q)=>{u||(S.preventDefault(),S.stopPropagation(),A(q))},A=S=>{o(!0),i(S)},X=()=>{o(!1),i(null)},B=(0,e.useMemo)(()=>!p&&!P&&w.length<1,[p,P,w]),j=(0,I.t)("connections.connect-data.category-header-label","Data sources");return e.createElement(e.Fragment,null,c&&e.createElement(De,{item:c,isOpen:n,onDismiss:X}),e.createElement(Te,{onChange:y}),e.createElement("div",{className:l.spacer}),e.createElement(ye,{iconName:"database",label:j}),p?e.createElement(M.u,{text:"Loading..."}):P?e.createElement("p",null,"Error: ",P.message):e.createElement(W,{items:R,onClickItem:V}),B&&e.createElement(Ne,null))}function Le(){return e.createElement(E.T,{navId:"connections-add-new-connection"},e.createElement(E.T.Contents,null,e.createElement(Ie,null)))}var $=s(63439),k=s(25357),Me=s(97795);function we(){const t="standalone-plugin-page-/connections/add-new-connection",{id:a}=(0,g.UO)(),c=!!(0,m.useSelector)(i=>i.navIndex)[t]?t:"connections-add-new-connection";return e.createElement(Me.Q,{pluginId:a,navId:c,notFoundComponent:e.createElement(Oe,null),notFoundNavModel:{text:"Unknown datasource",subTitle:"No datasource with this ID could be found.",active:!0}})}function Oe(){const{id:t}=(0,g.UO)();return e.createElement($.b,{severity:m.AppNotificationSeverity.Warning,title:""},"Maybe you mistyped the URL or the plugin with the id ",e.createElement(k.C,{text:t,color:"orange"})," is unavailable.",e.createElement("br",null),"To see a list of available datasources please ",e.createElement("a",{href:f.Z.AddNewConnection},"click here"),".")}var T=s(34667);function Re(){const t=N.Vt.hasPermission(m.AccessControlAction.DataSourcesCreate),a=(0,d.d7)();return t?e.createElement(D.Qj,{icon:"plus",href:T.config.appSubUrl+a.New},e.createElement(I.cC,{i18nKey:"data-sources.datasource-add-button.label"},"Add new data source")):null}var We=s(65333),Be=s(66970),K=s(95685),C=s(99464),ae=s(2148),Ze=s(96757);const J="alpha-asc",ne="alpha-desc",Ue=[{label:"Sort by A\u2013Z",value:J},{label:"Sort by Z\u2013A",value:ne}];function Fe(){const t=(0,m.useDispatch)(),a=(0,e.useCallback)(l=>t((0,d.zT)(l)),[t]),n=(0,m.useSelector)(({dataSources:l})=>(0,d.IO)(l)),o=(0,e.useCallback)(l=>t((0,d.Nu)(l.value===J)),[t]),c=(0,m.useSelector)(({dataSources:l})=>(0,d.IA)(l)),i={onChange:o,value:c?J:ne,getSortOptions:()=>Promise.resolve(Ue)};return e.createElement(Ze.Z,{searchQuery:n,setSearchQuery:a,key:"action-bar",sortPicker:i})}function $e(){const{isLoading:t}=(0,d.zJ)(),a=(0,m.useSelector)(l=>(0,d.mt)(l.dataSources)),n=(0,m.useSelector)(({dataSources:l})=>(0,d.r7)(l)),o=N.Vt.hasPermission(m.AccessControlAction.DataSourcesCreate),c=N.Vt.hasPermission(m.AccessControlAction.DataSourcesWrite),i=N.Vt.hasPermission(m.AccessControlAction.DataSourcesExplore);return e.createElement(Ve,{dataSources:a,dataSourcesCount:n,isLoading:t,hasCreateRights:o,hasWriteRights:c,hasExploreRights:i})}function Ve({dataSources:t,dataSourcesCount:a,isLoading:n,hasCreateRights:o,hasWriteRights:c,hasExploreRights:i}){const l=(0,h.wW)(je),u=(0,d.d7)(),y=(0,g.TH)();return(0,e.useEffect)(()=>{(0,C.dF)({grafana_version:T.config.buildInfo.version,path:y.pathname})},[y]),n?e.createElement(K.Z,null):a===0?e.createElement(Be.Z,{buttonDisabled:!o,title:"No data sources defined",buttonIcon:"database",buttonLink:u.New,buttonTitle:"Add data source",proTip:"You can also define data sources through configuration files.",proTipLink:"http://docs.grafana.org/administration/provisioning/?utm_source=grafana_ds_list#data-sources",proTipLinkTitle:"Learn more",proTipTarget:"_blank"}):e.createElement(e.Fragment,null,e.createElement(Fe,null),e.createElement("ul",{className:l.list},t.map(p=>{const P=T.config.appSubUrl+u.Edit.replace(/:uid/gi,p.uid);return e.createElement("li",{key:p.uid},e.createElement(v.Z,{href:c?P:void 0},e.createElement(v.Z.Heading,null,p.name),e.createElement(v.Z.Figure,null,e.createElement("img",{src:p.typeLogoUrl,alt:"",height:"40px",width:"40px",className:l.logo})),e.createElement(v.Z.Meta,null,[p.typeName,p.url,p.isDefault&&e.createElement(We.V,{key:"default-tag",name:"default",colorIndex:1})]),e.createElement(v.Z.Tags,null,e.createElement(D.Qj,{icon:"apps",fill:"outline",variant:"secondary",href:`dashboard/new-with-ds/${p.uid}`,onClick:()=>{(0,C.hJ)({grafana_version:T.config.buildInfo.version,datasource_uid:p.uid,plugin_name:p.typeName,path:y.pathname})}},"Build a dashboard"),i&&e.createElement(D.Qj,{icon:"compass",fill:"outline",variant:"secondary",className:l.button,href:(0,ae.iU)(p),onClick:()=>{(0,C.U4)({grafana_version:T.config.buildInfo.version,datasource_uid:p.uid,plugin_name:p.typeName,path:y.pathname})}},"Explore"))))})))}const je=t=>({list:(0,r.css)({listStyle:"none",display:"grid"}),logo:(0,r.css)({objectFit:"contain"}),button:(0,r.css)({marginLeft:t.spacing(2)})});function He(){const a=(0,m.useSelector)(({dataSources:n})=>(0,d.r7)(n))>0?e.createElement(Re,null):void 0;return e.createElement(E.T,{navId:"connections-datasources",actions:a},e.createElement(E.T.Contents,null,e.createElement($e,null)))}var se=s(42997),ze=s(30235),ke=s(73624);function Ke({uid:t}){(0,d.E)(t);const a=(0,m.useDispatch)(),n=(0,m.useSelector)(u=>u.dataSources.dataSource),o=(0,m.useSelector)(u=>u.plugins.dashboards),c=(0,m.useSelector)(u=>u.plugins.isLoadingPluginDashboards);(0,e.useEffect)(()=>{n.id>0&&a((0,ze.m3)())},[a,n.id]);const i=(u,y)=>{a((0,se.$j)({pluginId:u.pluginId,path:u.path,overwrite:y,inputs:[{name:"*",type:"datasource",pluginId:n.type,value:n.name}]},u.title))},l=({uid:u})=>{a((0,se.fG)(u))};return e.createElement(Qe,{dashboards:o,isLoading:c,onImportDashboard:i,onRemoveDashboard:l})}const Qe=({isLoading:t,dashboards:a,onImportDashboard:n,onRemoveDashboard:o})=>t?e.createElement(K.Z,null):e.createElement(ke.Z,{dashboards:a,onImport:n,onRemove:o});var oe=s(21691);function re(t){const{uid:a}=(0,g.UO)(),n=(0,g.TH)(),o=(0,oe.wl)(a),c=(0,b.bJ)(o.type),i=new URLSearchParams(n.search),l=(0,oe.MF)(a,t||i.get("page"));return{navId:"connections-datasources",pageNav:{...l.main,text:o.name,subTitle:`Type: ${c?.name}`,children:(l.main.children||[]).map(y=>({...y,url:y.url?.replace("datasources/edit/","/connections/datasources/edit/")}))}}}function Ge(){const{uid:t}=(0,g.UO)(),{navId:a,pageNav:n}=re("dashboards");return e.createElement(E.T,{navId:a,pageNav:n},e.createElement(E.T.Contents,null,e.createElement(Ke,{uid:t})))}var Y=s(89949),Je=s(84714),Ye=s(15766),ce=s(61576),Xe=s(10864),qe=s(82123),_e=s(5933),O=s(74639),le=s(48024),et=s(42074);function tt({dataSourceName:t,isDefault:a,onDefaultChange:n,onNameChange:o,alertingSupported:c,disabled:i}){return e.createElement(e.Fragment,null,!T.config.featureToggles.dataSourcePageHeader&&e.createElement(at,{enabled:c}),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(le._,{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:i},e.createElement(te.I,{id:"basic-settings-name",type:"text",value:t,placeholder:"Name",onChange:l=>o(l.currentTarget.value),required:!0,"aria-label":O.wl.pages.DataSource.name}))),e.createElement(le._,{label:"Default",labelWidth:8,disabled:i},e.createElement(et.x,{id:"basic-settings-default",value:a,onChange:l=>{n(l.currentTarget.checked)}})))))}function at({enabled:t}){const a=(0,h.wW)(nt);return e.createElement("div",{className:a.badge},t?e.createElement(k.C,{color:"green",icon:"check-circle",text:"Alerting supported"}):e.createElement(k.C,{color:"orange",icon:"exclamation-triangle",text:"Alerting not supported"}))}const nt=t=>({badge:(0,r.css)`
    margin-bottom: ${t.spacing(2)};
  `});function st({canSave:t,canDelete:a,onDelete:n,onSubmit:o,onTest:c}){return e.createElement("div",{className:"gf-form-button-row"},e.createElement(D.zx,{type:"button",variant:"destructive",disabled:!a,onClick:n,"data-testid":O.wl.pages.DataSource.delete},"Delete"),t&&e.createElement(D.zx,{type:"submit",variant:"primary",disabled:!t,onClick:o,"data-testid":O.wl.pages.DataSource.saveAndTest},"Save & test"),!t&&e.createElement(D.zx,{variant:"primary",onClick:c},"Test"))}var ot=s(47494),rt=s(74273),ct=s(12308);const lt="datasources.settings.cloudInfoBox.isDismissed";function it({dataSource:t}){let a="",n="";if(t.readOnly||(t.version??0)>2||ct.config.buildInfo.edition!==ot.e.OpenSource)return null;switch(t.type){case"prometheus":a="Prometheus",n="Loki";break;case"loki":a="Loki",n="Prometheus";break;default:return null}return e.createElement(rt.G,{storageKey:lt,defaultValue:!1},(o,c)=>o?null:e.createElement($.b,{title:`Configure your ${a} data source below`,severity:"info",bottomSpacing:4,onRemove:()=>{c(!0)}},"Or skip the effort and get ",a," (and ",n,") 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=${t.type}-settings`,target:"_blank",rel:"noreferrer",title:"The free plan includes 10k active metrics and 50gb storage."},"free-forever Grafana Cloud plan"),"."))}const ut="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 ie(){return e.createElement($.b,{"aria-label":O.wl.pages.DataSource.readOnly,severity:"info",title:"Provisioned data source"},ut)}function dt({dataSourceRights:t,onDelete:a}){const{readOnly:n,hasDeleteRights:o}=t,c=!n&&o,i=()=>history.back();return e.createElement(e.Fragment,null,n&&e.createElement(ie,null),e.createElement("div",{className:"gf-form-button-row"},c&&e.createElement(D.zx,{type:"submit",variant:"destructive",onClick:a},"Delete"),e.createElement(D.zx,{variant:"secondary",fill:"outline",type:"button",onClick:i},"Back")))}const mt="You are not allowed to modify this data source. Please contact your server admin to update this data source.";function gt(){return e.createElement($.b,{severity:"info",title:"Missing rights"},mt)}function pt({plugin:t,pageId:a}){if(!t||!t.configPages)return null;const n=t.configPages.find(({id:o})=>o===a);return n?e.createElement(n.body,{plugin:t,query:{}}):e.createElement("div",null,"Page not found: ",n)}var ft=s(9772);class Et extends e.PureComponent{constructor(a){super(a),this.element=null,this.onModelChanged=n=>{this.props.onModelChange(n)},this.scopeProps={ctrl:{datasourceMeta:a.dataSourceMeta,current:(0,Y.cloneDeep)(a.dataSource)},onModelChanged:this.onModelChanged},this.onModelChanged=this.onModelChanged.bind(this)}componentDidMount(){const{plugin:a}=this.props;if(this.element&&!a.components.ConfigEditor){const n=(0,ft.w)(),o='<plugin-component type="datasource-config-ctrl" />';this.component=n.load(this.element,this.scopeProps,o)}}componentDidUpdate(a){const{plugin:n}=this.props;!n.components.ConfigEditor&&this.props.dataSource!==a.dataSource&&(this.scopeProps.ctrl.current=(0,Y.cloneDeep)(this.props.dataSource),this.component?.digest())}componentWillUnmount(){this.component&&this.component.destroy()}render(){const{plugin:a,dataSource:n}=this.props;return a?e.createElement("div",{ref:o=>this.element=o},a.components.ConfigEditor&&e.createElement(a.components.ConfigEditor,{options:n,onOptionsChange:this.onModelChanged})):null}}var ht=s(90741);function vt({state:t}){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(ht.u,{state:t})))}var ue=s(9848);const yt=(t,a)=>({content:(0,r.css)`
      color: ${t.colors.text.secondary};
      padding-top: ${a?t.spacing(1):0};
      max-height: 50vh;
      overflow-y: auto;
    `,disabled:(0,r.css)`
      pointer-events: none;
      color: ${t.colors.text.secondary};
    `}),de=({title:t,exploreUrl:a,dataSourceId:n,onDashboardLinkClicked:o})=>{const c=(0,h.l4)(),l=yt(c,!!t),u=N.Vt.hasPermission(m.AccessControlAction.DataSourcesExplore);return e.createElement("div",{className:l.content},"Next, you can start to visualize data by"," ",e.createElement(ue.r,{"aria-label":"Create a dashboard",href:`/dashboard/new-with-ds/${n}`,className:"external-link",onClick:o},"building a dashboard"),", or by querying data in the"," ",e.createElement(ue.r,{"aria-label":"Explore data",className:(0,r.cx)("external-link",{[`${l.disabled}`]:!u,"test-disabled":!u}),href:a},"Explore view"),".")};de.displayName="AlertSuccessMessage";const St=new Set(["success","info","warning","error"]),Dt=t=>St.has(t),Ct=t=>t.toLowerCase()==="ok"?"success":Dt(t)?t:"info";function xt({testingStatus:t,exploreUrl:a,dataSource:n}){const o=Ct(t?.status??"error"),c=t?.message,i=t?.details?.message,l=t?.details?.verboseMessage,u=()=>{(0,C.hJ)({grafana_version:T.config.buildInfo.version,datasource_uid:n.uid,plugin_name:n.typeName,path:location.pathname})};return c?e.createElement("div",{className:"gf-form-group p-t-2"},e.createElement($.b,{severity:o,title:c,"aria-label":O.wl.pages.DataSource.alert},t?.details&&e.createElement(e.Fragment,null,i,o==="success"?e.createElement(de,{title:c,exploreUrl:a,dataSourceId:n.uid,onDashboardLinkClicked:u}):null,l?e.createElement("details",{style:{whiteSpace:"pre-wrap"}},String(l)):null))):null}function me({uid:t,pageId:a}){(0,d.E)(t);const n=(0,m.useDispatch)(),o=(0,d.wl)(t),c=(0,d.Qs)(o.type),i=(0,d._l)(),l=(0,d.YY)(t),u=(0,d.Rz)(t),y=(0,d.q6)(),p=(0,d.hw)(t),P=(0,d.qj)(),w=A=>n((0,d.yr)(A)),R=A=>n((0,d.BX)(A)),V=A=>n((0,d.rl)(A));return e.createElement(Nt,{pageId:a,dataSource:o,dataSourceMeta:c,dataSourceSettings:i,dataSourceRights:l,exploreUrl:u,onDelete:y,onDefaultChange:w,onNameChange:R,onOptionsChange:V,onTest:p,onUpdate:P})}function Nt({pageId:t,dataSource:a,dataSourceMeta:n,dataSourceSettings:o,dataSourceRights:c,exploreUrl:i,onDelete:l,onDefaultChange:u,onNameChange:y,onOptionsChange:p,onTest:P,onUpdate:w}){const{plugin:R,loadError:V,testingStatus:A,loading:X}=o,{readOnly:B,hasWriteRights:j,hasDeleteRights:S}=c,q=a.id>0,H=(0,Xe.F)()?.getInstanceSettings(a.uid),zt=!!(H?.meta?.alerting??!1),kt=H?.type==="alertmanager",Kt=zt||kt,he=async Z=>{Z.preventDefault(),(0,C.ij)("save_and_test");try{await w({...a}),(0,C.aL)({item:"success"}),_e.Z.publish(new Je.Ix)}catch(z){(0,C.aL)({item:"fail",error:z});return}P()},Qt=(0,e.useMemo)(()=>{const Z=["grafana-pdc-app","grafana-auth-app"],z=Ye.y.DataSourceConfig,{extensions:_}=(0,qe.QK)({extensionPointId:z});return _.filter(Gt=>Z.includes(Gt.pluginId))},[]);return V?e.createElement(dt,{dataSourceRights:c,onDelete:()=>{(0,C.ij)("delete"),l()}}):X?e.createElement(K.Z,null):!q||!H?null:t?e.createElement(ce.n,{instanceSettings:H},e.createElement(pt,{pageId:t,plugin:R})):e.createElement("form",{onSubmit:he},!j&&e.createElement(gt,null),B&&e.createElement(ie,null),n.state&&e.createElement(vt,{state:n.state}),e.createElement(it,{dataSource:a}),e.createElement(tt,{dataSourceName:a.name,isDefault:a.isDefault,onDefaultChange:u,onNameChange:y,alertingSupported:Kt,disabled:B||!j}),R&&e.createElement(ce.n,{instanceSettings:H},e.createElement(Et,{plugin:R,dataSource:a,dataSourceMeta:n,onModelChange:p})),Qt.map(Z=>{const z=Z.component;return e.createElement("div",{key:Z.id},e.createElement(z,{context:{dataSource:(0,Y.omit)(a,["secureJsonData"]),dataSourceMeta:n,testingStatus:A,setJsonData:_=>p({...a,jsonData:{...a.jsonData,..._}})}}))}),e.createElement(xt,{testingStatus:A,exploreUrl:i,dataSource:a}),e.createElement(st,{onSubmit:he,onDelete:()=>{(0,C.ij)("delete"),l()},onTest:()=>{(0,C.ij)("test"),P()},canDelete:!B&&S,canSave:!B&&j}))}function ge({uid:t}){const a=(0,d.wl)(t),n=N.Vt.hasPermission(m.AccessControlAction.DataSourcesExplore);return e.createElement(e.Fragment,null,n&&e.createElement(D.Qj,{variant:"secondary",size:"sm",href:(0,ae.iU)(a),onClick:()=>{(0,C.ij)("explore"),(0,C.U4)({grafana_version:T.config.buildInfo.version,datasource_uid:a.uid,plugin_name:a.typeName,path:location.pathname})}},"Explore data"),e.createElement(D.Qj,{size:"sm",variant:"secondary",href:`dashboard/new-with-ds/${a.uid}`,onClick:()=>{(0,C.ij)("build_a_dashboard"),(0,C.hJ)({grafana_version:T.config.buildInfo.version,datasource_uid:a.uid,plugin_name:a.typeName,path:location.pathname})}},"Build a dashboard"))}const bt=t=>{const a=[],n=t.alertingSupported;return a.push({label:"Type",value:t.dataSourcePluginName}),a.push({label:"Alerting",value:e.createElement(k.C,{color:n?"green":"red",text:n?"Supported":"Not supported"})}),a};function Pt({title:t}){const a=(0,h.wW)(Tt);return e.createElement("div",{className:a.container},e.createElement("h1",{className:a.title},t))}const Tt=t=>({container:(0,r.css)({marginBottom:t.spacing(2),h1:{display:"inline-block"}}),title:(0,r.css)({display:"inline-block",margin:"0 0 0 0",maxWidth:"40vw",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})});function At({uid:t,pageId:a,navId:n}){const o=(0,d.MF)(t,a),c=bt({dataSourcePluginName:o.main.dataSourcePluginName,alertingSupported:o.dataSourceHeader.alertingSupported});return e.createElement(E.T,{navId:n,pageNav:o.main,renderTitle:i=>e.createElement(Pt,{title:i}),info:c,actions:e.createElement(ge,{uid:t})},e.createElement(E.T.Contents,null,e.createElement(me,{uid:t,pageId:a})))}const It=At;function Lt(){const{uid:t}=(0,g.UO)(),a=(0,g.TH)(),o=new URLSearchParams(a.search).get("page"),c=T.config.featureToggles.dataSourcePageHeader,{navId:i,pageNav:l}=re();return c?e.createElement(It,{uid:t,pageId:o,navId:"connections-datasources"}):e.createElement(E.T,{navId:i,pageNav:l,actions:e.createElement(ge,{uid:t})},e.createElement(E.T.Contents,null,e.createElement(me,{uid:t,pageId:o})))}var Mt=s(33716),wt=s(86064),pe=s(59390),Ot=s(64022),fe=s(97918);function Rt(){const t=(0,b.UQ)(),{isLoading:a}=(0,b.ZV)(),n=(0,h.wW)(Bt);return a||t.length===0?null:e.createElement(wt.v,{"aria-label":O.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(pe.a,{items:t,className:n.list,renderItem:o=>e.createElement("div",{className:n.wrapper},e.createElement(Ot.Lh,{spacing:"sm",justify:"flex-start",align:"center"},e.createElement("strong",null,o.pluginId),e.createElement(fe.o,{status:Wt(o.errorCode),className:n.badge})))})))}function Wt(t){switch(t){case x.w2.invalidSignature:return x.Xy.invalid;case x.w2.missingSignature:return x.Xy.missing;case x.w2.modifiedSignature:return x.Xy.modified;default:return x.Xy.missing}}function Bt(t){return{list:(0,r.css)({listStyleType:"circle"}),wrapper:(0,r.css)({marginTop:t.spacing(1)}),badge:(0,r.css)({marginTop:0})}}function Zt({onClick:t,dataSourcePlugin:a}){const n=a.module==="phantom",o=!n&&!a.unlicensed,c=a.info?.links?.length>0?a.info.links[0]:null,i=c?.target??"_blank",l=(0,h.wW)(Ut);return e.createElement(v.Z,{className:(0,r.cx)(l.card,"card-parent"),onClick:o?t:()=>{}},e.createElement(v.Z.Heading,{className:l.heading,"aria-label":O.wl.pages.AddDataSource.dataSourcePluginsV2(a.name)},a.name),e.createElement(v.Z.Figure,{align:"center",className:l.figure},e.createElement("img",{className:l.logo,src:a.info.logos.small,alt:""})),e.createElement(v.Z.Description,{className:l.description},a.info.description),!n&&e.createElement(v.Z.Meta,{className:l.meta},e.createElement(fe.o,{status:a.signature})),e.createElement(v.Z.Actions,{className:l.actions},c&&e.createElement(D.Qj,{"aria-label":`${a.name}, learn more.`,href:`${c.url}?utm_source=grafana_add_ds`,onClick:u=>u.stopPropagation(),rel:"noopener",target:i,variant:"secondary"},c.name)))}function Ut(t){return{heading:(0,r.css)({fontSize:t.v1.typography.heading.h5,fontWeight:"inherit"}),figure:(0,r.css)({width:"inherit",marginRight:"0px","> img":{width:t.spacing(7)}}),meta:(0,r.css)({marginTop:"6px",position:"relative"}),description:(0,r.css)({margin:"0px",fontSize:t.typography.size.sm}),actions:(0,r.css)({position:"relative",alignSelf:"center",marginTop:"0px",opacity:0,".card-parent:hover &, .card-parent:focus-within &":{opacity:1}}),card:(0,r.css)({gridTemplateAreas:`
        "Figure   Heading   Actions"
        "Figure Description Actions"
        "Figure    Meta     Actions"
        "Figure     -       Actions"`}),logo:(0,r.css)({marginRight:t.v1.spacing.lg,marginLeft:t.v1.spacing.sm,width:t.spacing(7),maxHeight:t.spacing(7)})}}function Ee({dataSourcePlugins:t,onClickDataSourceType:a}){return!t||!t.length?null:e.createElement(pe.a,{items:t,getItemKey:n=>n.id.toString(),renderItem:n=>e.createElement(Zt,{dataSourcePlugin:n,onClick:()=>a(n)}),className:(0,r.css)`
        > li {
          margin-bottom: 2px;
        }
      `})}function Ft({categories:t,onClickDataSourceType:a}){const n=`${f.Z.AddNewConnection}?cat=data-source`;return e.createElement(e.Fragment,null,t.map(({id:o,title:c,plugins:i})=>e.createElement("div",{className:"add-data-source-category",key:o},e.createElement("div",{className:"add-data-source-category__header",id:o},c),e.createElement(Ee,{dataSourcePlugins:i,onClickDataSourceType:a}))),e.createElement("div",{className:"add-data-source-more"},e.createElement(D.Qj,{variant:"secondary",href:n,target:"_self",rel:"noopener"},"Find more data source plugins")))}function $t(){(0,d.OU)();const t=(0,m.useDispatch)(),a=(0,m.useSelector)(u=>(0,d.I5)(u.dataSources)),n=(0,m.useSelector)(u=>u.dataSources.dataSourceTypeSearchQuery),o=(0,m.useSelector)(u=>u.dataSources.isLoadingDataSourcePlugins),c=(0,m.useSelector)(u=>u.dataSources.categories),i=(0,d.nH)(),l=u=>t((0,d.Ht)(u));return e.createElement(Vt,{dataSources:a,dataSourceCategories:c,searchQuery:n,isLoading:o,onAddDataSource:i,onSetSearchQuery:l})}function Vt({dataSources:t,dataSourceCategories:a,searchQuery:n,isLoading:o,onAddDataSource:c,onSetSearchQuery:i}){const l=(0,d.d7)();return o?e.createElement(K.Z,null):e.createElement(e.Fragment,null,e.createElement("div",{className:"page-action-bar"},e.createElement(Mt.H,{value:n,onChange:i,placeholder:"Filter by name or type"}),e.createElement("div",{className:"page-action-bar__spacer"}),e.createElement(D.Qj,{href:l.List,fill:"outline",variant:"secondary",icon:"arrow-left"},"Cancel")),!n&&e.createElement(Rt,null),e.createElement("div",null,n&&e.createElement(Ee,{dataSourcePlugins:t,onClickDataSourceType:c}),!n&&e.createElement(Ft,{categories:a,onClickDataSourceType:c})))}function jt(){return e.createElement(E.T,{navId:"connections-datasources",pageNav:{text:"Add data source",subTitle:"Choose a data source type",active:!0}},e.createElement(E.T.Contents,null,e.createElement($t,null)))}function Ht(){const a=!!(0,m.useSelector)(n=>n.navIndex)["standalone-plugin-page-/connections/add-new-connection"];return e.createElement(d.Vj.Provider,{value:{New:f.Z.DataSourcesNew,List:f.Z.DataSources,Edit:f.Z.DataSourcesEdit,Dashboards:f.Z.DataSourcesDashboards}},e.createElement(g.rs,null,e.createElement(g.AW,{exact:!0,sensitive:!0,path:f.Z.Base,component:()=>e.createElement(g.l_,{to:f.Z.AddNewConnection})}),e.createElement(g.AW,{exact:!0,sensitive:!0,path:f.Z.DataSources,component:He}),e.createElement(g.AW,{exact:!0,sensitive:!0,path:f.Z.DataSourcesNew,component:jt}),e.createElement(g.AW,{exact:!0,sensitive:!0,path:f.Z.DataSourcesDetails,component:we}),e.createElement(g.AW,{exact:!0,sensitive:!0,path:f.Z.DataSourcesEdit,component:Lt}),e.createElement(g.AW,{exact:!0,sensitive:!0,path:f.Z.DataSourcesDashboards,component:Ge}),!a&&e.createElement(g.AW,{exact:!0,sensitive:!0,path:f.Z.AddNewConnection,component:Le}),e.createElement(g.AW,{component:()=>e.createElement(g.l_,{to:"/notfound"})})))}},90741:(Q,L,s)=>{s.d(L,{u:()=>m});var e=s(27702),g=s(9232),d=s(25357);const m=E=>{const r=f(E.state);return r?e.createElement(d.C,{className:E.className,color:r.color,title:r.tooltip,text:r.text,icon:r.icon}):null};function f(E){switch(E){case g.BV.deprecated:return{text:"Deprecated",color:"red",tooltip:"This feature is deprecated and will be removed in a future release"};case g.BV.alpha:return{text:"Alpha",color:"blue",tooltip:"This feature is experimental and future updates might not be backward compatible"};case g.BV.beta:return{text:"Beta",color:"blue",tooltip:"This feature is close to complete but not fully tested"};default:return null}}}}]);

//# sourceMappingURL=Connections.128b00d3ee236c3f2b9a.js.map