parent
776984188f
commit
67f401b029
5 changed files with 12 additions and 11 deletions
|
@ -145,38 +145,32 @@ describe("Realm settings events tab tests", () => {
|
||||||
|
|
||||||
cy.findByTestId("option-aes-generated").click();
|
cy.findByTestId("option-aes-generated").click();
|
||||||
realmSettingsPage.enterUIDisplayName("test_aes-generated");
|
realmSettingsPage.enterUIDisplayName("test_aes-generated");
|
||||||
realmSettingsPage.toggleSwitch("active", false);
|
|
||||||
realmSettingsPage.toggleSwitch("enabled", false);
|
|
||||||
realmSettingsPage.addProvider();
|
realmSettingsPage.addProvider();
|
||||||
|
|
||||||
realmSettingsPage.toggleAddProviderDropdown();
|
realmSettingsPage.toggleAddProviderDropdown();
|
||||||
|
|
||||||
cy.findByTestId("option-ecdsa-generated").click();
|
cy.findByTestId("option-ecdsa-generated").click();
|
||||||
realmSettingsPage.enterUIDisplayName("test_ecdsa-generated");
|
realmSettingsPage.enterUIDisplayName("test_ecdsa-generated");
|
||||||
realmSettingsPage.toggleSwitch("enabled", false);
|
realmSettingsPage.toggleSwitch("active", false);
|
||||||
realmSettingsPage.addProvider();
|
realmSettingsPage.addProvider();
|
||||||
|
|
||||||
realmSettingsPage.toggleAddProviderDropdown();
|
realmSettingsPage.toggleAddProviderDropdown();
|
||||||
|
|
||||||
cy.findByTestId("option-hmac-generated").click();
|
cy.findByTestId("option-hmac-generated").click();
|
||||||
realmSettingsPage.enterUIDisplayName("test_hmac-generated");
|
realmSettingsPage.enterUIDisplayName("test_hmac-generated");
|
||||||
realmSettingsPage.toggleSwitch("active", false);
|
realmSettingsPage.toggleSwitch("enabled", false);
|
||||||
realmSettingsPage.addProvider();
|
realmSettingsPage.addProvider();
|
||||||
|
|
||||||
realmSettingsPage.toggleAddProviderDropdown();
|
realmSettingsPage.toggleAddProviderDropdown();
|
||||||
|
|
||||||
cy.findByTestId("option-rsa-generated").click();
|
cy.findByTestId("option-rsa-generated").click();
|
||||||
realmSettingsPage.enterUIDisplayName("test_rsa-generated");
|
realmSettingsPage.enterUIDisplayName("test_rsa-generated");
|
||||||
realmSettingsPage.toggleSwitch("active", false);
|
|
||||||
realmSettingsPage.toggleSwitch("enabled", false);
|
|
||||||
realmSettingsPage.addProvider();
|
realmSettingsPage.addProvider();
|
||||||
|
|
||||||
realmSettingsPage.toggleAddProviderDropdown();
|
realmSettingsPage.toggleAddProviderDropdown();
|
||||||
|
|
||||||
cy.findByTestId("option-rsa-enc-generated").click();
|
cy.findByTestId("option-rsa-enc-generated").click();
|
||||||
realmSettingsPage.enterUIDisplayName("test_rsa-enc-generated");
|
realmSettingsPage.enterUIDisplayName("test_rsa-enc-generated");
|
||||||
realmSettingsPage.toggleSwitch("active", false);
|
|
||||||
realmSettingsPage.toggleSwitch("enabled", false);
|
|
||||||
realmSettingsPage.addProvider();
|
realmSettingsPage.addProvider();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -242,7 +242,10 @@ export default function MappingDetails() {
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormProvider {...form}>
|
<FormProvider {...form}>
|
||||||
<DynamicComponents properties={mapping?.properties || []} />
|
<DynamicComponents
|
||||||
|
properties={mapping?.properties || []}
|
||||||
|
isNew={!isUpdating}
|
||||||
|
/>
|
||||||
</FormProvider>
|
</FormProvider>
|
||||||
<ActionGroup>
|
<ActionGroup>
|
||||||
<Button variant="primary" type="submit">
|
<Button variant="primary" type="submit">
|
||||||
|
|
|
@ -11,6 +11,8 @@ export const BooleanComponent = ({
|
||||||
label,
|
label,
|
||||||
helpText,
|
helpText,
|
||||||
isDisabled = false,
|
isDisabled = false,
|
||||||
|
defaultValue,
|
||||||
|
isNew = true,
|
||||||
}: ComponentProps) => {
|
}: ComponentProps) => {
|
||||||
const { t } = useTranslation("dynamic");
|
const { t } = useTranslation("dynamic");
|
||||||
const { control } = useFormContext();
|
const { control } = useFormContext();
|
||||||
|
@ -27,7 +29,7 @@ export const BooleanComponent = ({
|
||||||
<Controller
|
<Controller
|
||||||
name={convertToName(name!)}
|
name={convertToName(name!)}
|
||||||
data-testid={name}
|
data-testid={name}
|
||||||
defaultValue={false}
|
defaultValue={isNew ? defaultValue : false}
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<Switch
|
<Switch
|
||||||
|
@ -38,7 +40,7 @@ export const BooleanComponent = ({
|
||||||
isChecked={
|
isChecked={
|
||||||
field.value === "true" ||
|
field.value === "true" ||
|
||||||
field.value === true ||
|
field.value === true ||
|
||||||
field.value[0] === "true"
|
field.value?.[0] === "true"
|
||||||
}
|
}
|
||||||
onChange={(value) => field.onChange("" + value)}
|
onChange={(value) => field.onChange("" + value)}
|
||||||
data-testid={name}
|
data-testid={name}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { convertAttributeNameToForm } from "../../util";
|
||||||
type DynamicComponentProps = {
|
type DynamicComponentProps = {
|
||||||
properties: ConfigPropertyRepresentation[];
|
properties: ConfigPropertyRepresentation[];
|
||||||
stringify?: boolean;
|
stringify?: boolean;
|
||||||
|
isNew?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DynamicComponents = ({
|
export const DynamicComponents = ({
|
||||||
|
|
|
@ -16,6 +16,7 @@ import { TextComponent } from "./TextComponent";
|
||||||
|
|
||||||
export type ComponentProps = Omit<ConfigPropertyRepresentation, "type"> & {
|
export type ComponentProps = Omit<ConfigPropertyRepresentation, "type"> & {
|
||||||
isDisabled?: boolean;
|
isDisabled?: boolean;
|
||||||
|
isNew?: boolean;
|
||||||
stringify?: boolean;
|
stringify?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue