added links to permission create (#1885)

This commit is contained in:
Erik Jan de Wit 2022-01-19 11:11:40 +01:00 committed by GitHub
parent 884102d83b
commit d5ecda9e74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View file

@ -1,5 +1,5 @@
import React, { useState } from "react";
import { Link } from "react-router-dom";
import { Link, useHistory } from "react-router-dom";
import { useTranslation } from "react-i18next";
import {
Alert,
@ -30,6 +30,7 @@ import { toCreateResource } from "../routes/NewResource";
import { useRealm } from "../../context/realm-context/RealmContext";
import { toResourceDetails } from "../routes/Resource";
import { MoreLabel } from "./MoreLabel";
import { toNewPermission } from "../routes/NewPermission";
type ResourcesProps = {
clientId: string;
@ -41,6 +42,7 @@ type ExpandableResourceRepresentation = ResourceRepresentation & {
export const AuthorizationResources = ({ clientId }: ResourcesProps) => {
const { t } = useTranslation("clients");
const history = useHistory();
const adminClient = useAdminClient();
const { addAlert, addError } = useAlerts();
const { realm } = useRealm();
@ -221,6 +223,14 @@ export const AuthorizationResources = ({ clientId }: ResourcesProps) => {
title: t("createPermission"),
className: "pf-m-link",
isOutsideDropdown: true,
onClick: () =>
history.push(
toNewPermission({
realm,
id: clientId,
permissionType: "resource",
})
),
},
],
}}

View file

@ -31,6 +31,7 @@ import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState
import useToggle from "../../utils/useToggle";
import { DeleteScopeDialog } from "./DeleteScopeDialog";
import { DetailDescription } from "./DetailDescription";
import { toNewPermission } from "../routes/NewPermission";
type ScopesProps = {
clientId: string;
@ -210,6 +211,14 @@ export const AuthorizationScopes = ({ clientId }: ScopesProps) => {
title: t("createPermission"),
className: "pf-m-link",
isOutsideDropdown: true,
onClick: () =>
history.push(
toNewPermission({
realm,
id: clientId,
permissionType: "resource",
})
),
},
],
}}