You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ve...@apache.org on 2015/06/17 01:05:25 UTC
[51/58] [abbrv] incubator-atlas git commit: HDPDGI-69:Dileep:Use
details api to get LoadProcess name
HDPDGI-69:Dileep:Use details api to get LoadProcess name
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/1efb57bc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/1efb57bc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/1efb57bc
Branch: refs/heads/master
Commit: 1efb57bc453206b8377bb63e6f659d2861212697
Parents: d54a598
Author: Vishal Kadam <vi...@gmail.com>
Authored: Tue Jun 16 00:07:42 2015 -0400
Committer: Vishal Kadam <vi...@gmail.com>
Committed: Tue Jun 16 00:08:19 2015 -0400
----------------------------------------------------------------------
.../public/modules/lineage/lineageController.js | 66 +++++++++++++++++---
1 file changed, 57 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1efb57bc/dashboard/v2/public/modules/lineage/lineageController.js
----------------------------------------------------------------------
diff --git a/dashboard/v2/public/modules/lineage/lineageController.js b/dashboard/v2/public/modules/lineage/lineageController.js
index daecccb..0227552 100755
--- a/dashboard/v2/public/modules/lineage/lineageController.js
+++ b/dashboard/v2/public/modules/lineage/lineageController.js
@@ -18,8 +18,9 @@
'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', 'DetailsResource', '$q',
+ function($element, $scope, $state, $stateParams, _, LineageResource, d3, DetailsResource, $q) {
+ var guidsList = [];
function getLineageData(tableData, callRender) {
LineageResource.get({
@@ -27,15 +28,38 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco
type: tableData.type
}, function lineageSuccess(response) {
if (!_.isEmpty(response.results.values.vertices)) {
- $scope.lineageData = transformData(response.results);
- if (callRender) {
- render();
- }
+ var allGuids = loadProcess(response.results.values.edges, response.results.values.vertices);
+ allGuids.then(function(res) {
+ guidsList = JSON.parse(res);
+ $scope.lineageData = transformData(response.results);
+ if (callRender) {
+ render();
+ }
+ });
}
$scope.requested = false;
});
}
+ function loadProcess(edges, vertices) {
+
+ var urlCalls = [];
+ var deferred = $q.defer();
+ for (var guid in edges) {
+ if (!vertices.hasOwnProperty(guid)) {
+ urlCalls.push(DetailsResource.get({
+ id: guid
+ }).$promise);
+ }
+
+ }
+ $q.all(urlCalls)
+ .then(function(results) {
+ deferred.resolve(JSON.stringify(results));
+ });
+ return deferred.promise;
+ }
+
$scope.type = $element.parent().attr('data-table-type');
$scope.requested = false;
@@ -67,10 +91,24 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco
nodes = {};
function getNode(guid) {
+ var name, type;
+ if (vertices.hasOwnProperty(guid)) {
+ name = vertices[guid].values.name;
+ type = vertices[guid].values.vertexId.values.typeName;
+ } else {
+ var loadProcess = getLoadProcessTypes(guid);
+ if (typeof loadProcess !== "undefined") {
+ name = loadProcess.name;
+ type = loadProcess.typeName;
+ } else {
+ name = 'Load Process';
+ type = 'Load Process';
+ }
+ }
var vertex = {
guid: guid,
- name: vertices.hasOwnProperty(guid) ? vertices[guid].values.name : 'Load Process',
- type: vertices.hasOwnProperty(guid) ? vertices[guid].values.vertexId.values.typeName : 'LoadProcess'
+ name: name,
+ type: type
};
if (!nodes.hasOwnProperty(guid)) {
nodes[guid] = vertex;
@@ -78,6 +116,17 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco
return nodes[guid];
}
+ function getLoadProcessTypes(guid) {
+ var procesRes = [];
+ angular.forEach(guidsList, function(value) {
+ if (value.id.id === guid) {
+ procesRes.name = value.values.name;
+ procesRes.typeName = value.typeName;
+ }
+ });
+ return procesRes;
+ }
+
function attachParent(edge, node) {
edge.forEach(function eachPoint(childGuid) {
var childNode = getNode(childGuid);
@@ -172,7 +221,6 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco
.attr("y", "-18px")
.attr("width", "34px")
.attr("height", "34px");
-
nodeEnter.append('text')
.attr('x', function(d) {
return d.children || d._children ?