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

theme.keycloak.v2.admin.resources.assets.ClientScopesSection-efceeb44.js Maven / Gradle / Ivy

There is a newer version: 25.0.1
Show newest version
import{c as A,u as k,d as E,r as a,l as W,g as m,A as L,j as t,Z,P as q,B as z,L as R,a6 as J,D as Q,a7 as X,G as Y,a8 as K,a5 as _}from"./index-0cda761d.js";import{g as $}from"./utils-49fe564a.js";import{A as d,r as ee,a as te,c as oe,C as P}from"./ClientScopeTypes-d24d11d6.js";import{u as se}from"./ConfirmDialog-100e6a40.js";import{K as ne}from"./KeycloakDataTable-a1a2bfca.js";import{V as re}from"./ViewHeader-ff389f8e.js";import{u as ae,m as ce}from"./useLocaleSort-ef2c79ac.js";import{S as le,a as ie,C as pe,n as me,t as de,p as Se}from"./SearchFilter-5d051f5f.js";import{b as j}from"./ToolbarContent-fee3570e.js";import{N as F}from"./Td-d9b96677.js";import"./Select-68736f55.js";import"./check-fc57dbe1.js";import"./star-icon-2ee5dfa7.js";import"./Modal-ea09312d.js";import"./PaginatingTableToolbar-11bdf18a.js";import"./plus-circle-icon-fe78809e.js";import"./EmptyStateBody-f9d2c033.js";import"./EmptyStateSecondaryActions-e8364506.js";import"./TableToolbar-470a2060.js";import"./Form-4087ddae.js";import"./Text-b9444fb8.js";import"./filter-icon-56a9cd24.js";import"./grip-vertical-icon-ba7b06db.js";import"./Checkbox-3affa1d3.js";const ue=s=>{const{t:o}=k("client-scopes"),{addAlert:c,addError:S}=E();return t.jsx(te,{clientScope:s,type:s.type,all:!0,onSelect:async u=>{try{await oe(s,u),c(o("clientScopeSuccess"),L.success),s.refresh()}catch(i){S("client-scopes:clientScopeError",i)}}})},ye=({id:s,name:o})=>{const{realm:c}=A();return t.jsx(R,{to:_({realm:c,id:s,tab:"settings"}),children:o},s)};function Ge(){const{realm:s}=A(),{t:o}=k("client-scopes"),{addAlert:c,addError:S}=E(),[u,i]=a.useState(!1),[l,y]=a.useState([]),[n,C]=a.useState("name"),[b,h]=a.useState(d.none),[w,f]=a.useState("all"),B=ae(),[T,N]=a.useState(0),r=()=>{y([]),N(T+1)},O=async(e,p,v)=>{const I=await m.clientScopes.listDefaultClientScopes(),U=await m.clientScopes.listDefaultOptionalClientScopes(),G=await m.clientScopes.find(),H=n==="name"?me(v):n==="type"?de(b):Se(w),M=G.map(g=>({...g,type:I.find(x=>x.name===g.name)?P.default:U.find(x=>x.name===g.name)?P.optional:d.none})).filter(H);return B(M,ce("name")).slice(e,Number(e)+Number(p))},[D,V]=se({titleKey:o("deleteClientScope",{count:l.length,name:l[0]?.name}),messageKey:"client-scopes:deleteConfirm",continueButtonLabel:"common:delete",continueButtonVariant:W.danger,onConfirm:async()=>{try{for(const e of l){try{await ee(e)}catch(p){console.warn("could not remove scope",p.response?.data?.errorMessage||p)}await m.clientScopes.del({id:e.id})}c(o("deletedSuccess"),L.success),r()}catch(e){S("client-scopes:deleteError",e)}}});return t.jsxs(t.Fragment,{children:[t.jsx(V,{}),t.jsx(re,{titleKey:"clientScopes",subKey:"client-scopes:clientScopeExplain",helpUrl:Z.clientScopesUrl}),t.jsx(q,{variant:"light",className:"pf-u-p-0",children:t.jsx(ne,{loader:O,ariaLabelKey:"client-scopes:clientScopeList",searchPlaceholderKey:n==="name"?"client-scopes:searchFor":void 0,isSearching:n!=="name",searchTypeComponent:t.jsx(le,{searchType:n,onSelect:e=>C(e),withProtocol:!0}),isPaginated:!0,onSelect:e=>y([...e]),canSelectAll:!0,toolbarItem:t.jsxs(t.Fragment,{children:[t.jsx(ie,{searchType:n,type:b,onSelect:e=>{C(e),f("all"),h(d.none),r()},onType:e=>{h(e),f("all"),r()},protocol:w,onProtocol:e=>{f(e),h(d.none),r()}}),t.jsx(j,{children:t.jsx(z,{component:e=>t.jsx(R,{...e,to:J({realm:s})}),children:o("createClientScope")})}),t.jsx(j,{children:t.jsx(pe,{selectedRows:l,refresh:r})}),t.jsx(j,{children:t.jsx(Q,{toggle:t.jsx(X,{onToggle:i}),isOpen:u,isPlain:!0,dropdownItems:[t.jsx(Y,{component:"button",isDisabled:l.length===0,onClick:()=>{D(),i(!1)},children:o("common:delete")},"action")]})})]}),actions:[{title:o("common:delete"),onRowClick:e=>{y([e]),D()}}],columns:[{name:"name",cellRenderer:ye},{name:"type",displayKey:"client-scopes:assignedType",cellRenderer:e=>t.jsx(ue,{...e,refresh:r})},{name:"protocol",displayKey:"client-scopes:protocol",cellRenderer:e=>$(o,e.protocol??"openid-connect"),transforms:[F(15)]},{name:"attributes['gui.order']",displayKey:"client-scopes:displayOrder",cellFormatters:[K()],transforms:[F(15)]},{name:"description",cellFormatters:[K()]}]},T)})]})}export{Ge as default};
//# sourceMappingURL=ClientScopesSection-efceeb44.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy