Skip to content

Commit

Permalink
RANGER-4377: Fix to use public/v2/api/zone-headers api to get list of…
Browse files Browse the repository at this point in the history
… zones in Access Logs and Report pages

Signed-off-by: Mehul Parikh <[email protected]>
  • Loading branch information
fimugdha authored and mehulbparikh committed Sep 5, 2023
1 parent b40f21f commit 5eedf6f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ import {
toString,
toUpper,
has,
filter,
isNull
filter
} from "lodash";
import { toast } from "react-toastify";
import { Link } from "react-router-dom";
Expand Down Expand Up @@ -209,16 +208,18 @@ function Access() {
);

const fetchZones = async () => {
let zonesResp;
let zonesResp = [];
try {
zonesResp = await fetchApi({
url: "zones/zones"
const response = await fetchApi({
url: "public/v2/api/zone-headers"
});

zonesResp = response?.data || [];
} catch (error) {
console.error(`Error occurred while fetching Zones! ${error}`);
}

setZones(sortBy(zonesResp.data.securityZones, ["name"]));
setZones(sortBy(zonesResp, ["name"]));
};

const toggleChange = (chkVal) => {
Expand Down Expand Up @@ -296,7 +297,6 @@ function Access() {
<button
className="pull-right link-tag query-icon btn btn-sm"
size="sm"
variant="link"
title="Copy"
onClick={(e) => {
e.stopPropagation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,11 @@ import { toast } from "react-toastify";
import { fetchApi } from "Utils/fetchAPI";
import { useQuery } from "../../components/CommonComponents";
import SearchPolicyTable from "./SearchPolicyTable";
import {
getBaseUrl,
isAuditor,
isKeyAdmin,
isKMSAuditor
} from "../../utils/XAUtils";
import { isAuditor, isKeyAdmin, isKMSAuditor } from "../../utils/XAUtils";
import CustomBreadcrumb from "../CustomBreadcrumb";
import moment from "moment-timezone";

function UserAccessLayout(props) {
function UserAccessLayout() {
const isKMSRole = isKeyAdmin() || isKMSAuditor();
const isAuditRole = isAuditor() || isKMSAuditor();
const [show, setShow] = useState(true);
Expand Down Expand Up @@ -160,9 +155,9 @@ function UserAccessLayout(props) {
let zonesResp = [];
try {
const response = await fetchApi({
url: "zones/zones"
url: "public/v2/api/zone-headers"
});
zonesResp = response?.data?.securityZones || [];
zonesResp = response?.data || [];
} catch (error) {
console.error(`Error occurred while fetching Zones! ${error}`);
}
Expand All @@ -171,7 +166,7 @@ function UserAccessLayout(props) {
return { value: zone.name, label: zone.name };
});

setZones(zonesResp?.data?.securityZones || []);
setZones(zonesResp || []);
setZoneNameOpts(zonesList);
};

Expand Down

0 comments on commit 5eedf6f

Please sign in to comment.