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 {
height: auto;
min-height: 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',
function($window) {
return $window.d3;
}
]).factory('dagreD3', ['$window',
function($window) {
return $window.dagreD3;
}
]).factory('Global', ['$window',
function($window) {
return {
......
......@@ -21,11 +21,12 @@
angular.module('dgc.details').controller('DetailsController', ['$scope', '$stateParams', 'DetailsResource',
function($scope, $stateParams, DetailsResource) {
var details = DetailsResource.get({
DetailsResource.get({
id: $stateParams.id
}, function(data) {
$scope.details = data;
$scope.tableName = data.values.name;
});
$scope.details=details;
$scope.tableName= details.name;
$scope.isString = angular.isString;
......
......@@ -57,4 +57,4 @@
<div role="tabpanel" class="tab-pane" id="Input"><div data-ng-include="'/modules/lineage/views/inputs.html'"></div></div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -24,8 +24,8 @@ angular.module('dgc.home.routes', []).config(['$stateProvider',
// states for my app
$stateProvider.state('home', {
url: '/',
templateUrl: '/modules/home/views/home.html'
url: '/search',
templateUrl: '/modules/search/views/search.html'
});
}
]);
......@@ -18,73 +18,98 @@
'use strict';
angular.module('dgc.lineage').controller('LineageController', ['$element', '$scope', '$state', '$stateParams', 'lodash', 'LineageResource', 'd3',
function($element, $scope, $state, $stateParams, _, LineageResource, d3) {
angular.module('dgc.lineage').controller('LineageController', ['$element', '$scope', '$state', '$stateParams', 'lodash', 'LineageResource', 'd3', 'dagreD3',
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;
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;
renderGraph(transformData(response.results), d3.select($element[0]).select('svg'));
});
function transformData(metaData){
function transformData(metaData) {
var nodes = [];
var name, guid;
var nodeGuids = Object.keys(metaData.values.vertices);
for (var index in nodeGuids) {
name = metaData.values.vertices[nodeGuids[index]].values.name;
guid = nodeGuids[index];
nodes.push({ guid: guid, label: name, shape: "rect" });
nodes.push({
guid: guid,
label: name,
shape: "rect"
});
}
var edges = [];
var parent;
var child;
var edgesParents = Object.keys(metaData.values.edges);
for(index in edgesParents){
parent = edgesParents[index];
for(var j = 0; j < metaData.values.edges[parent].length; j++ ) {
for (index in edgesParents) {
parent = edgesParents[index];
for (var j = 0; j < metaData.values.edges[parent].length; j++) {
child = metaData.values.edges[parent][j];
if(!metaData.values.vertices.hasOwnProperty(child)) {
nodes.push({guid: child, label: 'Load Process', shape: "circle"});
if (!metaData.values.vertices.hasOwnProperty(child)) {
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
var g = new dagreD3
.graphlib
.Graph()
.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 }); });
_.forEach(data.nodes, function (node) {
g.setNode(node.guid, { label: node.label, shape: node.shape });
.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 }); });
_.forEach(data.nodes, function(node) {
g.setNode(node.guid, {
label: node.label,
shape: node.shape
});
});
_.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) {
var node = g.node(v);
node.rx = node.ry = 5;
......@@ -92,21 +117,20 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco
var inner = element.select("g");
// Create the renderer
// Create the renderer
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);
// Center the graph
// Center the graph
var initialScale = 0.75;
zoom
.translate([(element.attr("width") - g.graph().width * initialScale) / 2, 20])
.scale(initialScale)
.event(element);
// zoom
// .translate([(element.attr("width") - g.graph().width * initialScale) / 2, 20])
// .scale(initialScale)
// .event(element);
element.attr('height', g.graph().height * initialScale + 90);
}
}
]);
......@@ -21,11 +21,11 @@
angular.module('dgc.navigation').controller('NavigationController', ['$scope', 'NavigationResource',
function($scope, NavigationResource) {
$scope.leftnav= NavigationResource.get();
$scope.leftnav = NavigationResource.get();
$scope.updateVar = function(event) {
$scope.$$prevSibling.query = angular.element(event.target).text();
};
}
]);
\ No newline at end of file
]);
......@@ -18,4 +18,4 @@
'use strict';
angular.module('dgc.navigation',[]);
\ No newline at end of file
angular.module('dgc.navigation', []);
......@@ -21,21 +21,25 @@
angular.module('dgc.search').controller('SearchController', ['$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.resultCount=0;
$scope.resultCount = 0;
$scope.isCollapsed = true;
$scope.search = function(query) {
$scope.results = [];
NotificationService.reset();
$scope.limit = 4;
SearchResource.search({query:query}, function searchSuccess(response) {
SearchResource.search({
query: query
}, function searchSuccess(response) {
$scope.results = response.results;
$scope.resultCount=response.count;
$scope.resultCount = response.count;
if ($scope.results.length < 1) {
NotificationService.error('No Result found', false);
}
$state.go('search.results', {query:query}, {
$state.go('search.results', {
query: query
}, {
location: 'replace'
});
}, function searchError(err) {
......@@ -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;
};
/* $scope.$watch("currentPage + numPerPage", function() {
var begin = (($scope.currentPage - 1) * $scope.numPerPage);
var end = begin + $scope.numPerPage;
/* $scope.$watch("currentPage + numPerPage", function() {
var begin = (($scope.currentPage - 1) * $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) {
var res = {};
angular.forEach(items, function(value, key) {
if((typeof value !== 'object'))
if ((typeof value !== 'object'))
res[key] = value;
});
return res;
};
$scope.query=$stateParams.query;
$scope.query = $stateParams.query;
if ($scope.query) {
$scope.search($scope.query);
}
......
......@@ -19,15 +19,16 @@
'use strict';
angular.module('dgc.search').directive(
"myDirective", function() {
"myDirective",
function() {
return {
restrict: 'EA',
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;
console.log($scope.isCollapsed);
},
transclude: true,
scope: {}
};
});
\ No newline at end of file
});
......@@ -26,11 +26,11 @@ angular.module('dgc.search').config(['$stateProvider',
$stateProvider.state('search', {
url: '/search',
templateUrl: '/modules/search/views/search.html',
controller:'SearchController'
controller: 'SearchController'
}).state('search.results', {
url: '/:query',
templateUrl: '/modules/search/views/searchResult.html',
controller:'SearchController'
controller: 'SearchController'
});
}
]);
......@@ -15,11 +15,6 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<script>
$(function () {
$('#myTab a:last').tab('show')
})
</script>
<!-- Angular JS -->
<script type="text/javascript" src="/lib/angular/angular.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