You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by bi...@apache.org on 2018/02/05 09:53:08 UTC

[1/2] kylin git commit: KYLIN-3069 Add proper time zone support to the WebUI instead of GMT/PST kludge

Repository: kylin
Updated Branches:
  refs/heads/2.3.x 61f36a270 -> d4c8fbcc5


KYLIN-3069 Add proper time zone support to the WebUI instead of GMT/PST kludge

Signed-off-by: chenzhx <ch...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/148f5c6c
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/148f5c6c
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/148f5c6c

Branch: refs/heads/2.3.x
Commit: 148f5c6ca7a2296cb011cc1e710830cea1fd1ac3
Parents: 61f36a2
Author: peng.jianhua <pe...@zte.com.cn>
Authored: Thu Jan 25 13:27:56 2018 +0800
Committer: chenzhx <ch...@apache.org>
Committed: Mon Feb 5 16:20:43 2018 +0800

----------------------------------------------------------------------
 webapp/app/js/filters/filter.js           | 42 ++++++++------------------
 webapp/app/js/services/kylinProperties.js |  3 ++
 webapp/app/partials/query/query.html      |  2 +-
 3 files changed, 17 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/148f5c6c/webapp/app/js/filters/filter.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/filters/filter.js b/webapp/app/js/filters/filter.js
index 72bb502..0f8382d 100755
--- a/webapp/app/js/filters/filter.js
+++ b/webapp/app/js/filters/filter.js
@@ -122,7 +122,6 @@ KylinApp
     }
   }).filter('utcToConfigTimeZone', function ($filter, kylinConfig) {
 
-    var gmttimezone;
     //convert GMT+0 time to specified Timezone
     return function (item, timezone, format) {
 
@@ -132,39 +131,24 @@ KylinApp
       }
 
       if (angular.isUndefined(timezone) || timezone === '') {
-        timezone = kylinConfig.getTimeZone() == "" ? 'PST' : kylinConfig.getTimeZone();
-      }
-      if (angular.isUndefined(format) || format === '') {
-        format = "yyyy-MM-dd HH:mm:ss";
+        timezone = kylinConfig.getTimeZone() == "" ? 'UTC' : kylinConfig.getTimeZone();
       }
 
-      //convert short name timezone to GMT
-      switch (timezone) {
-        //convert PST to GMT
-        case "PST":
-          gmttimezone = "GMT-8";
-          break;
-        default:
-          gmttimezone = timezone;
+      if (angular.isUndefined(format) || format === '') {
+        format = "YYYY-MM-DD HH:mm:ss z";
       }
 
-      var localOffset = new Date().getTimezoneOffset();
-      var convertedMillis = item;
-      if (gmttimezone.indexOf("GMT+") != -1) {
-        var offset = gmttimezone.substr(4, 1);
-        convertedMillis = new Date(item).getTime() + offset * 60 * 60000 + localOffset * 60000;
-      }
-      else if (gmttimezone.indexOf("GMT-") != -1) {
-        var offset = gmttimezone.substr(4, 1);
-        convertedMillis = new Date(item).getTime() - offset * 60 * 60000 + localOffset * 60000;
-      }
-      else {
-        // return PST by default
-        timezone = "PST";
-        convertedMillis = new Date(item).getTime() - 8 * 60 * 60000 + localOffset * 60000;
+      var time = "";
+      if(timezone.indexOf("GMT")!=-1){
+          var zone = timezone;
+          var offset = parseInt(timezone.substr(3, 2));
+          time = moment(item).utc().zone(-offset).format("YYYY-MM-DD HH:mm:ss ") + zone;
+      }else if(moment.tz.zone(timezone) != null){
+          time = moment(item).tz(timezone).format(format);
+      }else{
+          time = moment(item).utc().format(format);
       }
-      return $filter('date')(convertedMillis, format) + " " + timezone;
-
+      return time;
     }
   }).filter('reverseToGMT0', function ($filter) {
     //backend store GMT+0 timezone ,by default front will show local,so convert to GMT+0 Date String format

http://git-wip-us.apache.org/repos/asf/kylin/blob/148f5c6c/webapp/app/js/services/kylinProperties.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/kylinProperties.js b/webapp/app/js/services/kylinProperties.js
index c344866..bd492bd 100644
--- a/webapp/app/js/services/kylinProperties.js
+++ b/webapp/app/js/services/kylinProperties.js
@@ -31,6 +31,9 @@ KylinApp.service('kylinConfig', function (AdminService, $log) {
   };
 
   this.getProperty = function (name) {
+    if(angular.isUndefined(_config)){
+      return '';
+    }
     var keyIndex = _config.indexOf('\n' + name + '=');
     var keyLength = name.length;
     var partialResult = _config.substr(keyIndex);

http://git-wip-us.apache.org/repos/asf/kylin/blob/148f5c6c/webapp/app/partials/query/query.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/query/query.html b/webapp/app/partials/query/query.html
index 30a21c3..841048e 100644
--- a/webapp/app/partials/query/query.html
+++ b/webapp/app/partials/query/query.html
@@ -145,7 +145,7 @@
                     <tr ng-repeat="query in cachedFilterQueries | reverse track by $index"
                         ng-if="$index >= (cachedFilterQueries.curPage-1)*cachedFilterQueries.perPage && $index < cachedFilterQueries.curPage*cachedFilterQueries.perPage">
                         <td>
-                            <span style="color: #808080;line-height: 25px">Queried At: {{query.savedAt}} </span><span ng-if="query.project">in Project: {{query.project}}</span>
+                            <span style="color: #808080;line-height: 25px">Queried At: {{query.savedAt | utcToConfigTimeZone}} </span><span ng-if="query.project">in Project: {{query.project}}</span>
 
                             <div class="pull-right">
                                 <button class="btn btn-default btn-xs" ng-click="submitQuery(query.sql, query.project)"><i class="fa fa-refresh"></i>


[2/2] kylin git commit: KYLIN-3215

Posted by bi...@apache.org.
KYLIN-3215

Change-Id: I1e9052ec7123bcf3f7538f142cf7c9a4057bad00

Signed-off-by: chenzhx <ch...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/d4c8fbcc
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/d4c8fbcc
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/d4c8fbcc

Branch: refs/heads/2.3.x
Commit: d4c8fbcc58c5b237be5bfa7f1cc06400976f8551
Parents: 148f5c6
Author: peng.jianhua <pe...@zte.com.cn>
Authored: Wed Jan 31 17:49:33 2018 +0800
Committer: chenzhx <ch...@apache.org>
Committed: Mon Feb 5 17:04:03 2018 +0800

----------------------------------------------------------------------
 webapp/app/partials/jobs/jobList.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/d4c8fbcc/webapp/app/partials/jobs/jobList.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/jobs/jobList.html b/webapp/app/partials/jobs/jobList.html
index 034bdbe..1ff6ea4 100644
--- a/webapp/app/partials/jobs/jobList.html
+++ b/webapp/app/partials/jobs/jobList.html
@@ -145,7 +145,7 @@
                 <li ng-if="job.job_status=='RUNNING' || job.job_status=='NEW' || job.job_status=='PENDING' || job.job_status=='ERROR' || job.job_status=='STOPPED'">
                   <a ng-click="cancel(job)">Discard</a>
                 </li>
-                <li ng-if="job.job_status=='FINISHED' || job.job_status=='DISCARDED' || job.job_status=='ERROR' || job.job_status=='STOPPED'">
+                <li ng-if="job.job_status=='FINISHED' || job.job_status=='DISCARDED'">
                   <a ng-click="drop(job)">Drop</a>
                 </li>
                 <li>