You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@griffin.apache.org by gu...@apache.org on 2017/06/12 05:16:58 UTC

incubator-griffin git commit: Nav

Repository: incubator-griffin
Updated Branches:
  refs/heads/master 693b47047 -> a45937dd0


Nav

Author: Yang <xi...@ebay.com>

Closes #68 from RachelYang2/nav.


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

Branch: refs/heads/master
Commit: a45937dd0900de33d29602aea87cdda975ddd93b
Parents: 693b470
Author: Yang <xi...@ebay.com>
Authored: Mon Jun 12 13:16:48 2017 +0800
Committer: Lionel Liu <bh...@163.com>
Committed: Mon Jun 12 13:16:48 2017 +0800

----------------------------------------------------------------------
 ui/index.html                           |  5 +-
 ui/js/controllers/bigChart-ctrl.js      |  8 +--
 ui/js/controllers/createrule-ac-ctrl.js |  7 +--
 ui/js/controllers/dataassets-ctrl.js    | 16 ++++--
 ui/js/controllers/detail-ctrl.js        | 65 +++++++++++++++++++++++
 ui/js/controllers/health-ctrl.js        | 31 ++++-------
 ui/js/controllers/index.js              |  3 +-
 ui/js/controllers/sidebar-ctrl.js       |  8 +--
 ui/js/directives/treeview.js            |  3 +-
 ui/js/routes.js                         |  5 ++
 ui/js/services/bark-chart.js            |  4 +-
 ui/js/services/services.js              |  2 +-
 ui/pages/measures/detail.html           | 77 ++++++++++++++++++++++++++++
 13 files changed, 191 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a45937dd/ui/index.html
----------------------------------------------------------------------
diff --git a/ui/index.html b/ui/index.html
index b89aa82..229401f 100644
--- a/ui/index.html
+++ b/ui/index.html
@@ -146,7 +146,7 @@ limitations under the License.
 
 </div>
 
-<div id="bigChartContainer"  class="big-chart-container" style="display:none;" ng-controller="BigChartCtrl">
+<!-- <div id="bigChartContainer"  class="big-chart-container" style="display:none;" ng-controller="BigChartCtrl">
     <div id="bigChartShow" class="big-chart-content">
         <div class="container-fluid">
             <div class="pull-right" style="position:fixed;right:20px;top:10px;z-index:1050;">
@@ -159,12 +159,11 @@ limitations under the License.
             </div>
 
             <div class="row">
-                <!--<highchart config="chartConfig" />-->
                 <div id="bigChartDiv"></div>
             </div>
         </div>
     </div>
-</div>
+</div> -->
 
 <div class="modal fade" id="download-sample" role="dialog" ng-controller="DownloadSampleCtrl">
     <div class="modal-dialog modal-xg modal-lg">

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a45937dd/ui/js/controllers/bigChart-ctrl.js
----------------------------------------------------------------------
diff --git a/ui/js/controllers/bigChart-ctrl.js b/ui/js/controllers/bigChart-ctrl.js
index 3984185..4558142 100644
--- a/ui/js/controllers/bigChart-ctrl.js
+++ b/ui/js/controllers/bigChart-ctrl.js
@@ -14,7 +14,7 @@ limitations under the License.
  */
 define(['./module'], function(controllers) {
     'use strict';
-    controllers.controller('BigChartCtrl', ['$scope', '$http', '$config', '$filter', '$timeout', '$compile', '$routeParams', '$barkChart', '$rootScope', function($scope, $http, $config, $filter, $timeout, $compile, $routeParams, $barkChart, $rootScope) {
+    controllers.controller('BigChartCtrl', ['$scope', '$http', '$config', '$filter', '$timeout', '$compile', '$routeParams', '$barkChart', '$rootScope', '$location',function($scope, $http, $config, $filter, $timeout, $compile, $routeParams, $barkChart, $rootScope,$location) {
 
       var echarts = require('echarts');
 
@@ -32,7 +32,9 @@ define(['./module'], function(controllers) {
 
       $scope.closeBigChart = function(){
         console.log('close big chart!');
-        $('#bigChartContainer').hide();
+        // $('#bigChartContainer').hide();
+        history.back();
+        // $location.path('/health');
         // $('#mainWindow').show();
       }
 
@@ -55,4 +57,4 @@ define(['./module'], function(controllers) {
       }
 
     }]);
-});
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a45937dd/ui/js/controllers/createrule-ac-ctrl.js
----------------------------------------------------------------------
diff --git a/ui/js/controllers/createrule-ac-ctrl.js b/ui/js/controllers/createrule-ac-ctrl.js
index 15b37b9..6d04368 100644
--- a/ui/js/controllers/createrule-ac-ctrl.js
+++ b/ui/js/controllers/createrule-ac-ctrl.js
@@ -46,8 +46,8 @@ define(['./module'], function(controllers) {
                         dbList.push(dbNode);
                         if (db) {
                                angular.forEach(db,function(table){
-                                   console.log(table);
-                                   console.log(typeof(table));
+                                   // console.log(table);
+                                   // console.log(typeof(table));
                                    var dsNode = {
                                        name: table.tableName,
                                        l2: true,
@@ -150,7 +150,8 @@ define(['./module'], function(controllers) {
                 console.log($scope.schemaCollectionTarget);
                 });
             }
-            $scope.dataAsset = $scope.currentNodeTarget.name + ',' + $scope.currentNode.name;
+            if($scope.currentNodeTarget)
+                $scope.dataAsset = $scope.currentNodeTarget.name + ',' + $scope.currentNode.name;
             console.log($scope.dataAsset);
         });
 

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a45937dd/ui/js/controllers/dataassets-ctrl.js
----------------------------------------------------------------------
diff --git a/ui/js/controllers/dataassets-ctrl.js b/ui/js/controllers/dataassets-ctrl.js
index d33fd36..999c7ac 100644
--- a/ui/js/controllers/dataassets-ctrl.js
+++ b/ui/js/controllers/dataassets-ctrl.js
@@ -33,13 +33,19 @@ define(['./module'], function (controllers) {
         if(start == 0 && !$scope.rowCollection){
           $http.get(allModels).success(function(data) {
             if(data){
-              data.sort(function(a,b){
-                return -(a.timestamp - b.timestamp);
-              });
+              // data.sort(function(a,b){
+              //   return -(a.timestamp - b.timestamp);
+              // });
             }
+            originalRowCollection = new Array();
+            angular.forEach(data,function(db){
+              angular.forEach(db,function(table){
+                originalRowCollection.push(table);
+              });
+            });
 
-            originalRowCollection = angular.copy(data);
-            $scope.rowCollection = angular.copy(data);
+            // originalRowCollection = angular.copy(data);
+            $scope.rowCollection = angular.copy(originalRowCollection);
             // $scope.rowCollection.sort(function(a,b){
             //   return (a.assetName<b.assetName?-1:(a.assetName>b.assetName?1:0));
             // });

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a45937dd/ui/js/controllers/detail-ctrl.js
----------------------------------------------------------------------
diff --git a/ui/js/controllers/detail-ctrl.js b/ui/js/controllers/detail-ctrl.js
new file mode 100644
index 0000000..acb798b
--- /dev/null
+++ b/ui/js/controllers/detail-ctrl.js
@@ -0,0 +1,65 @@
+/*-
+ * Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+ */
+
+define(['./module'], function (controllers) {
+    'use strict';
+    controllers.controller('DetailCtrl', ['$scope', '$http', '$config', '$location','$timeout', '$route', '$barkChart', '$rootScope','$routeParams', function ($scope, $http, $config, $location, $timeout, $route, $barkChart, $rootScope,$routeParams) {
+      console.log('detail controller');
+      // var url="/js/controllers/heatmap.json";
+
+        var echarts = require('echarts');
+        var formatUtil = echarts.format;
+
+
+        var showBig = function(metricName){
+          var metricDetailUrl = $config.uri.dashboard;
+          // var metricDetailUrl = 'data.json';
+          $http.post(metricDetailUrl, {"query": {  "bool":{"filter":[ {"term" : {"name": metricName }}]}},  "sort": [{"tmst": {"order": "asc"}}],"size":1000}).success(function(data) {
+            // $http.get(metricDetailUrl).success(function (data) {
+                // body...
+            
+            var metric = new Object();
+            metric.name = data.hits.hits[0]._source.name;
+            metric.timestamp = data.hits.hits[data.hits.hits.length-1]._source.tmst;
+            metric.dq = data.hits.hits[data.hits.hits.length-1]._source.matched/data.hits.hits[data.hits.hits.length-1]._source.matched*100;
+            metric.details = new Array();
+            angular.forEach(data.hits.hits,function(point){
+                metric.details.push(point);
+            })
+            $rootScope.showBigChart($barkChart.getOptionBig(metric));
+          });
+        }
+
+        pageInit();
+
+        function pageInit() {
+            $scope.$emit('initReq');
+            showBig($routeParams.modelname);
+        }
+
+        $scope.$on('resizeHandler', function(e) {
+            if($route.current.$$route.controller == 'HealthCtrl'){
+                console.log('health resize');
+                resizeTreeMap();
+                $scope.myChart.resize();
+            }
+        });
+
+        function resizeTreeMap() {
+            $('#chart1').height( $('#mainWindow').height() - $('.bs-component').outerHeight() );
+        }
+
+    }]);
+});

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a45937dd/ui/js/controllers/health-ctrl.js
----------------------------------------------------------------------
diff --git a/ui/js/controllers/health-ctrl.js b/ui/js/controllers/health-ctrl.js
index fe3c90e..83d1bbb 100644
--- a/ui/js/controllers/health-ctrl.js
+++ b/ui/js/controllers/health-ctrl.js
@@ -32,7 +32,9 @@ define(['./module'], function (controllers) {
 
 //            var url = $config.uri.heatmap;
             var url_dashboard = $config.uri.dashboard ;
+            // var url_dashboard = 'data.json';
             var url_organization = $config.uri.organization;
+            // var url_organization = 'org.json';
             $http.get(url_organization).success(function(res){
                var orgNode = null;
                angular.forEach(res, function(value,key) {
@@ -42,7 +44,8 @@ define(['./module'], function (controllers) {
                     orgNode.assetMap = value;
                });
                $scope.originalOrgs = angular.copy($scope.orgs);
-               $http.post(url_dashboard, {"query": {"match_all":{}},  "sort": [{"tmst": {"order": "asc"}}],"size":1000}).success(function(data) {
+                $http.post(url_dashboard, {"query": {"match_all":{}},  "sort": [{"tmst": {"order": "asc"}}],"size":1000}).success(function(data) {
+//                  $http.get(url_dashboard).success(function(data){
                     angular.forEach(data.hits.hits, function(sys) {
                         var chartData = sys._source;
                         chartData.sort = function(a,b){
@@ -125,7 +128,9 @@ define(['./module'], function (controllers) {
                                         normal: {
                                             color: '#4c8c6f'
                                         }
-                                    }
+                                    },
+                                    // link:'/#/detailed/'+metric.name,
+                                    // target:'self',
                                 };
                                 if (metric.dqfail == 1) {
                                     itemChild.itemStyle.normal.color = '#ae5732';
@@ -204,7 +209,7 @@ define(['./module'], function (controllers) {
                                 show: false
                             },
                             roam: false,
-                            nodeClick: false,
+                            nodeClick: 'link',
                             data: data,
                             // leafDepth: 1,
                             width: '95%',
@@ -225,29 +230,13 @@ define(['./module'], function (controllers) {
                     // }
                     // param.event.event.preventDefault();
                     if (param.data.name) {
-
-                        showBig(param.data.name);
-                        // return false;
+                        // $location.path('/detailed/'+param.data.name);
+                        window.location.href = '/#/detailed/'+param.data.name;
                     }
                 });
 
         }
 
-        var showBig = function(metricName){
-          var metricDetailUrl = $config.uri.dashboard;
-          $http.post(metricDetailUrl, {"query": {  "bool":{"filter":[ {"term" : {"name": metricName }}]}},  "sort": [{"tmst": {"order": "asc"}}],"size":1000}).success(function(data) {
-            var metric = new Object();
-            metric.name = data.hits.hits[0]._source.name;
-            metric.timestamp = data.hits.hits[data.hits.hits.length-1]._source.tmst;
-            metric.dq = data.hits.hits[data.hits.hits.length-1]._source.matched/data.hits.hits[data.hits.hits.length-1]._source.matched*100;
-            metric.details = new Array();
-            angular.forEach(data.hits.hits,function(point){
-                metric.details.push(point);
-            })
-            $rootScope.showBigChart($barkChart.getOptionBig(metric));
-          });
-        }
-
         $scope.$on('resizeHandler', function(e) {
             if($route.current.$$route.controller == 'HealthCtrl'){
                 console.log('health resize');

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a45937dd/ui/js/controllers/index.js
----------------------------------------------------------------------
diff --git a/ui/js/controllers/index.js b/ui/js/controllers/index.js
index 84de409..0b9df36 100644
--- a/ui/js/controllers/index.js
+++ b/ui/js/controllers/index.js
@@ -36,7 +36,8 @@ define([
     './subscribemodel-ctrl',
     './bigChart-ctrl',
     './main-ctrl',
-    './downloadSample-ctrl'
+    './downloadSample-ctrl',
+    './detail-ctrl'
     // './my-ctrl-2'
 ], function () {
   // console.log('my controller 1');

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a45937dd/ui/js/controllers/sidebar-ctrl.js
----------------------------------------------------------------------
diff --git a/ui/js/controllers/sidebar-ctrl.js b/ui/js/controllers/sidebar-ctrl.js
index e048ed3..e64c6ea 100644
--- a/ui/js/controllers/sidebar-ctrl.js
+++ b/ui/js/controllers/sidebar-ctrl.js
@@ -15,7 +15,7 @@ limitations under the License.
 
 define(['./module'], function(controllers) {
     'use strict';
-    controllers.controller('SideBarCtrl', ['$scope', '$http', '$config', '$filter', '$timeout', '$compile', '$routeParams', '$barkChart', '$rootScope', function($scope, $http, $config, $filter, $timeout, $compile, $routeParams, $barkChart, $rootScope) {
+    controllers.controller('SideBarCtrl', ['$scope', '$http', '$config', '$filter', '$timeout', '$compile', '$routeParams', '$barkChart', '$rootScope','$location', function($scope, $http, $config, $filter, $timeout, $compile, $routeParams, $barkChart, $rootScope,$location) {
 
         var echarts = require('echarts');
 
@@ -51,8 +51,8 @@ define(['./module'], function(controllers) {
             myChart.setOption(metric.myOption);
 
             $('#'+chartId).unbind('click');
-            $('#'+chartId).click(function() {
-              showBig($scope.finalData[parentIndex].metrics[index]);
+            $('#'+chartId).click(function(e) {
+              window.location.href = '/#/detailed/'+$scope.finalData[parentIndex].metrics[index].name;
             });
 
         };
@@ -63,6 +63,7 @@ define(['./module'], function(controllers) {
 
         function sideBarList(sysName){
             var url_organization = $config.uri.organization;
+            // var url_organization = 'org.json';
             $http.get(url_organization).success(function(res){
                var orgNode = null;
                angular.forEach(res, function(value,key) {
@@ -74,6 +75,7 @@ define(['./module'], function(controllers) {
                $scope.originalOrg = angular.copy($scope.orgs);
                var url_briefmetrics = $config.uri.dashboard;
                $http.post(url_briefmetrics, {"query": {"match_all":{}},  "sort": [{"tmst": {"order": "asc"}}],"size":1000}).success(function(data) {
+               // $http.get('data.json').success(function(data){
                    angular.forEach(data.hits.hits, function(sys) {
                         var chartData = sys._source;
                         chartData.sort = function(a,b){

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a45937dd/ui/js/directives/treeview.js
----------------------------------------------------------------------
diff --git a/ui/js/directives/treeview.js b/ui/js/directives/treeview.js
index 1d09770..f9a2190 100644
--- a/ui/js/directives/treeview.js
+++ b/ui/js/directives/treeview.js
@@ -69,7 +69,8 @@ define(['./module'], function (directives) {
           //tree template
           var template =
             '<ul>' +
-              '<li ng-repeat="node in ' + treeModel + '">' +
+              '<li ng-repeat="node in ' + treeModel + '" >' +
+                '<span ng-show=!node.' + nodeChildren + '.length>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>'+
                 '<i class="collapsed fa fa-caret-right" ng-show="node.' + nodeChildren + '.length && node.collapsed" ng-click="selectNodeHead(node)"></i>' +
                 '<i class="expanded fa fa-caret-down" ng-show="node.' + nodeChildren + '.length && !node.collapsed" ng-click="selectNodeHead(node)"></i>' +
                 '<i class="' + l1Icon + '" ng-show="node.l1"></i>'  +

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a45937dd/ui/js/routes.js
----------------------------------------------------------------------
diff --git a/ui/js/routes.js b/ui/js/routes.js
index 943196e..ac9aeb6 100644
--- a/ui/js/routes.js
+++ b/ui/js/routes.js
@@ -67,6 +67,11 @@ define(['./app'], function(app) {
             controller: 'ViewRuleCtrl'
         });
 
+        $routeProvider.when('/detailed/:modelname',{
+            templateUrl:'/pages/measures/detail.html',
+            controller:'DetailCtrl'
+        })
+
         $routeProvider.when('/jobs',{
             templateUrl:'pages/jobs/jobs.html',
             controller:'JobCtrl'

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a45937dd/ui/js/services/bark-chart.js
----------------------------------------------------------------------
diff --git a/ui/js/services/bark-chart.js b/ui/js/services/bark-chart.js
index 85cc7ae..c63cb5b 100644
--- a/ui/js/services/bark-chart.js
+++ b/ui/js/services/bark-chart.js
@@ -203,8 +203,8 @@ define(['./module'], function (services) {
     var option = {
       title: {
         text:  metric.name,
-//        link: '/#/viewrule/' + metric.name,
-//        target: 'self',
+        link: '/#/viewrule/' + metric.name,
+        target: 'self',
         left: 'center',
         textStyle: {
             fontSize: 25

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a45937dd/ui/js/services/services.js
----------------------------------------------------------------------
diff --git a/ui/js/services/services.js b/ui/js/services/services.js
index 7096301..fe9f9ab 100644
--- a/ui/js/services/services.js
+++ b/ui/js/services/services.js
@@ -37,7 +37,7 @@ define(['./module'], function (services) {
 
               dbtree:BACKEND_SERVER + '/metadata/hive/alltables',
               schemadefinition: BACKEND_SERVER + '/metadata/hive',
-              dataassetlist: BACKEND_SERVER + '/metadata/hive/default/alltables',
+              dataassetlist: BACKEND_SERVER + '/metadata/hive/alltables',
 
               adddataasset: BACKEND_SERVER + API_ROOT_PATH + '/dataassets',
               updatedataasset: BACKEND_SERVER + API_ROOT_PATH + '/dataassets',

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/a45937dd/ui/pages/measures/detail.html
----------------------------------------------------------------------
diff --git a/ui/pages/measures/detail.html b/ui/pages/measures/detail.html
new file mode 100644
index 0000000..45b1d51
--- /dev/null
+++ b/ui/pages/measures/detail.html
@@ -0,0 +1,77 @@
+<!--
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+
+<!DOCTYPE html>
+
+<html lang="en">
+
+<head>
+
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <meta name="description" content="">
+    <meta name="author" content="">
+    <link rel="icon" href="/img/favicon.ico">
+
+    <title>Griffin - Data Quality Service</title>
+
+    <!-- Bootstrap Core CSS -->
+    <link href="bower_components/bootswatch/cyborg/bootstrap.css" rel="stylesheet">
+    <!-- Custom Fonts -->
+    <link href="bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
+
+    <link href="bower_components/AngularJS-Toaster/toaster.css" rel="stylesheet">
+
+    <link href="css/main.css" rel="stylesheet">
+    <link href="css/treeview.css" rel="stylesheet">
+    <link href="css/treeview-check.css" rel="stylesheet">
+    <link href="css/sidebar.css" rel="stylesheet">
+    <link href="pages/measures/measure.css" rel="stylesheet">
+    <link href="pages/metrics/metrics.css" rel="stylesheet">
+    <link href="pages/template/bigchart.css" rel="stylesheet">
+    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
+    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
+    <!--[if lt IE 9]>
+    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
+    <![endif]-->
+
+</head>
+
+
+<body>
+
+<div id="bigChartContainer"  class="big-chart-container" style="display:none;" ng-controller="BigChartCtrl">
+    <div id="bigChartShow" class="big-chart-content">
+        <div class="container-fluid">
+            <div class="pull-right" style="position:fixed;right:20px;top:10px;z-index:1050;">
+                <button type="button" id="bigChartClose" class="bark-close thick" aria-label="Close" ng-click="closeBigChart()">
+                </button>
+            </div>
+
+            <div class="pull-right" style="position:fixed;right:150px;top:10px;z-index:1050;">
+                <a href ng-click="downloadSample()" style="font-size:15px;color:#d48265;"><u>Download Sample</u></a>
+            </div>
+
+            <div class="row">
+                <div id="bigChartDiv"></div>
+            </div>
+        </div>
+    </div>
+</div>
+</body>
+</html>