"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2154],{72557:(ne,k,s)=>{s.d(k,{A:()=>y});var e=s(96540),g=s(14186),u=s(67647),m=s(55852),p=s(73725);class y extends e.PureComponent{render(){const{searchQuery:N,linkButton:E,setSearchQuery:R,target:x,placeholder:B="Search by name or type",sortPicker:A}=this.props,M={href:E?.href,disabled:E?.disabled};return x&&(M.target=x),e.createElement("div",{className:"page-action-bar"},e.createElement(g.I,{grow:!0},e.createElement(u.Z,{value:N,onChange:R,placeholder:B})),A&&e.createElement(p.r,{onChange:A.onChange,value:A.value,getSortOptions:A.getSortOptions}),E&&e.createElement(m.z9,{...M},E.title))}}},73725:(ne,k,s)=>{s.d(k,{r:()=>N});var e=s(96540),g=s(16817),u=s(88323),m=s(14578),p=s(53477),y=s(24439);const c=()=>(0,y.getGrafanaSearcher)().getSortOptions();function N({onChange:E,value:R,placeholder:x,filter:B,getSortOptions:A,isClearable:M}){const H=(0,g.A)(async()=>{const z=await(A??c)();return B?z.filter(j=>B.includes(j.value)):z},[A,B]);if(H.loading)return null;const f=!!(R?.includes("desc")||R?.startsWith("-"));return e.createElement(u.l6,{key:R,width:28,onChange:E,value:H.value?.find(z=>z.value===R)??null,options:H.value,"aria-label":"Sort",placeholder:x??`Sort (Default ${p.r4.label})`,prefix:e.createElement(m.I,{name:f?"sort-amount-down":"sort-amount-up"}),isClearable:M})}},39774:(ne,k,s)=>{s.r(k),s.d(k,{default:()=>qt});var e=s(96540),g=s(24180),u=s(85464),m=s(80348),p=s(6320),y=s(36830),c=s(32196),N=s(43429),E=s(40845),R=s(39558),x=s(10096),B=s(83277),A=s(44836),M=s(83391),H=s(71259),f=s(10860),z=s(50691);const j=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)})}),Ce=({items:t,onClickItem:a})=>{const n=(0,E.of)(j);return e.createElement(H.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(z.fk,null)):null)))};var V=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;
  `}),be=({iconName:t,label:a})=>{const n=(0,E.of)(Ne);return e.createElement("div",{className:n.categoryHeader},e.createElement(V.I,{name:t,size:"xl"}),e.createElement("h3",{className:n.categoryLabel},a))};var xe=s(37390),D=s(55852);const se=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)(se);return e.createElement(xe.a,{className:o.modal,contentClassName:o.modalContent,title:e.createElement(Ae,{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(V.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(D.$n,{onClick:n},"Okay"))))}function Ae({item:t}){const a=(0,E.of)(se);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,c.css)`
    text-align: center;
    padding: 50px 0;
    font-style: italic;
  `}),Ie=()=>{const t=(0,E.of)(Te);return e.createElement("p",{className:t.noResults},"No results matching your query were found.")};var oe=s(10354);const Le=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)})}),Me=(0,A.t)("connections.search.placeholder","Search all"),$e=({onChange:t,value:a})=>{const n=(0,E.of)(Le);return e.createElement("div",{className:n.searchContainer},e.createElement(oe.p,{value:a,onChange:t,prefix:e.createElement(V.I,{name:"search"}),placeholder:Me,"aria-label":"Search all"}))},Re=t=>({spacer:(0,c.css)({height:t.spacing(2)}),modal:(0,c.css)({width:"500px"}),modalContent:(0,c.css)({overflow:"visible"})});function we(){const[t,a]=(0,B.s)(),n=t.search?String(t.search):"",[o,r]=(0,e.useState)(!1),[i,l]=(0,e.useState)(null),d=(0,E.of)(Re),v=x.TP.hasPermission(m.AccessControlAction.DataSourcesCreate),T=h=>{a({search:h.currentTarget.value.toLowerCase()})},{error:S,plugins:b,isLoading:I}=(0,M.PW)({keyword:n,type:N.QE.datasource}),F=(0,e.useMemo)(()=>b.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})),[b]),P=(h,Y)=>{v||(h.preventDefault(),h.stopPropagation(),Z(Y))},Z=h=>{r(!0),l(h)},$=()=>{r(!1),l(null)},L=(0,e.useMemo)(()=>!I&&!S&&b.length<1,[I,S,b]),G=(0,A.t)("connections.connect-data.category-header-label","Data sources");return e.createElement(e.Fragment,null,i&&e.createElement(Pe,{item:i,isOpen:o,onDismiss:$}),e.createElement($e,{onChange:T,value:n}),e.createElement("div",{className:d.spacer}),e.createElement(be,{iconName:"database",label:G}),I?e.createElement(R._,{text:"Loading..."}):S?e.createElement("p",null,"Error: ",S.message):e.createElement(Ce,{items:F,onClickItem:P}),L&&e.createElement(Ie,null))}function Be(){return e.createElement(y.Y,{navId:"connections-add-new-connection"},e.createElement(y.Y.Contents,null,e.createElement(we,null)))}var U=s(42418),re=s(39938),Oe=s(93418);function Fe(){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(Oe.V,{pluginId:a,navId:r,notFoundComponent:e.createElement(ke,null),notFoundNavModel:{text:"Unknown datasource",subTitle:"No datasource with this ID could be found.",active:!0}})}function ke(){const{id:t}=(0,g.g)();return e.createElement(U.F,{severity:m.AppNotificationSeverity.Warning,title:""},"Maybe you mistyped the URL or the plugin with the id ",e.createElement(re.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 ze(){const t=x.TP.hasPermission(m.AccessControlAction.DataSourcesCreate),a=(0,u.aM)();return t?e.createElement(D.z9,{icon:"plus",href:w.$.appSubUrl+a.New},e.createElement(A.x6,{i18nKey:"data-sources.datasource-add-button.label"},"Add new data source")):null}var Ue=s(7521),C=s(4589),K=s(70255),Ze=s(78369),We=s(67061),ce=s(11959);function J({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(D.z9,{icon:"apps",fill:"outline",variant:"secondary",href:`dashboard/new-with-ds/${t.uid}`,onClick:()=>{(0,C.TR)({grafana_version:w.$.buildInfo.version,datasource_uid:t.uid,plugin_name:t.typeName,path:location.pathname})}},"Build a dashboard"),n&&e.createElement(D.z9,{icon:"compass",fill:"outline",variant:"secondary",className:i.button,href:(0,ce.h)(t),onClick:()=>{(0,C.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)(Ke);return e.createElement(f.Z,null,e.createElement(f.Z.Heading,null,e.createElement(K.A,{width:140})),e.createElement(f.Z.Figure,null,e.createElement(K.A,{width:40,height:40,containerClassName:a.figure})),e.createElement(f.Z.Meta,null,e.createElement(K.A,{width:120})),e.createElement(f.Z.Tags,null,e.createElement(We.B,{direction:"row",gap:2},e.createElement(K.A,{height:32,width:179,containerClassName:a.button}),t&&e.createElement(K.A,{height:32,width:107,containerClassName:a.button}))))}J.Skeleton=He;const Ke=()=>({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 X="alpha-asc",le="alpha-desc",Ge=[{label:"Sort by A\u2013Z",value:X},{label:"Sort by Z\u2013A",value:le}];function Qe(){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===X)),[t]),r=(0,m.useSelector)(({dataSources:l})=>(0,u.lv)(l)),i={onChange:o,value:r?X:le,getSortOptions:()=>Promise.resolve(Ge)};return e.createElement(Ve.A,{searchQuery:n,setSearchQuery:a,key:"action-bar",sortPicker:i})}function je(){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=x.TP.hasPermission(m.AccessControlAction.DataSourcesCreate),r=x.TP.hasPermission(m.AccessControlAction.DataSourcesWrite),i=x.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)(Xe),d=(0,u.aM)(),v=(0,g.zy)();if((0,e.useEffect)(()=>{(0,C.kg)({grafana_version:w.$.buildInfo.version,path:v.pathname})},[v]),!n&&a===0)return e.createElement(Ue.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 T=()=>n?new Array(20).fill(null).map((S,b)=>e.createElement(J.Skeleton,{key:b,hasExploreRights:i})):t.map(S=>e.createElement("li",{key:S.uid},e.createElement(J,{dataSource:S,hasWriteRights:r,hasExploreRights:i})));return e.createElement(e.Fragment,null,e.createElement(Qe,null),e.createElement("ul",{className:l.list},T()))}const Xe=t=>({list:(0,c.css)({listStyle:"none",display:"grid"})});function qe(){const a=(0,m.useSelector)(({dataSources:n})=>(0,u.wC)(n))>0?e.createElement(ze,null):void 0;return e.createElement(y.Y,{navId:"connections-datasources",actions:a},e.createElement(y.Y.Contents,null,e.createElement(je,null)))}var q=s(39419),ie=s(3673),_e=s(20701),et=s(38348);function tt({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,_e.h9)())},[a,n.id]);const i=(d,v)=>{a((0,ie.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,ie.TA)(d))};return e.createElement(at,{dashboards:o,isLoading:r,onImportDashboard:i,onRemoveDashboard:l})}const at=({isLoading:t,dashboards:a,onImportDashboard:n,onRemoveDashboard:o})=>t?e.createElement(q.A,null):e.createElement(et.A,{dashboards:a,onImport:n,onRemove:o});var de=s(19347),ue=s(17422),_=s(11084),ee=s(74984);function me(t){const{uid:a}=(0,g.g)(),n=(0,g.zy)(),o=(0,_.xw)(a),r=(0,_.S4)(o.type),i=(0,M.ob)(o.type),l=new URLSearchParams(n.search),d=t||l.get("page"),{plugin:v,loadError:T,loading:S}=(0,_._e)(),b=(0,de.l)()?.getInstanceSettings(a),I=!!(b?.meta?.alerting??!1),F=b?.type==="alertmanager",P=I||F,Z=(0,m.useSelector)(h=>h.navIndex),$=d?`datasource-${d}-${a}`:`datasource-settings-${a}`;let L={node:{text:"Data Source Nav Node"},main:{text:"Data Source Nav Node"}};if(T){const h={text:T,subTitle:"Data Source Error",icon:"exclamation-triangle"};L={node:h,main:h}}return(S||!v)&&(L=(0,ue.tc)(Z,$,(0,ee.$m)("settings"))),v&&(L=(0,ue.tc)(Z,$,(0,ee.Vh)((0,ee.R4)(o,v),d||"settings"))),{navId:"connections-datasources",pageNav:{...L.main,dataSourcePluginName:i?.name||v?.meta.name||"",active:!0,text:o.name,subTitle:`Type: ${r.name}`,children:(L.main.children||[]).map(h=>({...h,url:h.url?.replace("datasources/edit/","/connections/datasources/edit/")}))},dataSourceHeader:{alertingSupported:P}}}function nt(){const{uid:t}=(0,g.g)(),{navId:a,pageNav:n}=me("dashboards");return e.createElement(y.Y,{navId:a,pageNav:n},e.createElement(y.Y.Contents,null,e.createElement(tt,{uid:t})))}var te=s(2543),st=s(69129),ot=s(74135),ge=s(76287),rt=s(4402),ct=s(28138),O=s(13544),pe=s(14186),lt=s(15292);function it({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(pe.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},e.createElement(oe.p,{id:"basic-settings-name",type:"text",value:t,placeholder:"Name",onChange:i=>o(i.currentTarget.value),required:!0,"data-testid":O.Tp.pages.DataSource.name}))),e.createElement(pe.I,{label:"Default",labelWidth:8,disabled:r},e.createElement(lt.K,{id:"basic-settings-default",value:a,onChange:i=>{n(i.currentTarget.checked)}})))))}function ta({enabled:t}){const a=useStyles2(dt);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 dt=t=>({badge:css`
    margin-bottom: ${t.spacing(2)};
  `});function ut({canSave:t,canDelete:a,onDelete:n,onSubmit:o,onTest:r}){return e.createElement("div",{className:"gf-form-button-row"},e.createElement(D.$n,{type:"button",variant:"destructive",disabled:!a,onClick:n,"data-testid":O.Tp.pages.DataSource.delete},"Delete"),t&&e.createElement(D.$n,{type:"submit",variant:"primary",disabled:!t,onClick:o,"data-testid":O.Tp.pages.DataSource.saveAndTest},"Save & test"),!t&&e.createElement(D.$n,{variant:"primary",onClick:r},"Test"))}var mt=s(61268),gt=s(61680),pt=s(2913);const ht="datasources.settings.cloudInfoBox.isDismissed";function ft({dataSource:t}){let a="",n="";if(t.readOnly||(t.version??0)>2||pt.$W.buildInfo.edition!==mt.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(gt.b,{storageKey:ht,defaultValue:!1},(o,r)=>o?null:e.createElement(U.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 Et="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 he(){return e.createElement(U.F,{"data-testid":O.Tp.pages.DataSource.readOnly,severity:"info",title:"Provisioned data source"},Et)}function vt({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(he,null),e.createElement("div",{className:"gf-form-button-row"},r&&e.createElement(D.$n,{type:"submit",variant:"destructive",onClick:a},"Delete"),e.createElement(D.$n,{variant:"secondary",fill:"outline",type:"button",onClick:i},"Back")))}const St="You are not allowed to modify this data source. Please contact your server admin to update this data source.";function yt(){return e.createElement(U.F,{severity:"info",title:"Missing rights"},St)}function Dt({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 Ct=s(7376);class Nt 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,te.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,Ct.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,te.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 xt({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 fe=s(50720);const Pt=(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};
    `}),Ee=({title:t,exploreUrl:a,dataSourceId:n,onDashboardLinkClicked:o})=>{const r=(0,E.$j)(),l=Pt(r,!!t),d=x.TP.hasPermission(m.AccessControlAction.DataSourcesExplore);return e.createElement("div",{className:l.content},"Next, you can start to visualize data by"," ",e.createElement(fe.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(fe.N,{"aria-label":"Explore data",className:(0,c.cx)("external-link",{[`${l.disabled}`]:!d,"test-disabled":!d}),href:a},"Explore view"),".")};Ee.displayName="AlertSuccessMessage";const At=new Set(["success","info","warning","error"]),Tt=t=>At.has(t),It=t=>t.toLowerCase()==="ok"?"success":Tt(t)?t:"info";function Lt({testingStatus:t,exploreUrl:a,dataSource:n}){const o=It(t?.status??"error"),r=t?.message,i=t?.details?.message,l=t?.details?.verboseMessage,d=()=>{(0,C.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(U.F,{severity:o,title:r,"data-testid":O.Tp.pages.DataSource.alert},t?.details&&e.createElement(e.Fragment,null,i,o==="success"?e.createElement(Ee,{title:r,exploreUrl:a,dataSourceId:n.uid,onDashboardLinkClicked:d}):null,l?e.createElement("details",{style:{whiteSpace:"pre-wrap"}},String(l)):null))):null}function Mt({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)(),T=(0,u.BY)(t),S=(0,u.k9)(),b=P=>n((0,u.C_)(P)),I=P=>n((0,u.rb)(P)),F=P=>n((0,u.jz)(P));return e.createElement($t,{pageId:a,dataSource:o,dataSourceMeta:r,dataSourceSettings:i,dataSourceRights:l,exploreUrl:d,onDelete:v,onDefaultChange:b,onNameChange:I,onOptionsChange:F,onTest:T,onUpdate:S})}function $t({pageId:t,dataSource:a,dataSourceMeta:n,dataSourceSettings:o,dataSourceRights:r,exploreUrl:i,onDelete:l,onDefaultChange:d,onNameChange:v,onOptionsChange:T,onTest:S,onUpdate:b}){const{plugin:I,loadError:F,testingStatus:P,loading:Z}=o,{readOnly:$,hasWriteRights:L,hasDeleteRights:G}=r,h=a.id>0,Y=(0,de.l)()?.getInstanceSettings(a.uid),De=async W=>{W.preventDefault(),(0,C._i)("save_and_test");try{await b({...a}),(0,C.m3)({item:"success"}),ct.A.publish(new st.wE)}catch{(0,C.m3)({item:"fail"});return}S()},_t=(0,e.useMemo)(()=>{const W=["grafana-pdc-app","grafana-auth-app"],Q=ot.S.DataSourceConfig,{extensions:ae}=(0,rt.Dp)({extensionPointId:Q});return ae.filter(ea=>W.includes(ea.pluginId))},[]);return F?e.createElement(vt,{dataSourceRights:r,onDelete:()=>{(0,C._i)("delete"),l()}}):Z?e.createElement(q.A,null):!h||!Y?null:t?e.createElement(ge.p,{instanceSettings:Y},e.createElement(Dt,{pageId:t,plugin:I})):e.createElement("form",{onSubmit:De},!L&&e.createElement(yt,null),$&&e.createElement(he,null),n.state&&e.createElement(xt,{state:n.state}),e.createElement(ft,{dataSource:a}),e.createElement(it,{dataSourceName:a.name,isDefault:a.isDefault,onDefaultChange:d,onNameChange:v,disabled:$||!L}),I&&e.createElement(ge.p,{instanceSettings:Y},e.createElement(Nt,{plugin:I,dataSource:a,dataSourceMeta:n,onModelChange:T})),_t.map(W=>{const Q=W.component;return e.createElement("div",{key:W.id},e.createElement(Q,{context:{dataSource:(0,te.omit)(a,["secureJsonData"]),dataSourceMeta:n,testingStatus:P,setJsonData:ae=>T({...a,jsonData:{...a.jsonData,...ae}})}}))}),e.createElement(Lt,{testingStatus:P,exploreUrl:i,dataSource:a}),e.createElement(ut,{onSubmit:De,onDelete:()=>{(0,C._i)("delete"),l()},onTest:()=>{(0,C._i)("test"),S()},canDelete:!$&&G,canSave:!$&&L}))}function Rt({uid:t}){const a=(0,u.xw)(t),n=x.TP.hasPermission(m.AccessControlAction.DataSourcesExplore);return e.createElement(e.Fragment,null,n&&e.createElement(D.z9,{variant:"secondary",size:"sm",href:(0,ce.h)(a),onClick:()=>{(0,C._i)("explore"),(0,C.M1)({grafana_version:w.$.buildInfo.version,datasource_uid:a.uid,plugin_name:a.typeName,path:location.pathname})}},"Explore data"),e.createElement(D.z9,{size:"sm",variant:"secondary",href:`dashboard/new-with-ds/${a.uid}`,onClick:()=>{(0,C._i)("build_a_dashboard"),(0,C.TR)({grafana_version:w.$.buildInfo.version,datasource_uid:a.uid,plugin_name:a.typeName,path:location.pathname})}},"Build a dashboard"))}const wt=t=>{const a=[],n=t.alertingSupported;return a.push({label:"Type",value:t.dataSourcePluginName}),a.push({label:"Alerting",value:e.createElement(re.E,{color:n?"green":"red",text:n?"Supported":"Not supported"})}),a};function Bt({title:t}){const a=(0,E.of)(Ot);return e.createElement("div",{className:a.container},e.createElement("h1",{className:a.title},t))}const Ot=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 Ft({uid:t,pageId:a}){const{navId:n,pageNav:o,dataSourceHeader:r}=me(),i=wt({dataSourcePluginName:o.dataSourcePluginName,alertingSupported:r.alertingSupported});return e.createElement(y.Y,{navId:n,pageNav:o,renderTitle:l=>e.createElement(Bt,{title:l}),info:i,actions:e.createElement(Rt,{uid:t})},e.createElement(y.Y.Contents,null,e.createElement(Mt,{uid:t,pageId:a})))}const kt=Ft;function zt(){const{uid:t}=(0,g.g)(),a=(0,g.zy)(),o=new URLSearchParams(a.search).get("page");return e.createElement(kt,{uid:t,pageId:o})}var Ut=s(67647),ve=s(33552),Zt=s(66864),Se=s(98624);function Wt({filterByPluginType:t}){let a=(0,M.F9)(t);const{isLoading:n}=(0,M.m5)(),o=(0,E.of)(Kt);return n||a.length===0?null:e.createElement(U.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":O.Tp.pages.PluginsList.signatureErrorNotice,severity:"warning"},e.createElement("p",null,"The following plugins are disabled and not shown in the list below:"),e.createElement(ve.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(Se.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(V.I,{name:"book"})," Read more about plugin signing"))}function Ht(t){switch(t){case N.ZK.invalidSignature:return N.Ac.invalid;case N.ZK.missingSignature:return N.Ac.missing;case N.ZK.modifiedSignature:return N.Ac.modified;default:return N.Ac.missing}}function Kt(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":O.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(Se.B,{status:a.signature})),e.createElement(f.Z.Actions,{className:l.actions},r&&e.createElement(D.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 ye({dataSourcePlugins:t,onClickDataSourceType:a}){return!t||!t.length?null:e.createElement(ve.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 Gt({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(ye,{dataSourcePlugins:i,onClickDataSourceType:a}))),e.createElement("div",{className:"add-data-source-more"},e.createElement(D.z9,{variant:"secondary",href:n,target:"_self",rel:"noopener"},"Find more data source plugins")))}function Qt(){(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(jt,{dataSources:a,dataSourceCategories:r,searchQuery:n,isLoading:o,onAddDataSource:i,onSetSearchQuery:l})}function jt({dataSources:t,dataSourceCategories:a,searchQuery:n,isLoading:o,onAddDataSource:r,onSetSearchQuery:i}){const l=(0,u.aM)();return o?e.createElement(q.A,null):e.createElement(e.Fragment,null,e.createElement("div",{className:"page-action-bar"},e.createElement(Ut.Z,{value:n,onChange:i,placeholder:"Filter by name or type"}),e.createElement("div",{className:"page-action-bar__spacer"}),e.createElement(D.z9,{href:l.List,fill:"outline",variant:"secondary",icon:"arrow-left"},"Cancel")),!n&&e.createElement(Wt,{filterByPluginType:N.QE.datasource}),e.createElement("div",null,n&&e.createElement(ye,{dataSourcePlugins:t,onClickDataSourceType:r}),!n&&e.createElement(Gt,{categories:a,onClickDataSourceType:r})))}function Jt(){return e.createElement(y.Y,{navId:"connections-datasources",pageNav:{text:"Add data source",subTitle:"Choose a data source type",active:!0}},e.createElement(y.Y.Contents,null,e.createElement(Qt,null)))}function Xt(){const{search:t}=(0,g.zy)();return e.createElement(g.rd,{to:{pathname:p.b.AddNewConnection,search:t}})}function qt(){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:qe}),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:Fe}),e.createElement(g.qh,{exact:!0,sensitive:!0,path:p.b.DataSourcesEdit,component:zt}),e.createElement(g.qh,{exact:!0,sensitive:!0,path:p.b.DataSourcesDashboards,component:nt}),!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:Xt}),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.b53c715b9b9a782d8647.js.map