diff --git a/src/identity-providers/IdentityProvidersSection.tsx b/src/identity-providers/IdentityProvidersSection.tsx index 14bff93eea..895869c8c2 100644 --- a/src/identity-providers/IdentityProvidersSection.tsx +++ b/src/identity-providers/IdentityProvidersSection.tsx @@ -48,7 +48,7 @@ export default function IdentityProvidersSection() { const { realm } = useRealm(); const history = useHistory(); const [key, setKey] = useState(0); - const refresh = () => setKey(new Date().getTime()); + const refresh = () => setKey(key + 1); const [addProviderOpen, setAddProviderOpen] = useState(false); const [manageDisplayDialog, setManageDisplayDialog] = useState(false); @@ -69,13 +69,11 @@ export default function IdentityProvidersSection() { return provider.identityProviders!; }, (providers) => { - setProviders(providers); + setProviders(sortBy(providers, ["config.guiOrder", "alias"])); }, - [] + [key] ); - const loader = () => Promise.resolve(sortBy(providers, "alias")); - const DetailLink = (identityProvider: IdentityProviderRepresentation) => ( {manageDisplayDialog && ( setManageDisplayDialog(false)} + onClose={() => { + setManageDisplayDialog(false); + refresh(); + }} providers={providers.filter((p) => p.enabled)} /> )} @@ -212,8 +213,7 @@ export default function IdentityProvidersSection() { )} {providers.length !== 0 && ( { - order.map(async (alias, index) => { + onClick={async () => { + const updates = order.map((alias, index) => { const provider = providers.find((p) => p.alias === alias)!; provider.config!.guiOrder = index; - try { - await adminClient.identityProviders.update({ alias }, provider); - addAlert(t("orderChangeSuccess"), AlertVariant.success); - } catch (error) { - addError("identity-providers:orderChangeError", error); - } + return adminClient.identityProviders.update({ alias }, provider); }); + try { + await Promise.all(updates); + addAlert(t("orderChangeSuccess")); + } catch (error) { + addError("identity-providers:orderChangeError", error); + } + onClose(); }} > @@ -111,28 +112,23 @@ export const ManageOrderDialog = ({ onDragCancel={onDragCancel} itemOrder={order} > - {sortBy(providers, "config.guiOrder").map((provider) => ( + {sortBy(providers, "config.guiOrder", "alias").map((provider) => ( - + - {provider.alias} + {provider.alias} , ]} /> diff --git a/src/user-federation/ManagePriorityDialog.tsx b/src/user-federation/ManagePriorityDialog.tsx index 6cf7623f28..a1a665b093 100644 --- a/src/user-federation/ManagePriorityDialog.tsx +++ b/src/user-federation/ManagePriorityDialog.tsx @@ -2,7 +2,6 @@ import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { sortBy } from "lodash-es"; import { - AlertVariant, Button, ButtonVariant, DataList, @@ -68,19 +67,23 @@ export const ManagePriorityDialog = ({