"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[1510],{74410(C,l,n){n.d(l,{l:()=>v});var r=n(14553),c=n(22803),O=n(55501),e=n(49785);function v({defaultValues:x,onSubmit:d,validateOnMount:m=!1,validateFieldsOnMount:f,children:t,validateOn:o="onSubmit",maxWidth:s=600,...p}){const{handleSubmit:j,trigger:i,formState:P,...z}=(0,e.mN)({mode:o,defaultValues:x});return(0,O.useEffect)(()=>{m&&i(f)},[i,f,m]),(0,r.jsx)("form",{className:(0,c.css)({maxWidth:s!=="none"?s+"px":s,width:"100%"}),onSubmit:j(d),...p,children:t({errors:P.errors,formState:P,trigger:i,...z})})}},73318(C,l,n){n.r(l),n.d(l,{OrgDetailsPage:()=>T,default:()=>N});var r=n(14553),c=n(55501),O=n(71468),e=n(92745),v=n(41654),x=n(45229),d=n(13791),m=n(51290),f=n(84057),t=n(15130),o=n(11257),s=n(87745),p=n(16780),j=n(37386),i=n(63527),P=n(45861),z=n(74410);const S=({onSubmit:g,orgName:D})=>{const h=t.TP.hasPermission(o.w.OrgsWrite);return(0,r.jsx)(z.l,{defaultValues:{orgName:D},onSubmit:({orgName:a})=>g(a),children:({register:a})=>(0,r.jsxs)(p.n,{label:(0,e.t)("org.org-profile.label-organization-profile","Organization profile"),disabled:!h,children:[(0,r.jsx)(j.D,{label:(0,e.t)("org.org-profile.label-organization-name","Organization name"),children:(0,r.jsx)(i.p,{id:"org-name-input",type:"text",...a("orgName",{required:!0})})}),(0,r.jsx)(P.$n,{type:"submit",children:(0,r.jsx)(e.x6,{i18nKey:"org.org-profile.update-organization-name",children:"Update organization name"})})]})})};var E=n(93922),M=n(74396);const T=(0,c.memo)(function({navModel:D,organization:h,loadOrganization:a,setOrganizationName:U,updateOrganization:W}){(0,c.useEffect)(()=>{a()},[a]);const I=u=>{U(u),W()},L=()=>new Promise(u=>{x.l.publish(new s.bY({title:(0,e.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()=>u(!0),onDismiss:async()=>u(!1)}))}),y=Object.keys(h).length===0,A=t.TP.hasPermission(o.w.OrgsRead),K=t.TP.hasPermission(o.w.OrgsPreferencesRead),Y=t.TP.hasPermission(o.w.OrgsPreferencesWrite);return(0,r.jsx)(d.Y,{navModel:D,children:(0,r.jsx)(d.Y.Contents,{isLoading:y,children:!y&&(0,r.jsxs)(v.B,{direction:"column",gap:3,children:[A&&(0,r.jsx)(S,{onSubmit:I,orgName:h.name}),K&&(0,r.jsx)(m.u,{resourceUri:"org",disabled:!Y,preferenceType:"org",onConfirm:L})]})})})});function R(g){return{navModel:(0,f.tc)(g.navIndex,"org-settings"),organization:g.organization.organization}}const B={loadOrganization:E.YS,setOrganizationName:M.n,updateOrganization:E.L_},N=(0,O.connect)(R,B)(T)}}]);

//# sourceMappingURL=OrgDetailsPage-react19.0932784d54e9f7097266.js.map