[Groonga-commit] groonga/groonga-admin at 17d25de [master] Format time values

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Nov 10 15:36:40 JST 2014


Kouhei Sutou	2014-11-10 15:36:40 +0900 (Mon, 10 Nov 2014)

  New Revision: 17d25de7a36e41d5323d658def1dabc2393f1789
  https://github.com/groonga/groonga-admin/commit/17d25de7a36e41d5323d658def1dabc2393f1789

  Message:
    Format time values

  Modified files:
    app/scripts/controllers/table-search-controller.js
    app/views/tables/search.html

  Modified: app/scripts/controllers/table-search-controller.js (+11 -2)
===================================================================
--- app/scripts/controllers/table-search-controller.js    2014-11-10 15:26:22 +0900 (b8b4475)
+++ app/scripts/controllers/table-search-controller.js    2014-11-10 15:36:40 +0900 (089cf4e)
@@ -8,7 +8,7 @@
  * Controller of the groongaAdminApp
  */
 angular.module('groongaAdminApp')
-  .controller('TableSearchController', function ($scope, $routeParams, $location, $http) {
+  .controller('TableSearchController', function ($scope, $routeParams, $location, $http, $filter) {
     var client = new GroongaClient($http);
 
     function computeCurrentPage(offset) {
@@ -282,9 +282,18 @@ angular.module('groongaAdminApp')
         });
         $scope.response.records = response.records().map(function(record) {
           return record.map(function(value, index) {
+            var column = $scope.response.columns[index];
+            var formattedValue;
+            if (column.type === 'Time') {
+              var iso8601Format = 'yyyy-MM-ddTHH:mm:ss.sssZ';
+              formattedValue = $filter('date')(value * 1000, iso8601Format);
+            } else {
+              formattedValue = value;
+            }
             return {
               value: value,
-              column: $scope.response.columns[index]
+              formattedValue: formattedValue,
+              column: column
             };
           });
         });

  Modified: app/views/tables/search.html (+2 -2)
===================================================================
--- app/views/tables/search.html    2014-11-10 15:26:22 +0900 (755ab46)
+++ app/views/tables/search.html    2014-11-10 15:36:40 +0900 (9172a76)
@@ -133,7 +133,7 @@
         <tbody>
           <tr ng-repeat="record in response.records track by $index">
             <td ng-repeat="element in record track by $index">
-              {{element.value}}
+              {{element.formattedValue}}
             </td>
           </tr>
         </tbody>
@@ -148,7 +148,7 @@
               <tbody>
                 <tr ng-repeat="item in record track by $index">
                   <th>{{item.column.name}}</th>
-                  <td>{{item.value}}</td>
+                  <td>{{item.formattedValue}}</td>
                 </tr>
               </tbody>
             </table>
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index