"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2154],{72557:(Se,H,s)=>{s.d(H,{A:()=>b});var e=s(96540),g=s(14186),u=s(67647),m=s(55852),p=s(73725);class b extends e.PureComponent{render(){const{searchQuery:x,linkButton:E,setSearchQuery:G,target:z,placeholder:I="Search by name or type",sortPicker:R}=this.props,M={href:E?.href,disabled:E?.disabled};return z&&(M.target=z),e.createElement("div",{className:"page-action-bar"},e.createElement(g.I,{grow:!0},e.createElement(u.Z,{value:x,onChange:G,placeholder:I})),R&&e.createElement(p.r,{onChange:R.onChange,value:R.value,getSortOptions:R.getSortOptions}),E&&e.createElement(m.z9,{...M},E.title))}}},19514:(Se,H,s)=>{s.r(H),s.d(H,{default:()=>Xt});var e=s(96540),g=s(58476),u=s(85464),m=s(31678),p=s(6320),b=s(17205),c=s(32196),x=s(43429),E=s(40845),G=s(39558),z=s(69529),I=s(10096),R=s(83277),M=s(44836),W=s(83391),ye=s(71259),f=s(10860),De=s(50691);const Ce=t=>({heading:(0,c.css)({fontSize:t.typography.h5.fontSize,fontWeight:"inherit"}),figure:(0,c.css)({width:"inherit",marginRight:"0px","> img":{width:t.spacing(7)}}),meta:(0,c.css)({marginTop:"6px",position:"relative"}),description:(0,c.css)({margin:"0px",fontSize:t.typography.bodySmall.fontSize}),card:(0,c.css)({gridTemplateAreas:`
        "Figure   Heading   Actions"
        "Figure Description Actions"
        "Figure    Meta     Actions"
        "Figure     -       Actions"`}),logo:(0,c.css)({marginRight:t.spacing(3),marginLeft:t.spacing(1),width:t.spacing(7),maxHeight:t.spacing(7)})}),be=({items:t,onClickItem:a})=>{const n=(0,E.of)(Ce);return e.createElement(ye.x,{gap:1.5,minColumnWidth:44},t.map(o=>e.createElement(f.Z,{key:o.id,className:n.card,href:o.url,onClick:r=>{a&&a(r,o)}},e.createElement(f.Z.Heading,{className:n.heading},o.name),e.createElement(f.Z.Figure,{align:"center",className:n.figure},e.createElement("img",{className:n.logo,src:o.logo,alt:""})),o.angularDetected?e.createElement(f.Z.Meta,{className:n.meta},e.createElement(De.fk,null)):null)))};var Y=s(14578);const Ne=t=>({categoryHeader:(0,c.css)`
    align-items: center;
    display: flex;
    margin-bottom: 24px;
  `,categoryLabel:(0,c.css)`
    margin-bottom: 0px;
    margin-left: 8px;
  `}),xe=({iconName:t,label:a})=>{const n=(0,E.of)(Ne);return e.createElement("div",{className:n.categoryHeader},e.createElement(Y.I,{name:t,size:"xl"}),e.createElement("h3",{className:n.categoryLabel},a))};var Ae=s(37390),y=s(55852);const te=t=>({modal:(0,c.css)`
    width: 500px;
  `,modalContent:(0,c.css)`
    overflow: visible;
    color: ${t.colors.text.secondary};

    a {
      color: ${t.colors.text.link};
    }
  `,description:(0,c.css)`
    margin-bottom: ${t.spacing(2)};
  `,bottomSection:(0,c.css)`
    display: flex;
    border-top: 1px solid ${t.colors.border.weak};
    padding-top: ${t.spacing(3)};
    margin-top: ${t.spacing(3)};
  `,actionsSection:(0,c.css)`
    display: flex;
    justify-content: end;
    margin-top: ${t.spacing(3)};
  `,warningIcon:(0,c.css)`
    color: ${t.colors.warning.main};
    padding-right: ${t.spacing()};
    margin-top: ${t.spacing(.25)};
  `,header:(0,c.css)`
    display: flex;
    align-items: center;
  `,headerTitle:(0,c.css)`
    margin: 0;
  `,headerLogo:(0,c.css)`
    margin-right: ${t.spacing(2)};
    width: 32px;
    height: 32px;
  `});function Pe({item:t,isOpen:a,onDismiss:n}){const o=(0,E.of)(te);return e.createElement(Ae.a,{className:o.modal,contentClassName:o.modalContent,title:e.createElement(Te,{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(Y.I,{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(y.$n,{onClick:n},"Okay"))))}function Te({item:t}){const a=(0,E.of)(te);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)))}var ae=s(10354);const Ie=t=>({searchContainer:(0,c.css)({display:"flex",justifyContent:"space-between",position:"sticky",top:0,backgroundColor:t.colors.background.primary,zIndex:2,padding:t.spacing(2,0)})}),Le=(0,M.t)("connections.search.placeholder","Search all"),Me=({onChange:t,value:a})=>{const n=(0,E.of)(Ie);return e.createElement("div",{className:n.searchContainer},e.createElement(ae.p,{value:a,onChange:t,prefix:e.createElement(Y.I,{name:"search"}),placeholder:Le,"aria-label":"Search all"}))},we=t=>({spacer:(0,c.css)({height:t.spacing(2)}),modal:(0,c.css)({width:"500px"}),modalContent:(0,c.css)({overflow:"visible"})});function $e(){const[t,a]=(0,R.s)(),n=t.search?String(t.search):"",[o,r]=(0,e.useState)(!1),[i,l]=(0,e.useState)(null),d=(0,E.of)(we),v=I.TP.hasPermission(m.AccessControlAction.DataSourcesCreate),A=h=>{a({search:h.currentTarget.value.toLowerCase()})},{error:S,plugins:C,isLoading:P}=(0,W.PW)({keyword:n,type:x.QE.datasource}),B=(0,e.useMemo)(()=>C.map(h=>({id:h.id,name:h.name,description:h.description,logo:h.info.logos.small,url:p.b.DataSourcesDetails.replace(":id",h.id),angularDetected:h.angularDetected})),[C]),N=(h,U)=>{v||(h.preventDefault(),h.stopPropagation(),F(U))},F=h=>{r(!0),l(h)},L=()=>{r(!1),l(null)},T=(0,e.useMemo)(()=>!P&&!S&&C.length<1,[P,S,C]),V=(0,M.t)("connections.connect-data.category-header-label","Data sources");return e.createElement(e.Fragment,null,i&&e.createElement(Pe,{item:i,isOpen:o,onDismiss:L}),e.createElement(Me,{onChange:A,value:n}),e.createElement("div",{className:d.spacer}),e.createElement(xe,{iconName:"database",label:V}),P?e.createElement(G._,{text:"Loading..."}):S?e.createElement("p",null,"Error: ",S.message):e.createElement(be,{items:B,onClickItem:N}),T&&e.createElement(z.p,{variant:"not-found",message:(0,M.t)("connections.connect-data.empty-message","No results matching your query were found")}))}function Be(){return e.createElement(b.Y,{navId:"connections-add-new-connection"},e.createElement(b.Y.Contents,null,e.createElement($e,null)))}var k=s(42418),ne=s(39938),Re=s(93418);function ke(){const t="standalone-plugin-page-/connections/add-new-connection",{id:a}=(0,g.g)(),r=!!(0,m.useSelector)(i=>i.navIndex)[t]?t:"connections-add-new-connection";return e.createElement(Re.V,{pluginId:a,navId:r,notFoundComponent:e.createElement(Fe,null),notFoundNavModel:{text:"Unknown datasource",subTitle:"No datasource with this ID could be found.",active:!0}})}function Fe(){const{id:t}=(0,g.g)();return e.createElement(k.F,{severity:m.AppNotificationSeverity.Warning,title:""},"Maybe you mistyped the URL or the plugin with the id ",e.createElement(ne.E,{text:t,color:"orange"})," is unavailable.",e.createElement("br",null),"To see a list of available datasources please ",e.createElement("a",{href:p.b.AddNewConnection},"click here"),".")}var w=s(32264);function Oe(){const t=I.TP.hasPermission(m.AccessControlAction.DataSourcesCreate),a=(0,u.aM)();return t?e.createElement(y.z9,{icon:"plus",href:w.$.appSubUrl+a.New},e.createElement(M.x6,{i18nKey:"data-sources.datasource-add-button.label"},"Add new data source")):null}var ze=s(7521),D=s(4589),Z=s(70255),Ze=s(78369),Ue=s(67061),oe=s(11959);function Q({dataSource:t,hasWriteRights:a,hasExploreRights:n}){const o=(0,u.aM)(),r=w.$.appSubUrl+o.Edit.replace(/:uid/gi,t.uid),i=(0,E.of)(Ye);return e.createElement(f.Z,{href:a?r:void 0},e.createElement(f.Z.Heading,null,t.name),e.createElement(f.Z.Figure,null,e.createElement("img",{src:t.typeLogoUrl,alt:"",height:"40px",width:"40px",className:i.logo})),e.createElement(f.Z.Meta,null,[t.typeName,t.url,t.isDefault&&e.createElement(Ze.v,{key:"default-tag",name:"default",colorIndex:1})]),e.createElement(f.Z.Tags,null,e.createElement(y.z9,{icon:"apps",fill:"outline",variant:"secondary",href:`dashboard/new-with-ds/${t.uid}`,onClick:()=>{(0,D.TR)({grafana_version:w.$.buildInfo.version,datasource_uid:t.uid,plugin_name:t.typeName,path:location.pathname})}},"Build a dashboard"),n&&e.createElement(y.z9,{icon:"compass",fill:"outline",variant:"secondary",className:i.button,href:(0,oe.h)(t),onClick:()=>{(0,D.M1)({grafana_version:w.$.buildInfo.version,datasource_uid:t.uid,plugin_name:t.typeName,path:location.pathname})}},"Explore")))}function He({hasExploreRights:t}){const a=(0,E.of)(We);return e.createElement(f.Z,null,e.createElement(f.Z.Heading,null,e.createElement(Z.A,{width:140})),e.createElement(f.Z.Figure,null,e.createElement(Z.A,{width:40,height:40,containerClassName:a.figure})),e.createElement(f.Z.Meta,null,e.createElement(Z.A,{width:120})),e.createElement(f.Z.Tags,null,e.createElement(Ue.B,{direction:"row",gap:2},e.createElement(Z.A,{height:32,width:179,containerClassName:a.button}),t&&e.createElement(Z.A,{height:32,width:107,containerClassName:a.button}))))}Q.Skeleton=He;const We=()=>({button:(0,c.css)({lineHeight:1}),figure:(0,c.css)({lineHeight:1})}),Ye=t=>({logo:(0,c.css)({objectFit:"contain"}),button:(0,c.css)({marginLeft:t.spacing(2)})});var Ve=s(72557);const j="alpha-asc",se="alpha-desc",Ke=[{label:"Sort by A\u2013Z",value:j},{label:"Sort by Z\u2013A",value:se}];function Ge(){const t=(0,m.useDispatch)(),a=(0,e.useCallback)(l=>t((0,u.Bs)(l)),[t]),n=(0,m.useSelector)(({dataSources:l})=>(0,u.xs)(l)),o=(0,e.useCallback)(l=>t((0,u.Tk)(l.value===j)),[t]),r=(0,m.useSelector)(({dataSources:l})=>(0,u.lv)(l)),i={onChange:o,value:r?j:se,getSortOptions:()=>Promise.resolve(Ke)};return e.createElement(Ve.A,{searchQuery:n,setSearchQuery:a,key:"action-bar",sortPicker:i})}function Qe(){const{isLoading:t}=(0,u.US)(),a=(0,m.useSelector)(l=>(0,u.zC)(l.dataSources)),n=(0,m.useSelector)(({dataSources:l})=>(0,u.wC)(l)),o=I.TP.hasPermission(m.AccessControlAction.DataSourcesCreate),r=I.TP.hasPermission(m.AccessControlAction.DataSourcesWrite),i=I.TP.hasPermission(m.AccessControlAction.DataSourcesExplore);return e.createElement(je,{dataSources:a,dataSourcesCount:n,isLoading:t,hasCreateRights:o,hasWriteRights:r,hasExploreRights:i})}function je({dataSources:t,dataSourcesCount:a,isLoading:n,hasCreateRights:o,hasWriteRights:r,hasExploreRights:i}){const l=(0,E.of)(Je),d=(0,u.aM)(),v=(0,g.zy)();if((0,e.useEffect)(()=>{(0,D.kg)({grafana_version:w.$.buildInfo.version,path:v.pathname})},[v]),!n&&a===0)return e.createElement(ze.A,{buttonDisabled:!o,title:"No data sources defined",buttonIcon:"database",buttonLink:d.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"});const A=()=>n?new Array(20).fill(null).map((S,C)=>e.createElement(Q.Skeleton,{key:C,hasExploreRights:i})):t.map(S=>e.createElement("li",{key:S.uid},e.createElement(Q,{dataSource:S,hasWriteRights:r,hasExploreRights:i})));return e.createElement(e.Fragment,null,e.createElement(Ge,null),t.length===0&&!n?e.createElement(z.p,{variant:"not-found",message:(0,M.t)("data-sources.empty-state.message","No data sources found")}):e.createElement("ul",{className:l.list},A()))}const Je=t=>({list:(0,c.css)({listStyle:"none",display:"grid"})});function Xe(){const a=(0,m.useSelector)(({dataSources:n})=>(0,u.wC)(n))>0?e.createElement(Oe,null):void 0;return e.createElement(b.Y,{navId:"connections-datasources",actions:a},e.createElement(b.Y.Contents,null,e.createElement(Qe,null)))}var J=s(39419),re=s(3673),qe=s(20701),_e=s(38348);function et({uid:t}){(0,u.oU)(t);const a=(0,m.useDispatch)(),n=(0,m.useSelector)(d=>d.dataSources.dataSource),o=(0,m.useSelector)(d=>d.plugins.dashboards),r=(0,m.useSelector)(d=>d.plugins.isLoadingPluginDashboards);(0,e.useEffect)(()=>{n.id>0&&a((0,qe.h9)())},[a,n.id]);const i=(d,v)=>{a((0,re.Q9)({pluginId:d.pluginId,path:d.path,overwrite:v,inputs:[{name:"*",type:"datasource",pluginId:n.type,value:n.name}]},d.title))},l=({uid:d})=>{a((0,re.TA)(d))};return e.createElement(tt,{dashboards:o,isLoading:r,onImportDashboard:i,onRemoveDashboard:l})}const tt=({isLoading:t,dashboards:a,onImportDashboard:n,onRemoveDashboard:o})=>t?e.createElement(J.A,null):e.createElement(_e.A,{dashboards:a,onImport:n,onRemove:o});var ce=s(19347),le=s(17422),X=s(11084),q=s(74984);function ie(t){const{uid:a}=(0,g.g)(),n=(0,g.zy)(),o=(0,X.xw)(a),r=(0,X.S4)(o.type),i=(0,W.ob)(o.type),l=new URLSearchParams(n.search),d=t||l.get("page"),{plugin:v,loadError:A,loading:S}=(0,X._e)(),C=(0,ce.l)()?.getInstanceSettings(a),P=!!(C?.meta?.alerting??!1),B=C?.type==="alertmanager",N=P||B,F=(0,m.useSelector)(h=>h.navIndex),L=d?`datasource-${d}-${a}`:`datasource-settings-${a}`;let T={node:{text:"Data Source Nav Node"},main:{text:"Data Source Nav Node"}};if(A){const h={text:A,subTitle:"Data Source Error",icon:"exclamation-triangle"};T={node:h,main:h}}return(S||!v)&&(T=(0,le.tc)(F,L,(0,q.$m)("settings"))),v&&(T=(0,le.tc)(F,L,(0,q.Vh)((0,q.R4)(o,v),d||"settings"))),{navId:"connections-datasources",pageNav:{...T.main,dataSourcePluginName:i?.name||v?.meta.name||"",active:!0,text:o.name,subTitle:`Type: ${r.name}`,children:(T.main.children||[]).map(h=>({...h,url:h.url?.replace("datasources/edit/","/connections/datasources/edit/")}))},dataSourceHeader:{alertingSupported:N}}}function at(){const{uid:t}=(0,g.g)(),{navId:a,pageNav:n}=ie("dashboards");return e.createElement(b.Y,{navId:a,pageNav:n},e.createElement(b.Y.Contents,null,e.createElement(et,{uid:t})))}var _=s(2543),nt=s(69129),ot=s(74135),de=s(76287),st=s(4402),rt=s(28138),$=s(13544),ue=s(14186),ct=s(15292);function lt({dataSourceName:t,isDefault:a,onDefaultChange:n,onNameChange:o,disabled:r}){return e.createElement(e.Fragment,null,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(ue.I,{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:r,labelWidth:14},e.createElement(ae.p,{id:"basic-settings-name",type:"text",value:t,placeholder:"Name",onChange:i=>o(i.currentTarget.value),required:!0,"data-testid":$.Tp.pages.DataSource.name}))),e.createElement(ue.I,{label:"Default",labelWidth:8,disabled:r},e.createElement(ct.K,{id:"basic-settings-default",value:a,onChange:i=>{n(i.currentTarget.checked)}})))))}function ea({enabled:t}){const a=useStyles2(it);return React.createElement("div",{className:a.badge},t?React.createElement(Badge,{color:"green",icon:"check-circle",text:"Alerting supported"}):React.createElement(Badge,{color:"orange",icon:"exclamation-triangle",text:"Alerting not supported"}))}const it=t=>({badge:css`
    margin-bottom: ${t.spacing(2)};
  `});function dt({canSave:t,canDelete:a,onDelete:n,onSubmit:o,onTest:r}){return e.createElement("div",{className:"gf-form-button-row"},e.createElement(y.$n,{type:"button",variant:"destructive",disabled:!a,onClick:n,"data-testid":$.Tp.pages.DataSource.delete},"Delete"),t&&e.createElement(y.$n,{type:"submit",variant:"primary",disabled:!t,onClick:o,"data-testid":$.Tp.pages.DataSource.saveAndTest},"Save & test"),!t&&e.createElement(y.$n,{variant:"primary",onClick:r},"Test"))}var ut=s(61268),mt=s(61680),gt=s(2913);const pt="datasources.settings.cloudInfoBox.isDismissed";function ht({dataSource:t}){let a="",n="";if(t.readOnly||(t.version??0)>2||gt.config.buildInfo.edition!==ut.r.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(mt.b,{storageKey:pt,defaultValue:!1},(o,r)=>o?null:e.createElement(k.F,{title:`Configure your ${a} data source below`,severity:"info",bottomSpacing:4,onRemove:()=>{r(!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 ft="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 me(){return e.createElement(k.F,{"data-testid":$.Tp.pages.DataSource.readOnly,severity:"info",title:"Provisioned data source"},ft)}function Et({dataSourceRights:t,onDelete:a}){const{readOnly:n,hasDeleteRights:o}=t,r=!n&&o,i=()=>history.back();return e.createElement(e.Fragment,null,n&&e.createElement(me,null),e.createElement("div",{className:"gf-form-button-row"},r&&e.createElement(y.$n,{type:"submit",variant:"destructive",onClick:a},"Delete"),e.createElement(y.$n,{variant:"secondary",fill:"outline",type:"button",onClick:i},"Back")))}const vt="You are not allowed to modify this data source. Please contact your server admin to update this data source.";function St(){return e.createElement(k.F,{severity:"info",title:"Missing rights"},vt)}function yt({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 Dt=s(7376);class Ct 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,_.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,Dt.E)(),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,_.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 bt=s(10803);function Nt({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(bt.p,{state:t})))}var ge=s(50720);const xt=(t,a)=>({content:(0,c.css)`
      color: ${t.colors.text.secondary};
      padding-top: ${a?t.spacing(1):0};
      max-height: 50vh;
      overflow-y: auto;
    `,disabled:(0,c.css)`
      pointer-events: none;
      color: ${t.colors.text.secondary};
    `}),pe=({title:t,exploreUrl:a,dataSourceId:n,onDashboardLinkClicked:o})=>{const r=(0,E.$j)(),l=xt(r,!!t),d=I.TP.hasPermission(m.AccessControlAction.DataSourcesExplore);return e.createElement("div",{className:l.content},"Next, you can start to visualize data by"," ",e.createElement(ge.N,{"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(ge.N,{"aria-label":"Explore data",className:(0,c.cx)("external-link",{[`${l.disabled}`]:!d,"test-disabled":!d}),href:a},"Explore view"),".")};pe.displayName="AlertSuccessMessage";const At=new Set(["success","info","warning","error"]),Pt=t=>At.has(t),Tt=t=>t.toLowerCase()==="ok"?"success":Pt(t)?t:"info";function It({testingStatus:t,exploreUrl:a,dataSource:n}){const o=Tt(t?.status??"error"),r=t?.message,i=t?.details?.message,l=t?.details?.verboseMessage,d=()=>{(0,D.TR)({grafana_version:w.$.buildInfo.version,datasource_uid:n.uid,plugin_name:n.typeName,path:location.pathname})};return r?e.createElement("div",{className:"gf-form-group p-t-2"},e.createElement(k.F,{severity:o,title:r,"data-testid":$.Tp.pages.DataSource.alert},t?.details&&e.createElement(e.Fragment,null,i,o==="success"?e.createElement(pe,{title:r,exploreUrl:a,dataSourceId:n.uid,onDashboardLinkClicked:d}):null,l?e.createElement("details",{style:{whiteSpace:"pre-wrap"}},String(l)):null))):null}function Lt({uid:t,pageId:a}){(0,u.oU)(t);const n=(0,m.useDispatch)(),o=(0,u.xw)(t),r=(0,u.S4)(o.type),i=(0,u._e)(),l=(0,u.u1)(t),d=(0,u.Tn)(t),v=(0,u.$k)(),A=(0,u.BY)(t),S=(0,u.k9)(),C=N=>n((0,u.C_)(N)),P=N=>n((0,u.rb)(N)),B=N=>n((0,u.jz)(N));return e.createElement(Mt,{pageId:a,dataSource:o,dataSourceMeta:r,dataSourceSettings:i,dataSourceRights:l,exploreUrl:d,onDelete:v,onDefaultChange:C,onNameChange:P,onOptionsChange:B,onTest:A,onUpdate:S})}function Mt({pageId:t,dataSource:a,dataSourceMeta:n,dataSourceSettings:o,dataSourceRights:r,exploreUrl:i,onDelete:l,onDefaultChange:d,onNameChange:v,onOptionsChange:A,onTest:S,onUpdate:C}){const{plugin:P,loadError:B,testingStatus:N,loading:F}=o,{readOnly:L,hasWriteRights:T,hasDeleteRights:V}=r,h=a.id>0,U=(0,ce.l)()?.getInstanceSettings(a.uid),ve=async O=>{O.preventDefault(),(0,D._i)("save_and_test");try{await C({...a}),(0,D.m3)({item:"success"}),rt.A.publish(new nt.wE)}catch{(0,D.m3)({item:"fail"});return}S()},qt=(0,e.useMemo)(()=>{const O=["grafana-pdc-app","grafana-auth-app"],K=ot.S.DataSourceConfig,{extensions:ee}=(0,st.Dp)({extensionPointId:K});return ee.filter(_t=>O.includes(_t.pluginId))},[]);return B?e.createElement(Et,{dataSourceRights:r,onDelete:()=>{(0,D._i)("delete"),l()}}):F?e.createElement(J.A,null):!h||!U?null:t?e.createElement(de.p,{instanceSettings:U},e.createElement(yt,{pageId:t,plugin:P})):e.createElement("form",{onSubmit:ve},!T&&e.createElement(St,null),L&&e.createElement(me,null),n.state&&e.createElement(Nt,{state:n.state}),e.createElement(ht,{dataSource:a}),e.createElement(lt,{dataSourceName:a.name,isDefault:a.isDefault,onDefaultChange:d,onNameChange:v,disabled:L||!T}),P&&e.createElement(de.p,{instanceSettings:U},e.createElement(Ct,{plugin:P,dataSource:a,dataSourceMeta:n,onModelChange:A})),qt.map(O=>{const K=O.component;return e.createElement("div",{key:O.id},e.createElement(K,{context:{dataSource:(0,_.omit)(a,["secureJsonData"]),dataSourceMeta:n,testingStatus:N,setJsonData:ee=>A({...a,jsonData:{...a.jsonData,...ee}})}}))}),e.createElement(It,{testingStatus:N,exploreUrl:i,dataSource:a}),e.createElement(dt,{onSubmit:ve,onDelete:()=>{(0,D._i)("delete"),l()},onTest:()=>{(0,D._i)("test"),S()},canDelete:!L&&V,canSave:!L&&T}))}function wt({uid:t}){const a=(0,u.xw)(t),n=I.TP.hasPermission(m.AccessControlAction.DataSourcesExplore);return e.createElement(e.Fragment,null,n&&e.createElement(y.z9,{variant:"secondary",size:"sm",href:(0,oe.h)(a),onClick:()=>{(0,D._i)("explore"),(0,D.M1)({grafana_version:w.$.buildInfo.version,datasource_uid:a.uid,plugin_name:a.typeName,path:location.pathname})}},"Explore data"),e.createElement(y.z9,{size:"sm",variant:"secondary",href:`dashboard/new-with-ds/${a.uid}`,onClick:()=>{(0,D._i)("build_a_dashboard"),(0,D.TR)({grafana_version:w.$.buildInfo.version,datasource_uid:a.uid,plugin_name:a.typeName,path:location.pathname})}},"Build a dashboard"))}const $t=t=>{const a=[],n=t.alertingSupported;return a.push({label:"Type",value:t.dataSourcePluginName}),a.push({label:"Alerting",value:e.createElement(ne.E,{color:n?"green":"red",text:n?"Supported":"Not supported"})}),a};function Bt({title:t}){const a=(0,E.of)(Rt);return e.createElement("div",{className:a.container},e.createElement("h1",{className:a.title},t))}const Rt=t=>({container:(0,c.css)({marginBottom:t.spacing(2),h1:{display:"inline-block"}}),title:(0,c.css)({display:"inline-block",margin:"0 0 0 0",maxWidth:"40vw",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})});function kt({uid:t,pageId:a}){const{navId:n,pageNav:o,dataSourceHeader:r}=ie(),i=$t({dataSourcePluginName:o.dataSourcePluginName,alertingSupported:r.alertingSupported});return e.createElement(b.Y,{navId:n,pageNav:o,renderTitle:l=>e.createElement(Bt,{title:l}),info:i,actions:e.createElement(wt,{uid:t})},e.createElement(b.Y.Contents,null,e.createElement(Lt,{uid:t,pageId:a})))}const Ft=kt;function Ot(){const{uid:t}=(0,g.g)(),a=(0,g.zy)(),o=new URLSearchParams(a.search).get("page");return e.createElement(Ft,{uid:t,pageId:o})}var zt=s(67647),he=s(33552),Zt=s(66864),fe=s(98624);function Ut({filterByPluginType:t}){let a=(0,W.F9)(t);const{isLoading:n}=(0,W.m5)(),o=(0,E.of)(Wt);return n||a.length===0?null:e.createElement(k.F,{title:"Unsigned plugins were found during plugin initialization. Grafana Labs cannot guarantee the integrity of these plugins. We recommend only using signed plugins.","data-testid":$.Tp.pages.PluginsList.signatureErrorNotice,severity:"warning"},e.createElement("p",null,"The following plugins are disabled and not shown in the list below:"),e.createElement(he.B,{items:a,className:o.list,renderItem:r=>e.createElement("div",{className:o.wrapper},e.createElement(Zt.Gy,{spacing:"sm",justify:"flex-start",align:"center"},e.createElement("strong",null,r.pluginId),e.createElement(fe.B,{status:Ht(r.errorCode),className:o.badge})))}),e.createElement("a",{href:"https://grafana.com/docs/grafana/latest/plugins/plugin-signatures/",className:o.docsLink,target:"_blank",rel:"noreferrer"},e.createElement(Y.I,{name:"book"})," Read more about plugin signing"))}function Ht(t){switch(t){case x.ZK.invalidSignature:return x.Ac.invalid;case x.ZK.missingSignature:return x.Ac.missing;case x.ZK.modifiedSignature:return x.Ac.modified;default:return x.Ac.missing}}function Wt(t){return{list:(0,c.css)({listStyleType:"circle"}),wrapper:(0,c.css)({marginTop:t.spacing(1)}),badge:(0,c.css)({marginTop:0}),docsLink:(0,c.css)({display:"inline-block",color:t.colors.text.link,marginTop:t.spacing(2)})}}function Yt({onClick:t,dataSourcePlugin:a}){const n=a.module==="phantom",o=!n&&!a.unlicensed,r=a.info?.links?.length>0?a.info.links[0]:null,i=r?.target??"_blank",l=(0,E.of)(Vt);return e.createElement(f.Z,{className:(0,c.cx)(l.card,"card-parent"),onClick:o?t:()=>{}},e.createElement(f.Z.Heading,{className:l.heading,"aria-label":$.Tp.pages.AddDataSource.dataSourcePluginsV2(a.name)},a.name),e.createElement(f.Z.Figure,{align:"center",className:l.figure},e.createElement("img",{className:l.logo,src:a.info.logos.small,alt:""})),e.createElement(f.Z.Description,{className:l.description},a.info.description),!n&&e.createElement(f.Z.Meta,{className:l.meta},e.createElement(fe.B,{status:a.signature})),e.createElement(f.Z.Actions,{className:l.actions},r&&e.createElement(y.z9,{"aria-label":`${a.name}, learn more.`,href:`${r.url}?utm_source=grafana_add_ds`,onClick:d=>d.stopPropagation(),rel:"noopener",target:i,variant:"secondary"},r.name)))}function Vt(t){return{heading:(0,c.css)({fontSize:t.v1.typography.heading.h5,fontWeight:"inherit"}),figure:(0,c.css)({width:"inherit",marginRight:"0px","> img":{width:t.spacing(7)}}),meta:(0,c.css)({marginTop:"6px",position:"relative"}),description:(0,c.css)({margin:"0px",fontSize:t.typography.size.sm}),actions:(0,c.css)({position:"relative",alignSelf:"center",marginTop:"0px",opacity:0,".card-parent:hover &, .card-parent:focus-within &":{opacity:1}}),card:(0,c.css)({gridTemplateAreas:`
        "Figure   Heading   Actions"
        "Figure Description Actions"
        "Figure    Meta     Actions"
        "Figure     -       Actions"`}),logo:(0,c.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(he.B,{items:t,getItemKey:n=>n.id.toString(),renderItem:n=>e.createElement(Yt,{dataSourcePlugin:n,onClick:()=>a(n)}),className:(0,c.css)`
        > li {
          margin-bottom: 2px;
        }
      `})}function Kt({categories:t,onClickDataSourceType:a}){const n=`${p.b.AddNewConnection}?cat=data-source`;return e.createElement(e.Fragment,null,t.map(({id:o,title:r,plugins:i})=>e.createElement("div",{className:"add-data-source-category",key:o},e.createElement("div",{className:"add-data-source-category__header",id:o},r),e.createElement(Ee,{dataSourcePlugins:i,onClickDataSourceType:a}))),e.createElement("div",{className:"add-data-source-more"},e.createElement(y.z9,{variant:"secondary",href:n,target:"_self",rel:"noopener"},"Find more data source plugins")))}function Gt(){(0,u.hx)();const t=(0,m.useDispatch)(),a=(0,m.useSelector)(d=>(0,u.hp)(d.dataSources)),n=(0,m.useSelector)(d=>d.dataSources.dataSourceTypeSearchQuery),o=(0,m.useSelector)(d=>d.dataSources.isLoadingDataSourcePlugins),r=(0,m.useSelector)(d=>d.dataSources.categories),i=(0,u.Um)(),l=d=>t((0,u.eB)(d));return e.createElement(Qt,{dataSources:a,dataSourceCategories:r,searchQuery:n,isLoading:o,onAddDataSource:i,onSetSearchQuery:l})}function Qt({dataSources:t,dataSourceCategories:a,searchQuery:n,isLoading:o,onAddDataSource:r,onSetSearchQuery:i}){const l=(0,u.aM)();return o?e.createElement(J.A,null):e.createElement(e.Fragment,null,e.createElement("div",{className:"page-action-bar"},e.createElement(zt.Z,{value:n,onChange:i,placeholder:"Filter by name or type"}),e.createElement("div",{className:"page-action-bar__spacer"}),e.createElement(y.z9,{href:l.List,fill:"outline",variant:"secondary",icon:"arrow-left"},"Cancel")),!n&&e.createElement(Ut,{filterByPluginType:x.QE.datasource}),e.createElement("div",null,n&&e.createElement(Ee,{dataSourcePlugins:t,onClickDataSourceType:r}),!n&&e.createElement(Kt,{categories:a,onClickDataSourceType:r})))}function jt(){return e.createElement(b.Y,{navId:"connections-datasources",pageNav:{text:"Add data source",subTitle:"Choose a data source type",active:!0}},e.createElement(b.Y.Contents,null,e.createElement(Gt,null)))}function Jt(){const{search:t}=(0,g.zy)();return e.createElement(g.rd,{to:{pathname:p.b.AddNewConnection,search:t}})}function Xt(){const a=!!(0,m.useSelector)(n=>n.navIndex)["standalone-plugin-page-/connections/add-new-connection"];return e.createElement(u.CR.Provider,{value:{New:p.b.DataSourcesNew,List:p.b.DataSources,Edit:p.b.DataSourcesEdit,Dashboards:p.b.DataSourcesDashboards}},e.createElement(g.dO,null,e.createElement(g.qh,{exact:!0,sensitive:!0,path:p.b.Base,component:()=>e.createElement(g.rd,{to:p.b.AddNewConnection})}),e.createElement(g.qh,{exact:!0,sensitive:!0,path:p.b.DataSources,component:Xe}),e.createElement(g.qh,{exact:!0,sensitive:!0,path:p.b.DataSourcesNew,component:jt}),e.createElement(g.qh,{exact:!0,sensitive:!0,path:p.b.DataSourcesDetails,component:ke}),e.createElement(g.qh,{exact:!0,sensitive:!0,path:p.b.DataSourcesEdit,component:Ot}),e.createElement(g.qh,{exact:!0,sensitive:!0,path:p.b.DataSourcesDashboards,component:at}),!a&&e.createElement(g.qh,{exact:!0,sensitive:!0,path:p.b.AddNewConnection,component:Be}),e.createElement(g.qh,{exact:!0,path:p.b.ConnectDataOutdated,component:Jt}),e.createElement(g.rd,{from:`${p.b.Base}/your-connections/:page`,to:`${p.b.Base}/:page`}),e.createElement(g.rd,{from:p.b.YourConnectionsOutdated,to:p.b.DataSources}),e.createElement(g.qh,{component:()=>e.createElement(g.rd,{to:"/notfound"})})))}}}]);

//# sourceMappingURL=Connections.4792e6b83d53454203f2.js.map