theme.keycloak.v2.admin.resources.assets.SettingsCache-BECJJhg-.js Maven / Gradle / Ivy
import{jsxs as h,Fragment as y,jsx as e}from"react/jsx-runtime";import{u as M,a as x,e as P,d as S,f as O,c as K,aj as w,B as U,k as W,dY as Y,ae as p,D as z,T as $,aa as B,Z as q,ab as j,ac as I,ad as T,b5 as V,b6 as k,U as t,v as R,ao as X}from"./main-C7ps2lmX.js";import{u as F}from"./ConfirmDialog-hx7XKLbN.js";import{V as H}from"./ViewHeader-B7eeFzFA.js";import{F as G}from"./FormAccess-DyLNkc18.js";import{u as A}from"./useToggle-K3Kx99tM.js";import{i as D}from"./isEqual-BWOcMitS.js";const ie=({provider:l,save:a,noDivider:i=!1,dropdownItems:r=[]})=>{const{adminClient:s}=M(),{t:u}=x(),{id:f}=P(),C=S(),{addAlert:d,addError:b}=O(),{realm:g}=K(),{control:E,setValue:m}=w(),[n,o]=F({titleKey:"userFedDisableConfirmTitle",messageKey:"userFedDisableConfirm",continueButtonLabel:"disable",onConfirm:()=>{m("config.enabled[0]","false"),a()}}),[L,v]=F({titleKey:"userFedDeleteConfirmTitle",messageKey:"userFedDeleteConfirm",continueButtonLabel:"delete",continueButtonVariant:U.danger,onConfirm:async()=>{try{await s.components.del({id:f}),d(u("userFedDeletedSuccess"),W.success),C(Y({realm:g}),{replace:!0})}catch(c){b("userFedDeleteError",c)}}});return h(y,{children:[e(o,{}),e(v,{}),e(p,{name:"config.enabled",defaultValue:["true"],control:E,render:({field:c})=>f?e(H,{divider:!i,titleKey:l,dropdownItems:[...r,e(z,{onClick:()=>L(),"data-testid":"delete-cmd",children:u("deleteProvider")},"delete")],isEnabled:c.value?.[0]==="true"||c.value==="true",onToggle:_=>{_?(c.onChange([_.toString()]),a()):n()}}):e(H,{titleKey:u("addProvider",{provider:l,count:1})})})]})},Z=({title:l,description:a,showDescription:i=!1})=>h(y,{children:[e($,{size:"xl",headingLevel:"h2",className:i?"kc-wizard-section-header__title--has-description":"kc-wizard-section-header__title",children:l}),i&&e(B,{className:"kc-wizard-section-header__description",children:e(q,{children:a})})]}),N=({form:l})=>{const{t:a}=x(),[i,r]=A(),[s,u]=A(),[f,C]=A(),d=j({control:l.control,name:"config.cachePolicy"}),b=[e(t,{value:["0"],children:["00"]},0)];let g="";for(let n=1;n<24;n++)n<10?g=`0${n}`:g=`${n}`,b.push(e(t,{value:[`${n}`],children:g},n));const E=[e(t,{value:["0"],children:["00"]},0)];let m="";for(let n=1;n<60;n++)n<10?m=`0${n}`:m=`${n}`,E.push(e(t,{value:[`${n}`],children:m},n));return h(y,{children:[e(I,{label:a("cachePolicy"),labelIcon:e(T,{helpText:a("cachePolicyHelp"),fieldLabelId:"cachePolicy"}),fieldId:"kc-cache-policy",children:e(p,{name:"config.cachePolicy",defaultValue:["DEFAULT"],control:l.control,render:({field:n})=>h(V,{toggleId:"kc-cache-policy",onToggle:r,isOpen:i,onSelect:o=>{n.onChange(o),r()},selections:n.value,variant:k.single,"data-testid":"kerberos-cache-policy","aria-label":a("selectCachePolicy"),children:[e(t,{value:["DEFAULT"],children:"DEFAULT"},0),e(t,{value:["EVICT_DAILY"],children:"EVICT_DAILY"},1),e(t,{value:["EVICT_WEEKLY"],children:"EVICT_WEEKLY"},2),e(t,{value:["MAX_LIFESPAN"],children:"MAX_LIFESPAN"},3),e(t,{value:["NO_CACHE"],children:"NO_CACHE"},4)]})})}),D(d,["EVICT_WEEKLY"])?e(R,{id:"kc-eviction-day",name:"config.evictionDay[0]",label:a("evictionDay"),labelIcon:a("evictionDayHelp"),controller:{defaultValue:"1"},"aria-label":a("selectEvictionDay"),options:[{key:"1",value:a("Sunday")},{key:"2",value:a("Monday")},{key:"3",value:a("Tuesday")},{key:"4",value:a("Wednesday")},{key:"5",value:a("Thursday")},{key:"6",value:a("Friday")},{key:"7",value:a("Saturday")}]}):null,D(d,["EVICT_DAILY"])||D(d,["EVICT_WEEKLY"])?h(y,{children:[e(I,{label:a("evictionHour"),labelIcon:e(T,{helpText:a("evictionHourHelp"),fieldLabelId:"evictionHour"}),isRequired:!0,fieldId:"kc-eviction-hour",children:e(p,{name:"config.evictionHour",defaultValue:["0"],control:l.control,render:({field:n})=>e(V,{toggleId:"kc-eviction-hour",onToggle:u,isOpen:s,onSelect:o=>{n.onChange(o),u()},selections:n.value,variant:k.single,"aria-label":a("selectEvictionHour"),children:b})})}),e(I,{label:a("evictionMinute"),labelIcon:e(T,{helpText:a("evictionMinuteHelp"),fieldLabelId:"evictionMinute"}),isRequired:!0,fieldId:"kc-eviction-minute",children:e(p,{name:"config.evictionMinute",defaultValue:["0"],control:l.control,render:({field:n})=>e(V,{toggleId:"kc-eviction-minute",onToggle:C,isOpen:f,onSelect:o=>{n.onChange(o),C()},selections:n.value,variant:k.single,"aria-label":a("selectEvictionMinute"),children:E})})})]}):null,D(d,["MAX_LIFESPAN"])?e(I,{label:a("maxLifespan"),labelIcon:e(T,{helpText:a("maxLifespanHelp"),fieldLabelId:"maxLifespan"}),fieldId:"kc-max-lifespan",children:e(p,{name:"config.maxLifespan[0]",defaultValue:0,control:l.control,render:({field:n})=>{const L=v=>n.onChange(Math.max(v,0));return e(X,{id:"kc-max-lifespan","data-testid":"kerberos-cache-lifespan",value:n.value,min:0,unit:a("ms"),type:"text",onPlus:()=>n.onChange(Number(n.value)+1),onMinus:()=>n.onChange(Number(n.value)-1),onChange:v=>{const c=Number(v.currentTarget.value);L(isNaN(c)?0:c)}})}})}):null]})},oe=({form:l,showSectionHeading:a=!1,showSectionDescription:i=!1,unWrap:r=!1})=>{const{t:s}=x();return h(y,{children:[a&&e(Z,{title:s("cacheSettings"),description:s("cacheSettingsDescription"),showDescription:i}),r?e(N,{form:l}):e(G,{role:"manage-realm",isHorizontal:!0,children:e(N,{form:l})})]})};export{ie as H,oe as S,Z as W};
//# sourceMappingURL=SettingsCache-BECJJhg-.js.map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy