Skip to content

Commit

Permalink
Tweaks to Menu and Bucket Details (#2512)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvaldivia committed Dec 16, 2022
1 parent adc199b commit 1f60d4a
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 24 deletions.
6 changes: 3 additions & 3 deletions portal-ui/src/common/SecureComponent/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ export const IAM_PAGES = {
IDP_OPENID_CONFIGURATIONS_VIEW: "/idp/openid/configurations/:idpName",
IDP_OPENID_CONFIGURATIONS_ADD: "/idp/openid/configurations/add-idp",

POLICIES: "/identity/policies",
POLICY_ADD: "/identity/add-policy",
POLICIES_VIEW: "/identity/policies/*",
POLICIES: "/policies",
POLICY_ADD: "/add-policy",
POLICIES_VIEW: "/policies/*",
/* Monitoring */
TOOLS_LOGS: "/tools/logs",
TOOLS_AUDITLOGS: "/tools/audit-logs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const AccessRule = () => {
/>
)}
<Grid item xs={12} className={classes.actionsTray}>
<PanelTitle>Access Rules</PanelTitle>
<PanelTitle>Anonymous Access</PanelTitle>
<SecureComponent
scopes={[
IAM_SCOPES.S3_GET_BUCKET_POLICY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ const BucketDetails = ({ classes }: IBucketDetailsProps) => {
}}
{{
tabConfig: {
label: "Access Audit",
label: "Access",
value: "access",
component: Link,
disabled: !hasPermission(bucketName, [
Expand All @@ -410,7 +410,7 @@ const BucketDetails = ({ classes }: IBucketDetailsProps) => {
}}
{{
tabConfig: {
label: "Access Rules",
label: "Anonymous",
value: "prefix",
component: Link,
disabled: !hasPermission(bucketName, [
Expand Down
15 changes: 8 additions & 7 deletions portal-ui/src/screens/Console/valid-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ export const validRoutes = (
forceDisplay: true,
children: [],
},
{
group: "Administrator",
name: "Policies",
component: NavLink,
id: "policies",
to: IAM_PAGES.POLICIES,
icon: AccessMenuIcon,
},
{
group: "Administrator",
name: "Identity",
Expand All @@ -145,13 +153,6 @@ export const validRoutes = (
icon: GroupsMenuIcon,
fsHidden: ldapIsEnabled,
},
{
name: "Policies",
component: NavLink,
id: "policies",
to: IAM_PAGES.POLICIES,
icon: AccessMenuIcon,
},
{
name: "OpenID",
component: NavLink,
Expand Down
15 changes: 8 additions & 7 deletions portal-ui/tests/permissions-A/iamPolicies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
identityElement,
usersElement,
} from "../utils/elements-menu";
import { IAM_PAGES } from "../../src/common/SecureComponent/permissions";

const iamPolicyListItem = Selector(
".ReactVirtualized__Table__rowColumn"
Expand Down Expand Up @@ -52,21 +53,21 @@ test("IAM Policies sidebar item exists", async (t) => {
test("Create Policy button exists", async (t) => {
const createPolicyButtonExists = elements.createPolicyButton.exists;
await t
.navigateTo("http://localhost:9090/identity/policies")
.navigateTo(`http://localhost:9090${IAM_PAGES.POLICIES}`)
.expect(createPolicyButtonExists)
.ok();
});

test("Create Policy button is clickable", async (t) => {
await t
.navigateTo("http://localhost:9090/identity/policies")
.navigateTo(`http://localhost:9090${IAM_PAGES.POLICIES}`)
.click(elements.createPolicyButton);
});

test("Policy Name input exists in the Create Policy modal", async (t) => {
const policyNameInputExists = elements.createPolicyName.exists;
await t
.navigateTo("http://localhost:9090/identity/policies")
.navigateTo(`http://localhost:9090${IAM_PAGES.POLICIES}`)
.click(elements.createPolicyButton)
.expect(policyNameInputExists)
.ok();
Expand All @@ -75,15 +76,15 @@ test("Policy Name input exists in the Create Policy modal", async (t) => {
test("Policy textfield exists in the Create Policy modal", async (t) => {
const policyTextfieldExists = elements.createPolicyTextfield.exists;
await t
.navigateTo("http://localhost:9090/identity/policies")
.navigateTo(`http://localhost:9090${IAM_PAGES.POLICIES}`)
.click(elements.createPolicyButton)
.expect(policyTextfieldExists)
.ok();
});

test("Create Policy modal can be submitted after inputs are entered", async (t) => {
await t
.navigateTo("http://localhost:9090/identity/policies")
.navigateTo(`http://localhost:9090${IAM_PAGES.POLICIES}`)
.click(elements.createPolicyButton)
.typeText(elements.createPolicyName, constants.TEST_IAM_POLICY_NAME)
.typeText(elements.createPolicyTextfield, constants.TEST_IAM_POLICY, {
Expand All @@ -94,7 +95,7 @@ test("Create Policy modal can be submitted after inputs are entered", async (t)
}).after(async (t) => {
// Clean up created policy
await t
.navigateTo("http://localhost:9090/identity/policies")
.navigateTo(`http://localhost:9090${IAM_PAGES.POLICIES}`)
.typeText(elements.searchResourceInput, constants.TEST_IAM_POLICY_NAME)
.click(iamPolicyDelete)
.click(elements.deleteButton);
Expand All @@ -103,7 +104,7 @@ test("Create Policy modal can be submitted after inputs are entered", async (t)
test("Created Policy can be viewed and deleted", async (t) => {
const iamPolicyListItemExists = iamPolicyListItem.exists;
await t
.navigateTo("http://localhost:9090/identity/policies")
.navigateTo(`http://localhost:9090${IAM_PAGES.POLICIES}`)
.click(elements.createPolicyButton)
.typeText(elements.createPolicyName, constants.TEST_IAM_POLICY_NAME)
.typeText(elements.createPolicyTextfield, constants.TEST_IAM_POLICY, {
Expand Down
7 changes: 4 additions & 3 deletions portal-ui/tests/utils/elements-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ export const groupsElement = identityChildren
.find("a")
.withAttribute("href", IAM_PAGES.GROUPS);

export const iamPoliciesElement = identityChildren
.find("a")
.withAttribute("href", IAM_PAGES.POLICIES);
export const iamPoliciesElement = sidebarItem.withAttribute(
"href",
IAM_PAGES.POLICIES
);

export const configurationsElement = Selector(".MuiPaper-root")
.find("ul")
Expand Down
2 changes: 1 addition & 1 deletion portal-ui/tests/utils/elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const createGroupUserTable = Selector(
// Bucket page vertical tabs
//----------------------------------------------------
export const bucketAccessRulesTab =
Selector(".MuiTab-root").withText("Access Rules");
Selector(".MuiTab-root").withText("Anonymous");

//----------------------------------------------------
// Settings window
Expand Down

0 comments on commit 1f60d4a

Please sign in to comment.