Fixed title and link to page (#2183)

This commit is contained in:
Erik Jan de Wit 2022-03-09 17:44:43 +01:00 committed by GitHub
parent 4e697600e0
commit 62c13adda7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 29 deletions

View file

@ -32,6 +32,7 @@ import { HelpItem } from "../../components/help-enabler/HelpItem";
import { ResourcesPolicySelect } from "./ResourcesPolicySelect";
import { toAuthorizationTab } from "../routes/AuthenticationTab";
import { ScopeSelect } from "./ScopeSelect";
import { toUpperCase } from "../../util";
const DECISION_STRATEGIES = ["UNANIMOUS", "AFFIRMATIVE", "CONSENSUS"] as const;
@ -166,7 +167,11 @@ export default function PermissionDetails() {
<>
<DeleteConfirm />
<ViewHeader
titleKey={permissionId ? permission?.name! : "clients:createPermission"}
titleKey={
permissionId
? permission?.name!
: `clients:create${toUpperCase(permissionType)}BasedPermission`
}
dropdownItems={
permissionId
? [

View file

@ -1,5 +1,5 @@
import React, { useState } from "react";
import { Link, useHistory } from "react-router-dom";
import { Link } from "react-router-dom";
import { useTranslation } from "react-i18next";
import {
Alert,
@ -42,7 +42,6 @@ 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();
@ -173,6 +172,7 @@ export const AuthorizationResources = ({ clientId }: ResourcesProps) => {
<Th>{t("owner")}</Th>
<Th>{t("uris")}</Th>
<Th />
<Th />
</Tr>
</Thead>
{resources.map((resource, rowIndex) => (
@ -208,6 +208,23 @@ export const AuthorizationResources = ({ clientId }: ResourcesProps) => {
<Td>
<UriRenderer row={resource} />
</Td>
<Td width={10}>
<Button
variant="link"
component={(props) => (
<Link
{...props}
to={toNewPermission({
realm,
id: clientId,
permissionType: "resource",
})}
/>
)}
>
{t("createPermission")}
</Button>
</Td>
<Td
actions={{
items: [
@ -219,19 +236,6 @@ export const AuthorizationResources = ({ clientId }: ResourcesProps) => {
toggleDeleteDialog();
},
},
{
title: t("createPermission"),
className: "pf-m-link",
isOutsideDropdown: true,
onClick: () =>
history.push(
toNewPermission({
realm,
id: clientId,
permissionType: "resource",
})
),
},
],
}}
/>

View file

@ -161,6 +161,7 @@ export const AuthorizationScopes = ({ clientId }: ScopesProps) => {
<Th>{t("resources")}</Th>
<Th>{t("permissions")}</Th>
<Th />
<Th />
</Tr>
</Thead>
{scopes.map((scope, rowIndex) => (
@ -197,7 +198,25 @@ export const AuthorizationScopes = ({ clientId }: ScopesProps) => {
<Td>
<PermissionsRenderer row={scope} />
</Td>
<Td width={10}>
<Button
variant="link"
component={(props) => (
<Link
{...props}
to={toNewPermission({
realm,
id: clientId,
permissionType: "scope",
})}
/>
)}
>
{t("createPermission")}
</Button>
</Td>
<Td
isActionCell
actions={{
items: [
{
@ -207,19 +226,6 @@ export const AuthorizationScopes = ({ clientId }: ScopesProps) => {
toggleDeleteDialog();
},
},
{
title: t("createPermission"),
className: "pf-m-link",
isOutsideDropdown: true,
onClick: () =>
history.push(
toNewPermission({
realm,
id: clientId,
permissionType: "resource",
})
),
},
],
}}
/>

View file

@ -283,6 +283,8 @@ export default {
"Specifies that this permission must be applied to a specific resource instance.",
permissionScopes:
"Specifies that this permission must be applied to one or more scopes.",
permissionPolicies:
"Specifies all the policies that must be applied to the scopes defined by this policy or permission.",
permissionType:
"Specifies that this permission must be applied to all resources instances of a given type.",
permissionDecisionStrategy: