This is an automated email from the ASF dual-hosted git repository. zjffdu pushed a commit to branch branch-0.9 in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/branch-0.9 by this push: new f1f7224 [ZEPPELIN-4881] [front-end] Incorrect date display on version control f1f7224 is described below commit f1f72243dc935b5635e3fb3a0a21b01609937224 Author: 1721563...@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: 1721563...@qq.com <a18652727118> Closes #3814 from lonelyGhostisdog/ZEPPELIN-4881 and squashes the following commits: c8be29715 [1721563...@qq.com] [ZEPPELIN-4881] Modify the sorting method. The old sorting method puts the head revision in the wrong place 90c113669 [1721563...@qq.com] [ZEPPELIN-4881] add new function for reorder this array without Head revision, put Head revision in the first 10f7f6fa4 [1721563...@qq.com] [ZEPPELIN-4881] add field 'time' for Head revision to show in page (cherry picked from commit 5ed4995748cf2ed34e800f16cb6e449e080d6321) Signed-off-by: Jeff Zhang <zjf...@apache.org> --- 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) {