You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by nb...@apache.org on 2020/10/23 14:47:11 UTC

[atlas] branch master updated: ATLAS-3984 Add UI Date Timezone and UI Date Format in Session api

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 90f5b4a  ATLAS-3984 Add UI Date Timezone and UI Date Format in Session api
90f5b4a is described below

commit 90f5b4add36b8a006393d8fa92fa4ba93f49f309
Author: Mandar Ambawane <ma...@freestoneinfotech.com>
AuthorDate: Thu Oct 22 10:58:59 2020 +0530

    ATLAS-3984 Add UI Date Timezone and UI Date Format in Session api
    
    Signed-off-by: Nikhil P Bonte <nb...@apache.org>
---
 .../org/apache/atlas/web/resources/AdminResource.java     | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
index 59af513..f6a20c0 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
@@ -133,6 +133,9 @@ public class AdminResource {
     private static final String DEFAULT_EDITABLE_ENTITY_TYPES  = "hdfs_path";
     private static final String DEFAULT_UI_VERSION             = "atlas.ui.default.version";
     private static final String UI_VERSION_V2                  = "v2";
+    private static final String UI_DATE_TIMEZONE_FORMAT_ENABLED = "atlas.ui.date.timezone.format.enabled";
+    private static final String UI_DATE_FORMAT                 = "atlas.ui.date.format";
+    private static final String UI_DATE_DEFAULT_FORMAT         = "MM/DD/YYYY hh:mm:ss A";
     private static final List TIMEZONE_LIST  = Arrays.asList(TimeZone.getAvailableIDs());
 
     @Context
@@ -159,6 +162,8 @@ public class AdminResource {
     private final  AtlasAuditService        auditService;
     private final  String                   defaultUIVersion;
     private final  EntityAuditRepository    auditRepository;
+    private final  boolean                  isTimezoneFormatEnabled;
+    private final  String                   uiDateFormat;
 
     static {
         try {
@@ -191,9 +196,13 @@ public class AdminResource {
         this.auditRepository           = auditRepository;
 
         if (atlasProperties != null) {
-            defaultUIVersion = atlasProperties.getString(DEFAULT_UI_VERSION, UI_VERSION_V2);
+            this.defaultUIVersion = atlasProperties.getString(DEFAULT_UI_VERSION, UI_VERSION_V2);
+            this.isTimezoneFormatEnabled = atlasProperties.getBoolean(UI_DATE_TIMEZONE_FORMAT_ENABLED, true);
+            this.uiDateFormat = atlasProperties.getString(UI_DATE_FORMAT, UI_DATE_DEFAULT_FORMAT);
         } else {
-            defaultUIVersion = UI_VERSION_V2;
+            this.defaultUIVersion = UI_VERSION_V2;
+            this.isTimezoneFormatEnabled = true;
+            this.uiDateFormat = UI_DATE_DEFAULT_FORMAT;
         }
     }
 
@@ -339,6 +348,8 @@ public class AdminResource {
         responseData.put("userName", userName);
         responseData.put("groups", groups);
         responseData.put("timezones", TIMEZONE_LIST);
+        responseData.put(UI_DATE_TIMEZONE_FORMAT_ENABLED, isTimezoneFormatEnabled);
+        responseData.put(UI_DATE_FORMAT, uiDateFormat);
 
         response = Response.ok(AtlasJson.toV1Json(responseData)).build();