keycloak-scim/src/components/dynamic/components.ts
Jenny 0b73d51412
Realm settings(Client policies -> conditions): Update client-roles condition to match new design (#1532)
* wip client roles select field

WIP multivalued roles component

wip client roles select: multivalued rows component

wip client roles select

role multi select is working :)

update client roles select to use multivalued select as per new design

delete comments

remove unused css

update cypress tests

revert to original

remove duplicates

add isCreateable

* PR feedback

* small refactor

* change to use orderBy

* use localeCompare

* fix tests

Co-authored-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
2021-11-22 07:41:43 -05:00

41 lines
1.4 KiB
TypeScript

import type { FunctionComponent } from "react";
import type { ConfigPropertyRepresentation } from "@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigInfoRepresentation";
import { StringComponent } from "./StringComponent";
import { BooleanComponent } from "./BooleanComponent";
import { ListComponent } from "./ListComponent";
import { RoleComponent } from "./RoleComponent";
import { ScriptComponent } from "./ScriptComponent";
import { ClientSelectComponent } from "./ClientSelectComponent";
import { MultiValuedStringComponent } from "./MultivaluedStringComponent";
import { MultiValuedListComponent } from "./MultivaluedListComponent";
export type ComponentProps = Omit<ConfigPropertyRepresentation, "type">;
const ComponentTypes = [
"String",
"boolean",
"List",
"Role",
"Script",
"MultivaluedList",
"ClientList",
"MultivaluedString",
] as const;
export type Components = typeof ComponentTypes[number];
export const COMPONENTS: {
[index in Components]: FunctionComponent<ComponentProps>;
} = {
String: StringComponent,
boolean: BooleanComponent,
List: ListComponent,
Role: RoleComponent,
Script: ScriptComponent,
ClientList: ClientSelectComponent,
MultivaluedList: MultiValuedListComponent,
MultivaluedString: MultiValuedStringComponent,
} as const;
export const isValidComponentType = (value: string): value is Components =>
value in COMPONENTS;