"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[4253],{"./public/app/features/datasources/NewDataSourcePage.tsx":(e,a,s)=>{s.r(a),s.d(a,{default:()=>L,getNavModel:()=>N});var r,t,n,i,o,c=s("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js"),l=s("./.yarn/__virtual__/react-redux-virtual-7ad20a440e/3/opt/drone/yarncache/react-redux-npm-7.2.6-134f5ed64d-0bf142ce0d.zip/node_modules/react-redux/es/index.js"),u=s("./packages/grafana-ui/src/index.ts"),d=s("./.yarn/__virtual__/@emotion-css-virtual-72c314ddb1/3/opt/drone/yarncache/@emotion-css-npm-11.7.1-25ff8755a7-ac1f56656f.zip/node_modules/@emotion/css/dist/emotion-css.esm.js"),p=s("./packages/grafana-e2e-selectors/src/index.ts"),g=s("./public/app/core/components/Page/Page.tsx"),m=s("./public/app/features/datasources/state/actions.ts"),h=s("./public/app/features/datasources/state/selectors.ts"),f=s("./public/app/features/datasources/state/reducers.ts"),x=s("./public/app/features/plugins/admin/state/hooks.ts"),y=s("./packages/grafana-data/src/index.ts"),S=s("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/jsx-runtime.js");function b(){const e=(0,x.UQ)(),{isLoading:a}=(0,x.ZV)(),s=(0,u.useTheme)();return a||0===e.length?null:(0,S.jsx)(u.InfoBox,{"aria-label":p.wl.pages.PluginsList.signatureErrorNotice,severity:"warning",urlTitle:"Read more about plugin signing",url:"https://grafana.com/docs/grafana/latest/plugins/plugin-signatures/",children:(0,S.jsxs)("div",{children:[r||(r=(0,S.jsx)("p",{children:"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:",(0,S.jsx)(u.List,{items:e,className:d.css`
            list-style-type: circle;
          `,renderItem:e=>(0,S.jsx)("div",{className:d.css`
                margin-top: ${s.spacing.sm};
              `,children:(0,S.jsxs)(u.HorizontalGroup,{spacing:"sm",justify:"flex-start",align:"center",children:[(0,S.jsx)("strong",{children:e.pluginId}),(0,S.jsx)(u.PluginSignatureBadge,{status:v(e.errorCode),className:d.css`
                    margin-top: 0;
                  `})]})})})]})})}function v(e){switch(e){case y.PluginErrorCode.invalidSignature:return y.PluginSignatureStatus.invalid;case y.PluginErrorCode.missingSignature:return y.PluginSignatureStatus.missing;case y.PluginErrorCode.modifiedSignature:return y.PluginSignatureStatus.modified;default:return y.PluginSignatureStatus.missing}}function P(e,a,s){return a in e?Object.defineProperty(e,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[a]=s,e}const j={addDataSource:m.J_,loadDataSourcePlugins:m.Kj,setDataSourceTypeSearchQuery:f.Ht},C=(0,l.connect)((function(e){return{navModel:N(),plugins:(0,h.xo)(e.dataSources),searchQuery:e.dataSources.dataSourceTypeSearchQuery,categories:e.dataSources.categories,isLoading:e.dataSources.isLoadingDataSources}}),j);class _ extends c.PureComponent{constructor(){super(...arguments),P(this,"onDataSourceTypeClicked",(e=>{this.props.addDataSource(e)})),P(this,"onSearchQueryChange",(e=>{this.props.setDataSourceTypeSearchQuery(e)})),P(this,"onLearnMoreClick",(e=>{e.stopPropagation()}))}componentDidMount(){this.props.loadDataSourcePlugins()}renderPlugins(e,a){return e&&e.length?(0,S.jsx)(u.List,{items:e,className:d.css`
          > li {
            margin-bottom: 2px;
          }
        `,getItemKey:e=>e.id.toString(),renderItem:e=>(0,S.jsx)(D,{plugin:e,onClick:()=>this.onDataSourceTypeClicked(e),onLearnMoreClick:this.onLearnMoreClick}),"aria-labelledby":a}):null}renderCategories(){const{categories:e}=this.props;return(0,S.jsxs)(S.Fragment,{children:[e.map((e=>(0,S.jsxs)("div",{className:"add-data-source-category",children:[(0,S.jsx)("div",{className:"add-data-source-category__header",id:e.id,children:e.title}),this.renderPlugins(e.plugins,e.id)]},e.id))),t||(t=(0,S.jsx)("div",{className:"add-data-source-more",children:(0,S.jsx)(u.LinkButton,{variant:"secondary",href:"https://grafana.com/plugins?type=datasource&utm_source=grafana_add_ds",target:"_blank",rel:"noopener",children:"Find more data source plugins on grafana.com"})}))]})}render(){const{navModel:e,isLoading:a,searchQuery:s,plugins:r}=this.props;return(0,S.jsx)(g.Z,{navModel:e,children:(0,S.jsxs)(g.Z.Contents,{isLoading:a,children:[(0,S.jsxs)("div",{className:"page-action-bar",children:[(0,S.jsx)(u.FilterInput,{value:s,onChange:this.onSearchQueryChange,placeholder:"Filter by name or type"}),n||(n=(0,S.jsx)("div",{className:"page-action-bar__spacer"})),i||(i=(0,S.jsx)(u.LinkButton,{href:"datasources",fill:"outline",variant:"secondary",icon:"arrow-left",children:"Cancel"}))]}),!s&&(o||(o=(0,S.jsx)(b,{}))),(0,S.jsxs)("div",{children:[s&&this.renderPlugins(r),!s&&this.renderCategories()]})]})})}}const D=e=>{var a,s;const{plugin:r,onLearnMoreClick:t}=e,n="phantom"===r.module,i=n||r.unlicensed?()=>{}:e.onClick,o=(null===(a=r.info)||void 0===a||null===(s=a.links)||void 0===s?void 0:s.length)>0?r.info.links[0]:null,c=(0,u.useStyles2)(k);return(0,S.jsxs)(u.Card,{className:(0,d.cx)(c.card,"card-parent"),onClick:i,children:[(0,S.jsx)(u.Card.Heading,{className:c.heading,"aria-label":p.wl.pages.AddDataSource.dataSourcePluginsV2(r.name),children:r.name}),(0,S.jsx)(u.Card.Figure,{align:"center",className:c.figure,children:(0,S.jsx)("img",{className:c.logo,src:r.info.logos.small,alt:""})}),(0,S.jsx)(u.Card.Description,{className:c.description,children:r.info.description}),!n&&(0,S.jsx)(u.Card.Meta,{className:c.meta,children:(0,S.jsx)(u.PluginSignatureBadge,{status:r.signature})}),(0,S.jsx)(u.Card.Actions,{className:c.actions,children:o&&(0,S.jsx)(u.LinkButton,{variant:"secondary",href:`${o.url}?utm_source=grafana_add_ds`,target:"_blank",rel:"noopener",onClick:t,icon:"external-link-alt","aria-label":`${r.name}, learn more.`,children:o.name})})]})};function k(e){return{heading:(0,d.css)({fontSize:e.v1.typography.heading.h5,fontWeight:"inherit"}),figure:(0,d.css)({width:"inherit",marginRight:"0px","> img":{width:e.spacing(7)}}),meta:(0,d.css)({marginTop:"6px",position:"relative"}),description:(0,d.css)({margin:"0px",fontSize:e.typography.size.sm}),actions:(0,d.css)({position:"relative",alignSelf:"center",marginTop:"0px",opacity:0,".card-parent:hover &, .card-parent:focus-within &":{opacity:1}}),card:(0,d.css)({gridTemplateAreas:'\n      "Figure   Heading   Actions"\n      "Figure Description Actions"\n      "Figure    Meta     Actions"\n      "Figure     -       Actions"'}),logo:(0,d.css)({marginRight:e.v1.spacing.lg,marginLeft:e.v1.spacing.sm,width:e.spacing(7),maxHeight:e.spacing(7)})}}function N(){const e={icon:"database",id:"datasource-new",text:"Add data source",href:"datasources/new",subTitle:"Choose a data source type"};return{main:e,node:e}}const L=C(_)},"./public/app/features/plugins/admin/state/hooks.ts":(e,a,s)=>{s.d(a,{iY:()=>M,bt:()=>N,ZV:()=>k,GE:()=>v,UQ:()=>j,bJ:()=>P,x3:()=>C,IS:()=>L,y9:()=>D,S1:()=>_,wq:()=>w});var r=s("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js"),t=s("./.yarn/__virtual__/react-redux-virtual-7ad20a440e/3/opt/drone/yarncache/react-redux-npm-7.2.6-134f5ed64d-0bf142ce0d.zip/node_modules/react-redux/es/index.js"),n=s("./public/app/features/plugins/admin/state/reducer.ts"),i=s("./public/app/features/plugins/admin/state/actions.ts"),o=s("../../opt/drone/yarncache/reselect-npm-4.1.5-bc046e41ae-54c13c1e79.zip/node_modules/reselect/es/index.js"),c=s("./public/app/features/plugins/admin/types.ts");const l=e=>e.plugins,u=(0,o.P1)(l,(e=>{let{items:a}=e;return a})),d=(0,o.P1)(l,(e=>{let{settings:a}=e;return a.displayMode})),{selectAll:p,selectById:g}=n.CD.getSelectors(u),m=(e,a)=>(0,o.P1)((e=>(0,o.P1)(p,(a=>a.filter((a=>"installed"===e?a.isInstalled:!a.isCore)))))(e),(e=>e.filter((e=>"all"===a||e.type===a)))),h=(e,a,s)=>(0,o.P1)(m(a,s),(e=>(0,o.P1)(p,(a=>""===e?[]:a.filter((a=>{const s=[];return a.name&&s.push(a.name.toLowerCase()),a.orgName&&s.push(a.orgName.toLowerCase()),s.some((a=>a.includes(e.toLowerCase())))})))))(e),((a,s)=>""===e?a:s)),f=(0,o.P1)(p,(e=>e?e.filter((e=>Boolean(e.error))).map((e=>({pluginId:e.id,errorCode:e.error}))):[])),x=e=>(0,o.P1)(l,(a=>{let{requests:s={}}=a;return s[e]})),y=e=>(0,o.P1)(x(e),(e=>(null==e?void 0:e.status)===c.eE.Pending)),S=e=>(0,o.P1)(x(e),(e=>(null==e?void 0:e.status)===c.eE.Rejected?null==e?void 0:e.error:null));var b=s("./public/app/features/plugins/admin/helpers.ts");const v=e=>{let{query:a="",filterBy:s="installed",filterByType:r="all",sortBy:n=b.Nh.nameAsc}=e;T();const i=(0,t.useSelector)(h(a,s,r)),{isLoading:o,error:c}=k();return{isLoading:o,error:c,plugins:(0,b.AA)(i,n)}},P=e=>(T(),z(e),(0,t.useSelector)((a=>g(a,e)))),j=()=>(T(),(0,t.useSelector)(f)),C=()=>{const e=(0,t.useDispatch)();return(a,s,r)=>e((0,i.N9)({id:a,version:s,isUpdating:r}))},_=()=>{const e=(0,t.useDispatch)();return a=>e((0,i.Tz)(a))},D=()=>null===(0,t.useSelector)(S(i.tQ.typePrefix)),k=()=>({isLoading:(0,t.useSelector)(y(i.Qd.typePrefix)),error:(0,t.useSelector)(S(i.Qd.typePrefix))}),N=()=>({isLoading:(0,t.useSelector)(y(i.DD.typePrefix)),error:(0,t.useSelector)(S(i.DD.typePrefix))}),L=()=>({isInstalling:(0,t.useSelector)(y(i.N9.typePrefix)),error:(0,t.useSelector)(S(i.N9.typePrefix))}),w=()=>({isUninstalling:(0,t.useSelector)(y(i.Tz.typePrefix)),error:(0,t.useSelector)(S(i.Tz.typePrefix))}),T=()=>{const e=(0,t.useDispatch)(),a=(0,t.useSelector)((s=i.Qd.typePrefix,(0,o.P1)(x(s),(e=>void 0===e))));var s;(0,r.useEffect)((()=>{a&&e((0,i.Qd)())}),[])},z=e=>{const a=(0,t.useDispatch)(),s=(0,t.useSelector)((a=>g(a,e))),n=!(0,t.useSelector)(y(i.DD.typePrefix))&&s&&!s.details;(0,r.useEffect)((()=>{n&&a((0,i.DD)(e))}),[s])},M=()=>{const e=(0,t.useDispatch)();return{displayMode:(0,t.useSelector)(d),setDisplayMode:a=>e((0,n.UC)(a))}}}}]);
//# sourceMappingURL=NewDataSourcePage.cd4ada1146b53ad3284f.js.map