"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2154],{72557:(V,M,a)=>{a.d(M,{A:()=>S});var e=a(74848),h=a(96540),D=a(14186),l=a(67647),u=a(55852),p=a(73725);class S extends h.PureComponent{render(){const{searchQuery:y,linkButton:v,setSearchQuery:x,target:I,placeholder:B="Search by name or type",sortPicker:C}=this.props,W={href:v?.href,disabled:v?.disabled};return I&&(W.target=I),(0,e.jsxs)("div",{className:"page-action-bar",children:[(0,e.jsx)(D.I,{grow:!0,children:(0,e.jsx)(l.Z,{value:y,onChange:x,placeholder:B})}),C&&(0,e.jsx)(p.r,{onChange:C.onChange,value:C.value,getSortOptions:C.getSortOptions}),v&&(0,e.jsx)(u.z9,{...W,children:v.title})]})}}},34362:(V,M,a)=>{a.r(M),a.d(M,{default:()=>_t});var e=a(74848),h=a(24180),D=a(54148),l=a(85464),u=a(31678),p=a(6320),S=a(21780),r=a(32196),y=a(96540),v=a(43429),x=a(40845),I=a(39558),B=a(69529),C=a(10096),W=a(83277),P=a(8484),U=a(31036),j=a(83391),A=a(71259),m=a(10860),F=a(50691);const ee=t=>({heading:(0,r.css)({fontSize:t.typography.h5.fontSize,fontWeight:"inherit"}),figure:(0,r.css)({width:"inherit",marginRight:"0px","> img":{width:t.spacing(7)}}),meta:(0,r.css)({marginTop:"6px",position:"relative"}),description:(0,r.css)({margin:"0px",fontSize:t.typography.bodySmall.fontSize}),card:(0,r.css)({gridTemplateAreas:`
        "Figure   Heading   Actions"
        "Figure Description Actions"
        "Figure    Meta     Actions"
        "Figure     -       Actions"`}),logo:(0,r.css)({marginRight:t.spacing(3),marginLeft:t.spacing(1),width:t.spacing(7),maxHeight:t.spacing(7)})}),te=({items:t,onClickItem:s})=>{const n=(0,x.of)(ee);return(0,e.jsx)(A.x,{gap:1.5,minColumnWidth:44,children:t.map(o=>(0,e.jsxs)(m.Z,{className:n.card,href:o.url,onClick:i=>{s&&s(i,o)},children:[(0,e.jsx)(m.Z.Heading,{className:n.heading,children:o.name}),(0,e.jsx)(m.Z.Figure,{align:"center",className:n.figure,children:(0,e.jsx)("img",{className:n.logo,src:o.logo,alt:""})}),o.angularDetected?(0,e.jsx)(m.Z.Meta,{className:n.meta,children:(0,e.jsx)(F.fk,{})}):null]},o.id))})};var z=a(14578);const _=t=>({categoryHeader:(0,r.css)`
    align-items: center;
    display: flex;
    margin-bottom: 24px;
  `,categoryLabel:(0,r.css)`
    margin-bottom: 0px;
    margin-left: 8px;
  `}),w=({iconName:t,label:s})=>{const n=(0,x.of)(_);return(0,e.jsxs)("div",{className:n.categoryHeader,children:[(0,e.jsx)(z.I,{name:t,size:"xl"}),(0,e.jsx)("h3",{className:n.categoryLabel,children:s})]})};var ce=a(37390),f=a(55852);const le=t=>({modal:(0,r.css)`
    width: 500px;
  `,modalContent:(0,r.css)`
    overflow: visible;
    color: ${t.colors.text.secondary};

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

//# sourceMappingURL=Connections.1c0ecf1a93b02ea6448c.js.map