This commit is contained in:
jenny-s51 2021-04-28 16:42:59 -04:00
parent 435fb81550
commit abec27a334
4 changed files with 62 additions and 0 deletions

View file

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

View file

@ -43,6 +43,35 @@ export const RealmSettingsGeneralTab = ({
const requireSslTypes = ["all", "external", "none"];
<<<<<<< HEAD
=======
useEffect(() => {
return asyncStateFetch(
() => adminClient.realms.findOne({ realm: realmName }),
(realm) => {
console.log(realm)
setRealm(realm);
setupForm(realm);
},
handleError
);
}, []);
const setupForm = (realm: RealmRepresentation) => {
Object.entries(realm).map((entry) => setValue(entry[0], entry[1]));
};
const save = async (realm: RealmRepresentation) => {
try {
await adminClient.realms.update({ realm: realmName }, realm);
setRealm(realm);
addAlert(t("saveSuccess"), AlertVariant.success);
} catch (error) {
addAlert(t("saveError", { error }), AlertVariant.danger);
}
};
>>>>>>> wip keys
return (
<>
<PageSection variant="light">

View file

@ -6,10 +6,32 @@ import { HelpItem } from "../components/help-enabler/HelpItem";
import { FormPanel } from "../components/scroll-form/FormPanel";
import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation";
<<<<<<< HEAD
type RealmSettingsLoginTabProps = {
save: (realm: RealmRepresentation) => void;
realm: RealmRepresentation;
};
=======
export const RealmSettingsLoginTab = () => {
const { t } = useTranslation("realm-settings");
const [realm, setRealm] = useState<RealmRepresentation>();
const handleError = useErrorHandler();
const adminClient = useAdminClient();
const { realm: realmName } = useRealm();
const { addAlert } = useAlerts();
useEffect(() => {
console.log("kjsdlja")
return asyncStateFetch(
() => adminClient.realms.findOne({ realm: realmName }),
(realm) => {
setRealm(realm);
},
handleError
);
}, []);
>>>>>>> wip keys
export const RealmSettingsLoginTab = ({
save,

View file

@ -16,6 +16,7 @@ div.pf-c-card__body.kc-form-panel__body {
padding-left: 0px;
padding-bottom: var(--pf-global--spacer--2xl);
}
button#kc-certificate.pf-c-button.pf-m-secondary {
margin-left: var(--pf-global--spacer--md);
}