You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by zj...@apache.org on 2020/06/29 14:49:12 UTC

[zeppelin] branch master updated: [ZEPPELIN-4881] [front-end] Incorrect date display on version control

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 5ed4995  [ZEPPELIN-4881] [front-end] Incorrect date display on version control
5ed4995 is described below

commit 5ed4995748cf2ed34e800f16cb6e449e080d6321
Author: 1721563048@qq.com <a18652727118>
AuthorDate: Sun Jun 21 16:36:28 2020 +0800

    [ZEPPELIN-4881] [front-end] Incorrect date display on version control
    
    ### What is this PR for?
    fix dispaly bug. Now head revision can correctly display the commit time
    
    ### What type of PR is it?
    [Bug Fix]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    [ZEPPELIN-4881] https://issues.apache.org/jira/browse/ZEPPELIN-4881
    
    ### How should this be tested?
    GUI integration tests.
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    No Questions.
    
    Author: 1721563048@qq.com <a18652727118>
    
    Closes #3814 from lonelyGhostisdog/ZEPPELIN-4881 and squashes the following commits:
    
    c8be29715 [1721563048@qq.com] [ZEPPELIN-4881] Modify the sorting method. The old sorting method puts the head revision in the wrong place
    90c113669 [1721563048@qq.com] [ZEPPELIN-4881] add new function for reorder this array without Head revision, put Head revision in the first
    10f7f6fa4 [1721563048@qq.com] [ZEPPELIN-4881] add field 'time' for Head revision to show in page
---
 zeppelin-web/src/app/notebook/notebook-actionBar.html |  2 +-
 zeppelin-web/src/app/notebook/notebook.controller.js  | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/zeppelin-web/src/app/notebook/notebook-actionBar.html b/zeppelin-web/src/app/notebook/notebook-actionBar.html
index 0f24683..69d509c 100644
--- a/zeppelin-web/src/app/notebook/notebook-actionBar.html
+++ b/zeppelin-web/src/app/notebook/notebook-actionBar.html
@@ -169,7 +169,7 @@ limitations under the License.
           <span class="caret"></span>
         </button>
         <ul class="dropdown-menu pull-right" aria-labelledby="revisionsDropdown">
-          <li ng-repeat="revision in noteRevisions | orderBy:'time':true" class="revision">
+          <li ng-repeat="revision in revisionSort(noteRevisions)" class="revision">
             <a style="cursor:pointer" ng-click="visitRevision(revision)">
               <span style="display: block;">
                 <strong>{{revision.message}}</strong>
diff --git a/zeppelin-web/src/app/notebook/notebook.controller.js b/zeppelin-web/src/app/notebook/notebook.controller.js
index ebab5f8..e7249f0 100644
--- a/zeppelin-web/src/app/notebook/notebook.controller.js
+++ b/zeppelin-web/src/app/notebook/notebook.controller.js
@@ -54,6 +54,15 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
     return moment.unix(date).format('MMMM Do YYYY, h:mm a');
   };
 
+  // reorder this array without Head revision, put Head revision in the first
+  $scope.revisionSort = function(array) {
+    let orderArr = array.slice(1).sort((a, b) => {
+      return b.time-a.time;
+    });
+    orderArr.unshift(array[0]);
+    return orderArr;
+  };
+
   $scope.interpreterSettings = [];
   $scope.interpreterBindings = [];
   $scope.isNoteDirty = null;
@@ -332,6 +341,7 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
         $scope.noteRevisions.splice(0, 0, {
           id: 'Head',
           message: 'Head',
+          time: $scope.noteRevisions[0].time,
         });
       }
       if ($routeParams.revisionId) {