D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
share
/
grafana
/
public
/
build
/
Filename :
Connections.97562febb348a76626df.js
back
Copy
"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[5981],{96757:(Q,L,o)=>{o.d(L,{Z:()=>E});var e=o(27702),m=o(48024),d=o(33716),g=o(66670),p=o(5336);class E extends e.PureComponent{render(){const{searchQuery:x,linkButton:h,setSearchQuery:w,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(m._,{grow:!0},e.createElement(d.H,{value:x,onChange:w,placeholder:I})),b&&e.createElement(p.P,{onChange:b.onChange,value:b.value,getSortOptions:b.getSortOptions}),h&&e.createElement(g.Qj,{...v},h.title))}}},5336:(Q,L,o)=>{o.d(L,{P:()=>x});var e=o(27702),m=o(25111),d=o(28580),g=o(73453),p=o(15758),E=o(63064);const c=()=>(0,E.getGrafanaSearcher)().getSortOptions();function x({onChange:h,value:w,placeholder:N,filter:I,getSortOptions:b,isClearable:v}){const U=(0,m.Z)(async()=>{const R=await(b??c)();return I?R.filter($=>I.includes($.value)):R},[b,I]);if(U.loading)return null;const G=!!(w?.includes("desc")||w?.startsWith("-"));return e.createElement(d.Ph,{key:w,width:28,onChange:h,value:U.value?.find(R=>R.value===w)??null,options:U.value,"aria-label":"Sort",placeholder:N??`Sort (Default ${p.yw.label})`,prefix:e.createElement(g.J,{name:G?"sort-amount-down":"sort-amount-up"}),isClearable:v})}},46236:(Q,L,o)=>{o.r(L),o.d(L,{default:()=>zt});var e=o(27702),m=o(7662),d=o(9906),g=o(18771),p=o(90131),E=o(44644),c=o(42844),x=o(9232),h=o(66310),w=o(52419),N=o(66574),I=o(65322),b=o(64248),v=o(50230),U=o(76901);const G=t=>({sourcesList:(0,c.css)` display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; list-style: none; margin-bottom: 80px; `,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)})}),R=({items:t,onClickItem:a})=>{const n=(0,h.wW)(G);return e.createElement("ul",{className:n.sourcesList},t.map(s=>e.createElement(v.Z,{key:s.id,className:n.card,href:s.url,onClick:l=>{a&&a(l,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(U.Nq,null)):null)))};var $=o(73453);const ve=t=>({categoryHeader:(0,c.css)` align-items: center; display: flex; margin-bottom: 24px; `,categoryLabel:(0,c.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($.J,{name:t,size:"xl"}),e.createElement("h3",{className:n.categoryLabel},a))};var Se=o(13741),D=o(66670);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 De({item:t,isOpen:a,onDismiss:n}){const s=(0,h.wW)(te);return e.createElement(Se.u,{className:s.modal,contentClassName:s.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: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($.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(D.zx,{onClick:n},"Okay"))))}function Ce({item:t}){const a=(0,h.wW)(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)))}const xe=()=>({noResults:(0,c.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 ae=o(1128);const be=t=>({searchContainer:(0,c.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(ae.I,{onChange:t,prefix:e.createElement($.J,{name:"search"}),placeholder:Pe,"aria-label":"Search all"}))},Ae=()=>({spacer:(0,c.css)` height: 16px; `,modal:(0,c.css)` width: 500px; `,modalContent:(0,c.css)` overflow: visible; `});function Ie(){const[t,a]=(0,e.useState)(""),[n,s]=(0,e.useState)(!1),[l,i]=(0,e.useState)(null),r=(0,h.wW)(Ae),u=N.Vt.hasPermission(g.AccessControlAction.DataSourcesCreate),y=S=>{a(S.currentTarget.value.toLowerCase())},{isLoading:f,error:P,plugins:M}=(0,b.Pj)({keyword:t,type:x.zV.datasource}),Z=(0,e.useMemo)(()=>M.map(S=>({id:S.id,name:S.name,description:S.description,logo:S.info.logos.small,url:p.Z.DataSourcesDetails.replace(":id",S.id),angularDetected:S.angularDetected})),[M]),H=(S,_)=>{u||(S.preventDefault(),S.stopPropagation(),A(_))},A=S=>{s(!0),i(S)},q=()=>{s(!1),i(null)},B=(0,e.useMemo)(()=>!f&&!P&&M.length<1,[f,P,M]),V=(0,I.t)("connections.connect-data.category-header-label","Data sources");return e.createElement(e.Fragment,null,l&&e.createElement(De,{item:l,isOpen:n,onDismiss:q}),e.createElement(Te,{onChange:y}),e.createElement("div",{className:r.spacer}),e.createElement(ye,{iconName:"database",label:V}),f?e.createElement(w.u,{text:"Loading..."}):P?e.createElement("p",null,"Error: ",P.message):e.createElement(R,{items:Z,onClickItem:H}),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 F=o(63439),z=o(25357),we=o(97795);function Me(){const t="standalone-plugin-page-/connections/add-new-connection",{id:a}=(0,m.UO)(),l=!!(0,g.useSelector)(i=>i.navIndex)[t]?t:"connections-add-new-connection";return e.createElement(we.Q,{pluginId:a,navId:l,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,m.UO)();return e.createElement(F.b,{severity:g.AppNotificationSeverity.Warning,title:""},"Maybe you mistyped the URL or the plugin with the id ",e.createElement(z.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 T=o(34667);function Ze(){const t=N.Vt.hasPermission(g.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 Re=o(65333),Be=o(66970),k=o(95685),C=o(99464),ne=o(2148),We=o(96757);const J="alpha-asc",oe="alpha-desc",Ue=[{label:"Sort by A\u2013Z",value:J},{label:"Sort by Z\u2013A",value:oe}];function $e(){const t=(0,g.useDispatch)(),a=(0,e.useCallback)(r=>t((0,d.zT)(r)),[t]),n=(0,g.useSelector)(({dataSources:r})=>(0,d.IO)(r)),s=(0,e.useCallback)(r=>t((0,d.Nu)(r.value===J)),[t]),l=(0,g.useSelector)(({dataSources:r})=>(0,d.IA)(r)),i={onChange:s,value:l?J:oe,getSortOptions:()=>Promise.resolve(Ue)};return e.createElement(We.Z,{searchQuery:n,setSearchQuery:a,key:"action-bar",sortPicker:i})}function Fe(){const{isLoading:t}=(0,d.zJ)(),a=(0,g.useSelector)(r=>(0,d.mt)(r.dataSources)),n=(0,g.useSelector)(({dataSources:r})=>(0,d.r7)(r)),s=N.Vt.hasPermission(g.AccessControlAction.DataSourcesCreate),l=N.Vt.hasPermission(g.AccessControlAction.DataSourcesWrite),i=N.Vt.hasPermission(g.AccessControlAction.DataSourcesExplore);return e.createElement(He,{dataSources:a,dataSourcesCount:n,isLoading:t,hasCreateRights:s,hasWriteRights:l,hasExploreRights:i})}function He({dataSources:t,dataSourcesCount:a,isLoading:n,hasCreateRights:s,hasWriteRights:l,hasExploreRights:i}){const r=(0,h.wW)(Ve),u=(0,d.d7)(),y=(0,m.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:!s,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($e,null),e.createElement("ul",{className:r.list},t.map(f=>{const P=T.config.appSubUrl+u.Edit.replace(/:uid/gi,f.uid);return e.createElement("li",{key:f.uid},e.createElement(v.Z,{href:l?P:void 0},e.createElement(v.Z.Heading,null,f.name),e.createElement(v.Z.Figure,null,e.createElement("img",{src:f.typeLogoUrl,alt:"",height:"40px",width:"40px",className:r.logo})),e.createElement(v.Z.Meta,null,[f.typeName,f.url,f.isDefault&&e.createElement(Re.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/${f.uid}`,onClick:()=>{(0,C.hJ)({grafana_version:T.config.buildInfo.version,datasource_uid:f.uid,plugin_name:f.typeName,path:y.pathname})}},"Build a dashboard"),i&&e.createElement(D.Qj,{icon:"compass",fill:"outline",variant:"secondary",className:r.button,href:(0,ne.iU)(f),onClick:()=>{(0,C.U4)({grafana_version:T.config.buildInfo.version,datasource_uid:f.uid,plugin_name:f.typeName,path:y.pathname})}},"Explore"))))})))}const Ve=t=>({list:(0,c.css)({listStyle:"none",display:"grid"}),logo:(0,c.css)({objectFit:"contain"}),button:(0,c.css)({marginLeft:t.spacing(2)})});function je(){const a=(0,g.useSelector)(({dataSources:n})=>(0,d.r7)(n))>0?e.createElement(Ze,null):void 0;return e.createElement(E.T,{navId:"connections-datasources",actions:a},e.createElement(E.T.Contents,null,e.createElement(Fe,null)))}var se=o(42997),ze=o(30235),ke=o(73624);function Ke({uid:t}){(0,d.E)(t);const a=(0,g.useDispatch)(),n=(0,g.useSelector)(u=>u.dataSources.dataSource),s=(0,g.useSelector)(u=>u.plugins.dashboards),l=(0,g.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))},r=({uid:u})=>{a((0,se.fG)(u))};return e.createElement(Qe,{dashboards:s,isLoading:l,onImportDashboard:i,onRemoveDashboard:r})}const Qe=({isLoading:t,dashboards:a,onImportDashboard:n,onRemoveDashboard:s})=>t?e.createElement(k.Z,null):e.createElement(ke.Z,{dashboards:a,onImport:n,onRemove:s});var re=o(21691);function Y(t){const{uid:a}=(0,m.UO)(),n=(0,m.TH)(),s=(0,re.wl)(a),l=(0,b.bJ)(s.type),i=new URLSearchParams(n.search),r=(0,re.MF)(a,t||i.get("page"));return{navId:"connections-datasources",pageNav:{...r.main,text:s.name,subTitle:`Type: ${l?.name}`,children:(r.main.children||[]).map(y=>({...y,url:y.url?.replace("datasources/edit/","/connections/datasources/edit/")}))},dataSourceHeader:r.dataSourceHeader}}function Ge(){const{uid:t}=(0,m.UO)(),{navId:a,pageNav:n}=Y("dashboards");return e.createElement(E.T,{navId:a,pageNav:n},e.createElement(E.T.Contents,null,e.createElement(Ke,{uid:t})))}var X=o(89949),Je=o(84714),Ye=o(15766),ce=o(61576),Xe=o(10864),qe=o(82123),_e=o(5933),O=o(74639),le=o(48024),et=o(42074);function tt({dataSourceName:t,isDefault:a,onDefaultChange:n,onNameChange:s,alertingSupported:l,disabled:i}){return e.createElement(e.Fragment,null,!T.config.featureToggles.dataSourcePageHeader&&e.createElement(at,{enabled:l}),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(ae.I,{id:"basic-settings-name",type:"text",value:t,placeholder:"Name",onChange:r=>s(r.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:r=>{n(r.currentTarget.checked)}})))))}function at({enabled:t}){const a=(0,h.wW)(nt);return e.createElement("div",{className:a.badge},t?e.createElement(z.C,{color:"green",icon:"check-circle",text:"Alerting supported"}):e.createElement(z.C,{color:"orange",icon:"exclamation-triangle",text:"Alerting not supported"}))}const nt=t=>({badge:(0,c.css)` margin-bottom: ${t.spacing(2)}; `});function ot({canSave:t,canDelete:a,onDelete:n,onSubmit:s,onTest:l}){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:s,"data-testid":O.wl.pages.DataSource.saveAndTest},"Save & test"),!t&&e.createElement(D.zx,{variant:"primary",onClick:l},"Test"))}var st=o(47494),rt=o(74273),ct=o(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!==st.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},(s,l)=>s?null:e.createElement(F.b,{title:`Configure your ${a} data source below`,severity:"info",bottomSpacing:4,onRemove:()=>{l(!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(F.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:s}=t,l=!n&&s,i=()=>history.back();return e.createElement(e.Fragment,null,n&&e.createElement(ie,null),e.createElement("div",{className:"gf-form-button-row"},l&&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(F.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:s})=>s===a);return n?e.createElement(n.body,{plugin:t,query:{}}):e.createElement("div",null,"Page not found: ",n)}var ft=o(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,X.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)(),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,X.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 ht=o(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=o(9848);const yt=(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}; `}),de=({title:t,exploreUrl:a,dataSourceId:n,onDashboardLinkClicked:s})=>{const l=(0,h.l4)(),r=yt(l,!!t),u=N.Vt.hasPermission(g.AccessControlAction.DataSourcesExplore);return e.createElement("div",{className:r.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:s},"building a dashboard"),", or by querying data in the"," ",e.createElement(ue.r,{"aria-label":"Explore data",className:(0,c.cx)("external-link",{[`${r.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 s=Ct(t?.status??"error"),l=t?.message,i=t?.details?.message,r=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 l?e.createElement("div",{className:"gf-form-group p-t-2"},e.createElement(F.b,{severity:s,title:l,"aria-label":O.wl.pages.DataSource.alert},t?.details&&e.createElement(e.Fragment,null,i,s==="success"?e.createElement(de,{title:l,exploreUrl:a,dataSourceId:n.uid,onDashboardLinkClicked:u}):null,r?e.createElement("details",{style:{whiteSpace:"pre-wrap"}},String(r)):null))):null}function me({uid:t,pageId:a}){(0,d.E)(t);const n=(0,g.useDispatch)(),s=(0,d.wl)(t),l=(0,d.Qs)(s.type),i=(0,d._l)(),r=(0,d.YY)(t),u=(0,d.Rz)(t),y=(0,d.q6)(),f=(0,d.hw)(t),P=(0,d.qj)(),M=A=>n((0,d.yr)(A)),Z=A=>n((0,d.BX)(A)),H=A=>n((0,d.rl)(A));return e.createElement(Nt,{pageId:a,dataSource:s,dataSourceMeta:l,dataSourceSettings:i,dataSourceRights:r,exploreUrl:u,onDelete:y,onDefaultChange:M,onNameChange:Z,onOptionsChange:H,onTest:f,onUpdate:P})}function Nt({pageId:t,dataSource:a,dataSourceMeta:n,dataSourceSettings:s,dataSourceRights:l,exploreUrl:i,onDelete:r,onDefaultChange:u,onNameChange:y,onOptionsChange:f,onTest:P,onUpdate:M}){const{plugin:Z,loadError:H,testingStatus:A,loading:q}=s,{readOnly:B,hasWriteRights:V,hasDeleteRights:S}=l,_=a.id>0,j=(0,Xe.F)()?.getInstanceSettings(a.uid),kt=!!(j?.meta?.alerting??!1),Kt=j?.type==="alertmanager",Qt=kt||Kt,he=async W=>{W.preventDefault(),(0,C.ij)("save_and_test");try{await M({...a}),(0,C.aL)({item:"success"}),_e.Z.publish(new Je.Ix)}catch{(0,C.aL)({item:"fail"});return}P()},Gt=(0,e.useMemo)(()=>{const W=["grafana-pdc-app","grafana-auth-app"],K=Ye.y.DataSourceConfig,{extensions:ee}=(0,qe.QK)({extensionPointId:K});return ee.filter(Jt=>W.includes(Jt.pluginId))},[]);return H?e.createElement(dt,{dataSourceRights:l,onDelete:()=>{(0,C.ij)("delete"),r()}}):q?e.createElement(k.Z,null):!_||!j?null:t?e.createElement(ce.n,{instanceSettings:j},e.createElement(pt,{pageId:t,plugin:Z})):e.createElement("form",{onSubmit:he},!V&&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:Qt,disabled:B||!V}),Z&&e.createElement(ce.n,{instanceSettings:j},e.createElement(Et,{plugin:Z,dataSource:a,dataSourceMeta:n,onModelChange:f})),Gt.map(W=>{const K=W.component;return e.createElement("div",{key:W.id},e.createElement(K,{context:{dataSource:(0,X.omit)(a,["secureJsonData"]),dataSourceMeta:n,testingStatus:A,setJsonData:ee=>f({...a,jsonData:{...a.jsonData,...ee}})}}))}),e.createElement(xt,{testingStatus:A,exploreUrl:i,dataSource:a}),e.createElement(ot,{onSubmit:he,onDelete:()=>{(0,C.ij)("delete"),r()},onTest:()=>{(0,C.ij)("test"),P()},canDelete:!B&&S,canSave:!B&&V}))}function ge({uid:t}){const a=(0,d.wl)(t),n=N.Vt.hasPermission(g.AccessControlAction.DataSourcesExplore);return e.createElement(e.Fragment,null,n&&e.createElement(D.Qj,{variant:"secondary",size:"sm",href:(0,ne.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(z.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,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 At({uid:t,pageId:a}){const{navId:n,pageNav:s,dataSourceHeader:l}=Y(),i=bt({dataSourcePluginName:s.dataSourcePluginName,alertingSupported:l.alertingSupported});return e.createElement(E.T,{navId:n,pageNav:s,renderTitle:r=>e.createElement(Pt,{title:r}),info:i,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,m.UO)(),a=(0,m.TH)(),s=new URLSearchParams(a.search).get("page"),l=T.config.featureToggles.dataSourcePageHeader,{navId:i,pageNav:r}=Y();return l?e.createElement(It,{uid:t,pageId:s}):e.createElement(E.T,{navId:i,pageNav:r,actions:e.createElement(ge,{uid:t})},e.createElement(E.T.Contents,null,e.createElement(me,{uid:t,pageId:s})))}var wt=o(33716),Mt=o(86064),pe=o(59390),Ot=o(64022),fe=o(97918);function Zt(){const t=(0,b.UQ)(),{isLoading:a}=(0,b.ZV)(),n=(0,h.wW)(Bt);return a||t.length===0?null:e.createElement(Mt.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:s=>e.createElement("div",{className:n.wrapper},e.createElement(Ot.Lh,{spacing:"sm",justify:"flex-start",align:"center"},e.createElement("strong",null,s.pluginId),e.createElement(fe.o,{status:Rt(s.errorCode),className:n.badge})))})))}function Rt(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,c.css)({listStyleType:"circle"}),wrapper:(0,c.css)({marginTop:t.spacing(1)}),badge:(0,c.css)({marginTop:0})}}function Wt({onClick:t,dataSourcePlugin:a}){const n=a.module==="phantom",s=!n&&!a.unlicensed,l=a.info?.links?.length>0?a.info.links[0]:null,i=l?.target??"_blank",r=(0,h.wW)(Ut);return e.createElement(v.Z,{className:(0,c.cx)(r.card,"card-parent"),onClick:s?t:()=>{}},e.createElement(v.Z.Heading,{className:r.heading,"aria-label":O.wl.pages.AddDataSource.dataSourcePluginsV2(a.name)},a.name),e.createElement(v.Z.Figure,{align:"center",className:r.figure},e.createElement("img",{className:r.logo,src:a.info.logos.small,alt:""})),e.createElement(v.Z.Description,{className:r.description},a.info.description),!n&&e.createElement(v.Z.Meta,{className:r.meta},e.createElement(fe.o,{status:a.signature})),e.createElement(v.Z.Actions,{className:r.actions},l&&e.createElement(D.Qj,{"aria-label":`${a.name}, learn more.`,href:`${l.url}?utm_source=grafana_add_ds`,onClick:u=>u.stopPropagation(),rel:"noopener",target:i,variant:"secondary"},l.name)))}function Ut(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(pe.a,{items:t,getItemKey:n=>n.id.toString(),renderItem:n=>e.createElement(Wt,{dataSourcePlugin:n,onClick:()=>a(n)}),className:(0,c.css)` > li { margin-bottom: 2px; } `})}function $t({categories:t,onClickDataSourceType:a}){const n=`${p.Z.AddNewConnection}?cat=data-source`;return e.createElement(e.Fragment,null,t.map(({id:s,title:l,plugins:i})=>e.createElement("div",{className:"add-data-source-category",key:s},e.createElement("div",{className:"add-data-source-category__header",id:s},l),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 Ft(){(0,d.OU)();const t=(0,g.useDispatch)(),a=(0,g.useSelector)(u=>(0,d.I5)(u.dataSources)),n=(0,g.useSelector)(u=>u.dataSources.dataSourceTypeSearchQuery),s=(0,g.useSelector)(u=>u.dataSources.isLoadingDataSourcePlugins),l=(0,g.useSelector)(u=>u.dataSources.categories),i=(0,d.nH)(),r=u=>t((0,d.Ht)(u));return e.createElement(Ht,{dataSources:a,dataSourceCategories:l,searchQuery:n,isLoading:s,onAddDataSource:i,onSetSearchQuery:r})}function Ht({dataSources:t,dataSourceCategories:a,searchQuery:n,isLoading:s,onAddDataSource:l,onSetSearchQuery:i}){const r=(0,d.d7)();return s?e.createElement(k.Z,null):e.createElement(e.Fragment,null,e.createElement("div",{className:"page-action-bar"},e.createElement(wt.H,{value:n,onChange:i,placeholder:"Filter by name or type"}),e.createElement("div",{className:"page-action-bar__spacer"}),e.createElement(D.Qj,{href:r.List,fill:"outline",variant:"secondary",icon:"arrow-left"},"Cancel")),!n&&e.createElement(Zt,null),e.createElement("div",null,n&&e.createElement(Ee,{dataSourcePlugins:t,onClickDataSourceType:l}),!n&&e.createElement($t,{categories:a,onClickDataSourceType:l})))}function Vt(){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(Ft,null)))}function jt(){const{search:t}=(0,m.TH)();return e.createElement(m.l_,{to:{pathname:p.Z.AddNewConnection,search:t}})}function zt(){const a=!!(0,g.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(m.rs,null,e.createElement(m.AW,{exact:!0,sensitive:!0,path:p.Z.Base,component:()=>e.createElement(m.l_,{to:p.Z.AddNewConnection})}),e.createElement(m.AW,{exact:!0,sensitive:!0,path:p.Z.DataSources,component:je}),e.createElement(m.AW,{exact:!0,sensitive:!0,path:p.Z.DataSourcesNew,component:Vt}),e.createElement(m.AW,{exact:!0,sensitive:!0,path:p.Z.DataSourcesDetails,component:Me}),e.createElement(m.AW,{exact:!0,sensitive:!0,path:p.Z.DataSourcesEdit,component:Lt}),e.createElement(m.AW,{exact:!0,sensitive:!0,path:p.Z.DataSourcesDashboards,component:Ge}),!a&&e.createElement(m.AW,{exact:!0,sensitive:!0,path:p.Z.AddNewConnection,component:Le}),e.createElement(m.AW,{exact:!0,path:p.Z.ConnectDataOutdated,component:jt}),e.createElement(m.l_,{from:`${p.Z.Base}/your-connections/:page`,to:`${p.Z.Base}/:page`}),e.createElement(m.l_,{from:p.Z.YourConnectionsOutdated,to:p.Z.DataSources}),e.createElement(m.AW,{component:()=>e.createElement(m.l_,{to:"/notfound"})})))}},90741:(Q,L,o)=>{o.d(L,{u:()=>g});var e=o(27702),m=o(9232),d=o(25357);const g=E=>{const c=p(E.state);return c?e.createElement(d.C,{className:E.className,color:c.color,title:c.tooltip,text:c.text,icon:c.icon}):null};function p(E){switch(E){case m.BV.deprecated:return{text:"Deprecated",color:"red",tooltip:"This feature is deprecated and will be removed in a future release"};case m.BV.alpha:return{text:"Alpha",color:"blue",tooltip:"This feature is experimental and future updates might not be backward compatible"};case m.BV.beta:return{text:"Beta",color:"blue",tooltip:"This feature is close to complete but not fully tested"};default:return null}}}}]); //# sourceMappingURL=Connections.97562febb348a76626df.js.map