2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[1324,5851,4705],{94141:(e,s,t)=>{t.d(s,{A:()=>d});var l=t(65043),n=t(22166),o=t(89923),i=t(21383),r=t(64159),c=t(49555),a=t(70579);const d=e=>{let{onClose:s,modalOpen:t,title:d,children:u,wideLimit:p=!0,titleIcon:x=null,iconColor:h="default",sx:m}=e;const j=(0,i.jL)(),[g,b]=(0,l.useState)(!1),y=(0,n.d4)((e=>e.system.modalSnackBar));(0,l.useEffect)((()=>{j((0,r.h0)(""))}),[j]),(0,l.useEffect)((()=>{if(y){if(""===y.message)return void b(!1);"error"!==y.type&&b(!0)}}),[y]);let f="";return y&&(f=y.detailedErrorMsg,(""===f||f&&f.length<5)&&(f=y.message)),(0,a.jsxs)(o.ngX,{onClose:s,open:t,title:d,titleIcon:x,widthLimit:p,sx:m,iconColor:h,children:[(0,a.jsx)(c.A,{isModal:!0}),(0,a.jsx)(o.qb_,{onClose:()=>{b(!1),j((0,r.h0)(""))},open:g,message:f,mode:"inline",variant:"error"===y.type?"error":"default",autoHideDuration:"error"===y.type?10:5,condensed:!0}),u]})}},85851:(e,s,t)=>{t.r(s),t.d(s,{default:()=>u});var l=t(65043),n=t(89923),o=t(64159),i=t(21383),r=t(58661),c=t(56629),a=t(53518),d=t(70579);const u=e=>{let{selectedGroups:s,deleteOpen:t,closeDeleteModalAndRefresh:u}=e;const p=(0,i.jL)(),[x,h]=(0,l.useState)(!1);if(!s)return null;const m=s.map((e=>(0,d.jsx)("div",{children:(0,d.jsx)("b",{children:e})},e)));return(0,d.jsx)(r.A,{title:"Delete Group".concat(s.length>1?"s":""),confirmText:"Delete",isOpen:t,titleIcon:(0,d.jsx)(n.xWY,{}),isLoading:x,onConfirm:()=>{for(let e of s)h(!0),c.F.group.removeGroup(e).then((e=>{u(!0)})).catch((async e=>{const s=await e.json();p((0,o.C9)((0,a.S)(s))),u(!1)})).finally((()=>h(!1)))},onClose:()=>u(!1),confirmationContent:(0,d.jsxs)(l.Fragment,{children:["Are you sure you want to delete the following"," ",1===s.length?"":s.length," group",s.length>1?"s?":"?",m]})})}},91324:(e,s,t)=>{t.r(s),t.d(s,{default:()=>C});var l=t(65043),n=t(73216),o=t(89923),i=t(56629),r=t(53518),c=t(99161),a=t(77938),d=t(64159),u=t(21383),p=t(62560),x=t(74705),h=t(77403),m=t(22923),j=t(94141),g=t(70579);const b=e=>{let{title:s="",groupStatus:t="enabled",preSelectedUsers:n=[],selectedGroup:c="",open:a,onClose:p}=e;const x=(0,u.jL)(),[b,y]=(0,l.useState)(n);return(0,g.jsxs)(j.A,{modalOpen:a,onClose:p,title:s,titleIcon:(0,g.jsx)(o.WC,{}),children:[(0,g.jsxs)(o.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,g.jsx)(o.EmB,{label:"Selected Group",sx:{width:"100%"},children:c}),(0,g.jsx)(m.A,{selectedUsers:b,setSelectedUsers:y,editMode:!c})]}),(0,g.jsxs)(o.xA9,{item:!0,xs:12,sx:h.Uz.modalButtonBar,children:[(0,g.jsx)(o.$nd,{id:"reset-add-group-member",type:"button",variant:"regular",onClick:()=>{y(n)},label:"Reset"}),(0,g.jsx)(o.$nd,{id:"save-add-group-member",type:"button",variant:"callAction",onClick:()=>{i.F.group.updateGroup(c,{members:b,status:t}).then((()=>{p()})).catch((e=>{p(),x((0,d.Dy)((0,r.S)(e.error)))}))},label:"Save"})]})]})};var y=t(85851),f=t(64681),v=t(6681),A=t(55968),S=t(48793);const C=()=>{const e=(0,u.jL)(),s=(0,n.Zp)(),t=(0,n.g)(),[h,m]=(0,l.useState)({}),[j,C]=(0,l.useState)(!1),[P,G]=(0,l.useState)(!1),[M,U]=(0,l.useState)(!1),[k,w]=(0,l.useState)(""),[E,L]=(0,l.useState)("members"),{members:z=[],policy:D="",status:I}=h,N=z.filter((e=>e.includes(k))),R=(0,a._)(c.Ms,c.Ld,!0);(0,l.useEffect)((()=>{e((0,d.ph)("group_details"))}),[]),(0,l.useEffect)((()=>{t.groupName&&J()}),[t.groupName]);const F=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.length<=0?[]:e.split(",")}(D),B="enabled"===I,K=z.length>0?"Edit Members":"Add Members",_=(0,a._)(c.Ms,c.Oh),O=(0,a._)(c.Ms,c.Hr,!0),H=(0,a._)(c.Ms,c.QR,!0),$=(0,a._)(c.Ms,c.yv,!0);function J(){_&&i.F.group.groupInfo(t.groupName||"").then((e=>{m(e.data)})).catch((s=>{e((0,d.Dy)((0,r.S)(s.error))),m({})}))}const T=(0,g.jsxs)(o.azJ,{onMouseMove:()=>{e((0,d.ph)("groups_members"))},children:[(0,g.jsx)(o._xt,{separator:!0,sx:{marginBottom:15},actions:(0,g.jsxs)(o.azJ,{sx:{display:"flex",gap:10},children:[(0,g.jsx)(f.A,{placeholder:"Search members",onChange:e=>{w(e)},value:k,sx:{maxWidth:280}}),(0,g.jsx)(a.R,{resource:c.Ms,scopes:c.BD,errorProps:{disabled:!0},children:(0,g.jsx)(v.A,{tooltip:O?K:(0,c.vj)(c.k1,"edit Group membership"),children:(0,g.jsx)(o.$nd,{id:"add-user-group",label:K,variant:"callAction",icon:(0,g.jsx)(o.REV,{}),onClick:()=>{G(!0)},disabled:!O})})})]}),children:"Members"}),(0,g.jsx)(o.xA9,{item:!0,xs:12,children:(0,g.jsx)(a.R,{resource:c.Ms,scopes:c.x6,errorProps:{disabled:!0},children:(0,g.jsx)(v.A,{tooltip:R?"":(0,c.vj)(c.Ld,"view User details"),children:(0,g.jsx)(o.bQt,{itemActions:[{type:"view",onClick:e=>{s("".concat(c.zZ.USERS,"/").concat(encodeURIComponent(e)))},isDisabled:!R}],columns:[{label:"Access Key"}],selectedItems:[],isLoading:!1,records:N,entityName:"Users"})})})})]}),Q=(0,g.jsxs)(l.Fragment,{children:[(0,g.jsx)(o.azJ,{onMouseMove:()=>{e((0,d.ph)("groups_policies"))},children:(0,g.jsx)(o._xt,{separator:!0,sx:{marginBottom:15},actions:(0,g.jsx)(v.A,{tooltip:H?"Set Policies":(0,c.vj)(c.QR,"assign Policies"),children:(0,g.jsx)(o.$nd,{id:"set-policies",label:"Set Policies",variant:"callAction",icon:(0,g.jsx)(o.n$X,{}),onClick:()=>{C(!0)},disabled:!H})}),children:"Policies"})}),(0,g.jsx)(o.xA9,{item:!0,xs:12,children:(0,g.jsx)(v.A,{tooltip:$?"":(0,c.vj)(c.yv,"view Policy details"),children:(0,g.jsx)(o.bQt,{itemActions:[{type:"view",onClick:e=>{s("".concat(c.zZ.POLICIES,"/").concat(encodeURIComponent(e)))},isDisabled:!$}],columns:[{label:"Policy"}],isLoading:!1,records:F,entityName:"Policies"})})})]});return(0,g.jsxs)(l.Fragment,{children:[j?(0,g.jsx)(x.default,{open:j,selectedGroups:[t.groupName||""],selectedUser:null,closeModalAndRefresh:()=>{C(!1),J(),e((0,p.Gy)([]))}}):null,P?(0,g.jsx)(b,{selectedGroup:t.groupName,onSaveClick:()=>{},title:K,groupStatus:I,preSelectedUsers:z,open:P,onClose:()=>{G(!1),J()}}):null,M&&(0,g.jsx)(y.default,{deleteOpen:M,selectedGroups:[t.groupName||""],closeDeleteModalAndRefresh:e=>{U(!1),e&&s(c.zZ.GROUPS)}}),(0,g.jsx)(S.A,{label:(0,g.jsx)(l.Fragment,{children:(0,g.jsx)(o.EGL,{label:"Groups",onClick:()=>s(c.zZ.GROUPS)})}),actions:(0,g.jsx)(A.A,{})}),(0,g.jsxs)(o.Mxu,{children:[(0,g.jsx)(o.xA9,{item:!0,xs:12,children:(0,g.jsx)(o.lcx,{icon:(0,g.jsx)(l.Fragment,{children:(0,g.jsx)(o.YXz,{width:40})}),title:t.groupName||"",subTitle:null,bottomBorder:!0,actions:(0,g.jsxs)(o.azJ,{sx:{display:"flex",fontSize:14,alignItems:"center",gap:15},children:[(0,g.jsx)("span",{children:"Group Status:"}),(0,g.jsx)("span",{id:"group-status-label",style:{fontWeight:"bold"},children:B?"Enabled":"Disabled"}),(0,g.jsx)(v.A,{tooltip:(0,a._)(c.Ms,c.pf,!0)?"":(0,c.vj)(c.pf,"enable or disable Groups"),children:(0,g.jsx)(a.R,{resource:c.Ms,scopes:c.pf,errorProps:{disabled:!0},matchAll:!0,children:(0,g.jsx)(o.dOG,{indicatorLabels:["Enabled","Disabled"],checked:B,value:"group_enabled",id:"group-status",name:"group-status",onChange:()=>{var s;s=!B,i.F.group.updateGroup(t.groupName||"",{members:z,status:s?"enabled":"disabled"}).then((()=>{J()})).catch((s=>{e((0,d.Dy)((0,r.S)(s.error)))}))},switchOnly:!0})})}),(0,g.jsx)(v.A,{tooltip:"Delete Group",children:(0,g.jsx)(o.$nd,{id:"delete-user-group",variant:"secondary",icon:(0,g.jsx)(o.ucK,{}),onClick:()=>{U(!0)}})})]}),sx:{marginBottom:15}})}),(0,g.jsx)(o.xA9,{item:!0,xs:12,children:(0,g.jsx)(o.tUM,{options:[{tabConfig:{id:"members",label:"Members"},content:T},{tabConfig:{id:"policies",label:"Policies"},content:Q}],currentTabOrPath:E,onTabClick:L})})]})]})}},22923:(e,s,t)=>{t.d(s,{A:()=>h});var l=t(65043),n=t(33097),o=t.n(n),i=t(56629),r=t(53518),c=t(89923),a=t(8185),d=t(64159),u=t(21383),p=t(64681),x=t(70579);const h=e=>{let{selectedUsers:s,setSelectedUsers:t,editMode:n=!1}=e;const h=(0,u.jL)(),[m,j]=(0,l.useState)([]),[g,b]=(0,l.useState)(!1),[y,f]=(0,l.useState)(""),v=(0,l.useCallback)((()=>{i.F.users.listUsers().then((e=>{let s=o()(e.data,"users",[]);s||(s=[]),j(s.sort(a.LA)),b(!1)})).catch((e=>{h((0,d.Dy)((0,r.S)(e.error))),b(!1)}))}),[h]);(0,l.useEffect)((()=>{b(!0)}),[]),(0,l.useEffect)((()=>{g&&v()}),[g,v]);const A=s||[],S=m.filter((e=>e.accessKey.includes(y)));return(0,x.jsx)(c.xA9,{item:!0,xs:12,className:"inputItem",children:(0,x.jsxs)(c.azJ,{children:[g&&(0,x.jsx)(c.z21,{}),(null===m||void 0===m?void 0:m.length)>0?(0,x.jsxs)(l.Fragment,{children:[(0,x.jsx)(c.xA9,{item:!0,xs:12,className:"inputItem",children:(0,x.jsx)(p.A,{label:n?"Edit Members":"Assign Users",placeholder:"Filter Users",onChange:f,value:y})}),(0,x.jsx)(c.bQt,{columns:[{label:"Access Key",elementKey:"accessKey"}],onSelect:e=>{const s=e.target,l=s.value,n=s.checked;let o=[...A];return n?o.push(l):o=o.filter((e=>e!==l)),t(o),o},selectedItems:A,isLoading:g,records:S,entityName:"Users",idField:"accessKey",customPaperHeight:"200px"})]}):(0,x.jsx)(c.azJ,{sx:{textAlign:"center",padding:"10px 0"},children:"No Users to display"})]})})}},42967:(e,s,t)=>{t.d(s,{A:()=>x});var l=t(65043),n=t(89923),o=t(8185),i=t(64681),r=t(64159),c=t(21383),a=t(62560),d=t(22166),u=t(56629),p=t(70579);const x=e=>{let{noTitle:s=!1}=e;const t=(0,c.jL)(),[x,h]=(0,l.useState)([]),[m,j]=(0,l.useState)(!1),[g,b]=(0,l.useState)(""),y=(0,d.d4)((e=>e.createUser.selectedPolicies)),f=(0,l.useCallback)((()=>{j(!0),u.F.policies.listPolicies().then((e=>{var s;const t=null!==(s=e.data.policies)&&void 0!==s?s:[];j(!1),h(t.sort(o.Hw))})).catch((e=>{j(!1),t((0,r.Dy)(e))}))}),[t]);(0,l.useEffect)((()=>{j(!0)}),[]),(0,l.useEffect)((()=>{m&&f()}),[m,f]);const v=x.filter((e=>e.name.includes(g)));return(0,p.jsxs)(n.xA9,{item:!0,xs:12,className:"inputItem",children:[m&&(0,p.jsx)(n.z21,{}),x.length>0?(0,p.jsxs)(l.Fragment,{children:[(0,p.jsx)(n.xA9,{item:!0,xs:12,className:"inputItem",children:(0,p.jsx)(i.A,{placeholder:"Start typing to search for a Policy",onChange:e=>{b(e)},value:g,label:s?"":"Assign Policies"})}),(0,p.jsx)(n.bQt,{columns:[{label:"Policy",elementKey:"name"}],onSelect:e=>{const s=e.target,l=s.value,n=s.checked;let o=[...y];n?o.push(l):o=o.filter((e=>e!==l)),o=o.filter((e=>""!==e)),t((0,a.Gy)(o))},selectedItems:y,isLoading:m,records:v,entityName:"Policies",idField:"name",customPaperHeight:"200px"})]}):(0,p.jsx)(n.azJ,{sx:{textAlign:"center",padding:"10px 0"},children:"No Policies Available"})]})}},74705:(e,s,t)=>{t.r(s),t.d(s,{default:()=>j});var l=t(65043),n=t(33097),o=t.n(n),i=t(22166),r=t(89923),c=t(64159),a=t(21383),d=t(77403),u=t(62560),p=t(94141),x=t(42967),h=t(20649),m=t(70579);const j=e=>{let{closeModalAndRefresh:s,selectedUser:t,selectedGroups:n,open:j}=e;const g=(0,a.jL)(),[b,y]=(0,l.useState)(!1),[f,v]=(0,l.useState)([]),[A,S]=(0,l.useState)([]),C=(0,i.d4)((e=>e.createUser.selectedPolicies));(0,l.useEffect)((()=>{if(j){if(1===(null===n||void 0===n?void 0:n.length))return void(1===(null===n||void 0===n?void 0:n.length)&&h.A.invoke("GET","/api/v1/group/".concat(encodeURIComponent(n[0]))).then((e=>{const s=o()(e,"policy","");v(s.split(",")),S(s.split(",")),g((0,u.Gy)(s.split(",")))})).catch((e=>{g((0,c.Dy)(e)),y(!1)})));const e=o()(t,"policy",[]);v(e),S(e),g((0,u.Gy)(e))}}),[j,null===n||void 0===n?void 0:n.length,t]);const P=o()(t,"accessKey","");return(0,m.jsxs)(p.A,{onClose:()=>{s()},modalOpen:j,title:"Set Policies",children:[(0,m.jsxs)(r.Hbc,{withBorders:!1,containerPadding:!1,children:[(1===(null===n||void 0===n?void 0:n.length)||null!=t)&&(0,m.jsxs)(l.Fragment,{children:[(0,m.jsx)(r.EmB,{label:"Selected ".concat(null!==n?"Group":"User"),sx:{width:"100%"},children:null!==n?n[0]:P}),(0,m.jsx)(r.EmB,{label:"Current Policy",sx:{width:"100%"},children:f.join(", ")})]}),n&&(null===n||void 0===n?void 0:n.length)>1&&(0,m.jsx)(r.EmB,{label:"Selected Groups",sx:{width:"100%"},children:n.join(", ")}),(0,m.jsx)(r.xA9,{item:!0,xs:12,children:(0,m.jsx)(x.A,{selectedPolicy:A})})]}),(0,m.jsxs)(r.xA9,{item:!0,xs:12,sx:d.Uz.modalButtonBar,children:[(0,m.jsx)(r.$nd,{id:"reset",type:"button",variant:"regular",onClick:()=>{S(f),g((0,u.Gy)(f))},label:"Reset"}),(0,m.jsx)(r.$nd,{id:"save",type:"button",variant:"callAction",color:"primary",disabled:b,onClick:()=>{let e=null,l=null;null!==n?l=n:null!==t&&(e=[t.accessKey]||0),y(!0),h.A.invoke("PUT","/api/v1/set-policy-multi",{name:C,groups:l,users:e}).then((()=>{y(!1),s()})).catch((e=>{y(!1),g((0,c.Dy)(e))}))},label:"Save"})]}),b&&(0,m.jsx)(r.xA9,{item:!0,xs:12,children:(0,m.jsx)(r.z21,{})})]})}},8185:(e,s,t)=>{t.d(s,{Hw:()=>n,LA:()=>l,SO:()=>o,rY:()=>i});const l=(e,s)=>{if(e.accessKey&&s.accessKey){if(e.accessKey>s.accessKey)return 1;if(e.accessKey<s.accessKey)return-1}return 0},n=(e,s)=>e.name>s.name?1:e.name<s.name?-1:0,o=(e,s)=>e>s?1:e<s?-1:0,i=(e,s)=>e.policy>s.policy?1:e.policy<s.policy?-1:0}}]);
|
|
//# sourceMappingURL=1324.71a25603.chunk.js.map
|