sort mappers in alphabetical order (#2292)

fixes: #1821
This commit is contained in:
Erik Jan de Wit 2022-03-29 09:49:19 +02:00 committed by GitHub
parent f04788028b
commit e9707f0a87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,15 +14,17 @@ import { ListEmptyState } from "../../../components/list-empty-state/ListEmptySt
import { useAlerts } from "../../../components/alert/Alerts"; import { useAlerts } from "../../../components/alert/Alerts";
import { useAdminClient } from "../../../context/auth/AdminClient"; import { useAdminClient } from "../../../context/auth/AdminClient";
import { useConfirmDialog } from "../../../components/confirm-dialog/ConfirmDialog"; import { useConfirmDialog } from "../../../components/confirm-dialog/ConfirmDialog";
import { useWhoAmI } from "../../../context/whoami/WhoAmI";
export const LdapMapperList = () => { export const LdapMapperList = () => {
const history = useHistory(); const history = useHistory();
const { t } = useTranslation("user-federation"); const { t } = useTranslation("user-federation");
const adminClient = useAdminClient(); const adminClient = useAdminClient();
const { addAlert, addError } = useAlerts(); const { addAlert, addError } = useAlerts();
const { whoAmI } = useWhoAmI();
const { url } = useRouteMatch(); const { url } = useRouteMatch();
const [key, setKey] = useState(0); const [key, setKey] = useState(0);
const refresh = () => setKey(new Date().getTime()); const refresh = () => setKey(key + 1);
const { id } = useParams<{ id: string }>(); const { id } = useParams<{ id: string }>();
@ -46,7 +48,9 @@ export const LdapMapperList = () => {
} as ComponentRepresentation; } as ComponentRepresentation;
} }
); );
return mappersList; return mappersList.sort((a, b) =>
a.name!.localeCompare(b.name!, whoAmI.getLocale())
);
}; };
const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({ const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({