theme.keycloak.v2.admin.resources.assets.RolesList-LyWYaZd3.js Maven / Gradle / Ivy
import{jsxs as u,Fragment as D,jsx as o}from"react/jsx-runtime";import{u as S,a as L,d as x,f as k,c as C,B as E,j as g,h as I,L as p,bJ as N,aC as h,c8 as T,ad as j}from"./index-C1LIsRX7.js";import{useState as v}from"react";import{u as w}from"./ConfirmDialog-B5qjiAuo.js";import{L as B}from"./PaginatingTableToolbar-CpMLQtqt.js";import{K as P}from"./KeycloakDataTable-jyvvxdb8.js";const V=({defaultRoleName:n,toDetail:c,messageBundle:l,...e})=>{const{t:s}=L(l),{realm:m}=C();return e.name!==n?o(p,{to:c(e.id),children:e.name}):u(D,{children:[u(p,{to:T({realm:m,tab:"user-registration"}),children:[e.name," "]}),o(j,{helpText:s(`${l}:defaultRole`),fieldLabelId:"defaultRole"})]})},M=({loader:n,paginated:c=!0,parentRoleId:l,messageBundle:e="roles",toCreate:s,toDetail:m,isReadOnly:i})=>{const{adminClient:f}=S(),{t}=L(),K=x(),{addAlert:R,addError:b}=k(),{realmRepresentation:d}=C(),[r,y]=v(),[A,F]=w({titleKey:"roleDeleteConfirm",messageKey:t("roleDeleteConfirmDialog",{selectedRoleName:r?r.name:""}),continueButtonLabel:"delete",continueButtonVariant:E.danger,onConfirm:async()=>{try{l?await f.roles.delCompositeRoles({id:l},[r]):await f.roles.delById({id:r.id}),y(void 0),R(t("roleDeletedSuccess"),g.success)}catch(a){b("roleDeleteError",a)}}});return u(D,{children:[o(F,{}),o(P,{loader:n,ariaLabelKey:"roleList",searchPlaceholderKey:"searchForRoles",isPaginated:c,toolbarItem:!i&&o(I,{"data-testid":"create-role",component:a=>o(p,{...a,to:s}),children:t("createRole")}),actions:i?[]:[{title:t("delete"),onRowClick:a=>{y(a),d?.defaultRole&&a.name===d.defaultRole.name?R(t("defaultRoleDeleteError"),g.danger):A()}}],columns:[{name:"name",displayKey:"roleName",cellRenderer:a=>o(V,{...a,defaultRoleName:d?.defaultRole?.name,toDetail:m,messageBundle:e})},{name:"composite",displayKey:"composite",cellFormatters:[N(),h()]},{name:"description",displayKey:"description",cellFormatters:[h()]}],emptyState:o(B,{hasIcon:!0,message:t(`noRoles-${e}`),instructions:i?"":t(`noRolesInstructions-${e}`),primaryActionText:i?"":t("createRole"),onPrimaryAction:()=>K(s)})},r?r.id:"roleList")]})};export{M as R};
//# sourceMappingURL=RolesList-LyWYaZd3.js.map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy