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

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


The following commit(s) were added to refs/heads/master by this push:
     new 46a80a239e HDDS-9212. HeatMap UI doesn't load On Disabling & Enable 
Recon HeatMap using Feature Flag. (#5249)
46a80a239e is described below

commit 46a80a239e10759f56723d694e389a1751dc8ac3
Author: Devesh Kumar Singh <[email protected]>
AuthorDate: Mon Sep 11 11:51:05 2023 +0530

    HDDS-9212. HeatMap UI doesn't load On Disabling & Enable Recon HeatMap 
using Feature Flag. (#5249)
---
 .../hadoop/ozone/recon/api/AccessHeatMapEndpoint.java | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/AccessHeatMapEndpoint.java
 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/AccessHeatMapEndpoint.java
index 4e0263d114..db67dabb03 100644
--- 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/AccessHeatMapEndpoint.java
+++ 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/AccessHeatMapEndpoint.java
@@ -19,6 +19,7 @@
 package org.apache.hadoop.ozone.recon.api;
 
 import org.apache.hadoop.ozone.recon.api.types.EntityReadAccessHeatMapResponse;
+import org.apache.hadoop.ozone.recon.api.types.FeatureProvider;
 import org.apache.hadoop.ozone.recon.heatmap.HeatMapServiceImpl;
 
 import javax.inject.Inject;
@@ -31,6 +32,8 @@ import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import java.util.List;
+
 import static 
org.apache.hadoop.ozone.recon.ReconConstants.RECON_ACCESS_METADATA_START_DATE;
 import static org.apache.hadoop.ozone.recon.ReconConstants.RECON_ENTITY_PATH;
 import static org.apache.hadoop.ozone.recon.ReconConstants.RECON_ENTITY_TYPE;
@@ -78,6 +81,7 @@ public class AccessHeatMapEndpoint {
       @DefaultValue("key") @QueryParam(RECON_ENTITY_TYPE) String entityType,
       @DefaultValue("24H") @QueryParam(RECON_ACCESS_METADATA_START_DATE)
       String startDate) {
+    checkIfHeatMapFeatureIsEnabled();
     EntityReadAccessHeatMapResponse entityReadAccessHeatMapResponse = null;
     try {
       entityReadAccessHeatMapResponse =
@@ -88,4 +92,19 @@ public class AccessHeatMapEndpoint {
     }
     return Response.ok(entityReadAccessHeatMapResponse).build();
   }
+
+  private static void checkIfHeatMapFeatureIsEnabled() {
+    FeatureProvider.Feature heatMapFeature = null;
+    List<FeatureProvider.Feature> allDisabledFeatures =
+        FeatureProvider.getAllDisabledFeatures();
+    for (FeatureProvider.Feature feature : allDisabledFeatures) {
+      if ("HeatMap".equals(feature.getFeatureName())) {
+        heatMapFeature = feature;
+        break;
+      }
+    }
+    if (null != heatMapFeature) {
+      throw new WebApplicationException(Response.Status.NOT_FOUND);
+    }
+  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to