"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[5981],{67048:(K,M,o)=>{o.d(M,{r:()=>m});var e=o(41407),g=o(39953),d=o(82803);const m=(0,g.forwardRef)((f,r)=>{const{children:y,gap:h,columns:w,minColumnWidth:C,...A}=f,N=(0,d.wW)(p,h,w,C);return g.createElement("div",{ref:r,...A,className:N.grid},y)});m.displayName="Grid";const p=(f,r,y,h)=>({grid:(0,e.css)([{display:"grid",gap:r?f.spacing(r):void 0},h&&{gridTemplateColumns:`repeat(auto-fill, minmax(${f.spacing(h)}, 1fr))`},y&&{gridTemplateColumns:`repeat(${y}, 1fr)`}])})},49995:(K,M,o)=>{o.d(M,{Z:()=>f});var e=o(39953),g=o(69171),d=o(41245),m=o(4919),p=o(7965);class f extends e.PureComponent{render(){const{searchQuery:y,linkButton:h,setSearchQuery:w,target:C,placeholder:A="Search by name or type",sortPicker:N}=this.props,v={href:h?.href,disabled:h?.disabled};return C&&(v.target=C),e.createElement("div",{className:"page-action-bar"},e.createElement(g._,{grow:!0},e.createElement(d.H,{value:y,onChange:w,placeholder:A})),N&&e.createElement(p.P,{onChange:N.onChange,value:N.value,getSortOptions:N.getSortOptions}),h&&e.createElement(m.Qj,{...v},h.title))}}},7965:(K,M,o)=>{o.d(M,{P:()=>y});var e=o(39953),g=o(20653),d=o(9558),m=o(12190),p=o(9738),f=o(17231);const r=()=>(0,f.getGrafanaSearcher)().getSortOptions();function y({onChange:h,value:w,placeholder:C,filter:A,getSortOptions:N,isClearable:v}){const j=(0,g.Z)(async()=>{const $=await(N??r)();return A?$.filter(X=>A.includes(X.value)):$},[N,A]);if(j.loading)return null;const Y=!!(w?.includes("desc")||w?.startsWith("-"));return e.createElement(d.Ph,{key:w,width:28,onChange:h,value:j.value?.find($=>$.value===w)??null,options:j.value,"aria-label":"Sort",placeholder:C??`Sort (Default ${p.yw.label})`,prefix:e.createElement(m.J,{name:Y?"sort-amount-down":"sort-amount-up"}),isClearable:v})}},77546:(K,M,o)=>{o.r(M),o.d(M,{default:()=>Kt});var e=o(39953),g=o(53721),d=o(60998),m=o(57721),p=o(91473),f=o(13253),r=o(41407),y=o(30670),h=o(82803),w=o(84766),C=o(21308),A=o(62679),N=o(27440),v=o(4236),j=o(67048),Y=o(39826);const $=t=>({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)})}),X=({items:t,onClickItem:a})=>{const n=(0,h.wW)($);return e.createElement(j.r,{gap:1.5,minColumnWidth:44},t.map(s=>e.createElement(v.Z,{key:s.id,className:n.card,href:s.url,onClick:c=>{a&&a(c,s)}},e.createElement(v.Z.Heading,{className:n.heading},s.name),e.createElement(v.Z.Figure,{align:"center",className:n.figure},e.createElement("img",{className:n.logo,src:s.logo,alt:""})),s.angularDetected?e.createElement(v.Z.Meta,{className:n.meta},e.createElement(Y.Nq,null)):null)))};var G=o(12190);const Ce=t=>({categoryHeader:(0,r.css)`
    align-items: center;
    display: flex;
    margin-bottom: 24px;
  `,categoryLabel:(0,r.css)`
    margin-bottom: 0px;
    margin-left: 8px;
  `}),Ne=({iconName:t,label:a})=>{const n=(0,h.wW)(Ce);return e.createElement("div",{className:n.categoryHeader},e.createElement(G.J,{name:t,size:"xl"}),e.createElement("h3",{className:n.categoryLabel},a))};var xe=o(73075),x=o(4919);const oe=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 Pe({item:t,isOpen:a,onDismiss:n}){const s=(0,h.wW)(oe);return e.createElement(xe.u,{className:s.modal,contentClassName:s.modalContent,title:e.createElement(be,{item:t}),isOpen:a,onDismiss:n},e.createElement("div",null,e.createElement("div",null,t.description&&e.createElement("div",{className:s.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:s.bottomSection},e.createElement("div",{className:s.warningIcon},e.createElement(G.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:s.actionsSection},e.createElement(x.zx,{onClick:n},"Okay"))))}function be({item:t}){const a=(0,h.wW)(oe);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 Te=()=>({noResults:(0,r.css)`
    text-align: center;
    padding: 50px 0;
    font-style: italic;
  `}),Ae=()=>{const t=(0,h.wW)(Te);return e.createElement("p",{className:t.noResults},"No results matching your query were found.")};var se=o(38637);const Ie=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)};
  `}),Le=(0,A.t)("connections.search.placeholder","Search all"),Me=({onChange:t})=>{const a=(0,h.wW)(Ie);return e.createElement("div",{className:a.searchContainer},e.createElement(se.I,{onChange:t,prefix:e.createElement(G.J,{name:"search"}),placeholder:Le,"aria-label":"Search all"}))},we=()=>({spacer:(0,r.css)`
    height: 16px;
  `,modal:(0,r.css)`
    width: 500px;
  `,modalContent:(0,r.css)`
    overflow: visible;
  `});function Oe(){const[t,a]=(0,e.useState)(""),[n,s]=(0,e.useState)(!1),[c,u]=(0,e.useState)(null),l=(0,h.wW)(we),i=C.Vt.hasPermission(m.AccessControlAction.DataSourcesCreate),S=D=>{a(D.currentTarget.value.toLowerCase())},{error:E,plugins:b,isLoading:B}=(0,N.Pj)({keyword:t,type:y.zV.datasource}),R=(0,e.useMemo)(()=>b.map(D=>({id:D.id,name:D.name,description:D.description,logo:D.info.logos.small,url:p.Z.DataSourcesDetails.replace(":id",D.id),angularDetected:D.angularDetected})),[b]),U=(D,L)=>{i||(D.preventDefault(),D.stopPropagation(),T(L))},T=D=>{s(!0),u(D)},V=()=>{s(!1),u(null)},W=(0,e.useMemo)(()=>!B&&!E&&b.length<1,[B,E,b]),I=(0,A.t)("connections.connect-data.category-header-label","Data sources");return e.createElement(e.Fragment,null,c&&e.createElement(Pe,{item:c,isOpen:n,onDismiss:V}),e.createElement(Me,{onChange:S}),e.createElement("div",{className:l.spacer}),e.createElement(Ne,{iconName:"database",label:I}),B?e.createElement(w.u,{text:"Loading..."}):E?e.createElement("p",null,"Error: ",E.message):e.createElement(X,{items:R,onClickItem:U}),W&&e.createElement(Ae,null))}function Be(){return e.createElement(f.T,{navId:"connections-add-new-connection"},e.createElement(f.T.Contents,null,e.createElement(Oe,null)))}var F=o(33155),Q=o(12608),Re=o(13076);function We(){const t="standalone-plugin-page-/connections/add-new-connection",{id:a}=(0,g.UO)(),c=!!(0,m.useSelector)(u=>u.navIndex)[t]?t:"connections-add-new-connection";return e.createElement(Re.Q,{pluginId:a,navId:c,notFoundComponent:e.createElement(Ze,null),notFoundNavModel:{text:"Unknown datasource",subTitle:"No datasource with this ID could be found.",active:!0}})}function Ze(){const{id:t}=(0,g.UO)();return e.createElement(F.b,{severity:m.AppNotificationSeverity.Warning,title:""},"Maybe you mistyped the URL or the plugin with the id ",e.createElement(Q.C,{text:t,color:"orange"})," is unavailable.",e.createElement("br",null),"To see a list of available datasources please ",e.createElement("a",{href:p.Z.AddNewConnection},"click here"),".")}var O=o(32688);function Ue(){const t=C.Vt.hasPermission(m.AccessControlAction.DataSourcesCreate),a=(0,d.d7)();return t?e.createElement(x.Qj,{icon:"plus",href:O.config.appSubUrl+a.New},e.createElement(A.cC,{i18nKey:"data-sources.datasource-add-button.label"},"Add new data source")):null}var $e=o(51064),Fe=o(11906),J=o(13150),P=o(45558),re=o(71592),Ve=o(49995);const q="alpha-asc",ce="alpha-desc",He=[{label:"Sort by A\u2013Z",value:q},{label:"Sort by Z\u2013A",value:ce}];function je(){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)),s=(0,e.useCallback)(l=>t((0,d.Nu)(l.value===q)),[t]),c=(0,m.useSelector)(({dataSources:l})=>(0,d.IA)(l)),u={onChange:s,value:c?q:ce,getSortOptions:()=>Promise.resolve(He)};return e.createElement(Ve.Z,{searchQuery:n,setSearchQuery:a,key:"action-bar",sortPicker:u})}function ze(){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)),s=C.Vt.hasPermission(m.AccessControlAction.DataSourcesCreate),c=C.Vt.hasPermission(m.AccessControlAction.DataSourcesWrite),u=C.Vt.hasPermission(m.AccessControlAction.DataSourcesExplore);return e.createElement(ke,{dataSources:a,dataSourcesCount:n,isLoading:t,hasCreateRights:s,hasWriteRights:c,hasExploreRights:u})}function ke({dataSources:t,dataSourcesCount:a,isLoading:n,hasCreateRights:s,hasWriteRights:c,hasExploreRights:u}){const l=(0,h.wW)(Ke),i=(0,d.d7)(),S=(0,g.TH)();return(0,e.useEffect)(()=>{(0,P.dF)({grafana_version:O.config.buildInfo.version,path:S.pathname})},[S]),n?e.createElement(J.Z,null):a===0?e.createElement(Fe.Z,{buttonDisabled:!s,title:"No data sources defined",buttonIcon:"database",buttonLink:i.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(je,null),e.createElement("ul",{className:l.list},t.map(E=>{const b=O.config.appSubUrl+i.Edit.replace(/:uid/gi,E.uid);return e.createElement("li",{key:E.uid},e.createElement(v.Z,{href:c?b:void 0},e.createElement(v.Z.Heading,null,E.name),e.createElement(v.Z.Figure,null,e.createElement("img",{src:E.typeLogoUrl,alt:"",height:"40px",width:"40px",className:l.logo})),e.createElement(v.Z.Meta,null,[E.typeName,E.url,E.isDefault&&e.createElement($e.V,{key:"default-tag",name:"default",colorIndex:1})]),e.createElement(v.Z.Tags,null,e.createElement(x.Qj,{icon:"apps",fill:"outline",variant:"secondary",href:`dashboard/new-with-ds/${E.uid}`,onClick:()=>{(0,P.hJ)({grafana_version:O.config.buildInfo.version,datasource_uid:E.uid,plugin_name:E.typeName,path:S.pathname})}},"Build a dashboard"),u&&e.createElement(x.Qj,{icon:"compass",fill:"outline",variant:"secondary",className:l.button,href:(0,re.iU)(E),onClick:()=>{(0,P.U4)({grafana_version:O.config.buildInfo.version,datasource_uid:E.uid,plugin_name:E.typeName,path:S.pathname})}},"Explore"))))})))}const Ke=t=>({list:(0,r.css)({listStyle:"none",display:"grid"}),logo:(0,r.css)({objectFit:"contain"}),button:(0,r.css)({marginLeft:t.spacing(2)})});function Ge(){const a=(0,m.useSelector)(({dataSources:n})=>(0,d.r7)(n))>0?e.createElement(Ue,null):void 0;return e.createElement(f.T,{navId:"connections-datasources",actions:a},e.createElement(f.T.Contents,null,e.createElement(ze,null)))}var le=o(34401),Qe=o(31063),Je=o(56187);function Ye({uid:t}){(0,d.E)(t);const a=(0,m.useDispatch)(),n=(0,m.useSelector)(i=>i.dataSources.dataSource),s=(0,m.useSelector)(i=>i.plugins.dashboards),c=(0,m.useSelector)(i=>i.plugins.isLoadingPluginDashboards);(0,e.useEffect)(()=>{n.id>0&&a((0,Qe.m3)())},[a,n.id]);const u=(i,S)=>{a((0,le.$j)({pluginId:i.pluginId,path:i.path,overwrite:S,inputs:[{name:"*",type:"datasource",pluginId:n.type,value:n.name}]},i.title))},l=({uid:i})=>{a((0,le.fG)(i))};return e.createElement(Xe,{dashboards:s,isLoading:c,onImportDashboard:u,onRemoveDashboard:l})}const Xe=({isLoading:t,dashboards:a,onImportDashboard:n,onRemoveDashboard:s})=>t?e.createElement(J.Z,null):e.createElement(Je.Z,{dashboards:a,onImport:n,onRemove:s});var ie=o(26205),de=o(45015),_=o(45880),ee=o(1602);function te(t){const{uid:a}=(0,g.UO)(),n=(0,g.TH)(),s=(0,_.wl)(a),c=(0,_.Qs)(s.type),u=(0,N.bJ)(s.type),l=new URLSearchParams(n.search),i=t||l.get("page"),{plugin:S,loadError:E,loading:b}=(0,_._l)(),B=(0,ie.F)()?.getInstanceSettings(a),R=!!(B?.meta?.alerting??!1),U=B?.type==="alertmanager",T=R||U,V=(0,m.useSelector)(L=>L.navIndex),W=i?`datasource-${i}-${a}`:`datasource-settings-${a}`;let I={node:{text:"Data Source Nav Node"},main:{text:"Data Source Nav Node"}};if(E){const L={text:E,subTitle:"Data Source Error",icon:"exclamation-triangle"};I={node:L,main:L}}return(b||!S)&&(I=(0,de.ht)(V,W,(0,ee.xG)("settings"))),S&&(I=(0,de.ht)(V,W,(0,ee.nI)((0,ee.B1)(s,S),i||"settings"))),{navId:"connections-datasources",pageNav:{...I.main,dataSourcePluginName:u?.name||S?.meta.name||"",active:!0,text:s.name,subTitle:`Type: ${c.name}`,children:(I.main.children||[]).map(L=>({...L,url:L.url?.replace("datasources/edit/","/connections/datasources/edit/")}))},dataSourceHeader:{alertingSupported:T}}}function qe(){const{uid:t}=(0,g.UO)(),{navId:a,pageNav:n}=te("dashboards");return e.createElement(f.T,{navId:a,pageNav:n},e.createElement(f.T.Contents,null,e.createElement(Ye,{uid:t})))}var ae=o(86832),_e=o(36316),et=o(41175),ue=o(34265),tt=o(44076),at=o(28833),Z=o(28888),me=o(69171),nt=o(26286);function ot({dataSourceName:t,isDefault:a,onDefaultChange:n,onNameChange:s,alertingSupported:c,disabled:u}){return e.createElement(e.Fragment,null,!O.config.featureToggles.dataSourcePageHeader&&e.createElement(st,{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(me._,{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:u},e.createElement(se.I,{id:"basic-settings-name",type:"text",value:t,placeholder:"Name",onChange:l=>s(l.currentTarget.value),required:!0,"aria-label":Z.wl.pages.DataSource.name}))),e.createElement(me._,{label:"Default",labelWidth:8,disabled:u},e.createElement(nt.x,{id:"basic-settings-default",value:a,onChange:l=>{n(l.currentTarget.checked)}})))))}function st({enabled:t}){const a=(0,h.wW)(rt);return e.createElement("div",{className:a.badge},t?e.createElement(Q.C,{color:"green",icon:"check-circle",text:"Alerting supported"}):e.createElement(Q.C,{color:"orange",icon:"exclamation-triangle",text:"Alerting not supported"}))}const rt=t=>({badge:(0,r.css)`
    margin-bottom: ${t.spacing(2)};
  `});function ct({canSave:t,canDelete:a,onDelete:n,onSubmit:s,onTest:c}){return e.createElement("div",{className:"gf-form-button-row"},e.createElement(x.zx,{type:"button",variant:"destructive",disabled:!a,onClick:n,"data-testid":Z.wl.pages.DataSource.delete},"Delete"),t&&e.createElement(x.zx,{type:"submit",variant:"primary",disabled:!t,onClick:s,"data-testid":Z.wl.pages.DataSource.saveAndTest},"Save & test"),!t&&e.createElement(x.zx,{variant:"primary",onClick:c},"Test"))}var lt=o(70929),it=o(1188),dt=o(50820);const ut="datasources.settings.cloudInfoBox.isDismissed";function mt({dataSource:t}){let a="",n="";if(t.readOnly||(t.version??0)>2||dt.config.buildInfo.edition!==lt.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(it.G,{storageKey:ut,defaultValue:!1},(s,c)=>s?null:e.createElement(F.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 gt="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 ge(){return e.createElement(F.b,{"aria-label":Z.wl.pages.DataSource.readOnly,severity:"info",title:"Provisioned data source"},gt)}function pt({dataSourceRights:t,onDelete:a}){const{readOnly:n,hasDeleteRights:s}=t,c=!n&&s,u=()=>history.back();return e.createElement(e.Fragment,null,n&&e.createElement(ge,null),e.createElement("div",{className:"gf-form-button-row"},c&&e.createElement(x.zx,{type:"submit",variant:"destructive",onClick:a},"Delete"),e.createElement(x.zx,{variant:"secondary",fill:"outline",type:"button",onClick:u},"Back")))}const ft="You are not allowed to modify this data source. Please contact your server admin to update this data source.";function Et(){return e.createElement(F.b,{severity:"info",title:"Missing rights"},ft)}function ht({plugin:t,pageId:a}){if(!t||!t.configPages)return null;const n=t.configPages.find(({id:s})=>s===a);return n?e.createElement(n.body,{plugin:t,query:{}}):e.createElement("div",null,"Page not found: ",n)}var vt=o(52275);class yt 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,ae.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,vt.w)(),s='<plugin-component type="datasource-config-ctrl" />';this.component=n.load(this.element,this.scopeProps,s)}}componentDidUpdate(a){const{plugin:n}=this.props;!n.components.ConfigEditor&&this.props.dataSource!==a.dataSource&&(this.scopeProps.ctrl.current=(0,ae.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:s=>this.element=s},a.components.ConfigEditor&&e.createElement(a.components.ConfigEditor,{options:n,onOptionsChange:this.onModelChanged})):null}}var St=o(47082);function Dt({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(St.u,{state:t})))}var pe=o(18950);const Ct=(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};
    `}),fe=({title:t,exploreUrl:a,dataSourceId:n,onDashboardLinkClicked:s})=>{const c=(0,h.l4)(),l=Ct(c,!!t),i=C.Vt.hasPermission(m.AccessControlAction.DataSourcesExplore);return e.createElement("div",{className:l.content},"Next, you can start to visualize data by"," ",e.createElement(pe.r,{"aria-label":"Create a dashboard",href:`/dashboard/new-with-ds/${n}`,className:"external-link",onClick:s},"building a dashboard"),", or by querying data in the"," ",e.createElement(pe.r,{"aria-label":"Explore data",className:(0,r.cx)("external-link",{[`${l.disabled}`]:!i,"test-disabled":!i}),href:a},"Explore view"),".")};fe.displayName="AlertSuccessMessage";const Nt=new Set(["success","info","warning","error"]),xt=t=>Nt.has(t),Pt=t=>t.toLowerCase()==="ok"?"success":xt(t)?t:"info";function bt({testingStatus:t,exploreUrl:a,dataSource:n}){const s=Pt(t?.status??"error"),c=t?.message,u=t?.details?.message,l=t?.details?.verboseMessage,i=()=>{(0,P.hJ)({grafana_version:O.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(F.b,{severity:s,title:c,"aria-label":Z.wl.pages.DataSource.alert},t?.details&&e.createElement(e.Fragment,null,u,s==="success"?e.createElement(fe,{title:c,exploreUrl:a,dataSourceId:n.uid,onDashboardLinkClicked:i}):null,l?e.createElement("details",{style:{whiteSpace:"pre-wrap"}},String(l)):null))):null}function Ee({uid:t,pageId:a}){(0,d.E)(t);const n=(0,m.useDispatch)(),s=(0,d.wl)(t),c=(0,d.Qs)(s.type),u=(0,d._l)(),l=(0,d.YY)(t),i=(0,d.Rz)(t),S=(0,d.q6)(),E=(0,d.hw)(t),b=(0,d.qj)(),B=T=>n((0,d.yr)(T)),R=T=>n((0,d.BX)(T)),U=T=>n((0,d.rl)(T));return e.createElement(Tt,{pageId:a,dataSource:s,dataSourceMeta:c,dataSourceSettings:u,dataSourceRights:l,exploreUrl:i,onDelete:S,onDefaultChange:B,onNameChange:R,onOptionsChange:U,onTest:E,onUpdate:b})}function Tt({pageId:t,dataSource:a,dataSourceMeta:n,dataSourceSettings:s,dataSourceRights:c,exploreUrl:u,onDelete:l,onDefaultChange:i,onNameChange:S,onOptionsChange:E,onTest:b,onUpdate:B}){const{plugin:R,loadError:U,testingStatus:T,loading:V}=s,{readOnly:W,hasWriteRights:I,hasDeleteRights:D}=c,L=a.id>0,z=(0,ie.F)()?.getInstanceSettings(a.uid),Gt=!!(z?.meta?.alerting??!1),Qt=z?.type==="alertmanager",Jt=Gt||Qt,De=async H=>{H.preventDefault(),(0,P.ij)("save_and_test");try{await B({...a}),(0,P.aL)({item:"success"}),at.Z.publish(new _e.Ix)}catch(k){(0,P.aL)({item:"fail",error:k});return}b()},Yt=(0,e.useMemo)(()=>{const H=["grafana-pdc-app","grafana-auth-app"],k=et.y.DataSourceConfig,{extensions:ne}=(0,tt.QK)({extensionPointId:k});return ne.filter(Xt=>H.includes(Xt.pluginId))},[]);return U?e.createElement(pt,{dataSourceRights:c,onDelete:()=>{(0,P.ij)("delete"),l()}}):V?e.createElement(J.Z,null):!L||!z?null:t?e.createElement(ue.n,{instanceSettings:z},e.createElement(ht,{pageId:t,plugin:R})):e.createElement("form",{onSubmit:De},!I&&e.createElement(Et,null),W&&e.createElement(ge,null),n.state&&e.createElement(Dt,{state:n.state}),e.createElement(mt,{dataSource:a}),e.createElement(ot,{dataSourceName:a.name,isDefault:a.isDefault,onDefaultChange:i,onNameChange:S,alertingSupported:Jt,disabled:W||!I}),R&&e.createElement(ue.n,{instanceSettings:z},e.createElement(yt,{plugin:R,dataSource:a,dataSourceMeta:n,onModelChange:E})),Yt.map(H=>{const k=H.component;return e.createElement("div",{key:H.id},e.createElement(k,{context:{dataSource:(0,ae.omit)(a,["secureJsonData"]),dataSourceMeta:n,testingStatus:T,setJsonData:ne=>E({...a,jsonData:{...a.jsonData,...ne}})}}))}),e.createElement(bt,{testingStatus:T,exploreUrl:u,dataSource:a}),e.createElement(ct,{onSubmit:De,onDelete:()=>{(0,P.ij)("delete"),l()},onTest:()=>{(0,P.ij)("test"),b()},canDelete:!W&&D,canSave:!W&&I}))}function he({uid:t}){const a=(0,d.wl)(t),n=C.Vt.hasPermission(m.AccessControlAction.DataSourcesExplore);return e.createElement(e.Fragment,null,n&&e.createElement(x.Qj,{variant:"secondary",size:"sm",href:(0,re.iU)(a),onClick:()=>{(0,P.ij)("explore"),(0,P.U4)({grafana_version:O.config.buildInfo.version,datasource_uid:a.uid,plugin_name:a.typeName,path:location.pathname})}},"Explore data"),e.createElement(x.Qj,{size:"sm",variant:"secondary",href:`dashboard/new-with-ds/${a.uid}`,onClick:()=>{(0,P.ij)("build_a_dashboard"),(0,P.hJ)({grafana_version:O.config.buildInfo.version,datasource_uid:a.uid,plugin_name:a.typeName,path:location.pathname})}},"Build a dashboard"))}const At=t=>{const a=[],n=t.alertingSupported;return a.push({label:"Type",value:t.dataSourcePluginName}),a.push({label:"Alerting",value:e.createElement(Q.C,{color:n?"green":"red",text:n?"Supported":"Not supported"})}),a};function It({title:t}){const a=(0,h.wW)(Lt);return e.createElement("div",{className:a.container},e.createElement("h1",{className:a.title},t))}const Lt=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 Mt({uid:t,pageId:a}){const{navId:n,pageNav:s,dataSourceHeader:c}=te(),u=At({dataSourcePluginName:s.dataSourcePluginName,alertingSupported:c.alertingSupported});return e.createElement(f.T,{navId:n,pageNav:s,renderTitle:l=>e.createElement(It,{title:l}),info:u,actions:e.createElement(he,{uid:t})},e.createElement(f.T.Contents,null,e.createElement(Ee,{uid:t,pageId:a})))}const wt=Mt;function Ot(){const{uid:t}=(0,g.UO)(),a=(0,g.TH)(),s=new URLSearchParams(a.search).get("page"),c=O.config.featureToggles.dataSourcePageHeader,{navId:u,pageNav:l}=te();return c?e.createElement(wt,{uid:t,pageId:s}):e.createElement(f.T,{navId:u,pageNav:l,actions:e.createElement(he,{uid:t})},e.createElement(f.T.Contents,null,e.createElement(Ee,{uid:t,pageId:s})))}var Bt=o(41245),ve=o(38696),Rt=o(12223),ye=o(45802);function Wt({filterByPluginType:t}){let a=(0,N.UQ)(t);const{isLoading:n}=(0,N.ZV)(),s=(0,h.wW)(Ut);return n||a.length===0?null:e.createElement(F.b,{title:"Unsigned plugins were found during plugin initialization. Grafana Labs cannot guarantee the integrity of these plugins. We recommend only using signed plugins.","aria-label":Z.wl.pages.PluginsList.signatureErrorNotice,severity:"warning"},e.createElement("p",null,"The following plugins are disabled and not shown in the list below:"),e.createElement(ve.a,{items:a,className:s.list,renderItem:c=>e.createElement("div",{className:s.wrapper},e.createElement(Rt.Lh,{spacing:"sm",justify:"flex-start",align:"center"},e.createElement("strong",null,c.pluginId),e.createElement(ye.o,{status:Zt(c.errorCode),className:s.badge})))}),e.createElement("a",{href:"https://grafana.com/docs/grafana/latest/plugins/plugin-signatures/",className:s.docsLink,target:"_blank",rel:"noreferrer"},e.createElement(G.J,{name:"book"})," Read more about plugin signing"))}function Zt(t){switch(t){case y.w2.invalidSignature:return y.Xy.invalid;case y.w2.missingSignature:return y.Xy.missing;case y.w2.modifiedSignature:return y.Xy.modified;default:return y.Xy.missing}}function Ut(t){return{list:(0,r.css)({listStyleType:"circle"}),wrapper:(0,r.css)({marginTop:t.spacing(1)}),badge:(0,r.css)({marginTop:0}),docsLink:(0,r.css)({display:"inline-block",color:t.colors.text.link,marginTop:t.spacing(2)})}}function $t({onClick:t,dataSourcePlugin:a}){const n=a.module==="phantom",s=!n&&!a.unlicensed,c=a.info?.links?.length>0?a.info.links[0]:null,u=c?.target??"_blank",l=(0,h.wW)(Ft);return e.createElement(v.Z,{className:(0,r.cx)(l.card,"card-parent"),onClick:s?t:()=>{}},e.createElement(v.Z.Heading,{className:l.heading,"aria-label":Z.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(ye.o,{status:a.signature})),e.createElement(v.Z.Actions,{className:l.actions},c&&e.createElement(x.Qj,{"aria-label":`${a.name}, learn more.`,href:`${c.url}?utm_source=grafana_add_ds`,onClick:i=>i.stopPropagation(),rel:"noopener",target:u,variant:"secondary"},c.name)))}function Ft(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 Se({dataSourcePlugins:t,onClickDataSourceType:a}){return!t||!t.length?null:e.createElement(ve.a,{items:t,getItemKey:n=>n.id.toString(),renderItem:n=>e.createElement($t,{dataSourcePlugin:n,onClick:()=>a(n)}),className:(0,r.css)`
        > li {
          margin-bottom: 2px;
        }
      `})}function Vt({categories:t,onClickDataSourceType:a}){const n=`${p.Z.AddNewConnection}?cat=data-source`;return e.createElement(e.Fragment,null,t.map(({id:s,title:c,plugins:u})=>e.createElement("div",{className:"add-data-source-category",key:s},e.createElement("div",{className:"add-data-source-category__header",id:s},c),e.createElement(Se,{dataSourcePlugins:u,onClickDataSourceType:a}))),e.createElement("div",{className:"add-data-source-more"},e.createElement(x.Qj,{variant:"secondary",href:n,target:"_self",rel:"noopener"},"Find more data source plugins")))}function Ht(){(0,d.OU)();const t=(0,m.useDispatch)(),a=(0,m.useSelector)(i=>(0,d.I5)(i.dataSources)),n=(0,m.useSelector)(i=>i.dataSources.dataSourceTypeSearchQuery),s=(0,m.useSelector)(i=>i.dataSources.isLoadingDataSourcePlugins),c=(0,m.useSelector)(i=>i.dataSources.categories),u=(0,d.nH)(),l=i=>t((0,d.Ht)(i));return e.createElement(jt,{dataSources:a,dataSourceCategories:c,searchQuery:n,isLoading:s,onAddDataSource:u,onSetSearchQuery:l})}function jt({dataSources:t,dataSourceCategories:a,searchQuery:n,isLoading:s,onAddDataSource:c,onSetSearchQuery:u}){const l=(0,d.d7)();return s?e.createElement(J.Z,null):e.createElement(e.Fragment,null,e.createElement("div",{className:"page-action-bar"},e.createElement(Bt.H,{value:n,onChange:u,placeholder:"Filter by name or type"}),e.createElement("div",{className:"page-action-bar__spacer"}),e.createElement(x.Qj,{href:l.List,fill:"outline",variant:"secondary",icon:"arrow-left"},"Cancel")),!n&&e.createElement(Wt,{filterByPluginType:y.zV.datasource}),e.createElement("div",null,n&&e.createElement(Se,{dataSourcePlugins:t,onClickDataSourceType:c}),!n&&e.createElement(Vt,{categories:a,onClickDataSourceType:c})))}function zt(){return e.createElement(f.T,{navId:"connections-datasources",pageNav:{text:"Add data source",subTitle:"Choose a data source type",active:!0}},e.createElement(f.T.Contents,null,e.createElement(Ht,null)))}function kt(){const{search:t}=(0,g.TH)();return e.createElement(g.l_,{to:{pathname:p.Z.AddNewConnection,search:t}})}function Kt(){const a=!!(0,m.useSelector)(n=>n.navIndex)["standalone-plugin-page-/connections/add-new-connection"];return e.createElement(d.Vj.Provider,{value:{New:p.Z.DataSourcesNew,List:p.Z.DataSources,Edit:p.Z.DataSourcesEdit,Dashboards:p.Z.DataSourcesDashboards}},e.createElement(g.rs,null,e.createElement(g.AW,{exact:!0,sensitive:!0,path:p.Z.Base,component:()=>e.createElement(g.l_,{to:p.Z.AddNewConnection})}),e.createElement(g.AW,{exact:!0,sensitive:!0,path:p.Z.DataSources,component:Ge}),e.createElement(g.AW,{exact:!0,sensitive:!0,path:p.Z.DataSourcesNew,component:zt}),e.createElement(g.AW,{exact:!0,sensitive:!0,path:p.Z.DataSourcesDetails,component:We}),e.createElement(g.AW,{exact:!0,sensitive:!0,path:p.Z.DataSourcesEdit,component:Ot}),e.createElement(g.AW,{exact:!0,sensitive:!0,path:p.Z.DataSourcesDashboards,component:qe}),!a&&e.createElement(g.AW,{exact:!0,sensitive:!0,path:p.Z.AddNewConnection,component:Be}),e.createElement(g.AW,{exact:!0,path:p.Z.ConnectDataOutdated,component:kt}),e.createElement(g.l_,{from:`${p.Z.Base}/your-connections/:page`,to:`${p.Z.Base}/:page`}),e.createElement(g.l_,{from:p.Z.YourConnectionsOutdated,to:p.Z.DataSources}),e.createElement(g.AW,{component:()=>e.createElement(g.l_,{to:"/notfound"})})))}},47082:(K,M,o)=>{o.d(M,{u:()=>m});var e=o(39953),g=o(30670),d=o(12608);const m=f=>{const r=p(f.state);return r?e.createElement(d.C,{className:f.className,color:r.color,title:r.tooltip,text:r.text,icon:r.icon}):null};function p(f){switch(f){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.69ce7ce0a1c58719abdd.js.map