Repository: incubator-atlas Updated Branches: refs/heads/branch-0.5-incubating 844c79a64 -> 235c56101
HDPDGI-69:Dileep:Use details api to get LoadProcess name (cherry picked from commit 1efb57b) Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/235c5610 Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/235c5610 Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/235c5610 Branch: refs/heads/branch-0.5-incubating Commit: 235c561015c032ed704c4551ec3703394f186754 Parents: 844c79a Author: Vishal Kadam <[email protected]> Authored: Mon Jun 15 21:07:42 2015 -0700 Committer: Venkatesh Seetharam <[email protected]> Committed: Tue Jun 16 17:33:48 2015 -0700 ---------------------------------------------------------------------- .../public/modules/lineage/lineageController.js | 66 +++++++++++++++++--- 1 file changed, 57 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/235c5610/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 ?
