added links to permission create (#1885)
This commit is contained in:
parent
884102d83b
commit
d5ecda9e74
2 changed files with 20 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link, useHistory } from "react-router-dom";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
|
@ -30,6 +30,7 @@ import { toCreateResource } from "../routes/NewResource";
|
||||||
import { useRealm } from "../../context/realm-context/RealmContext";
|
import { useRealm } from "../../context/realm-context/RealmContext";
|
||||||
import { toResourceDetails } from "../routes/Resource";
|
import { toResourceDetails } from "../routes/Resource";
|
||||||
import { MoreLabel } from "./MoreLabel";
|
import { MoreLabel } from "./MoreLabel";
|
||||||
|
import { toNewPermission } from "../routes/NewPermission";
|
||||||
|
|
||||||
type ResourcesProps = {
|
type ResourcesProps = {
|
||||||
clientId: string;
|
clientId: string;
|
||||||
|
@ -41,6 +42,7 @@ type ExpandableResourceRepresentation = ResourceRepresentation & {
|
||||||
|
|
||||||
export const AuthorizationResources = ({ clientId }: ResourcesProps) => {
|
export const AuthorizationResources = ({ clientId }: ResourcesProps) => {
|
||||||
const { t } = useTranslation("clients");
|
const { t } = useTranslation("clients");
|
||||||
|
const history = useHistory();
|
||||||
const adminClient = useAdminClient();
|
const adminClient = useAdminClient();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
|
@ -221,6 +223,14 @@ export const AuthorizationResources = ({ clientId }: ResourcesProps) => {
|
||||||
title: t("createPermission"),
|
title: t("createPermission"),
|
||||||
className: "pf-m-link",
|
className: "pf-m-link",
|
||||||
isOutsideDropdown: true,
|
isOutsideDropdown: true,
|
||||||
|
onClick: () =>
|
||||||
|
history.push(
|
||||||
|
toNewPermission({
|
||||||
|
realm,
|
||||||
|
id: clientId,
|
||||||
|
permissionType: "resource",
|
||||||
|
})
|
||||||
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState
|
||||||
import useToggle from "../../utils/useToggle";
|
import useToggle from "../../utils/useToggle";
|
||||||
import { DeleteScopeDialog } from "./DeleteScopeDialog";
|
import { DeleteScopeDialog } from "./DeleteScopeDialog";
|
||||||
import { DetailDescription } from "./DetailDescription";
|
import { DetailDescription } from "./DetailDescription";
|
||||||
|
import { toNewPermission } from "../routes/NewPermission";
|
||||||
|
|
||||||
type ScopesProps = {
|
type ScopesProps = {
|
||||||
clientId: string;
|
clientId: string;
|
||||||
|
@ -210,6 +211,14 @@ export const AuthorizationScopes = ({ clientId }: ScopesProps) => {
|
||||||
title: t("createPermission"),
|
title: t("createPermission"),
|
||||||
className: "pf-m-link",
|
className: "pf-m-link",
|
||||||
isOutsideDropdown: true,
|
isOutsideDropdown: true,
|
||||||
|
onClick: () =>
|
||||||
|
history.push(
|
||||||
|
toNewPermission({
|
||||||
|
realm,
|
||||||
|
id: clientId,
|
||||||
|
permissionType: "resource",
|
||||||
|
})
|
||||||
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Reference in a new issue