"use strict";(globalThis.webpackChunksuperset=globalThis.webpackChunksuperset||[]).push([[8774],{27989:(e,t,a)=>{a.d(t,{Z:()=>m});var l=a(67294),r=a(51995),s=a(55867),n=a(35932),i=a(74069),o=a(4715),d=a(34858),u=a(60972),c=a(11965);const h=r.iK.div`
  display: block;
  color: ${e=>{let{theme:t}=e;return t.colors.grayscale.base}};
  font-size: ${e=>{let{theme:t}=e;return t.typography.sizes.s}}px;
`,p=r.iK.div`
  padding-bottom: ${e=>{let{theme:t}=e;return 2*t.gridUnit}}px;
  padding-top: ${e=>{let{theme:t}=e;return 2*t.gridUnit}}px;

  & > div {
    margin: ${e=>{let{theme:t}=e;return t.gridUnit}}px 0;
  }

  &.extra-container {
    padding-top: 8px;
  }

  .confirm-overwrite {
    margin-bottom: ${e=>{let{theme:t}=e;return 2*t.gridUnit}}px;
  }

  .input-container {
    display: flex;
    align-items: center;

    label {
      display: flex;
      margin-right: ${e=>{let{theme:t}=e;return 2*t.gridUnit}}px;
    }

    i {
      margin: 0 ${e=>{let{theme:t}=e;return t.gridUnit}}px;
    }
  }

  input,
  textarea {
    flex: 1 1 auto;
  }

  textarea {
    height: 160px;
    resize: none;
  }

  input::placeholder,
  textarea::placeholder {
    color: ${e=>{let{theme:t}=e;return t.colors.grayscale.light1}};
  }

  textarea,
  input[type='text'],
  input[type='number'] {
    padding: ${e=>{let{theme:t}=e;return 1.5*t.gridUnit}}px
      ${e=>{let{theme:t}=e;return 2*t.gridUnit}}px;
    border-style: none;
    border: 1px solid ${e=>{let{theme:t}=e;return t.colors.grayscale.light2}};
    border-radius: ${e=>{let{theme:t}=e;return t.gridUnit}}px;

    &[name='name'] {
      flex: 0 1 auto;
      width: 40%;
    }

    &[name='sqlalchemy_uri'] {
      margin-right: ${e=>{let{theme:t}=e;return 3*t.gridUnit}}px;
    }
  }
`,m=e=>{let{resourceName:t,resourceLabel:a,passwordsNeededMessage:r,confirmOverwriteMessage:m,onModelImport:b,show:g,onHide:y,passwordFields:f=[],setPasswordFields:Z=(()=>{}),sshTunnelPasswordFields:_=[],setSSHTunnelPasswordFields:w=(()=>{}),sshTunnelPrivateKeyFields:S=[],setSSHTunnelPrivateKeyFields:v=(()=>{}),sshTunnelPrivateKeyPasswordFields:x=[],setSSHTunnelPrivateKeyPasswordFields:T=(()=>{})}=e;const[k,C]=(0,l.useState)(!0),[P,$]=(0,l.useState)({}),[N,E]=(0,l.useState)(!1),[F,H]=(0,l.useState)(!1),[I,D]=(0,l.useState)([]),[A,M]=(0,l.useState)(!1),[O,U]=(0,l.useState)(),[R,z]=(0,l.useState)({}),[L,B]=(0,l.useState)({}),[K,q]=(0,l.useState)({}),V=()=>{D([]),Z([]),$({}),E(!1),H(!1),M(!1),U(""),w([]),v([]),T([]),z({}),B({}),q({})},{state:{alreadyExists:W,passwordsNeeded:Y,sshPasswordNeeded:j,sshPrivateKeyNeeded:G,sshPrivateKeyPasswordNeeded:X},importResource:J}=(0,d.PW)(t,a,(e=>{U(e)}));(0,l.useEffect)((()=>{Z(Y),Y.length>0&&M(!1)}),[Y,Z]),(0,l.useEffect)((()=>{E(W.length>0),W.length>0&&M(!1)}),[W,E]),(0,l.useEffect)((()=>{w(j),j.length>0&&M(!1)}),[j,w]),(0,l.useEffect)((()=>{v(G),G.length>0&&M(!1)}),[G,v]),(0,l.useEffect)((()=>{T(X),X.length>0&&M(!1)}),[X,T]);return k&&g&&C(!1),(0,c.tZ)(i.Z,{name:"model",className:"import-model-modal",disablePrimaryButton:0===I.length||N&&!F||A,onHandledPrimaryAction:()=>{var e;(null==(e=I[0])?void 0:e.originFileObj)instanceof File&&(M(!0),J(I[0].originFileObj,P,R,L,K,F).then((e=>{e&&(V(),b())})))},onHide:()=>{C(!0),y(),V()},primaryButtonName:N?(0,s.t)("Overwrite"):(0,s.t)("Import"),primaryButtonType:N?"danger":"primary",width:"750px",show:g,title:(0,c.tZ)("h4",null,(0,s.t)("Import %s",a))},(0,c.tZ)(p,null,(0,c.tZ)(o.gq,{name:"modelFile",id:"modelFile",accept:".yaml,.json,.yml,.zip",fileList:I,onChange:e=>{D([{...e.file,status:"done"}])},onRemove:e=>(D(I.filter((t=>t.uid!==e.uid))),!1),customRequest:()=>{},disabled:A},(0,c.tZ)(n.Z,{loading:A},(0,s.t)("Select file")))),O&&(0,c.tZ)(u.Z,{errorMessage:O,showDbInstallInstructions:f.length>0||_.length>0||S.length>0||x.length>0}),(()=>{if(0===f.length&&0===_.length&&0===S.length&&0===x.length)return null;const e=[...new Set([...f,..._,...S,...x])];return(0,c.tZ)(l.Fragment,null,(0,c.tZ)("h5",null,(0,s.t)("Database passwords")),(0,c.tZ)(h,null,r),e.map((e=>(0,c.tZ)(l.Fragment,null,(null==f?void 0:f.indexOf(e))>=0&&(0,c.tZ)(p,{key:`password-for-${e}`},(0,c.tZ)("div",{className:"control-label"},(0,s.t)("%s PASSWORD",e.slice(10)),(0,c.tZ)("span",{className:"required"},"*")),(0,c.tZ)("input",{name:`password-${e}`,autoComplete:`password-${e}`,type:"password",value:P[e],onChange:t=>$({...P,[e]:t.target.value})})),(null==_?void 0:_.indexOf(e))>=0&&(0,c.tZ)(p,{key:`ssh_tunnel_password-for-${e}`},(0,c.tZ)("div",{className:"control-label"},(0,s.t)("%s SSH TUNNEL PASSWORD",e.slice(10)),(0,c.tZ)("span",{className:"required"},"*")),(0,c.tZ)("input",{name:`ssh_tunnel_password-${e}`,autoComplete:`ssh_tunnel_password-${e}`,type:"password",value:R[e],onChange:t=>z({...R,[e]:t.target.value})})),(null==S?void 0:S.indexOf(e))>=0&&(0,c.tZ)(p,{key:`ssh_tunnel_private_key-for-${e}`},(0,c.tZ)("div",{className:"control-label"},(0,s.t)("%s SSH TUNNEL PRIVATE KEY",e.slice(10)),(0,c.tZ)("span",{className:"required"},"*")),(0,c.tZ)("textarea",{name:`ssh_tunnel_private_key-${e}`,autoComplete:`ssh_tunnel_private_key-${e}`,value:L[e],onChange:t=>B({...L,[e]:t.target.value})})),(null==x?void 0:x.indexOf(e))>=0&&(0,c.tZ)(p,{key:`ssh_tunnel_private_key_password-for-${e}`},(0,c.tZ)("div",{className:"control-label"},(0,s.t)("%s SSH TUNNEL PRIVATE KEY PASSWORD",e.slice(10)),(0,c.tZ)("span",{className:"required"},"*")),(0,c.tZ)("input",{name:`ssh_tunnel_private_key_password-${e}`,autoComplete:`ssh_tunnel_private_key_password-${e}`,type:"password",value:K[e],onChange:t=>q({...K,[e]:t.target.value})}))))))})(),N?(0,c.tZ)(l.Fragment,null,(0,c.tZ)(p,null,(0,c.tZ)("div",{className:"confirm-overwrite"},m),(0,c.tZ)("div",{className:"control-label"},(0,s.t)('Type "%s" to confirm',(0,s.t)("OVERWRITE"))),(0,c.tZ)("input",{id:"overwrite",type:"text",onChange:e=>{var t,a;const l=null!=(t=null==(a=e.currentTarget)?void 0:a.value)?t:"";H(l.toUpperCase()===(0,s.t)("OVERWRITE"))}}))):null)}},83556:(e,t,a)=>{a.d(t,{P:()=>c});var l=a(67294),r=a(51995),s=a(59361),n=a(58593),i=a(11965);const o=(0,r.iK)(s.Z)`
  ${e=>{let{theme:t}=e;return`\n  margin-top: ${t.gridUnit}px;\n  margin-bottom: ${t.gridUnit}px;\n  font-size: ${t.typography.sizes.s}px;\n  `}};
`,d=e=>{let{name:t,id:a,index:r,onDelete:s,editable:d=!1,onClick:u}=e;const c=(0,l.useMemo)((()=>t.length>20),[t]),h=(0,i.tZ)(l.Fragment,null,d?(0,i.tZ)(o,{key:a,closable:d,onClose:()=>r?null==s?void 0:s(r):null,color:"blue"},c?`${t.slice(0,20)}...`:t):(0,i.tZ)(o,{role:"link",key:a,onClick:u},a?(0,i.tZ)("a",{href:`/superset/all_entities/?tags=${t}`,target:"_blank",rel:"noreferrer"},c?`${t.slice(0,20)}...`:t):c?`${t.slice(0,20)}...`:t));return c?(0,i.tZ)(n.u,{title:t,key:t},h):h},u=r.iK.div`
  max-width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
`,c=e=>{let{tags:t,editable:a=!1,onDelete:r,maxTags:s}=e;const[n,o]=(0,l.useState)(s),c=e=>{null==r||r(e)},h=(0,l.useMemo)((()=>n?t.length>n:null),[t.length,n]),p=(0,l.useMemo)((()=>"number"==typeof n?t.length-n+1:null),[h,t.length,n]);return(0,i.tZ)(u,{className:"tag-list"},h&&"number"==typeof n?(0,i.tZ)(l.Fragment,null,t.slice(0,n-1).map(((e,t)=>(0,i.tZ)(d,{id:e.id,key:e.id,name:e.name,index:t,onDelete:c,editable:a}))),t.length>n?(0,i.tZ)(d,{name:`+${p}...`,onClick:()=>o(void 0)}):null):(0,i.tZ)(l.Fragment,null,t.map(((e,t)=>(0,i.tZ)(d,{id:e.id,key:e.id,name:e.name,index:t,onDelete:c,editable:a}))),s&&t.length>s?(0,i.tZ)(d,{name:"...",onClick:()=>o(s)}):null))}},18510:(e,t,a)=>{a.r(t),a.d(t,{default:()=>M});var l,r=a(55867),s=a(51995),n=a(93185),i=a(31069),o=a(67294),d=a(73727),u=a(15926),c=a.n(u),h=a(91877),p=a(40768),m=a(34858),b=a(19259),g=a(83556),y=a(32228),f=a(38703),Z=a(86074),_=a(18782),w=a(61337),S=a(14114),v=a(34581),x=a(70163),T=a(17198),k=a(36674),C=a(20818),P=a(58593),$=a(27989),N=a(79789),E=a(60718),F=a(65043);!function(e){e.PUBLISHED="published",e.DRAFT="draft"}(l||(l={}));var H=a(11965);const I=(0,r.t)('The passwords for the databases below are needed in order to import them together with the dashboards. Please note that the "Secure Extra" and "Certificate" sections of the database configuration are not present in export files, and should be added manually after the import if they are needed.'),D=(0,r.t)("You are importing one or more dashboards that already exist. Overwriting might cause you to lose some of your work. Are you sure you want to overwrite?"),A=s.iK.div`
  color: ${e=>{let{theme:t}=e;return t.colors.grayscale.base}};
`,M=(0,S.ZP)((function(e){const{addDangerToast:t,addSuccessToast:a,user:{userId:s}}=e,{state:{loading:u,resourceCount:S,resourceCollection:M,bulkSelectEnabled:O},setResourceCollection:U,hasPerm:R,fetchData:z,toggleBulkSelect:L,refreshData:B}=(0,m.Yi)("dashboard",(0,r.t)("dashboard"),t),K=(0,o.useMemo)((()=>M.map((e=>e.id))),[M]),[q,V]=(0,m.NE)("dashboard",K,t),[W,Y]=(0,o.useState)(null),[j,G]=(0,o.useState)(null),[X,J]=(0,o.useState)(!1),[Q,ee]=(0,o.useState)([]),[te,ae]=(0,o.useState)(!1),[le,re]=(0,o.useState)([]),[se,ne]=(0,o.useState)([]),[ie,oe]=(0,o.useState)([]),de=(0,w.OH)(null==s?void 0:s.toString(),null),ue=R("can_write"),ce=R("can_write"),he=R("can_write"),pe=R("can_export")&&(0,h.c)(n.T.VERSIONED_EXPORT),me=[{id:"changed_on_delta_humanized",desc:!0}];function be(e){Y(e)}function ge(e){return i.Z.get({endpoint:`/api/v1/dashboard/${e.id}`}).then((e=>{let{json:t={}}=e;U(M.map((e=>{var a;if(e.id===(null==t||null==(a=t.result)?void 0:a.id)){const{changed_by_name:a,changed_by:l,dashboard_title:r="",slug:s="",json_metadata:n="",changed_on_delta_humanized:i,url:o="",certified_by:d="",certification_details:u="",owners:c,tags:h}=t.result;return{...e,changed_by_name:a,changed_by:l,dashboard_title:r,slug:s,json_metadata:n,changed_on_delta_humanized:i,url:o,certified_by:d,certification_details:u,owners:c,tags:h}}return e})))}),(0,p.v$)((e=>t((0,r.t)("An error occurred while fetching dashboards: %s",e)))))}const ye=e=>{const t=e.map((e=>{let{id:t}=e;return t}));(0,y.Z)("dashboard",t,(()=>{ae(!1)})),ae(!0)},fe=(0,o.useMemo)((()=>[{Cell:e=>{let{row:{original:{id:t}}}=e;return s&&(0,H.tZ)(k.Z,{itemId:t,saveFaveStar:q,isStarred:V[t]})},Header:"",id:"id",disableSortBy:!0,size:"xs",hidden:!s},{Cell:e=>{let{row:{original:{url:t,dashboard_title:a,certified_by:l,certification_details:r}}}=e;return(0,H.tZ)(d.rU,{to:t},l&&(0,H.tZ)(o.Fragment,null,(0,H.tZ)(N.Z,{certifiedBy:l,details:r})," "),a)},Header:(0,r.t)("Title"),accessor:"dashboard_title"},{Cell:e=>{let{row:{original:{changed_by_name:t}}}=e;return(0,H.tZ)(o.Fragment,null,t)},Header:(0,r.t)("Modified by"),accessor:"changed_by.first_name",size:"xl"},{Cell:e=>{let{row:{original:{status:t}}}=e;return t===l.PUBLISHED?(0,r.t)("Published"):(0,r.t)("Draft")},Header:(0,r.t)("Status"),accessor:"published",size:"xl"},{Cell:e=>{let{row:{original:{changed_on_delta_humanized:t}}}=e;return(0,H.tZ)("span",{className:"no-wrap"},t)},Header:(0,r.t)("Modified"),accessor:"changed_on_delta_humanized",size:"xl"},{Cell:e=>{let{row:{original:{created_by:t}}}=e;return t?`${t.first_name} ${t.last_name}`:""},Header:(0,r.t)("Created by"),accessor:"created_by",disableSortBy:!0,size:"xl"},{Cell:e=>{let{row:{original:{owners:t=[]}}}=e;return(0,H.tZ)(v.Z,{users:t})},Header:(0,r.t)("Owners"),accessor:"owners",disableSortBy:!0,size:"xl"},{Cell:e=>{let{row:{original:{tags:t=[]}}}=e;return(0,H.tZ)(g.P,{tags:t.filter((e=>"TagTypes.custom"===e.type||1===e.type)),maxTags:3})},Header:(0,r.t)("Tags"),accessor:"tags",disableSortBy:!0,hidden:!(0,h.c)(n.T.TAGGING_SYSTEM)},{Cell:e=>{let{row:{original:l}}=e;return(0,H.tZ)(A,{className:"actions"},he&&(0,H.tZ)(b.Z,{title:(0,r.t)("Please confirm"),description:(0,H.tZ)(o.Fragment,null,(0,r.t)("Are you sure you want to delete")," ",(0,H.tZ)("b",null,l.dashboard_title),"?"),onConfirm:()=>(0,p.Iu)(l,B,a,t)},(e=>(0,H.tZ)(P.u,{id:"delete-action-tooltip",title:(0,r.t)("Delete"),placement:"bottom"},(0,H.tZ)("span",{role:"button",tabIndex:0,className:"action-button",onClick:e},(0,H.tZ)(x.Z.Trash,null))))),pe&&(0,H.tZ)(P.u,{id:"export-action-tooltip",title:(0,r.t)("Export"),placement:"bottom"},(0,H.tZ)("span",{role:"button",tabIndex:0,className:"action-button",onClick:()=>ye([l])},(0,H.tZ)(x.Z.Share,null))),ce&&(0,H.tZ)(P.u,{id:"edit-action-tooltip",title:(0,r.t)("Edit"),placement:"bottom"},(0,H.tZ)("span",{role:"button",tabIndex:0,className:"action-button",onClick:()=>be(l)},(0,H.tZ)(x.Z.EditAlt,null))))},Header:(0,r.t)("Actions"),id:"actions",hidden:!ce&&!he&&!pe,disableSortBy:!0}]),[s,ce,he,pe,q,V,B,a,t]),Ze=(0,o.useMemo)((()=>({Header:(0,r.t)("Favorite"),key:"favorite",id:"id",urlDisplay:"favorite",input:"select",operator:_.p.dashboardIsFav,unfilteredLabel:(0,r.t)("Any"),selects:[{label:(0,r.t)("Yes"),value:!0},{label:(0,r.t)("No"),value:!1}]})),[]),_e=(0,o.useMemo)((()=>{const a=[{Header:(0,r.t)("Search"),key:"search",id:"dashboard_title",input:"search",operator:_.p.titleOrSlug},{Header:(0,r.t)("Owner"),key:"owner",id:"owners",input:"select",operator:_.p.relationManyMany,unfilteredLabel:(0,r.t)("All"),fetchSelects:(0,p.tm)("dashboard","owners",(0,p.v$)((e=>t((0,r.t)("An error occurred while fetching dashboard owner values: %s",e)))),e.user),paginate:!0},{Header:(0,r.t)("Created by"),key:"created_by",id:"created_by",input:"select",operator:_.p.relationOneMany,unfilteredLabel:(0,r.t)("All"),fetchSelects:(0,p.tm)("dashboard","created_by",(0,p.v$)((e=>t((0,r.t)("An error occurred while fetching dashboard created by values: %s",e)))),e.user),paginate:!0},{Header:(0,r.t)("Status"),key:"published",id:"published",input:"select",operator:_.p.equals,unfilteredLabel:(0,r.t)("Any"),selects:[{label:(0,r.t)("Published"),value:!0},{label:(0,r.t)("Draft"),value:!1}]},...s?[Ze]:[],{Header:(0,r.t)("Certified"),key:"certified",id:"id",urlDisplay:"certified",input:"select",operator:_.p.dashboardIsCertified,unfilteredLabel:(0,r.t)("Any"),selects:[{label:(0,r.t)("Yes"),value:!0},{label:(0,r.t)("No"),value:!1}]}];return(0,h.c)(n.T.TAGGING_SYSTEM)&&a.push({Header:(0,r.t)("Tags"),key:"tags",id:"tags",input:"select",operator:_.p.dashboardTags,unfilteredLabel:(0,r.t)("All"),fetchSelects:E.m}),a}),[t,Ze,e.user]),we=[{desc:!1,id:"dashboard_title",label:(0,r.t)("Alphabetical"),value:"alphabetical"},{desc:!0,id:"changed_on_delta_humanized",label:(0,r.t)("Recently modified"),value:"recently_modified"},{desc:!1,id:"changed_on_delta_humanized",label:(0,r.t)("Least recently modified"),value:"least_recently_modified"}],Se=(0,o.useCallback)((e=>(0,H.tZ)(F.Z,{dashboard:e,hasPerm:R,bulkSelectEnabled:O,showThumbnails:de?de.thumbnails:(0,h.c)(n.T.THUMBNAILS),userId:s,loading:u,openDashboardEditModal:be,saveFavoriteStatus:q,favoriteStatus:V[e.id],handleBulkDashboardExport:ye,onDelete:e=>G(e)})),[O,V,R,u,s,q,de]),ve=[];return(he||pe)&&ve.push({name:(0,r.t)("Bulk select"),buttonStyle:"secondary","data-test":"bulk-select",onClick:L}),ue&&(ve.push({name:(0,H.tZ)(o.Fragment,null,(0,H.tZ)("i",{className:"fa fa-plus"})," ",(0,r.t)("Dashboard")),buttonStyle:"primary",onClick:()=>{window.location.assign("/dashboard/new")}}),(0,h.c)(n.T.VERSIONED_EXPORT)&&ve.push({name:(0,H.tZ)(P.u,{id:"import-tooltip",title:(0,r.t)("Import dashboards"),placement:"bottomRight"},(0,H.tZ)(x.Z.Import,null)),buttonStyle:"link",onClick:()=>{J(!0)}})),(0,H.tZ)(o.Fragment,null,(0,H.tZ)(Z.Z,{name:(0,r.t)("Dashboards"),buttons:ve}),(0,H.tZ)(b.Z,{title:(0,r.t)("Please confirm"),description:(0,r.t)("Are you sure you want to delete the selected dashboards?"),onConfirm:function(e){return i.Z.delete({endpoint:`/api/v1/dashboard/?q=${c().encode(e.map((e=>{let{id:t}=e;return t})))}`}).then((e=>{let{json:t={}}=e;B(),a(t.message)}),(0,p.v$)((e=>t((0,r.t)("There was an issue deleting the selected dashboards: ",e)))))}},(e=>{const l=[];return he&&l.push({key:"delete",name:(0,r.t)("Delete"),type:"danger",onSelect:e}),pe&&l.push({key:"export",name:(0,r.t)("Export"),type:"primary",onSelect:ye}),(0,H.tZ)(o.Fragment,null,W&&(0,H.tZ)(C.Z,{dashboardId:W.id,show:!0,onHide:()=>Y(null),onSubmit:ge}),j&&(0,H.tZ)(T.Z,{description:(0,H.tZ)(o.Fragment,null,(0,r.t)("Are you sure you want to delete")," ",(0,H.tZ)("b",null,j.dashboard_title),"?"),onConfirm:()=>{(0,p.Iu)(j,B,a,t,void 0,s),G(null)},onHide:()=>G(null),open:!!j,title:(0,r.t)("Please confirm")}),(0,H.tZ)(_.Z,{bulkActions:l,bulkSelectEnabled:O,cardSortSelectOptions:we,className:"dashboard-list-view",columns:fe,count:S,data:M,disableBulkSelect:L,fetchData:z,filters:_e,initialSort:me,loading:u,pageSize:25,showThumbnails:de?de.thumbnails:(0,h.c)(n.T.THUMBNAILS),renderCard:Se,defaultViewMode:(0,h.c)(n.T.LISTVIEWS_DEFAULT_CARD_VIEW)?"card":"table"}))})),(0,H.tZ)($.Z,{resourceName:"dashboard",resourceLabel:(0,r.t)("dashboard"),passwordsNeededMessage:I,confirmOverwriteMessage:D,addDangerToast:t,addSuccessToast:a,onModelImport:()=>{J(!1),B(),a((0,r.t)("Dashboard imported"))},show:X,onHide:()=>{J(!1)},passwordFields:Q,setPasswordFields:ee,sshTunnelPasswordFields:le,setSSHTunnelPasswordFields:re,sshTunnelPrivateKeyFields:se,setSSHTunnelPrivateKeyFields:ne,sshTunnelPrivateKeyPasswordFields:ie,setSSHTunnelPrivateKeyPasswordFields:oe}),te&&(0,H.tZ)(f.Z,null))}))}}]);
//# sourceMappingURL=7fe559914d86d72863e1.chunk.js.map