"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8808],{"./public/app/features/library-panels/components/LibraryPanelCard/LibraryPanelCard.tsx":(e,a,t)=>{t.d(a,{p:()=>z});var r=t("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js"),s=t("./.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"),n=t("./packages/grafana-ui/src/index.ts"),o=t("./public/app/features/panel/components/VizTypePicker/PanelTypeCard.tsx"),i=t("./packages/grafana-data/src/index.ts"),l=t("./public/app/features/library-panels/components/LibraryPanelsView/actions.ts"),d=t("./.yarn/__virtual__/@reduxjs-toolkit-virtual-37b359704c/3/opt/drone/yarncache/@reduxjs-toolkit-npm-1.7.1-608aebbd36-77e027b948.zip/node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js");const c={loadingState:i.LoadingState.Loading,dashboardTitles:[]},p=(0,d.PH)("libraryPanels/delete/searchCompleted"),u=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,a=arguments.length>1?arguments[1]:void 0;return p.match(a)?Object.assign({},e,{dashboardTitles:a.payload.dashboards.map((e=>e.title)),loadingState:i.LoadingState.Done}):e};var m=t("./public/app/features/library-panels/state/api.ts");var b,h,g,x,f=t("./public/app/features/library-panels/styles.ts"),j=t("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/jsx-runtime.js");const y=e=>{let{libraryPanel:a,onDismiss:t,onConfirm:s}=e;const o=(0,n.useStyles)(f.J),[{dashboardTitles:d,loadingState:g},x]=(0,r.useReducer)(u,c),y=(0,r.useMemo)((()=>(0,l.tb)(x)),[x]);(0,r.useEffect)((()=>{y(function(e){return async function(a){const t=await(0,m.E8)(e.uid);a(p({dashboards:t}))}}(a))}),[y,a]);const k=Boolean(d.length),_=g===i.LoadingState.Done;return(0,j.jsxs)(n.Modal,{className:o.modal,title:"Delete library panel",icon:"trash-alt",onDismiss:t,isOpen:!0,children:[_?null:b||(b=(0,j.jsx)(v,{})),_?(0,j.jsxs)("div",{children:[k?(0,j.jsx)(P,{dashboardTitles:d}):null,k?null:h||(h=(0,j.jsx)(S,{})),(0,j.jsxs)(n.Modal.ButtonRow,{children:[(0,j.jsx)(n.Button,{variant:"secondary",onClick:t,fill:"outline",children:"Cancel"}),(0,j.jsx)(n.Button,{variant:"destructive",onClick:s,disabled:k,children:"Delete"})]})]}):null]})},v=()=>g||(g=(0,j.jsx)("span",{children:"Loading library panel..."})),S=()=>{const e=(0,n.useStyles)(f.J);return(0,j.jsx)("div",{className:e.modalText,children:"Do you want to delete this panel?"})},P=e=>{let{dashboardTitles:a}=e;const t=(0,n.useStyles)(f.J),r=1===a.length?"dashboard.":"dashboards.",s=`${a.length} ${r}`;return 0===a.length?null:(0,j.jsxs)("div",{children:[(0,j.jsxs)("p",{className:t.textInfo,children:["This library panel can not be deleted because it is connected to ",(0,j.jsx)("strong",{children:s})," Remove the library panel from the dashboards listed below and retry."]}),(0,j.jsxs)("table",{className:t.myTable,children:[x||(x=(0,j.jsx)("thead",{children:(0,j.jsx)("tr",{children:(0,j.jsx)("th",{children:"Dashboard name"})})})),(0,j.jsx)("tbody",{children:a.map(((e,a)=>(0,j.jsx)("tr",{children:(0,j.jsx)("td",{children:e})},`dash-title-${a}`)))})]})]})};var k,_,w=t("./packages/grafana-runtime/src/index.ts"),D=t("./public/app/features/panel/components/PanelPluginError.tsx");const z=e=>{var a;let{libraryPanel:t,onClick:s,onDelete:n,showSecondaryActions:i}=e;const[l,d]=(0,r.useState)(!1),c=null!==(a=w.config.panels[t.model.type])&&void 0!==a?a:(0,D.X)(t.model.type).meta;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o.X,{isCurrent:!1,title:t.name,description:t.description,plugin:c,onClick:()=>null==s?void 0:s(t),onDelete:i?()=>d(!0):void 0,children:(0,j.jsx)(I,{libraryPanel:t})}),l&&(0,j.jsx)(y,{libraryPanel:t,onConfirm:()=>{null==n||n(t),d(!1)},onDismiss:()=>d(!1)})]})};function I(e){let{libraryPanel:a}=e;const t=(0,n.useStyles2)($);return a.meta.folderUid||a.meta.folderName?a.meta.folderUid?(0,j.jsx)("span",{className:t.metaContainer,children:(0,j.jsxs)(n.Link,{href:`/dashboards/f/${a.meta.folderUid}`,children:[_||(_=(0,j.jsx)(n.Icon,{name:"folder-upload",size:"sm"})),(0,j.jsx)("span",{children:a.meta.folderName})]})}):(0,j.jsxs)("span",{className:t.metaContainer,children:[k||(k=(0,j.jsx)(n.Icon,{name:"folder",size:"sm"})),(0,j.jsx)("span",{children:a.meta.folderName})]}):null}function $(e){return{metaContainer:s.css`
      display: flex;
      align-items: center;
      color: ${e.colors.text.secondary};
      font-size: ${e.typography.bodySmall.fontSize};
      padding-top: ${e.spacing(.5)};

      svg {
        margin-right: ${e.spacing(.5)};
        margin-bottom: 3px;
      }
    `}}},"./public/app/features/library-panels/components/LibraryPanelsView/actions.ts":(e,a,t)=>{t.d(a,{Xu:()=>g,UO:()=>x,tb:()=>f});var r=t("../../opt/drone/yarncache/rxjs-npm-7.5.1-ce59cbb6a3-78e3eecb16.zip/node_modules/rxjs/dist/esm5/internal/Subscription.js"),s=t("../../opt/drone/yarncache/rxjs-npm-7.5.1-ce59cbb6a3-78e3eecb16.zip/node_modules/rxjs/dist/esm5/internal/observable/from.js"),n=t("../../opt/drone/yarncache/rxjs-npm-7.5.1-ce59cbb6a3-78e3eecb16.zip/node_modules/rxjs/dist/esm5/internal/observable/of.js"),o=t("../../opt/drone/yarncache/rxjs-npm-7.5.1-ce59cbb6a3-78e3eecb16.zip/node_modules/rxjs/dist/esm5/internal/observable/merge.js"),i=t("../../opt/drone/yarncache/rxjs-npm-7.5.1-ce59cbb6a3-78e3eecb16.zip/node_modules/rxjs/dist/esm5/internal/observable/timer.js"),l=t("../../opt/drone/yarncache/rxjs-npm-7.5.1-ce59cbb6a3-78e3eecb16.zip/node_modules/rxjs/dist/esm5/internal/operators/mergeMap.js"),d=t("../../opt/drone/yarncache/rxjs-npm-7.5.1-ce59cbb6a3-78e3eecb16.zip/node_modules/rxjs/dist/esm5/internal/operators/catchError.js"),c=t("../../opt/drone/yarncache/rxjs-npm-7.5.1-ce59cbb6a3-78e3eecb16.zip/node_modules/rxjs/dist/esm5/internal/operators/finalize.js"),p=t("../../opt/drone/yarncache/rxjs-npm-7.5.1-ce59cbb6a3-78e3eecb16.zip/node_modules/rxjs/dist/esm5/internal/operators/share.js"),u=t("../../opt/drone/yarncache/rxjs-npm-7.5.1-ce59cbb6a3-78e3eecb16.zip/node_modules/rxjs/dist/esm5/internal/operators/mapTo.js"),m=t("../../opt/drone/yarncache/rxjs-npm-7.5.1-ce59cbb6a3-78e3eecb16.zip/node_modules/rxjs/dist/esm5/internal/operators/takeUntil.js"),b=t("./public/app/features/library-panels/state/api.ts"),h=t("./public/app/features/library-panels/components/LibraryPanelsView/reducer.ts");function g(e){return function(a){const t=new r.w0,g=(0,s.D)((0,b.Pq)({searchString:e.searchString,perPage:e.perPage,page:e.page,excludeUid:e.currentPanelId,sortDirection:e.sortDirection,typeFilter:e.panelFilter,folderFilter:e.folderFilter})).pipe((0,l.z)((e=>{let{perPage:a,elements:t,page:r,totalCount:s}=e;return(0,n.of)((0,h.zK)({libraryPanels:t,page:r,perPage:a,totalCount:s}))})),(0,d.K)((a=>(console.error(a),(0,n.of)((0,h.zK)(Object.assign({},h.p$,{page:e.page,perPage:e.perPage})))))),(0,c.x)((()=>t.unsubscribe())),(0,p.B)());t.add((0,o.T)((0,i.H)(50).pipe((0,u.h)((0,h.xU)()),(0,m.R)(g)),g).subscribe(a))}}function x(e,a){return async function(t){try{await(0,b.UO)(e),g(a)(t)}catch(e){console.error(e)}}}function f(e){return function(a){return a instanceof Function?a(e):e(a)}}},"./public/app/features/library-panels/components/LibraryPanelsView/reducer.ts":(e,a,t)=>{t.d(a,{p$:()=>n,xU:()=>o,zK:()=>i,oO:()=>l,_p:()=>d});var r=t("./.yarn/__virtual__/@reduxjs-toolkit-virtual-37b359704c/3/opt/drone/yarncache/@reduxjs-toolkit-npm-1.7.1-608aebbd36-77e027b948.zip/node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js"),s=t("./packages/grafana-data/src/index.ts");const n={loadingState:s.LoadingState.Loading,libraryPanels:[],totalCount:0,perPage:40,page:1,numberOfPages:0,currentPanelId:void 0},o=(0,r.PH)("libraryPanels/view/initSearch"),i=(0,r.PH)("libraryPanels/view/searchCompleted"),l=(0,r.PH)("libraryPanels/view/changePage"),d=(e,a)=>{if(o.match(a))return Object.assign({},e,{loadingState:s.LoadingState.Loading});if(i.match(a)){const{libraryPanels:t,page:r,perPage:n,totalCount:o}=a.payload,i=Math.ceil(o/n);return Object.assign({},e,{libraryPanels:t,perPage:n,totalCount:o,loadingState:s.LoadingState.Done,numberOfPages:i,page:r>i?r-1:r})}return l.match(a)?Object.assign({},e,{page:a.payload.page}):e}},"./public/app/features/library-panels/styles.ts":(e,a,t)=>{t.d(a,{J:()=>s});var r=t("./.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");function s(e){return{myTable:r.css`
      max-height: 204px;
      overflow-y: auto;
      margin-top: 11px;
      margin-bottom: 28px;
      border-radius: ${e.border.radius.sm};
      border: 1px solid ${e.colors.bg3};
      background: ${e.colors.bg1};
      color: ${e.colors.textSemiWeak};
      font-size: ${e.typography.size.md};
      width: 100%;

      thead {
        color: #538ade;
        font-size: ${e.typography.size.sm};
      }

      th,
      td {
        padding: 6px 13px;
        height: ${e.spacing.xl};
      }

      tbody > tr:nth-child(odd) {
        background: ${e.colors.bg2};
      }
    `,noteTextbox:r.css`
      margin-bottom: ${e.spacing.xl};
    `,textInfo:r.css`
      color: ${e.colors.textSemiWeak};
      font-size: ${e.typography.size.sm};
    `,dashboardSearch:r.css`
      margin-top: ${e.spacing.md};
    `,modal:r.css`
      width: 500px;
    `,modalText:r.css`
      font-size: ${e.typography.heading.h4};
      color: ${e.colors.link};
      margin-bottom: calc(${e.spacing.d} * 2);
      padding-top: ${e.spacing.d};
    `}}},"./public/app/features/manage-dashboards/DashboardImportPage.tsx":(e,a,t)=>{t.r(a),t.d(a,{default:()=>W});var r=t("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js"),s=t("./.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=t("./.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"),o=t("./packages/grafana-data/src/index.ts"),i=t("./packages/grafana-e2e-selectors/src/index.ts"),l=t("./packages/grafana-runtime/src/index.ts"),d=t("./packages/grafana-ui/src/index.ts"),c=t("./public/app/core/components/Page/Page.tsx"),p=t("./packages/grafana-runtime/src/utils/DataSourceWithBackend.ts"),u=t("./public/app/core/components/Select/FolderPicker.tsx"),m=t("./public/app/features/manage-dashboards/state/reducers.ts"),b=t("./public/app/features/manage-dashboards/services/ValidationSrv.ts");const h=e=>{try{return JSON.parse(e),!0}catch(e){return"Not valid JSON"}},g=e=>{const a=/(^\d+$)|dashboards\/(\d+)/.exec(e);return!(!a||!a[1]&&!a[2])||"Could not find a valid Grafana.com ID"},x=e=>(0,l.getBackendSrv)().get(`/api/dashboards/uid/${e}`).then((e=>`Dashboard named '${null==e?void 0:e.dashboard.title}' in folder '${null==e?void 0:e.meta.folderTitle}' has the same UID`)).catch((e=>(e.isHandled=!0,!0)));var f=t("./public/app/features/library-panels/components/LibraryPanelCard/LibraryPanelCard.tsx"),j=t("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/jsx-runtime.js");function y(e){let{inputs:a,label:t,description:r,folderName:s}=e;const n=(0,d.useStyles2)(v);return Boolean(null==a?void 0:a.length)?(0,j.jsx)("div",{className:n.spacer,children:(0,j.jsx)(d.Field,{label:t,description:r,children:(0,j.jsx)(j.Fragment,{children:a.map(((e,a)=>{const t=`elements[${a}]`,r=e.state===m.KQ.New?Object.assign({},e.model,{meta:Object.assign({},e.model.meta,{folderName:null!=s?s:"General"})}):Object.assign({},e.model);return(0,j.jsx)("div",{className:n.item,children:(0,j.jsx)(f.p,{libraryPanel:r,onClick:()=>{}})},t)}))})})}):null}function v(e){return{spacer:n.css`
      margin-bottom: ${e.spacing(2)};
    `,item:n.css`
      margin-bottom: ${e.spacing(1)};
    `}}const S=["ref"],P=["ref"];var k;function _(e,a){if(null==e)return{};var t,r,s={},n=Object.keys(e);for(r=0;r<n.length;r++)t=n[r],a.indexOf(t)>=0||(s[t]=e[t]);return s}const w=e=>{var a,t,s,n;let{register:o,errors:c,control:h,getValues:g,uidReset:f,inputs:v,initialFolderId:w,onUidReset:I,onCancel:$,onSubmit:C,watch:N}=e;const[F,O]=(0,r.useState)(!1),L=N("dataSources"),T=N("folder");(0,r.useEffect)((()=>{F&&(c.title||c.uid)&&C(g(),{})}),[c,g,F,C]);const U=null!==(a=null==v||null===(t=v.libraryPanels)||void 0===t?void 0:t.filter((e=>e.state===m.KQ.New)))&&void 0!==a?a:[],J=null!==(s=null==v||null===(n=v.libraryPanels)||void 0===n?void 0:n.filter((e=>e.state===m.KQ.Exits)))&&void 0!==s?s:[];return(0,j.jsxs)(j.Fragment,{children:[k||(k=(0,j.jsx)(d.Legend,{children:"Options"})),(0,j.jsx)(d.Field,{label:"Name",invalid:!!c.title,error:c.title&&c.title.message,children:(0,j.jsx)(d.Input,Object.assign({},o("title",{required:"Name is required",validate:async e=>{return await(a=e,t=g().folder.id,b.t.validateNewDashboardName(t,a).then((()=>!0)).catch((e=>{if("EXISTING"===e.type)return e.message})));var a,t}}),{type:"text","data-testid":i.wl.components.ImportDashboardForm.name}))}),(0,j.jsx)(d.Field,{label:"Folder",children:(0,j.jsx)(d.InputControl,{render:e=>{let{}=e,a=_(e.field,S);return(0,j.jsx)(u.E,Object.assign({},a,{enableCreateNew:!0,initialFolderId:w}))},name:"folder",control:h})}),(0,j.jsx)(d.Field,{label:"Unique identifier (UID)",description:"The unique identifier (UID) of a dashboard can be used for uniquely identify a dashboard between multiple Grafana installs. The UID allows having consistent URLs for accessing dashboards so changing the title of a dashboard will not break any bookmarked links to that dashboard.",invalid:!!c.uid,error:c.uid&&c.uid.message,children:(0,j.jsx)(j.Fragment,{children:f?(0,j.jsx)(d.Input,Object.assign({},o("uid",{required:!0,validate:async e=>await x(e)}))):(0,j.jsx)(d.Input,Object.assign({disabled:!0},o("uid",{validate:async e=>await x(e)}),{addonAfter:!f&&(0,j.jsx)(d.Button,{onClick:I,children:"Change uid"})}))})}),v.dataSources&&v.dataSources.map(((e,a)=>{if(e.pluginId===p.hr.type)return null;const t=`dataSources[${a}]`,r=null!=L?L:[];return(0,j.jsx)(d.Field,{label:e.label,invalid:c.dataSources&&!!c.dataSources[a],error:c.dataSources&&c.dataSources[a]&&"A data source is required",children:(0,j.jsx)(d.InputControl,{name:t,render:t=>{var s;let{}=t,n=_(t.field,P);return(0,j.jsx)(l.DataSourcePicker,Object.assign({},n,{noDefault:!0,placeholder:e.info,pluginId:e.pluginId,current:null===(s=r[a])||void 0===s?void 0:s.uid}))},control:h,rules:{required:!0}})},t)})),v.constants&&v.constants.map(((e,a)=>{const t=`constants[${a}]`;return(0,j.jsx)(d.Field,{label:e.label,error:c.constants&&c.constants[a]&&`${e.label} needs a value`,invalid:c.constants&&!!c.constants[a],children:(0,j.jsx)(d.Input,Object.assign({},o(t,{required:!0}),{defaultValue:e.value}))},t)})),(0,j.jsx)(y,{inputs:U,label:"New library panels",description:"List of new library panels that will get imported.",folderName:T.title}),(0,j.jsx)(y,{inputs:J,label:"Existing library panels",description:"List of existing library panels. These panels are not affected by the import.",folderName:T.title}),(0,j.jsxs)(d.HorizontalGroup,{children:[(0,j.jsx)(d.Button,{type:"submit","data-testid":i.wl.components.ImportDashboardForm.submit,variant:D(c),onClick:()=>{O(!0)},children:z(c)}),(0,j.jsx)(d.Button,{type:"reset",variant:"secondary",onClick:$,children:"Cancel"})]})]})};function D(e){return e&&(e.title||e.uid)?"destructive":"primary"}function z(e){return e&&(e.title||e.uid)?"Import (Overwrite)":"Import"}var I,$,C=t("./public/app/features/manage-dashboards/state/actions.ts");function N(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}const F={clearLoadedDashboard:C.ys,importDashboard:C.$j},O=(0,s.connect)((e=>{const a=l.locationService.getSearchObject();return{dashboard:e.importDashboard.dashboard,meta:e.importDashboard.meta,source:e.importDashboard.source,inputs:e.importDashboard.inputs,folder:a.folderId?{id:Number(a.folderId)}:{id:0}}}),F);class L extends r.PureComponent{constructor(){super(...arguments),N(this,"state",{uidReset:!1}),N(this,"onSubmit",(e=>{(0,l.reportInteraction)("dashboard_import_imported"),this.props.importDashboard(e)})),N(this,"onCancel",(()=>{this.props.clearLoadedDashboard()})),N(this,"onUidReset",(()=>{this.setState({uidReset:!0})}))}render(){const{dashboard:e,inputs:a,meta:t,source:r,folder:s}=this.props,{uidReset:n}=this.state;return(0,j.jsxs)(j.Fragment,{children:[r===m.G7.Gcom&&(0,j.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,j.jsx)("div",{children:(0,j.jsxs)(d.Legend,{children:["Importing dashboard from"," ",(0,j.jsx)("a",{href:`https://grafana.com/dashboards/${e.gnetId}`,className:"external-link",target:"_blank",rel:"noreferrer",children:"Grafana.com"})]})}),(0,j.jsx)("table",{className:"filter-table form-inline",children:(0,j.jsxs)("tbody",{children:[(0,j.jsxs)("tr",{children:[I||(I=(0,j.jsx)("td",{children:"Published by"})),(0,j.jsx)("td",{children:t.orgName})]}),(0,j.jsxs)("tr",{children:[$||($=(0,j.jsx)("td",{children:"Updated on"})),(0,j.jsx)("td",{children:(0,o.dateTimeFormat)(t.updatedAt)})]})]})})]}),(0,j.jsx)(d.Form,{onSubmit:this.onSubmit,defaultValues:Object.assign({},e,{constants:[],dataSources:[],elements:[],folder:s}),validateOnMount:!0,validateFieldsOnMount:["title","uid"],validateOn:"onChange",children:e=>{let{register:t,errors:r,control:o,watch:i,getValues:l}=e;return(0,j.jsx)(w,{register:t,errors:r,control:o,getValues:l,uidReset:n,inputs:a,onCancel:this.onCancel,onUidReset:this.onUidReset,onSubmit:this.onSubmit,watch:i,initialFolderId:s.id})}})]})}}const T=O(L);T.displayName="ImportDashboardOverview";var U,J,B,R=t("./public/app/core/app_events.ts"),G=t("./public/app/core/selectors/navModel.ts"),V=t("./public/app/core/actions/cleanUp.ts");function q(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}const A="dashboard_import_loaded",E={fetchGcomDashboard:C.q_,importDashboardJson:C.nQ,cleanUpAction:V.e},M=(0,s.connect)((e=>({navModel:(0,G.h)(e.navIndex,"import",void 0,!0),loadingState:e.importDashboard.state})),E);class H extends r.PureComponent{constructor(e){super(e),q(this,"onFileUpload",(e=>{(0,l.reportInteraction)(A,{import_source:"json_uploaded"});const{importDashboardJson:a}=this.props,t=e.currentTarget.files&&e.currentTarget.files.length>0&&e.currentTarget.files[0];if(t){const e=new FileReader,r=()=>e=>{let t;try{t=JSON.parse(e.target.result)}catch(e){return void R.Z.emit(o.AppEvents.alertError,["Import failed","JSON -> JS Serialization failed: "+e.message])}a(t)};e.onload=r(),e.readAsText(t)}})),q(this,"getDashboardFromJson",(e=>{(0,l.reportInteraction)(A,{import_source:"json_pasted"}),this.props.importDashboardJson(JSON.parse(e.dashboardJson))})),q(this,"getGcomDashboard",(e=>{let a;(0,l.reportInteraction)(A,{import_source:"gcom"});const t=/(^\d+$)|dashboards\/(\d+)/.exec(e.gcomDashboard);t&&t[1]?a=t[1]:t&&t[2]&&(a=t[2]),a&&this.props.fetchGcomDashboard(a)}));const{gcomDashboardId:a}=this.props.queryParams;a&&this.getGcomDashboard({gcomDashboard:a})}componentWillUnmount(){this.props.cleanUpAction({stateSelector:e=>e.importDashboard})}renderImportForm(){const e=X(this.props.theme);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{className:e.option,children:(0,j.jsx)(d.FileUpload,{accept:"application/json",onFileUpload:this.onFileUpload,children:"Upload JSON file"})}),(0,j.jsx)("div",{className:e.option,children:(0,j.jsx)(d.Form,{onSubmit:this.getGcomDashboard,defaultValues:{gcomDashboard:""},children:e=>{let{register:a,errors:t}=e;return(0,j.jsx)(d.Field,{label:"Import via grafana.com",invalid:!!t.gcomDashboard,error:t.gcomDashboard&&t.gcomDashboard.message,children:(0,j.jsx)(d.Input,Object.assign({id:"url-input",placeholder:"Grafana.com dashboard URL or ID",type:"text"},a("gcomDashboard",{required:"A Grafana dashboard URL or ID is required",validate:g}),{addonAfter:U||(U=(0,j.jsx)(d.Button,{type:"submit",children:"Load"}))}))})}})}),(0,j.jsx)("div",{className:e.option,children:(0,j.jsx)(d.Form,{onSubmit:this.getDashboardFromJson,defaultValues:{dashboardJson:""},children:e=>{let{register:a,errors:t}=e;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(d.Field,{label:"Import via panel json",invalid:!!t.dashboardJson,error:t.dashboardJson&&t.dashboardJson.message,children:(0,j.jsx)(d.TextArea,Object.assign({},a("dashboardJson",{required:"Need a dashboard JSON model",validate:h}),{"data-testid":i.wl.components.DashboardImportPage.textarea,id:"dashboard-json-textarea",rows:10}))}),(0,j.jsx)(d.Button,{type:"submit","data-testid":i.wl.components.DashboardImportPage.submit,children:"Load"})]})}})})]})}render(){const{loadingState:e,navModel:a}=this.props;return(0,j.jsx)(c.Z,{navModel:a,children:(0,j.jsxs)(c.Z.Contents,{children:[e===o.LoadingState.Loading&&(J||(J=(0,j.jsx)(d.VerticalGroup,{justify:"center",children:(0,j.jsx)(d.HorizontalGroup,{justify:"center",children:(0,j.jsx)(d.Spinner,{size:32})})}))),[o.LoadingState.Error,o.LoadingState.NotStarted].includes(e)&&this.renderImportForm(),e===o.LoadingState.Done&&(B||(B=(0,j.jsx)(T,{})))]})})}}const K=M((0,d.withTheme2)(H));K.displayName="DashboardImport";const W=K,X=(0,d.stylesFactory)((e=>({option:n.css`
      margin-bottom: ${e.spacing(4)};
    `})))},"./public/app/features/panel/components/VizTypePicker/PanelTypeCard.tsx":(e,a,t)=>{t.d(a,{X:()=>d});t("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js");var r=t("./packages/grafana-data/src/index.ts"),s=t("./packages/grafana-ui/src/index.ts"),n=t("./.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"),o=t("./packages/grafana-e2e-selectors/src/index.ts"),i=t("./public/app/features/plugins/components/PluginStateInfo.tsx"),l=t("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/jsx-runtime.js");const d=e=>{let{isCurrent:a,title:t,plugin:i,onClick:d,onDelete:u,disabled:m,showBadge:b,description:h,children:g}=e;const x=(0,s.useStyles2)(c),f=(0,n.cx)({[x.item]:!0,[x.disabled]:m||i.state===r.PluginState.deprecated,[x.current]:a});return(0,l.jsxs)("div",{className:f,"aria-label":o.wl.components.PluginVisualization.item(i.name),onClick:m?void 0:d,title:a?"Click again to close this section":i.name,children:[(0,l.jsx)("img",{className:x.img,src:i.info.logos.small,alt:""}),(0,l.jsxs)("div",{className:x.itemContent,children:[(0,l.jsx)("div",{className:x.name,children:t}),h?(0,l.jsx)("span",{className:x.description,children:h}):null,g]}),b&&(0,l.jsx)("div",{className:(0,n.cx)(x.badge,m&&x.disabled),children:(0,l.jsx)(p,{plugin:i})}),u&&(0,l.jsx)(s.IconButton,{name:"trash-alt",onClick:e=>{e.stopPropagation(),u()},"aria-label":"Delete button on panel type card"})]})};d.displayName="PanelTypeCard";const c=e=>({item:n.css`
      position: relative;
      display: flex;
      flex-shrink: 0;
      cursor: pointer;
      background: ${e.colors.background.secondary};
      border-radius: ${e.shape.borderRadius()};
      box-shadow: ${e.shadows.z1};
      border: 1px solid ${e.colors.background.secondary};
      align-items: center;
      padding: 8px;
      width: 100%;
      position: relative;
      overflow: hidden;
      transition: ${e.transitions.create(["background"],{duration:e.transitions.duration.short})};

      &:hover {
        background: ${e.colors.emphasize(e.colors.background.secondary,.03)};
      }
    `,itemContent:n.css`
      position: relative;
      width: 100%;
      padding: ${e.spacing(0,1)};
    `,current:n.css`
      label: currentVisualizationItem;
      border: 1px solid ${e.colors.primary.border};
      background: ${e.colors.action.selected};
    `,disabled:n.css`
      opacity: 0.2;
      filter: grayscale(1);
      cursor: default;
      pointer-events: none;
    `,name:n.css`
      text-overflow: ellipsis;
      overflow: hidden;
      font-size: ${e.typography.size.sm};
      font-weight: ${e.typography.fontWeightMedium};
      width: 100%;
    `,description:n.css`
      text-overflow: ellipsis;
      overflow: hidden;
      color: ${e.colors.text.secondary};
      font-size: ${e.typography.bodySmall.fontSize};
      font-weight: ${e.typography.fontWeightLight};
      width: 100%;
    `,img:n.css`
      max-height: 38px;
      width: 38px;
      display: flex;
      align-items: center;
    `,badge:n.css`
      background: ${e.colors.background.primary};
    `}),p=e=>{let{plugin:a}=e;return(0,r.isUnsignedPluginSignature)(a.signature)?(0,l.jsx)(s.PluginSignatureBadge,{status:a.signature}):(0,l.jsx)(i.u,{state:a.state})};p.displayName="PanelPluginBadge"},"./public/app/features/plugins/components/PluginStateInfo.tsx":(e,a,t)=>{t.d(a,{u:()=>o});t("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js");var r=t("./packages/grafana-ui/src/index.ts"),s=t("./packages/grafana-data/src/index.ts"),n=t("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/jsx-runtime.js");const o=e=>{const a=function(e){switch(e){case s.PluginState.deprecated:return{text:"Deprecated",color:"red",tooltip:"This feature is deprecated and will be removed in a future release"};case s.PluginState.alpha:return{text:"Alpha",color:"blue",tooltip:"This feature is experimental and future updates might not be backward compatible"};case s.PluginState.beta:return{text:"Beta",color:"blue",tooltip:"This feature is close to complete but not fully tested"};default:return null}}(e.state);return a?(0,n.jsx)(r.Badge,{color:a.color,title:a.tooltip,text:a.text,icon:a.icon}):null}}}]);
//# sourceMappingURL=DashboardImport.cd4ada1146b53ad3284f.js.map