fixed urls (#489)

fixing: #454
This commit is contained in:
Erik Jan de Wit 2021-04-01 08:36:14 +02:00 committed by GitHub
parent e0e6f677c6
commit c503663e4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 9 deletions

View file

@ -20,6 +20,7 @@ import { useAlerts } from "../../components/alert/Alerts";
import { AddMapperDialog } from "../add/MapperDialog"; import { AddMapperDialog } from "../add/MapperDialog";
import { useAdminClient } from "../../context/auth/AdminClient"; import { useAdminClient } from "../../context/auth/AdminClient";
import { KeycloakDataTable } from "../../components/table-toolbar/KeycloakDataTable"; import { KeycloakDataTable } from "../../components/table-toolbar/KeycloakDataTable";
import { useRealm } from "../../context/realm-context/RealmContext";
type MapperListProps = { type MapperListProps = {
clientScope: ClientScopeRepresentation; clientScope: ClientScopeRepresentation;
@ -36,8 +37,10 @@ export const MapperList = ({ clientScope, refresh }: MapperListProps) => {
const { t } = useTranslation("client-scopes"); const { t } = useTranslation("client-scopes");
const adminClient = useAdminClient(); const adminClient = useAdminClient();
const { addAlert } = useAlerts(); const { addAlert } = useAlerts();
const history = useHistory(); const history = useHistory();
const { url } = useRouteMatch(); const { realm } = useRealm();
const url = `/${realm}/client-scopes/${clientScope.id}/mappers`;
const [mapperAction, setMapperAction] = useState(false); const [mapperAction, setMapperAction] = useState(false);
const mapperList = clientScope.protocolMappers!; const mapperList = clientScope.protocolMappers!;

View file

@ -35,6 +35,7 @@ import { HelpItem } from "../../components/help-enabler/HelpItem";
import { useServerInfo } from "../../context/server-info/ServerInfoProvider"; import { useServerInfo } from "../../context/server-info/ServerInfoProvider";
import { convertFormValuesToObject, convertToFormValues } from "../../util"; import { convertFormValuesToObject, convertToFormValues } from "../../util";
import { FormAccess } from "../../components/form-access/FormAccess"; import { FormAccess } from "../../components/form-access/FormAccess";
import { useRealm } from "../../context/realm-context/RealmContext";
type Params = { type Params = {
id: string; id: string;
@ -56,8 +57,8 @@ export const MappingDetails = () => {
>(); >();
const history = useHistory(); const history = useHistory();
const { realm } = useRealm();
const serverInfo = useServerInfo(); const serverInfo = useServerInfo();
const { url } = useRouteMatch();
const isGuid = /^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$/; const isGuid = /^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$/;
useEffect(() => { useEffect(() => {
@ -114,12 +115,12 @@ export const MappingDetails = () => {
continueButtonVariant: ButtonVariant.danger, continueButtonVariant: ButtonVariant.danger,
onConfirm: async () => { onConfirm: async () => {
try { try {
await adminClient.clientScopes.delClientScopeMappings( await adminClient.clientScopes.delProtocolMapper({
{ client: id, id: mapperId }, id,
[] mapperId: mapperId,
); });
addAlert(t("mappingDeletedSuccess"), AlertVariant.success); addAlert(t("mappingDeletedSuccess"), AlertVariant.success);
history.push(`${url}/${id}`); history.push(`/${realm}/client-scopes/${id}/mappers`);
} catch (error) { } catch (error) {
addAlert(t("mappingDeletedError", { error }), AlertVariant.danger); addAlert(t("mappingDeletedError", { error }), AlertVariant.danger);
} }

View file

@ -93,13 +93,13 @@ export const routes: RoutesFn = (t: TFunction) => [
access: "manage-clients", access: "manage-clients",
}, },
{ {
path: "/:realm/client-scopes/:id/:tab/oidc-role-name-mapper", path: "/:realm/client-scopes/:id/mappers/oidc-role-name-mapper",
component: RoleMappingForm, component: RoleMappingForm,
breadcrumb: t("client-scopes:mappingDetails"), breadcrumb: t("client-scopes:mappingDetails"),
access: "view-clients", access: "view-clients",
}, },
{ {
path: "/:realm/client-scopes/:id/:tab/:mapperId", path: "/:realm/client-scopes/:id/mappers/:mapperId",
component: MappingDetails, component: MappingDetails,
breadcrumb: t("client-scopes:mappingDetails"), breadcrumb: t("client-scopes:mappingDetails"),
access: "view-clients", access: "view-clients",