adds keys table to realm settings

This commit is contained in:
jenny-s51 2021-04-29 15:04:19 -04:00
parent d5c5e3c01b
commit 12fe660816
4 changed files with 36 additions and 13 deletions

View file

@ -21,7 +21,6 @@ import { useAdminClient } from "../context/auth/AdminClient";
import type { RoleFormType } from "./RealmRoleTabs"; import type { RoleFormType } from "./RealmRoleTabs";
import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation";
import _ from "lodash"; import _ from "lodash";
import { filter } from "cypress/types/bluebird";
type AssociatedRolesTabProps = { type AssociatedRolesTabProps = {
additionalRoles: Role[]; additionalRoles: Role[];
@ -127,15 +126,6 @@ export const AssociatedRolesTab = ({
)!.clientId!) )!.clientId!)
); );
console.log(filterDupes
.filter((role) => role.clientRole)
.map(
(role) =>
(role.clientId = clients.find(
(client) => client.id === role.containerId
)!.clientId!)
))
return alphabetize(additionalRoles); return alphabetize(additionalRoles);
}); });
}; };

View file

@ -49,7 +49,6 @@ export const RealmSettingsGeneralTab = ({
return asyncStateFetch( return asyncStateFetch(
() => adminClient.realms.findOne({ realm: realmName }), () => adminClient.realms.findOne({ realm: realmName }),
(realm) => { (realm) => {
console.log(realm)
setRealm(realm); setRealm(realm);
setupForm(realm); setupForm(realm);
}, },

View file

@ -31,6 +31,7 @@ export const KeysTabInner = ({ keys }: KeysTabInnerProps) => {
const [certificate, setCertificate] = useState(""); const [certificate, setCertificate] = useState("");
const loader = async () => { const loader = async () => {
<<<<<<< HEAD
<<<<<<< HEAD <<<<<<< HEAD
return keys; return keys;
}; };
@ -87,6 +88,32 @@ export const KeysTabInner = ({ keys }: KeysTabInnerProps) => {
const toggleModal = () => setOpen(!open); const toggleModal = () => setOpen(!open);
>>>>>>> keys >>>>>>> keys
=======
return keys;
};
React.useEffect(() => {
refresh();
}, [keys]);
const [togglePublicKeyDialog, PublicKeyDialog] = useConfirmDialog({
titleKey: t("realm-settings:publicKeys").slice(0, -1),
messageKey: publicKey,
continueButtonLabel: "common:close",
continueButtonVariant: ButtonVariant.primary,
noCancelButton: true,
onConfirm: async () => {},
});
const [toggleCertificateDialog, CertificateDialog] = useConfirmDialog({
titleKey: t("realm-settings:certificate"),
messageKey: certificate,
continueButtonLabel: "common:close",
continueButtonVariant: ButtonVariant.primary,
noCancelButton: true,
onConfirm: async () => {},
});
>>>>>>> adds keys table to realm settings
const goToCreate = () => history.push(`${url}/add-role`); const goToCreate = () => history.push(`${url}/add-role`);
@ -94,6 +121,7 @@ export const KeysTabInner = ({ keys }: KeysTabInnerProps) => {
return <>{provider}</>; return <>{provider}</>;
}; };
<<<<<<< HEAD
<<<<<<< HEAD <<<<<<< HEAD
const ButtonRenderer = ({ provider, publicKey, certificate }: KeyData) => { const ButtonRenderer = ({ provider, publicKey, certificate }: KeyData) => {
if (provider === "ecdsa-generated") { if (provider === "ecdsa-generated") {
@ -103,6 +131,10 @@ export const KeysTabInner = ({ keys }: KeysTabInnerProps) => {
const ButtonRenderer = ({ name }: ComponentRepresentation) => { const ButtonRenderer = ({ name }: ComponentRepresentation) => {
if (name === "ecdsa-generated") { if (name === "ecdsa-generated") {
>>>>>>> keys >>>>>>> keys
=======
const ButtonRenderer = ({ provider, publicKey, certificate }: KeyData) => {
if (provider === "ecdsa-generated") {
>>>>>>> adds keys table to realm settings
return ( return (
<> <>
<Button <Button
@ -117,8 +149,12 @@ export const KeysTabInner = ({ keys }: KeysTabInnerProps) => {
</Button> </Button>
</> </>
); );
<<<<<<< HEAD
} }
if (provider === "rsa-generated" || provider === "fallback-RS256") { if (provider === "rsa-generated" || provider === "fallback-RS256") {
=======
} else if (provider === "rsa-generated" || provider === "fallback-RS256") {
>>>>>>> adds keys table to realm settings
return ( return (
<> <>
<Button <Button

View file

@ -21,8 +21,6 @@ export const RealmSettingsLoginTab = () => {
const { addAlert } = useAlerts(); const { addAlert } = useAlerts();
useEffect(() => { useEffect(() => {
console.log("kjsdlja")
return asyncStateFetch( return asyncStateFetch(
() => adminClient.realms.findOne({ realm: realmName }), () => adminClient.realms.findOne({ realm: realmName }),
(realm) => { (realm) => {