This is an automated email from the ASF dual-hosted git repository.

mehul pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git

commit 5eedf6fcfb26d742328c007a928e2189e4ddd064
Author: Mugdha Varadkar <[email protected]>
AuthorDate: Mon Aug 28 17:31:40 2023 +0530

    RANGER-4377: Fix to use public/v2/api/zone-headers api to get list of zones 
in Access Logs and Report pages
    
    Signed-off-by: Mehul Parikh <[email protected]>
---
 .../react-webapp/src/views/AuditEvent/AccessLogs.jsx      | 14 +++++++-------
 .../react-webapp/src/views/Reports/UserAccessLayout.jsx   | 15 +++++----------
 2 files changed, 12 insertions(+), 17 deletions(-)

diff --git 
a/security-admin/src/main/webapp/react-webapp/src/views/AuditEvent/AccessLogs.jsx
 
b/security-admin/src/main/webapp/react-webapp/src/views/AuditEvent/AccessLogs.jsx
index 630e51637..c189c0a1b 100644
--- 
a/security-admin/src/main/webapp/react-webapp/src/views/AuditEvent/AccessLogs.jsx
+++ 
b/security-admin/src/main/webapp/react-webapp/src/views/AuditEvent/AccessLogs.jsx
@@ -40,8 +40,7 @@ import {
   toString,
   toUpper,
   has,
-  filter,
-  isNull
+  filter
 } from "lodash";
 import { toast } from "react-toastify";
 import { Link } from "react-router-dom";
@@ -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) => {
@@ -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();
diff --git 
a/security-admin/src/main/webapp/react-webapp/src/views/Reports/UserAccessLayout.jsx
 
b/security-admin/src/main/webapp/react-webapp/src/views/Reports/UserAccessLayout.jsx
index 1adcc6b3b..e3d09c51e 100644
--- 
a/security-admin/src/main/webapp/react-webapp/src/views/Reports/UserAccessLayout.jsx
+++ 
b/security-admin/src/main/webapp/react-webapp/src/views/Reports/UserAccessLayout.jsx
@@ -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);
@@ -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}`);
     }
@@ -171,7 +166,7 @@ function UserAccessLayout(props) {
       return { value: zone.name, label: zone.name };
     });
 
-    setZones(zonesResp?.data?.securityZones || []);
+    setZones(zonesResp || []);
     setZoneNameOpts(zonesList);
   };
 

Reply via email to