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

theme.keycloak.v2.admin.resources.assets.ExecutorForm-BtMpq0Ui.js Maven / Gradle / Ivy

import{jsxs as u,Fragment as R,jsx as o}from"react/jsx-runtime";import{u as U,a as W,d as J,f as Q,b as X,g as Y,w as Z,P as _,ac as $,ad as S,ae as ee,b5 as te,b6 as oe,U as re,F as ie,A as ce,i as g,L as F,dW as h,k as se}from"./main-C7ps2lmX.js";import{useState as l}from"react";import{D as ae}from"./DynamicComponents-DvaX3FJx.js";import{F as ne}from"./FormAccess-DyLNkc18.js";import{V as le}from"./ViewHeader-B7eeFzFA.js";import{u as V}from"./useParams-B67lSY02.js";import"react-dom";import"./ClientSelect-B9UqjyP6.js";import"./FileUpload-CumNwlWc.js";import"./CodeEditor-C-nZkUJx.js";import"./copy-icon-ACZmDH8e.js";import"./EmptyStateFooter-DqmBOP2I.js";import"./EmptyStateActions-DWNUFByn.js";import"./GroupPickerDialog-C09EjRTA.js";import"./PaginatingTableToolbar-Cjsz5Jh4.js";import"./DataListItemRow-BC0LurDd.js";import"./FlexItem-BzZfUnQ1.js";import"./KeySelect-jKxsKqdI.js";import"./useToggle-K3Kx99tM.js";import"./MultiLineInput-DiPNQ1LE.js";import"./AddRoleMappingModal-DW8o4W0z.js";import"./KeycloakDataTable-DbY4la1D.js";import"./Td-D2hVFK0Z.js";import"./grip-vertical-icon-BxF7V59o.js";import"./_baseFlatten-eIEJR-AJ.js";import"./ConfirmDialog-hx7XKLbN.js";import"./filter-icon-DO0QNij3.js";const I={config:{},executor:""};function je(){const{adminClient:P}=U(),{t:c}=W(),A=J(),{realm:d,profileName:a}=V(),{executorName:n}=V(),{addAlert:C,addError:H}=Q(),[N,T]=l(!1),p=X().componentTypes?.["org.keycloak.services.clientpolicy.executor.ClientPolicyExecutorProvider"],[m,O]=l([]),[D,G]=l([]),[v,L]=l([]),[w,B]=l([]),f=Y({defaultValues:I}),{control:j,reset:y,handleSubmit:z}=f,i=!!n,E=e=>{const r=e.find(s=>s.name===a)?.executors?.find(s=>s.executor===n);r&&y({config:r.configuration})};Z(()=>P.clientPolicies.listProfiles({includeGlobalProfiles:!0}),e=>{L(e.globalProfiles),B(e.profiles),E(e.profiles),E(e.globalProfiles)},[]);const q=async()=>{const e=f.getValues(),t=w.map(r=>{if(r.name!==a)return r;const s=(r.executors??[]).concat({executor:e.executor,configuration:e.config||{}});if(i){const k=r.executors.find(M=>M.executor===n);k.configuration={...k.configuration,...e.config}}return i?r:{...r,executors:s}});try{await P.clientPolicies.createProfiles({profiles:t,globalProfiles:v}),C(c(i?"updateExecutorSuccess":"addExecutorSuccess"),se.success),A(h({realm:d,profileName:a}))}catch(r){H(i?"updateExecutorError":"addExecutorError",r)}},x=v.find(e=>e.name===a),b=p?.find(e=>e.id===n),K=b?.properties.map(e=>{const t=i?e.defaultValue:"";return{...e,defaultValue:t}});return u(R,{children:[o(le,{titleKey:i?n:c("addExecutor"),divider:!0}),u(_,{variant:"light",children:[u(ne,{isHorizontal:!0,role:"manage-realm",className:"pf-v5-u-mt-lg",isReadOnly:!!x,children:[o($,{label:c("executorType"),fieldId:"kc-executorType",labelIcon:m.length>0&&m[0].helpText!==""?o(S,{helpText:m[0].helpText,fieldLabelId:"executorTypeHelpText"}):i?o(S,{helpText:b?.helpText,fieldLabelId:"executorTypeHelpText"}):void 0,children:o(ee,{name:"executor",defaultValue:"",control:j,render:({field:e})=>o(te,{toggleId:"kc-executor",placeholderText:"Select an executor",onToggle:t=>T(t),onSelect:t=>{y({...I,executor:t.toString()});const r=p?.filter(s=>s.id===t);O(r??[]),G(r?.[0].properties??[]),T(!1)},selections:i?n:e.value,variant:oe.single,"data-testid":"executorType-select","aria-label":c("executorType"),isOpen:N,maxHeight:580,isDisabled:i,children:p?.map(t=>o(re,{selected:t.id===e.value,value:t.id,description:t.helpText,children:t.id},t.id))})})}),o(ie,{...f,children:o(ae,{properties:i?K:D})}),!x&&u(ce,{children:[o(g,{variant:"primary",onClick:()=>z(q)(),"data-testid":"addExecutor-saveBtn",children:c(i?"save":"add")}),o(g,{variant:"link",component:e=>o(F,{...e,to:h({realm:d,profileName:a})}),"data-testid":"addExecutor-cancelBtn",children:c("cancel")})]})]}),i&&x&&o("div",{className:"kc-backToProfile",children:o(g,{component:e=>o(F,{...e,to:h({realm:d,profileName:a})}),variant:"primary",children:c("back")})})]})]})}export{je as default};
//# sourceMappingURL=ExecutorForm-BtMpq0Ui.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy