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