All Downloads are FREE. Search and download functionalities are using the official Maven repository.

theme.keycloak.v2.admin.resources.assets.RolesList-c10a9707.js Maven / Gradle / Ivy

There is a newer version: 25.0.1
Show newest version
import{u as h,b as S,d as A,c as j,r as x,q as E,l as k,g as u,A as y,j as e,K as N,B,L as p,a$ as I,a8 as g,bt as T,h as v}from"./index-831988f6.js";import{u as w}from"./ConfirmDialog-927d61dd.js";import{L as P}from"./PaginatingTableToolbar-c55a17f1.js";import{K as V}from"./KeycloakDataTable-2267a354.js";const $=({defaultRoleName:m,toDetail:c,messageBundle:r,...a})=>{const{t:l}=h(r),{realm:d}=j();return a.name!==m?e.jsx(p,{to:c(a.id),children:a.name}):e.jsxs(e.Fragment,{children:[e.jsxs(p,{to:T({realm:d,tab:"user-registration"}),children:[a.name," "]}),e.jsx(v,{helpText:l(`${r}:defaultRole`),fieldLabelId:"defaultRole"})]})},J=({loader:m,paginated:c=!0,parentRoleId:r,messageBundle:a="roles",toCreate:l,toDetail:d,isReadOnly:n})=>{const{t:o}=h(a),D=S(),{addAlert:f,addError:L}=A(),{realm:K}=j(),[i,b]=x.useState(),[s,R]=x.useState();E(()=>u.realms.findOne({realm:K}),t=>{b(t)},[]);const[C,F]=w({titleKey:"roles:roleDeleteConfirm",messageKey:o("roles:roleDeleteConfirmDialog",{selectedRoleName:s?s.name:""}),continueButtonLabel:"common:delete",continueButtonVariant:k.danger,onConfirm:async()=>{try{r?await u.roles.delCompositeRoles({id:r},[s]):await u.roles.delById({id:s.id}),R(void 0),f(o("roles:roleDeletedSuccess"),y.success)}catch(t){L("roles:roleDeleteError",t)}}});return i?e.jsxs(e.Fragment,{children:[e.jsx(F,{}),e.jsx(V,{loader:m,ariaLabelKey:"roles:roleList",searchPlaceholderKey:"roles:searchFor",isPaginated:c,toolbarItem:!n&&e.jsx(B,{"data-testid":"create-role",component:t=>e.jsx(p,{...t,to:l}),children:o("createRole")}),actions:n?[]:[{title:o("common:delete"),onRowClick:t=>{R(t),i.defaultRole&&t.name===i.defaultRole.name?f(o("defaultRoleDeleteError"),y.danger):C()}}],columns:[{name:"name",displayKey:"roles:roleName",cellRenderer:t=>e.jsx($,{...t,defaultRoleName:i.defaultRole?.name,toDetail:d,messageBundle:a})},{name:"composite",displayKey:"roles:composite",cellFormatters:[I(),g()]},{name:"description",displayKey:"common:description",cellFormatters:[g()]}],emptyState:e.jsx(P,{hasIcon:!0,message:o("noRoles"),instructions:n?"":o("noRolesInstructions"),primaryActionText:n?"":o("createRole"),onPrimaryAction:()=>D(l)})},s?s.id:"roleList")]}):e.jsx(N,{})};export{J as R};
//# sourceMappingURL=RolesList-c10a9707.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy