Skip to content

Commit

Permalink
RANGER-4369: Options for permissions pop up for knox policies are not…
Browse files Browse the repository at this point in the history
… the same in Backbone UI and React JS
  • Loading branch information
Brijesh619 authored and dhavalshah9131 committed Oct 5, 2023
1 parent 376c8f7 commit be923c4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ const CheckboxComp = (props) => {
/>
</Form.Group>
))}
{showSelectAll && (
<Form.Group className="mb-3">
{showSelectAll && options?.length > 1 && (
<Form.Group className="mb-3" controlId={selectAllLabel}>
<Form.Check
checked={isAllChecked()}
type="checkbox"
Expand Down Expand Up @@ -160,7 +160,7 @@ const CustomCondition = (props) => {
return (
<>
{conditionDefVal?.length > 0 &&
conditionDefVal.map((m, index) => {
conditionDefVal.map((m) => {
let uiHintAttb =
m.uiHint != undefined && m.uiHint != "" ? JSON.parse(m.uiHint) : "";
if (uiHintAttb != "") {
Expand Down Expand Up @@ -683,7 +683,7 @@ const Editable = (props) => {
}
};

const handleClose = (e) => {
const handleClose = () => {
setValidated({ state: false, errorMSG: "" });
dispatch({
type: "SET_POPOVER",
Expand All @@ -696,7 +696,7 @@ const Editable = (props) => {
<Popover
id="popover-basic"
className={`editable-popover ${
type === TYPE_CHECKBOX && "popover-maxHeight"
type === TYPE_CHECKBOX && "popover-maxHeight popover-minHeight"
}`}
>
<Popover.Title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,9 @@ h3.wrap-header {
.editable-popover {
min-width: 250px;
}
.popover-minHeight {
min-width: 200px;
}

.table-editable {
text-align: center !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
*/

import React, { useMemo, useRef, useState } from "react";
import { Table, Button, Badge, Form } from "react-bootstrap";
import { Table, Button, Form } from "react-bootstrap";
import { FieldArray } from "react-final-form-arrays";
import { Col } from "react-bootstrap";
import { Field, useFormState } from "react-final-form";
import { Field } from "react-final-form";
import AsyncSelect from "react-select/async";
import { find, groupBy, isEmpty, isArray, has } from "lodash";
import { find, groupBy, isEmpty, isArray } from "lodash";
import { toast } from "react-toastify";
import Editable from "Components/Editable";
import { RangerPolicyType } from "Utils/XAEnums";
Expand Down Expand Up @@ -61,8 +61,6 @@ export default function PolicyPermissionItem(props) {
const [groupLoading, setGroupLoading] = useState(false);
const [userLoading, setUserLoading] = useState(false);

let { values, errors, change, error, ...args } = useFormState();

const permList = ["Select Roles", "Select Groups", "Select Users"];

if (serviceCompDetails?.policyConditions?.length > 0) {
Expand Down Expand Up @@ -308,7 +306,7 @@ export default function PolicyPermissionItem(props) {
<Field
className="form-control"
name={`${name}.roles`}
render={({ input, meta }) => (
render={({ input }) => (
<div className="d-flex">
<AsyncSelect
{...input}
Expand Down Expand Up @@ -339,7 +337,7 @@ export default function PolicyPermissionItem(props) {
<Field
className="form-control"
name={`${name}.groups`}
render={({ input, meta }) => (
render={({ input }) => (
<div>
<AsyncSelect
{...input}
Expand Down Expand Up @@ -370,7 +368,7 @@ export default function PolicyPermissionItem(props) {
<Field
className="form-control"
name={`${name}.users`}
render={({ input, meta }) => (
render={({ input }) => (
<div>
<AsyncSelect
{...input}
Expand Down Expand Up @@ -409,7 +407,7 @@ export default function PolicyPermissionItem(props) {
index
)
}
render={({ input, meta }) => (
render={({ input }) => (
<div className="table-editable">
<Editable
{...input}
Expand Down Expand Up @@ -440,7 +438,7 @@ export default function PolicyPermissionItem(props) {
index
)
}
render={({ input, meta }) => (
render={({ input }) => (
<div className="table-editable">
<TagBasePermissionItem
options={getAccessTypeOptions()}
Expand All @@ -467,7 +465,7 @@ export default function PolicyPermissionItem(props) {
index
)
}
render={({ input, meta }) => (
render={({ input }) => (
<div className="table-editable">
<Editable
{...input}
Expand All @@ -491,7 +489,7 @@ export default function PolicyPermissionItem(props) {
<Field
className="form-control"
name={`${name}.dataMaskInfo`}
render={({ input, meta }) =>
render={({ input }) =>
fields?.value[index]?.accesses?.tableList
?.length > 0 ? (
<div className="table-editable">
Expand Down Expand Up @@ -538,11 +536,11 @@ export default function PolicyPermissionItem(props) {
</div>
) : (
<div>
<span className="editable-add-text">
<span className="editable-add-text text-secondary">
Select Masking Option
</span>
<Button
className="mg-10 btn-mini text-secondary"
className="mg-10 mx-auto btn-mini d-block text-secondary"
variant="outline-dark"
size="sm"
type="button"
Expand All @@ -568,7 +566,7 @@ export default function PolicyPermissionItem(props) {
<Field
className="form-control"
name={`${name}.dataMaskInfo`}
render={({ input, meta }) => (
render={({ input }) => (
<div className="table-editable">
<Editable
{...input}
Expand Down Expand Up @@ -654,7 +652,7 @@ export default function PolicyPermissionItem(props) {
data-cy="delegatedAdmin"
type="checkbox"
>
{({ input, meta }) => (
{({ input }) => (
<div>
<input {...input} type="checkbox" />
</div>
Expand Down

0 comments on commit be923c4

Please sign in to comment.