"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[1510],{9098(C,l,n){n.d(l,{l:()=>h});var e=n(14553),c=n(22803),u=n(55501),o=n(49785);function h({defaultValues:v,onSubmit:O,validateOnMount:s=!1,validateFieldsOnMount:d,children:x,validateOn:t="onSubmit",maxWidth:r=600,...p}){const{handleSubmit:E,trigger:i,formState:m,...j}=(0,o.mN)({mode:t,defaultValues:v});return(0,u.useEffect)(()=>{s&&i(d)},[i,d,s]),(0,e.jsx)("form",{className:(0,c.css)({maxWidth:r!=="none"?r+"px":r,width:"100%"}),onSubmit:E(O),...p,children:x({errors:m.errors,formState:m,trigger:i,...j})})}},45081(C,l,n){n.r(l),n.d(l,{OrgDetailsPage:()=>T,default:()=>N});var e=n(14553),c=n(55501),u=n(71468),o=n(52358),h=n(5989),v=n(68763),O=n(71112),s=n(5246),d=n(27925),x=n(65312),t=n(68459),r=n(48148),p=n(82098),E=n(21453),i=n(49669),m=n(16244),j=n(45270),S=n(9098);const R=({onSubmit:g,orgName:z})=>{const f=t.TP.hasPermission(r.w.OrgsWrite);return(0,e.jsx)(S.l,{defaultValues:{orgName:z},onSubmit:({orgName:a})=>g(a),children:({register:a})=>(0,e.jsxs)(E.n,{label:(0,o.t)("org.org-profile.label-organization-profile","Organization profile"),disabled:!f,children:[(0,e.jsx)(i.D,{label:(0,o.t)("org.org-profile.label-organization-name","Organization name"),children:(0,e.jsx)(m.p,{id:"org-name-input",type:"text",...a("orgName",{required:!0})})}),(0,e.jsx)(j.$n,{type:"submit",children:(0,e.jsx)(o.x6,{i18nKey:"org.org-profile.update-organization-name",children:"Update organization name"})})]})})};var D=n(62085),M=n(49589);const T=(0,c.memo)(function({navModel:z,organization:f,loadOrganization:a,setOrganizationName:W,updateOrganization:I}){(0,c.useEffect)(()=>{a()},[a]);const L=P=>{W(P),I()},A=()=>new Promise(P=>{O.l.publish(new p.bY({title:(0,o.t)("org.org-details-page.title.confirm-preferences-update","Confirm preferences update"),text:"This will update the preferences for the whole organization. Are you sure you want to update the preferences?",yesText:"Save",yesButtonVariant:"primary",onConfirm:async()=>P(!0),onDismiss:async()=>P(!1)}))}),y=Object.keys(f).length===0,K=t.TP.hasPermission(r.w.OrgsRead),Y=t.TP.hasPermission(r.w.OrgsPreferencesRead),F=t.TP.hasPermission(r.w.OrgsPreferencesWrite),V=(0,h.$d)()?"namespace":"org";return(0,e.jsx)(s.Y,{navModel:z,children:(0,e.jsx)(s.Y.Contents,{isLoading:y,children:!y&&(0,e.jsxs)(v.B,{direction:"column",gap:3,children:[K&&(0,e.jsx)(R,{onSubmit:L,orgName:f.name}),Y&&(0,e.jsx)(d.u,{resourceUri:V,disabled:!F,preferenceType:"org",onConfirm:A})]})})})});function U(g){return{navModel:(0,x.t)(g.navIndex,"org-settings"),organization:g.organization.organization}}const B={loadOrganization:D.YS,setOrganizationName:M.n,updateOrganization:D.L_},N=(0,u.connect)(U,B)(T)}}]);

//# sourceMappingURL=OrgDetailsPage-react19.b4cbdb7358f3382c9863.js.map