Commit dd61e708 by babanb

made change for details and lineage

made change for details and lineage
parent de0371f8
...@@ -119,4 +119,8 @@ footer.navbar-bottom img { ...@@ -119,4 +119,8 @@ footer.navbar-bottom img {
height: auto; height: auto;
min-height: 0; min-height: 0;
padding: 5px 5px 5px 0; padding: 5px 5px 5px 0;
}
#Details
{
height: 800px;
} }
\ No newline at end of file
...@@ -38,6 +38,10 @@ angular.module('dgc').factory('lodash', ['$window', ...@@ -38,6 +38,10 @@ angular.module('dgc').factory('lodash', ['$window',
function($window) { function($window) {
return $window.d3; return $window.d3;
} }
]).factory('dagreD3', ['$window',
function($window) {
return $window.dagreD3;
}
]).factory('Global', ['$window', ]).factory('Global', ['$window',
function($window) { function($window) {
return { return {
......
...@@ -21,11 +21,12 @@ ...@@ -21,11 +21,12 @@
angular.module('dgc.details').controller('DetailsController', ['$scope', '$stateParams', 'DetailsResource', angular.module('dgc.details').controller('DetailsController', ['$scope', '$stateParams', 'DetailsResource',
function($scope, $stateParams, DetailsResource) { function($scope, $stateParams, DetailsResource) {
var details = DetailsResource.get({ DetailsResource.get({
id: $stateParams.id id: $stateParams.id
}, function(data) {
$scope.details = data;
$scope.tableName = data.values.name;
}); });
$scope.details=details;
$scope.tableName= details.name;
$scope.isString = angular.isString; $scope.isString = angular.isString;
......
...@@ -57,4 +57,4 @@ ...@@ -57,4 +57,4 @@
<div role="tabpanel" class="tab-pane" id="Input"><div data-ng-include="'/modules/lineage/views/inputs.html'"></div></div> <div role="tabpanel" class="tab-pane" id="Input"><div data-ng-include="'/modules/lineage/views/inputs.html'"></div></div>
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -24,8 +24,8 @@ angular.module('dgc.home.routes', []).config(['$stateProvider', ...@@ -24,8 +24,8 @@ angular.module('dgc.home.routes', []).config(['$stateProvider',
// states for my app // states for my app
$stateProvider.state('home', { $stateProvider.state('home', {
url: '/', url: '/search',
templateUrl: '/modules/home/views/home.html' templateUrl: '/modules/search/views/search.html'
}); });
} }
]); ]);
...@@ -18,73 +18,98 @@ ...@@ -18,73 +18,98 @@
'use strict'; 'use strict';
angular.module('dgc.lineage').controller('LineageController', ['$element', '$scope', '$state', '$stateParams', 'lodash', 'LineageResource', 'd3', angular.module('dgc.lineage').controller('LineageController', ['$element', '$scope', '$state', '$stateParams', 'lodash', 'LineageResource', 'd3', 'dagreD3',
function($element, $scope, $state, $stateParams, _, LineageResource, d3) { function($element, $scope, $state, $stateParams, _, LineageResource, d3, dagreD3) {
$scope.metaData =[]; $scope.metaData = [];
LineageResource.get({tableName:$scope.tableName,type:"outputs"}, function lineageSuccess(response) { LineageResource.get({
tableName: $scope.tableName,
type: "outputs"
}, function lineageSuccess(response) {
$scope.metaData = response.results; $scope.metaData = response.results;
renderGraph(transformData(response.results), d3.select($element[0]).select('svg')); renderGraph(transformData(response.results), d3.select($element[0]).select('svg'));
}); });
tableName="sales_fact_daily_mv";
LineageResource.get({tableName:$scope.tableName,type:"inputs"}, function lineageSuccess(response) { LineageResource.get({
tableName: $scope.tableName,
type: "inputs"
}, function lineageSuccess(response) {
$scope.metaData = response.results; $scope.metaData = response.results;
renderGraph(transformData(response.results), d3.select($element[0]).select('svg')); renderGraph(transformData(response.results), d3.select($element[0]).select('svg'));
}); });
function transformData(metaData){
function transformData(metaData) {
var nodes = []; var nodes = [];
var name, guid; var name, guid;
var nodeGuids = Object.keys(metaData.values.vertices); var nodeGuids = Object.keys(metaData.values.vertices);
for (var index in nodeGuids) { for (var index in nodeGuids) {
name = metaData.values.vertices[nodeGuids[index]].values.name; name = metaData.values.vertices[nodeGuids[index]].values.name;
guid = nodeGuids[index]; guid = nodeGuids[index];
nodes.push({ guid: guid, label: name, shape: "rect" }); nodes.push({
guid: guid,
label: name,
shape: "rect"
});
} }
var edges = []; var edges = [];
var parent; var parent;
var child; var child;
var edgesParents = Object.keys(metaData.values.edges); var edgesParents = Object.keys(metaData.values.edges);
for(index in edgesParents){ for (index in edgesParents) {
parent = edgesParents[index]; parent = edgesParents[index];
for(var j = 0; j < metaData.values.edges[parent].length; j++ ) { for (var j = 0; j < metaData.values.edges[parent].length; j++) {
child = metaData.values.edges[parent][j]; child = metaData.values.edges[parent][j];
if(!metaData.values.vertices.hasOwnProperty(child)) { if (!metaData.values.vertices.hasOwnProperty(child)) {
nodes.push({guid: child, label: 'Load Process', shape: "circle"}); nodes.push({
guid: child,
label: 'Load Process',
shape: "circle"
});
} }
edges.push({parent: parent, child: child}); edges.push({
parent: parent,
child: child
});
} }
} }
return {nodes: nodes, edges: edges}; return {
nodes: nodes,
edges: edges
};
} }
function renderGraph(data, element) {
function renderGraph(data, element){
// Create a new directed graph // Create a new directed graph
var g = new dagreD3 var g = new dagreD3
.graphlib .graphlib
.Graph() .Graph()
.setGraph({rankdir: "LR"}); .setGraph({
rankdir: "LR"
// Automatically label each of the nodes });
//g.setNode("DB (sales)", { label: "Sales DB", width: 144, height: 100 })
//states.forEach(function(state) { g.setNode(state, { label: state }); }); // Automatically label each of the nodes
//g.setNode("DB (sales)", { label: "Sales DB", width: 144, height: 100 })
_.forEach(data.nodes, function (node) { //states.forEach(function(state) { g.setNode(state, { label: state }); });
g.setNode(node.guid, { label: node.label, shape: node.shape });
_.forEach(data.nodes, function(node) {
g.setNode(node.guid, {
label: node.label,
shape: node.shape
});
}); });
_.forEach(data.edges, function(edge) { _.forEach(data.edges, function(edge) {
g.setEdge(edge.parent, edge.child, {label: ""}); g.setEdge(edge.parent, edge.child, {
label: ""
});
}); });
// Set some general styles // Set some general styles
g.nodes().forEach(function(v) { g.nodes().forEach(function(v) {
var node = g.node(v); var node = g.node(v);
node.rx = node.ry = 5; node.rx = node.ry = 5;
...@@ -92,21 +117,20 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco ...@@ -92,21 +117,20 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco
var inner = element.select("g"); var inner = element.select("g");
// Create the renderer // Create the renderer
var render = new dagreD3.render(); var render = new dagreD3.render();
// Run the renderer. This is what draws the final graph. // Run the renderer. This is what draws the final graph.
render(inner, g); render(inner, g);
// Center the graph // Center the graph
var initialScale = 0.75; var initialScale = 0.75;
zoom // zoom
.translate([(element.attr("width") - g.graph().width * initialScale) / 2, 20]) // .translate([(element.attr("width") - g.graph().width * initialScale) / 2, 20])
.scale(initialScale) // .scale(initialScale)
.event(element); // .event(element);
element.attr('height', g.graph().height * initialScale + 90); element.attr('height', g.graph().height * initialScale + 90);
} }
} }
]); ]);
...@@ -21,11 +21,11 @@ ...@@ -21,11 +21,11 @@
angular.module('dgc.navigation').controller('NavigationController', ['$scope', 'NavigationResource', angular.module('dgc.navigation').controller('NavigationController', ['$scope', 'NavigationResource',
function($scope, NavigationResource) { function($scope, NavigationResource) {
$scope.leftnav= NavigationResource.get(); $scope.leftnav = NavigationResource.get();
$scope.updateVar = function(event) { $scope.updateVar = function(event) {
$scope.$$prevSibling.query = angular.element(event.target).text(); $scope.$$prevSibling.query = angular.element(event.target).text();
}; };
} }
]); ]);
\ No newline at end of file
...@@ -18,4 +18,4 @@ ...@@ -18,4 +18,4 @@
'use strict'; 'use strict';
angular.module('dgc.navigation',[]); angular.module('dgc.navigation', []);
\ No newline at end of file
...@@ -21,21 +21,25 @@ ...@@ -21,21 +21,25 @@
angular.module('dgc.search').controller('SearchController', ['$scope', '$location', '$http', '$state', '$stateParams', 'SearchResource', 'NotificationService', angular.module('dgc.search').controller('SearchController', ['$scope', '$location', '$http', '$state', '$stateParams', 'SearchResource', 'NotificationService',
function($scope, $location, $http, $state, $stateParams, SearchResource, NotificationService) { function($scope, $location, $http, $state, $stateParams, SearchResource, NotificationService) {
$scope.types = ['table','column','db','view','loadprocess','storagedesc']; $scope.types = ['table', 'column', 'db', 'view', 'loadprocess', 'storagedesc'];
$scope.results = []; $scope.results = [];
$scope.resultCount=0; $scope.resultCount = 0;
$scope.isCollapsed = true; $scope.isCollapsed = true;
$scope.search = function(query) { $scope.search = function(query) {
$scope.results = []; $scope.results = [];
NotificationService.reset(); NotificationService.reset();
$scope.limit = 4; $scope.limit = 4;
SearchResource.search({query:query}, function searchSuccess(response) { SearchResource.search({
query: query
}, function searchSuccess(response) {
$scope.results = response.results; $scope.results = response.results;
$scope.resultCount=response.count; $scope.resultCount = response.count;
if ($scope.results.length < 1) { if ($scope.results.length < 1) {
NotificationService.error('No Result found', false); NotificationService.error('No Result found', false);
} }
$state.go('search.results', {query:query}, { $state.go('search.results', {
query: query
}, {
location: 'replace' location: 'replace'
}); });
}, function searchError(err) { }, function searchError(err) {
...@@ -47,22 +51,22 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio ...@@ -47,22 +51,22 @@ angular.module('dgc.search').controller('SearchController', ['$scope', '$locatio
return $scope.types.indexOf(this.results.dataType.typeName && this.results.dataType.typeName.toLowerCase()) > -1; return $scope.types.indexOf(this.results.dataType.typeName && this.results.dataType.typeName.toLowerCase()) > -1;
}; };
/* $scope.$watch("currentPage + numPerPage", function() { /* $scope.$watch("currentPage + numPerPage", function() {
var begin = (($scope.currentPage - 1) * $scope.numPerPage); var begin = (($scope.currentPage - 1) * $scope.numPerPage);
var end = begin + $scope.numPerPage; var end = begin + $scope.numPerPage;
$scope.filteredResults = $scope.rows.slice(begin, end); $scope.filteredResults = $scope.rows.slice(begin, end);
});*/ });*/
$scope.filterSearchResults = function(items) { $scope.filterSearchResults = function(items) {
var res = {}; var res = {};
angular.forEach(items, function(value, key) { angular.forEach(items, function(value, key) {
if((typeof value !== 'object')) if ((typeof value !== 'object'))
res[key] = value; res[key] = value;
}); });
return res; return res;
}; };
$scope.query=$stateParams.query; $scope.query = $stateParams.query;
if ($scope.query) { if ($scope.query) {
$scope.search($scope.query); $scope.search($scope.query);
} }
......
...@@ -19,15 +19,16 @@ ...@@ -19,15 +19,16 @@
'use strict'; 'use strict';
angular.module('dgc.search').directive( angular.module('dgc.search').directive(
"myDirective", function() { "myDirective",
function() {
return { return {
restrict: 'EA', restrict: 'EA',
template: '<a href="javascript: void(0);" button-toggle toggle="isCollapsed" class="show-more" ng-click="isCollapsed = !isCollapsed">..show more</a>', template: '<a href="javascript: void(0);" button-toggle toggle="isCollapsed" class="show-more" ng-click="isCollapsed = !isCollapsed">..show more</a>',
link: function($scope){ link: function($scope) {
$scope.isCollapsed = true; $scope.isCollapsed = true;
console.log($scope.isCollapsed); console.log($scope.isCollapsed);
}, },
transclude: true, transclude: true,
scope: {} scope: {}
}; };
}); });
\ No newline at end of file
...@@ -26,11 +26,11 @@ angular.module('dgc.search').config(['$stateProvider', ...@@ -26,11 +26,11 @@ angular.module('dgc.search').config(['$stateProvider',
$stateProvider.state('search', { $stateProvider.state('search', {
url: '/search', url: '/search',
templateUrl: '/modules/search/views/search.html', templateUrl: '/modules/search/views/search.html',
controller:'SearchController' controller: 'SearchController'
}).state('search.results', { }).state('search.results', {
url: '/:query', url: '/:query',
templateUrl: '/modules/search/views/searchResult.html', templateUrl: '/modules/search/views/searchResult.html',
controller:'SearchController' controller: 'SearchController'
}); });
} }
]); ]);
...@@ -15,11 +15,6 @@ ...@@ -15,11 +15,6 @@
~ See the License for the specific language governing permissions and ~ See the License for the specific language governing permissions and
~ limitations under the License. ~ limitations under the License.
--> -->
<script>
$(function () {
$('#myTab a:last').tab('show')
})
</script>
<!-- Angular JS --> <!-- Angular JS -->
<script type="text/javascript" src="/lib/angular/angular.min.js"></script> <script type="text/javascript" src="/lib/angular/angular.min.js"></script>
<script type="text/javascript" src="/lib/lodash/lodash.min.js"></script> <script type="text/javascript" src="/lib/lodash/lodash.min.js"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment