mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-09 15:02:05 -03:30
Rework floating promises to avoid concurrency side effects
Closes #40739 Signed-off-by: Alexander Schwartz <aschwart@redhat.com> Signed-off-by: Alexander Schwartz <alexander.schwartz@gmx.net> Co-authored-by: Jon Koops <jonkoops@gmail.com>
This commit is contained in:
parent
70f4acdf43
commit
2e613dea27
@ -111,8 +111,8 @@ export const AccountRow = ({
|
||||
<Button
|
||||
id={`${account.providerAlias}-idp-link`}
|
||||
variant="link"
|
||||
onClick={() => {
|
||||
login({
|
||||
onClick={async () => {
|
||||
await login({
|
||||
action: "idp_link:" + account.providerAlias,
|
||||
});
|
||||
}}
|
||||
|
||||
@ -69,7 +69,7 @@ export const DeviceActivity = () => {
|
||||
|
||||
const signOutAll = async () => {
|
||||
await deleteSession(context);
|
||||
context.keycloak.logout();
|
||||
await context.keycloak.logout();
|
||||
};
|
||||
|
||||
const signOutSession = async (
|
||||
|
||||
@ -266,8 +266,8 @@ export const SigningIn = () => {
|
||||
<Button
|
||||
variant="danger"
|
||||
data-testrole="remove"
|
||||
onClick={() => {
|
||||
login({
|
||||
onClick={async () => {
|
||||
await login({
|
||||
action:
|
||||
"delete_credential:" +
|
||||
meta.credential.id,
|
||||
@ -280,8 +280,10 @@ export const SigningIn = () => {
|
||||
{container.updateAction && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => {
|
||||
login({ action: container.updateAction });
|
||||
onClick={async () => {
|
||||
await login({
|
||||
action: container.updateAction,
|
||||
});
|
||||
}}
|
||||
data-testrole="update"
|
||||
>
|
||||
|
||||
@ -51,6 +51,7 @@ export const Oid4Vci = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (initialSelected !== selected && credentialsIssuer !== undefined) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
requestVCOffer(context, selectOptions[selected], credentialsIssuer).then(
|
||||
(blob) => {
|
||||
const reader = new FileReader();
|
||||
|
||||
@ -105,15 +105,15 @@ export const PermissionRequest = ({
|
||||
</Td>
|
||||
<Td>
|
||||
<Button
|
||||
onClick={() => {
|
||||
approveDeny(shareRequest, true);
|
||||
onClick={async () => {
|
||||
await approveDeny(shareRequest, true);
|
||||
}}
|
||||
>
|
||||
{t("accept")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
approveDeny(shareRequest);
|
||||
onClick={async () => {
|
||||
await approveDeny(shareRequest);
|
||||
}}
|
||||
className="pf-v5-u-ml-sm"
|
||||
variant="danger"
|
||||
|
||||
@ -66,7 +66,7 @@ export function usePromise<T>(
|
||||
}
|
||||
}
|
||||
|
||||
handlePromise();
|
||||
void handlePromise();
|
||||
|
||||
// Abort the Promise when the component unmounts, or the dependencies change.
|
||||
return () => controller.abort();
|
||||
|
||||
@ -18,7 +18,7 @@ test.describe("Signing in", () => {
|
||||
|
||||
await page.getByTestId("accountSecurity").click();
|
||||
await expect(page.getByTestId("account-security/signing-in")).toBeVisible();
|
||||
page.getByTestId("account-security/signing-in").click();
|
||||
await page.getByTestId("account-security/signing-in").click();
|
||||
|
||||
await expect(
|
||||
page.getByTestId("password/credential-list").getByRole("listitem"),
|
||||
@ -54,11 +54,11 @@ test.describe("Signing in 2", () => {
|
||||
await login(page, "jdoe", "jdoe", "groups");
|
||||
|
||||
const credentials = await getCredentials(jdoeUser!.id!, realm);
|
||||
deleteCredential(jdoeUser!.id!, credentials![0].id!, realm);
|
||||
await deleteCredential(jdoeUser!.id!, credentials![0].id!, realm);
|
||||
|
||||
await page.getByTestId("accountSecurity").click();
|
||||
await expect(page.getByTestId("account-security/signing-in")).toBeVisible();
|
||||
page.getByTestId("account-security/signing-in").click();
|
||||
await page.getByTestId("account-security/signing-in").click();
|
||||
|
||||
await expect(
|
||||
page.getByTestId("password/credential-list").getByRole("listitem"),
|
||||
|
||||
@ -58,7 +58,7 @@ export async function createIdentityProvider(
|
||||
idp: IdentityProviderRepresentation,
|
||||
realm = DEFAULT_REALM,
|
||||
): Promise<string> {
|
||||
return adminClient.identityProviders.create({ ...idp, realm })["id"];
|
||||
return (await adminClient.identityProviders.create({ ...idp, realm }))["id"];
|
||||
}
|
||||
|
||||
export async function deleteIdentityProvider(
|
||||
|
||||
@ -434,7 +434,7 @@ export default function FlowDetails() {
|
||||
const [removed] = order.splice(source.index, 1);
|
||||
order.splice(dest.index, 0, removed);
|
||||
const change = executionList.getChange(dragged, order);
|
||||
executeChange(dragged, change);
|
||||
void executeChange(dragged, change);
|
||||
return true;
|
||||
} else {
|
||||
setLiveText(t("onDragCancel"));
|
||||
@ -482,9 +482,9 @@ export default function FlowDetails() {
|
||||
type={
|
||||
flow.providerId === "client-flow" ? "client" : "basic"
|
||||
}
|
||||
onSelect={(type) => {
|
||||
onSelect={async (type) => {
|
||||
if (type) {
|
||||
addExecution(flow.alias!, type);
|
||||
await addExecution(flow.alias!, type);
|
||||
}
|
||||
setShowAddExecutionDialog(false);
|
||||
}}
|
||||
@ -494,8 +494,8 @@ export default function FlowDetails() {
|
||||
<AddSubFlowModal
|
||||
name={flow.alias!}
|
||||
onCancel={() => setShowSubFlowDialog(false)}
|
||||
onConfirm={(newFlow) => {
|
||||
addFlow(flow.alias!, newFlow);
|
||||
onConfirm={async (newFlow) => {
|
||||
await addFlow(flow.alias!, newFlow);
|
||||
setShowSubFlowDialog(false);
|
||||
}}
|
||||
/>
|
||||
|
||||
@ -160,7 +160,7 @@ export const RequiredActions = () => {
|
||||
if (!dragged.alias) return;
|
||||
|
||||
const times = newIndex - oldIndex;
|
||||
executeMove(dragged, times);
|
||||
await executeMove(dragged, times);
|
||||
}}
|
||||
columns={[
|
||||
{
|
||||
@ -177,8 +177,8 @@ export const RequiredActions = () => {
|
||||
label={t("on")}
|
||||
labelOff={t("off")}
|
||||
isChecked={row.enabled}
|
||||
onChange={() => {
|
||||
updateAction(row.data, "enabled");
|
||||
onChange={async () => {
|
||||
await updateAction(row.data, "enabled");
|
||||
}}
|
||||
aria-label={row.name}
|
||||
/>
|
||||
@ -196,8 +196,8 @@ export const RequiredActions = () => {
|
||||
isDisabled={!row.enabled}
|
||||
labelOff={!row.enabled ? t("disabledOff") : t("off")}
|
||||
isChecked={row.defaultAction}
|
||||
onChange={() => {
|
||||
updateAction(row.data, "defaultAction");
|
||||
onChange={async () => {
|
||||
await updateAction(row.data, "defaultAction");
|
||||
}}
|
||||
aria-label={row.name}
|
||||
/>
|
||||
|
||||
@ -148,8 +148,8 @@ export const GenerateKeyDialog = ({
|
||||
key="confirm"
|
||||
data-testid="confirm"
|
||||
isDisabled={!isValid}
|
||||
onClick={() => {
|
||||
handleSubmit((config) => {
|
||||
onClick={async () => {
|
||||
await handleSubmit((config) => {
|
||||
save(config);
|
||||
toggleDialog();
|
||||
})();
|
||||
|
||||
@ -58,8 +58,8 @@ export const ImportKeyDialog = ({
|
||||
id="modal-confirm"
|
||||
data-testid="confirm"
|
||||
key="confirm"
|
||||
onClick={() => {
|
||||
handleSubmit((importFile) => {
|
||||
onClick={async () => {
|
||||
await handleSubmit((importFile) => {
|
||||
save(importFile);
|
||||
toggleDialog();
|
||||
})();
|
||||
|
||||
@ -32,8 +32,8 @@ export const SamlImportKeyDialog = ({
|
||||
|
||||
const { addAlert, addError } = useAlerts();
|
||||
|
||||
const submit = (form: SamlKeysDialogForm) => {
|
||||
submitForm(adminClient, form, id, attr, (error) => {
|
||||
const submit = async (form: SamlKeysDialogForm) => {
|
||||
await submitForm(adminClient, form, id, attr, (error) => {
|
||||
if (error) {
|
||||
addError("importError", error);
|
||||
} else {
|
||||
@ -50,8 +50,8 @@ export const SamlImportKeyDialog = ({
|
||||
continueButtonLabel="import"
|
||||
titleKey="importKey"
|
||||
confirmButtonDisabled={!isValid}
|
||||
onConfirm={() => {
|
||||
handleSubmit(submit)();
|
||||
onConfirm={async () => {
|
||||
await handleSubmit(submit)();
|
||||
}}
|
||||
>
|
||||
<FormProvider {...form}>
|
||||
|
||||
@ -224,8 +224,8 @@ export const SamlKeys = ({ clientId, save }: SamlKeysProps) => {
|
||||
messageKey: "reGenerateSigningExplain",
|
||||
continueButtonLabel: "yes",
|
||||
cancelButtonLabel: "no",
|
||||
onConfirm: () => {
|
||||
generate(selectedType!);
|
||||
onConfirm: async () => {
|
||||
await generate(selectedType!);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -84,8 +84,8 @@ export const SamlKeysDialog = ({
|
||||
|
||||
const { addAlert, addError } = useAlerts();
|
||||
|
||||
const submit = (form: SamlKeysDialogForm) => {
|
||||
submitForm(adminClient, form, id, attr, (error) => {
|
||||
const submit = async (form: SamlKeysDialogForm) => {
|
||||
await submitForm(adminClient, form, id, attr, (error) => {
|
||||
if (error) {
|
||||
addError("importError", error);
|
||||
} else {
|
||||
@ -133,9 +133,9 @@ export const SamlKeysDialog = ({
|
||||
data-testid="confirm"
|
||||
variant="primary"
|
||||
isDisabled={!isValid && !keys}
|
||||
onClick={() => {
|
||||
onClick={async () => {
|
||||
if (type) {
|
||||
handleSubmit(submit)();
|
||||
await handleSubmit(submit)();
|
||||
}
|
||||
onClose();
|
||||
}}
|
||||
|
||||
@ -34,7 +34,7 @@ export const RealmContextProvider = ({ children }: PropsWithChildren) => {
|
||||
|
||||
// Configure admin client to use selected realm when it changes.
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
void (async () => {
|
||||
adminClient.setConfig({ realmName: realm });
|
||||
const namespace = encodeURIComponent(realm);
|
||||
await i18n.loadNamespaces(namespace);
|
||||
|
||||
@ -33,7 +33,7 @@ export class WhoAmI {
|
||||
constructor(me?: WhoAmIRepresentation) {
|
||||
this.#me = me;
|
||||
if (this.#me?.locale) {
|
||||
i18n.changeLanguage(this.#me.locale, (error) => {
|
||||
void i18n.changeLanguage(this.#me.locale, (error) => {
|
||||
if (error) {
|
||||
console.warn("Error(s) loading locale", this.#me?.locale, error);
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ export const AssignedPolicies = ({
|
||||
: [],
|
||||
);
|
||||
|
||||
const assign = (policies: { policy: PolicyRepresentation }[]) => {
|
||||
const assign = async (policies: { policy: PolicyRepresentation }[]) => {
|
||||
const assignedPolicies = policies.map(({ policy }) => ({
|
||||
id: policy.id!,
|
||||
}));
|
||||
@ -101,7 +101,7 @@ export const AssignedPolicies = ({
|
||||
...(getValues("policies") || []),
|
||||
...assignedPolicies,
|
||||
]);
|
||||
trigger("policies");
|
||||
await trigger("policies");
|
||||
setSelectedPolicies([
|
||||
...selectedPolicies,
|
||||
...policies.map(({ policy }) => policy),
|
||||
@ -171,8 +171,8 @@ export const AssignedPolicies = ({
|
||||
providers={providers!}
|
||||
policies={policies!}
|
||||
resourceType={resourceType}
|
||||
onAssign={(newPolicy) => {
|
||||
assign([{ policy: newPolicy }]);
|
||||
onAssign={async (newPolicy) => {
|
||||
await assign([{ policy: newPolicy }]);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@ -179,9 +179,9 @@ export const NewPermissionPolicyDialog = ({
|
||||
>
|
||||
<Form
|
||||
id="createPermissionPolicy-form"
|
||||
onSubmit={(e) => {
|
||||
onSubmit={async (e) => {
|
||||
e.stopPropagation();
|
||||
handleSubmit(save)(e);
|
||||
await handleSubmit(save)(e);
|
||||
}}
|
||||
isHorizontal
|
||||
>
|
||||
|
||||
@ -128,8 +128,8 @@ export const DefaultsGroupsTab = () => {
|
||||
title: "addDefaultGroups",
|
||||
ok: "add",
|
||||
}}
|
||||
onConfirm={(groups) => {
|
||||
addGroups(groups || []);
|
||||
onConfirm={async (groups) => {
|
||||
await addGroups(groups || []);
|
||||
toggleGroupPicker();
|
||||
}}
|
||||
onClose={toggleGroupPicker}
|
||||
|
||||
@ -71,8 +71,8 @@ export const RealmSettingsLoginTab = ({
|
||||
label={t("on")}
|
||||
labelOff={t("off")}
|
||||
isChecked={realm.registrationAllowed}
|
||||
onChange={(_event, value) => {
|
||||
updateSwitchValue({ registrationAllowed: value });
|
||||
onChange={async (_event, value) => {
|
||||
await updateSwitchValue({ registrationAllowed: value });
|
||||
}}
|
||||
aria-label={t("registrationAllowed")}
|
||||
/>
|
||||
@ -96,8 +96,8 @@ export const RealmSettingsLoginTab = ({
|
||||
label={t("on")}
|
||||
labelOff={t("off")}
|
||||
isChecked={realm.resetPasswordAllowed}
|
||||
onChange={(_event, value) => {
|
||||
updateSwitchValue({ resetPasswordAllowed: value });
|
||||
onChange={async (_event, value) => {
|
||||
await updateSwitchValue({ resetPasswordAllowed: value });
|
||||
}}
|
||||
aria-label={t("resetPasswordAllowed")}
|
||||
/>
|
||||
@ -120,8 +120,8 @@ export const RealmSettingsLoginTab = ({
|
||||
label={t("on")}
|
||||
labelOff={t("off")}
|
||||
isChecked={realm.rememberMe}
|
||||
onChange={(_event, value) => {
|
||||
updateSwitchValue({ rememberMe: value });
|
||||
onChange={async (_event, value) => {
|
||||
await updateSwitchValue({ rememberMe: value });
|
||||
}}
|
||||
aria-label={t("rememberMe")}
|
||||
/>
|
||||
@ -148,8 +148,8 @@ export const RealmSettingsLoginTab = ({
|
||||
label={t("on")}
|
||||
labelOff={t("off")}
|
||||
isChecked={realm.registrationEmailAsUsername}
|
||||
onChange={(_event, value) => {
|
||||
updateSwitchValue([
|
||||
onChange={async (_event, value) => {
|
||||
await updateSwitchValue([
|
||||
{
|
||||
registrationEmailAsUsername: value,
|
||||
},
|
||||
@ -179,8 +179,8 @@ export const RealmSettingsLoginTab = ({
|
||||
label={t("on")}
|
||||
labelOff={t("off")}
|
||||
isChecked={realm.loginWithEmailAllowed}
|
||||
onChange={(_event, value) => {
|
||||
updateSwitchValue([
|
||||
onChange={async (_event, value) => {
|
||||
await updateSwitchValue([
|
||||
{
|
||||
loginWithEmailAllowed: value,
|
||||
},
|
||||
@ -207,8 +207,8 @@ export const RealmSettingsLoginTab = ({
|
||||
label={t("on")}
|
||||
labelOff={t("off")}
|
||||
isChecked={realm.duplicateEmailsAllowed}
|
||||
onChange={(_event, value) => {
|
||||
updateSwitchValue({
|
||||
onChange={async (_event, value) => {
|
||||
await updateSwitchValue({
|
||||
duplicateEmailsAllowed: value,
|
||||
});
|
||||
}}
|
||||
@ -237,8 +237,8 @@ export const RealmSettingsLoginTab = ({
|
||||
label={t("on")}
|
||||
labelOff={t("off")}
|
||||
isChecked={realm.verifyEmail}
|
||||
onChange={(_event, value) => {
|
||||
updateSwitchValue({ verifyEmail: value });
|
||||
onChange={async (_event, value) => {
|
||||
await updateSwitchValue({ verifyEmail: value });
|
||||
}}
|
||||
aria-label={t("verifyEmail")}
|
||||
/>
|
||||
@ -268,8 +268,8 @@ export const RealmSettingsLoginTab = ({
|
||||
label={t("on")}
|
||||
labelOff={t("off")}
|
||||
isChecked={realm.editUsernameAllowed}
|
||||
onChange={(_event, value) => {
|
||||
updateSwitchValue({ editUsernameAllowed: value });
|
||||
onChange={async (_event, value) => {
|
||||
await updateSwitchValue({ editUsernameAllowed: value });
|
||||
}}
|
||||
aria-label={t("editUsernameAllowed")}
|
||||
/>
|
||||
|
||||
@ -386,9 +386,9 @@ export default function NewClientPolicy() {
|
||||
titleKey: "disablePolicyConfirmTitle",
|
||||
messageKey: "disablePolicyConfirm",
|
||||
continueButtonLabel: "disable",
|
||||
onConfirm: () => {
|
||||
onConfirm: async () => {
|
||||
form.setValue("enabled", !form.getValues().enabled);
|
||||
save();
|
||||
await save();
|
||||
},
|
||||
});
|
||||
|
||||
@ -401,8 +401,8 @@ export default function NewClientPolicy() {
|
||||
<DeleteConditionConfirm />
|
||||
<DeleteProfileConfirm />
|
||||
<AddClientProfileModal
|
||||
onConfirm={(profiles: ClientProfileRepresentation[]) => {
|
||||
addProfiles(profiles.map((item) => item.name!));
|
||||
onConfirm={async (profiles: ClientProfileRepresentation[]) => {
|
||||
await addProfiles(profiles.map((item) => item.name!));
|
||||
}}
|
||||
allProfiles={policyProfiles}
|
||||
open={profilesModalOpen}
|
||||
@ -452,12 +452,12 @@ export default function NewClientPolicy() {
|
||||
}
|
||||
isReadOnly={isGlobalPolicy}
|
||||
isEnabled={field.value}
|
||||
onToggle={(value) => {
|
||||
onToggle={async (value) => {
|
||||
if (!value) {
|
||||
toggleDisableDialog();
|
||||
} else {
|
||||
field.onChange(value);
|
||||
save();
|
||||
await save();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
@ -287,8 +287,8 @@ export const PartialImportDialog = (props: PartialImportProps) => {
|
||||
data-testid="confirm"
|
||||
key="import"
|
||||
isDisabled={!isAnyResourceChecked}
|
||||
onClick={() => {
|
||||
doImport();
|
||||
onClick={async () => {
|
||||
await doImport();
|
||||
}}
|
||||
>
|
||||
{t("import")}
|
||||
|
||||
@ -272,9 +272,9 @@ export const PoliciesTab = () => {
|
||||
clientPolicy={clientPolicy}
|
||||
form={form}
|
||||
saveStatus={saveStatus}
|
||||
onConfirm={() => {
|
||||
onConfirm={async () => {
|
||||
form.setValue(clientPolicy.name!, false);
|
||||
saveStatus();
|
||||
await saveStatus();
|
||||
}}
|
||||
/>
|
||||
),
|
||||
|
||||
@ -218,7 +218,7 @@ export const RealmSettingsTabs = () => {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
fetchLocalizationTexts();
|
||||
void fetchLocalizationTexts();
|
||||
}, [setValue, realm]);
|
||||
|
||||
const save = async (r: UIRealmRepresentation) => {
|
||||
|
||||
@ -154,7 +154,7 @@ export const EventsTab = ({ realm }: EventsTabProps) => {
|
||||
const enabledEventTypes = events?.enabledEventTypes?.filter(
|
||||
(e) => !values.includes(e),
|
||||
);
|
||||
addEvents(enabledEventTypes);
|
||||
await addEvents(enabledEventTypes);
|
||||
setEvents({ ...events, enabledEventTypes });
|
||||
};
|
||||
|
||||
|
||||
@ -147,7 +147,7 @@ export const RealmOverrides = ({
|
||||
}
|
||||
};
|
||||
|
||||
fetchLocalizationTexts().then((translations) => {
|
||||
void fetchLocalizationTexts().then((translations) => {
|
||||
const updatedRows: IRow[] = translations.map(
|
||||
(translation): IRow => ({
|
||||
rowEditBtnAriaLabel: () =>
|
||||
@ -221,7 +221,7 @@ export const RealmOverrides = ({
|
||||
refreshTable();
|
||||
translationForm.setValue("key", "");
|
||||
translationForm.setValue("value", "");
|
||||
i18n.reloadResources();
|
||||
await i18n.reloadResources();
|
||||
|
||||
addAlert(t("addTranslationSuccess"), AlertVariant.success);
|
||||
} catch (error) {
|
||||
@ -321,7 +321,7 @@ export const RealmOverrides = ({
|
||||
},
|
||||
value,
|
||||
);
|
||||
i18n.reloadResources();
|
||||
await i18n.reloadResources();
|
||||
|
||||
addAlert(t("updateTranslationSuccess"), AlertVariant.success);
|
||||
setTableRows(newRows);
|
||||
@ -341,8 +341,8 @@ export const RealmOverrides = ({
|
||||
{addTranslationModalOpen && (
|
||||
<AddTranslationModal
|
||||
handleModalToggle={handleModalToggle}
|
||||
save={(pair: any) => {
|
||||
addKeyValue(pair);
|
||||
save={async (pair: any) => {
|
||||
await addKeyValue(pair);
|
||||
handleModalToggle();
|
||||
}}
|
||||
form={translationForm}
|
||||
@ -517,8 +517,8 @@ export const RealmOverrides = ({
|
||||
<Form
|
||||
isHorizontal
|
||||
className="kc-form-translationValue"
|
||||
onSubmit={handleSubmit(() => {
|
||||
onSubmit(formValue, rowIndex);
|
||||
onSubmit={handleSubmit(async () => {
|
||||
await onSubmit(formValue, rowIndex);
|
||||
})}
|
||||
>
|
||||
<FormGroup
|
||||
|
||||
@ -25,7 +25,7 @@ export const ImageUpload = ({ name, onChange }: ImageUploadProps) => {
|
||||
});
|
||||
|
||||
if (file) {
|
||||
fileToDataUri(file).then((dataUri) => {
|
||||
void fileToDataUri(file).then((dataUri) => {
|
||||
setDataUri(dataUri);
|
||||
onChange?.(dataUri);
|
||||
});
|
||||
@ -35,7 +35,7 @@ export const ImageUpload = ({ name, onChange }: ImageUploadProps) => {
|
||||
useEffect(() => {
|
||||
(() => {
|
||||
if (loadedFile) {
|
||||
fileToDataUri(loadedFile).then((dataUri) => {
|
||||
void fileToDataUri(loadedFile).then((dataUri) => {
|
||||
setDataUri(dataUri);
|
||||
});
|
||||
}
|
||||
|
||||
@ -144,8 +144,8 @@ export const ThemeColors = ({ realm, save, theme }: ThemeColorsProps) => {
|
||||
<>
|
||||
{open && (
|
||||
<FileNameDialog
|
||||
onSave={(name) => {
|
||||
handleSubmit((data) => convert({ ...data, name }))();
|
||||
onSave={async (name) => {
|
||||
await handleSubmit((data) => convert({ ...data, name }))();
|
||||
setOpen(false);
|
||||
}}
|
||||
onClose={toggle}
|
||||
|
||||
@ -134,7 +134,7 @@ styles=css/login.css css/theme-styles.css
|
||||
}
|
||||
`,
|
||||
);
|
||||
zip.generateAsync({ type: "blob" }).then((content) => {
|
||||
await zip.generateAsync({ type: "blob" }).then((content) => {
|
||||
const url = URL.createObjectURL(content);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
|
||||
@ -104,7 +104,7 @@ export const AttributesGroupTab = ({
|
||||
}),
|
||||
);
|
||||
|
||||
save(
|
||||
await save(
|
||||
{ ...config, groups },
|
||||
{
|
||||
successMessageKey: "deleteSuccess",
|
||||
|
||||
@ -102,7 +102,7 @@ export const AttributesTab = ({ setTableData }: AttributesTabProps) => {
|
||||
(attribute) => attribute.name !== attributeToDelete,
|
||||
);
|
||||
|
||||
save(
|
||||
await save(
|
||||
{ ...config, attributes: updatedAttributes, groups: config.groups },
|
||||
{
|
||||
successMessageKey: "deleteAttributeSuccess",
|
||||
@ -139,7 +139,7 @@ export const AttributesTab = ({ setTableData }: AttributesTabProps) => {
|
||||
attributes.splice(fromIndex, 1);
|
||||
attributes.splice(newIndex, 0, movedAttribute);
|
||||
|
||||
save(
|
||||
await save(
|
||||
{ attributes, groups },
|
||||
{
|
||||
successMessageKey: "updatedUserProfileSuccess",
|
||||
@ -228,7 +228,7 @@ export const AttributesTab = ({ setTableData }: AttributesTabProps) => {
|
||||
const dragged = attributes[oldIndex];
|
||||
if (!dragged.name) return;
|
||||
|
||||
executeMove(dragged, newIndex);
|
||||
await executeMove(dragged, newIndex);
|
||||
}}
|
||||
actions={[
|
||||
{
|
||||
|
||||
@ -114,8 +114,8 @@ export const RevocationModal = ({
|
||||
data-testid="set-to-now-button"
|
||||
key="set-to-now"
|
||||
variant="tertiary"
|
||||
onClick={() => {
|
||||
setToNow();
|
||||
onClick={async () => {
|
||||
await setToNow();
|
||||
handleModalToggle();
|
||||
}}
|
||||
form="revocation-modal-form"
|
||||
@ -126,8 +126,8 @@ export const RevocationModal = ({
|
||||
data-testid="clear-not-before-button"
|
||||
key="clear"
|
||||
variant="tertiary"
|
||||
onClick={() => {
|
||||
clearNotBefore();
|
||||
onClick={async () => {
|
||||
await clearNotBefore();
|
||||
handleModalToggle();
|
||||
}}
|
||||
form="revocation-modal-form"
|
||||
@ -138,8 +138,8 @@ export const RevocationModal = ({
|
||||
data-testid="modal-test-connection-button"
|
||||
key="push"
|
||||
variant="secondary"
|
||||
onClick={() => {
|
||||
push();
|
||||
onClick={async () => {
|
||||
await push();
|
||||
handleModalToggle();
|
||||
}}
|
||||
form="revocation-modal-form"
|
||||
|
||||
@ -208,8 +208,8 @@ export default function LdapMapperDetails() {
|
||||
? [
|
||||
<DropdownItem
|
||||
key="ldapSync"
|
||||
onClick={() => {
|
||||
sync("keycloakToFed");
|
||||
onClick={async () => {
|
||||
await sync("keycloakToFed");
|
||||
}}
|
||||
>
|
||||
{t(mapper.metadata.keycloakToFedSyncMessage)}
|
||||
|
||||
@ -230,8 +230,8 @@ export default function EditUser() {
|
||||
titleKey: "disableConfirmUserTitle",
|
||||
messageKey: "disableConfirmUser",
|
||||
continueButtonLabel: "disable",
|
||||
onConfirm: () => {
|
||||
save({
|
||||
onConfirm: async () => {
|
||||
await save({
|
||||
...toUserFormFields(user!),
|
||||
enabled: false,
|
||||
});
|
||||
@ -326,11 +326,11 @@ export default function EditUser() {
|
||||
{t("delete")}
|
||||
</DropdownItem>,
|
||||
]}
|
||||
onToggle={(value) => {
|
||||
onToggle={async (value) => {
|
||||
if (!value) {
|
||||
toggleDisableDialog();
|
||||
} else {
|
||||
save({
|
||||
await save({
|
||||
...toUserFormFields(user),
|
||||
enabled: value,
|
||||
});
|
||||
|
||||
@ -263,9 +263,9 @@ export const UserCredentials = ({ user, setUser }: UserCredentialsProps) => {
|
||||
);
|
||||
};
|
||||
|
||||
const onDrop = (evt: ReactDragEvent) => {
|
||||
const onDrop = async (evt: ReactDragEvent) => {
|
||||
if (isValidDrop(evt)) {
|
||||
onDragFinish(state.draggedItemId, state.tempItemOrder);
|
||||
await onDragFinish(state.draggedItemId, state.tempItemOrder);
|
||||
} else {
|
||||
onDragCancel();
|
||||
}
|
||||
|
||||
@ -168,11 +168,11 @@ export const UserForm = ({
|
||||
ok: "join",
|
||||
}}
|
||||
canBrowse={isManager}
|
||||
onConfirm={(groups) => {
|
||||
onConfirm={async (groups) => {
|
||||
if (user?.id) {
|
||||
addGroups(groups || []);
|
||||
await addGroups(groups || []);
|
||||
} else {
|
||||
addChips(groups || []);
|
||||
await addChips(groups || []);
|
||||
}
|
||||
|
||||
setOpen(false);
|
||||
@ -305,8 +305,8 @@ export const UserForm = ({
|
||||
<Switch
|
||||
data-testid="user-locked-switch"
|
||||
id="temporaryLocked"
|
||||
onChange={(_event, value) => {
|
||||
unLockUser();
|
||||
onChange={async (_event, value) => {
|
||||
await unLockUser();
|
||||
setLocked(value);
|
||||
}}
|
||||
isChecked={locked}
|
||||
|
||||
@ -72,8 +72,8 @@ export const ResetCredentialDialog = ({
|
||||
onCancel={onClose}
|
||||
toggleDialog={onClose}
|
||||
continueButtonLabel="credentialResetConfirm"
|
||||
onConfirm={() => {
|
||||
handleSubmit(sendCredentialsResetEmail)();
|
||||
onConfirm={async () => {
|
||||
await handleSubmit(sendCredentialsResetEmail)();
|
||||
}}
|
||||
confirmButtonDisabled={!resetIsNotDisabled}
|
||||
>
|
||||
|
||||
@ -157,8 +157,8 @@ export const ResetPasswordDialog = ({
|
||||
<PasswordInput
|
||||
data-testid="passwordField"
|
||||
id="password"
|
||||
onChange={(e) => {
|
||||
onChange(e);
|
||||
onChange={async (e) => {
|
||||
await onChange(e);
|
||||
if (passwordConfirmation !== e.currentTarget.value) {
|
||||
setError("passwordConfirmation", {
|
||||
message: t("confirmPasswordDoesNotMatch").toString(),
|
||||
|
||||
@ -26,7 +26,7 @@ export default function useQueryPermission(
|
||||
setStatus(null);
|
||||
setPlainStatus(null);
|
||||
|
||||
navigator.permissions.query({ name }).then((newStatus) => {
|
||||
void navigator.permissions.query({ name }).then((newStatus) => {
|
||||
setStatus(newStatus);
|
||||
updatePlainStatus(newStatus);
|
||||
});
|
||||
|
||||
@ -90,14 +90,14 @@ async function assertElementExists(
|
||||
}
|
||||
|
||||
export async function assertJwksUrlExists(page: Page, exist: boolean = true) {
|
||||
assertElementExists(page, "[data-testid='config.jwksUrl']", exist);
|
||||
await assertElementExists(page, "[data-testid='config.jwksUrl']", exist);
|
||||
}
|
||||
|
||||
export async function assertPkceMethodExists(
|
||||
page: Page,
|
||||
exist: boolean = true,
|
||||
) {
|
||||
assertElementExists(page, "#config\\.pkceMethod", exist);
|
||||
await assertElementExists(page, "#config\\.pkceMethod", exist);
|
||||
}
|
||||
|
||||
export async function goToMappersTab(page: Page) {
|
||||
|
||||
@ -11,7 +11,7 @@ export async function assertRowHasSignOutKebab(page: Page, row: string) {
|
||||
}
|
||||
|
||||
export async function clickNotBefore(page: Page) {
|
||||
page.getByTestId("clear-not-before-button").click();
|
||||
await page.getByTestId("clear-not-before-button").click();
|
||||
}
|
||||
|
||||
export async function assertNotBeforeValue(page: Page, value: string) {
|
||||
|
||||
@ -9,7 +9,7 @@ export async function clickSaveButton(page: Page) {
|
||||
}
|
||||
|
||||
export async function clickAddUserButton(page: Page) {
|
||||
page.getByTestId("no-users-found-empty-action").click();
|
||||
await page.getByTestId("no-users-found-empty-action").click();
|
||||
}
|
||||
|
||||
export async function fillUserForm(
|
||||
|
||||
@ -14,7 +14,7 @@ export async function goToRealms(page: Page) {
|
||||
}
|
||||
|
||||
export async function goToOrganizations(page: Page) {
|
||||
page.getByTestId("nav-item-organizations").click();
|
||||
await page.getByTestId("nav-item-organizations").click();
|
||||
}
|
||||
|
||||
export async function goToClients(page: Page) {
|
||||
|
||||
@ -66,7 +66,6 @@ export default tseslint.config(
|
||||
"@typescript-eslint/no-dynamic-delete": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-extraneous-class": "off",
|
||||
"@typescript-eslint/no-floating-promises": "off",
|
||||
"@typescript-eslint/no-inferrable-types": "off",
|
||||
"@typescript-eslint/no-invalid-void-type": "off",
|
||||
"@typescript-eslint/no-misused-promises": "off",
|
||||
|
||||
@ -158,7 +158,7 @@ describe("Realms", () => {
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
deleteRealm(kcAdminClient, currentRealmName);
|
||||
await deleteRealm(kcAdminClient, currentRealmName);
|
||||
});
|
||||
|
||||
it("list client initial access", async () => {
|
||||
@ -211,7 +211,7 @@ describe("Realms", () => {
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
deleteRealm(kcAdminClient, currentRealmName);
|
||||
await deleteRealm(kcAdminClient, currentRealmName);
|
||||
});
|
||||
|
||||
it("add group to default groups", async () => {
|
||||
@ -321,7 +321,7 @@ describe("Realms", () => {
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
deleteRealm(kcAdminClient, currentRealmName);
|
||||
await deleteRealm(kcAdminClient, currentRealmName);
|
||||
});
|
||||
});
|
||||
|
||||
@ -360,7 +360,7 @@ describe("Realms", () => {
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
deleteRealm(kcAdminClient, currentRealmName);
|
||||
await deleteRealm(kcAdminClient, currentRealmName);
|
||||
});
|
||||
});
|
||||
|
||||
@ -396,7 +396,7 @@ describe("Realms", () => {
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
deleteRealm(kcAdminClient, currentRealmName);
|
||||
await deleteRealm(kcAdminClient, currentRealmName);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user