Commit 7f2b49ba by Venkatesh Seetharam

Merge branch 'dal' of github.com:MPR-Global/metadata into apache-local

parents 9071ce2a e426db2d
...@@ -38,3 +38,7 @@ test-output ...@@ -38,3 +38,7 @@ test-output
#Python #Python
*.pyc *.pyc
# other files
.DS_Store
*.swp
...@@ -15,23 +15,6 @@ ...@@ -15,23 +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.
*/ */
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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.
*/
package org.apache.atlas.hive.hook; package org.apache.atlas.hive.hook;
......
{ {
"name": "dgc-metadata", "name": "dgc-metadata",
"description": "Apache Atlas", "description": "Apache Atlas",
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
</div> </div>
<footer class="footer navbar-bottom"> <footer class="footer navbar-bottom">
<div class="container"> <div class="container">
<p align="right">Powered by<img src="modules/home/img/logo-green.png"></p> <!--<p align="right">Powered by<img src="modules/home/img/logo-green.png"></p>-->
</div> </div>
</footer> </footer>
...@@ -64,7 +64,8 @@ ...@@ -64,7 +64,8 @@
<script src="lib/angular-ui-router/release/angular-ui-router.js"></script> <script src="lib/angular-ui-router/release/angular-ui-router.js"></script>
<script src="lib/angular-ui-utils/ui-utils.js"></script> <script src="lib/angular-ui-utils/ui-utils.js"></script>
<script src="lib/lodash/lodash.js"></script> <script src="lib/lodash/lodash.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> <script src="/lib/d3/d3.js"></script>
<script src="/lib/d3-tip/index.js"></script>
<script src="js/app.min.js"></script> <script src="js/app.min.js"></script>
</body> </body>
......
...@@ -22,19 +22,19 @@ angular.module('dgc.details').controller('DetailsController', ['$window', '$scop ...@@ -22,19 +22,19 @@ angular.module('dgc.details').controller('DetailsController', ['$window', '$scop
function($window, $scope, $stateParams, DetailsResource) { function($window, $scope, $stateParams, DetailsResource) {
$scope.tableName = false; $scope.tableName = false;
$scope.isTable = false;
DetailsResource.get({ DetailsResource.get({
id: $stateParams.id id: $stateParams.id
}, function(data) { }, function(data) {
$scope.details = data; $scope.details = data;
$scope.schemas = data;
$scope.tableName = data.values.name; $scope.tableName = data.values.name;
$scope.isTable = data.typeName === 'Table';
}); });
$scope.isString = angular.isString; $scope.isString = angular.isString;
$scope.schemas = DetailsResource.get({
id: $stateParams.id
});
$scope.onActivate = function tabActivate(tabname) { $scope.onActivate = function tabActivate(tabname) {
$scope.$broadcast('render-lineage', { $scope.$broadcast('render-lineage', {
type: tabname, type: tabname,
......
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
</tbody> </tbody>
</table> </table>
</tab> </tab>
<tab data-heading="Schema"><ng-include src="'/modules/details/views/schema.html'"/></tab> <tab data-heading="Schema" data-ng-if="isTable"><ng-include src="'/modules/details/views/schema.html'"/></tab>
<tab data-heading="Output" data-disable="!tableName" data-select="onActivate('outputs')"><ng-include data-table-type="outputs" src="'/modules/lineage/views/lineage.html'"/></tab> <tab data-heading="Output" data-ng-if="isTable" data-disable="!tableName" data-select="onActivate('outputs')"><ng-include data-table-type="outputs" src="'/modules/lineage/views/lineage.html'"/></tab>
<tab data-heading="Input" data-disable="!tableName" data-select="onActivate('inputs')"><ng-include data-table-type="inputs" src="'/modules/lineage/views/lineage.html'"/></tab> <tab data-heading="Input" data-ng-if="isTable" data-disable="!tableName" data-select="onActivate('inputs')"><ng-include data-table-type="inputs" src="'/modules/lineage/views/lineage.html'"/></tab>
</tabset> </tabset>
</div> </div>
</div> </div>
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
'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', 'DetailsResource', '$q',
function($element, $scope, $state, $stateParams, _, LineageResource, d3) { function($element, $scope, $state, $stateParams, _, LineageResource, d3, DetailsResource, $q) {
var guidsList = [];
function getLineageData(tableData, callRender) { function getLineageData(tableData, callRender) {
LineageResource.get({ LineageResource.get({
...@@ -27,15 +28,38 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco ...@@ -27,15 +28,38 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco
type: tableData.type type: tableData.type
}, function lineageSuccess(response) { }, function lineageSuccess(response) {
if (!_.isEmpty(response.results.values.vertices)) { if (!_.isEmpty(response.results.values.vertices)) {
$scope.lineageData = transformData(response.results); var allGuids = loadProcess(response.results.values.edges, response.results.values.vertices);
if (callRender) { allGuids.then(function(res) {
render(); guidsList = res;
} $scope.lineageData = transformData(response.results);
if (callRender) {
render();
}
});
} }
$scope.requested = false; $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(results);
});
return deferred.promise;
}
$scope.type = $element.parent().attr('data-table-type'); $scope.type = $element.parent().attr('data-table-type');
$scope.requested = false; $scope.requested = false;
...@@ -67,10 +91,26 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco ...@@ -67,10 +91,26 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco
nodes = {}; nodes = {};
function getNode(guid) { function getNode(guid) {
var name, type, tip;
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;
tip = loadProcess.tip;
} else {
name = 'Load Process';
type = 'Load Process';
}
}
var vertex = { var vertex = {
guid: guid, guid: guid,
name: vertices.hasOwnProperty(guid) ? vertices[guid].values.name : 'Load Process', name: name,
type: vertices.hasOwnProperty(guid) ? vertices[guid].values.vertexId.values.typeName : 'LoadProcess' type: type,
tip: tip
}; };
if (!nodes.hasOwnProperty(guid)) { if (!nodes.hasOwnProperty(guid)) {
nodes[guid] = vertex; nodes[guid] = vertex;
...@@ -78,6 +118,18 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco ...@@ -78,6 +118,18 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco
return nodes[guid]; 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;
procesRes.tip = value.values.queryText;
}
});
return procesRes;
}
function attachParent(edge, node) { function attachParent(edge, node) {
edge.forEach(function eachPoint(childGuid) { edge.forEach(function eachPoint(childGuid) {
var childNode = getNode(childGuid); var childNode = getNode(childGuid);
...@@ -127,15 +179,37 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco ...@@ -127,15 +179,37 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco
return [d.y, d.x]; return [d.y, d.x];
}); });
/* Initialize tooltip */
var tooltip = d3.tip()
.attr('class', 'd3-tip')
.html(function(d) {
return '<pre class="alert alert-success">' + d.tip + '</pre>';
});
var svg = element.select('svg') var svg = element.select('svg')
.attr('width', width + margin.right + margin.left) .attr('width', width + margin.right + margin.left)
.attr('height', height + margin.top + margin.bottom) .attr('height', height + margin.top + margin.bottom)
/* Invoke the tip in the context of your visualization */
.call(tooltip)
.select('g') .select('g')
.attr('transform',
.attr('transform', 'translate(' + margin.left + ',' + margin.right + ')');
'translate(' + margin.left + ',' + margin.right + ')');
//arrow //arrow
svg.append("svg:defs").append("svg:marker").attr("id", "arrow").attr("viewBox", "0 0 10 10").attr("refX", 26).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 6).attr("markerHeight", 9).attr("orient", "auto").append("svg:path").attr("d", "M 0 0 L 10 5 L 0 10 z"); svg.append("svg:defs").append("svg:marker").attr("id", "arrow").attr("viewBox", "0 0 10 10").attr("refX", 26).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 6).attr("markerHeight", 9).attr("orient", "auto").append("svg:path").attr("d", "M 0 0 L 10 5 L 0 10 z");
//marker for input type graph
svg.append("svg:defs")
.append("svg:marker")
.attr("id", "input-arrow")
.attr("viewBox", "0 0 10 10")
.attr("refX", -15)
.attr("refY", 5)
.attr("markerUnits", "strokeWidth")
.attr("markerWidth", 6)
.attr("markerHeight", 9)
.attr("orient", "auto")
.append("svg:path")
.attr("d", "M -2 5 L 8 0 L 8 10 z");
var root = data; var root = data;
...@@ -168,6 +242,16 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco ...@@ -168,6 +242,16 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco
//return d.icon; //return d.icon;
return d.type === 'Table' ? '../img/tableicon.png' : '../img/process.png'; return d.type === 'Table' ? '../img/tableicon.png' : '../img/process.png';
}) })
.on('mouseover', function(d) {
if (d.type === 'LoadProcess') {
tooltip.show(d);
}
})
.on('mouseout', function(d) {
if (d.type === 'LoadProcess') {
tooltip.hide(d);
}
})
.attr("x", "-18px") .attr("x", "-18px")
.attr("y", "-18px") .attr("y", "-18px")
.attr("width", "34px") .attr("width", "34px")
...@@ -199,7 +283,12 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco ...@@ -199,7 +283,12 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco
//.style('stroke', function(d) { return d.target.level; }) //.style('stroke', function(d) { return d.target.level; })
.style('stroke', 'green') .style('stroke', 'green')
.attr('d', diagonal); .attr('d', diagonal);
link.attr("marker-end", "url(#arrow)");
if($scope.type === 'inputs') {
link.attr("marker-start", "url(#input-arrow)");//if input
} else {
link.attr("marker-end", "url(#arrow)");//if input
}
} }
......
...@@ -341,7 +341,8 @@ public class DefaultMetadataService implements MetadataService { ...@@ -341,7 +341,8 @@ public class DefaultMetadataService implements MetadataService {
onTraitAddedToEntity(guid, traitName); onTraitAddedToEntity(guid, traitName);
} }
private ITypedStruct deserializeTraitInstance(String traitInstanceDefinition) throws AtlasException { private ITypedStruct deserializeTraitInstance(String traitInstanceDefinition)
throws AtlasException {
try { try {
Struct traitInstance = InstanceSerialization.fromJsonStruct(traitInstanceDefinition, true); Struct traitInstance = InstanceSerialization.fromJsonStruct(traitInstanceDefinition, true);
...@@ -399,7 +400,8 @@ public class DefaultMetadataService implements MetadataService { ...@@ -399,7 +400,8 @@ public class DefaultMetadataService implements MetadataService {
} }
} }
private void onEntityAddedToRepo(ITypedReferenceableInstance typedInstance) throws AtlasException { private void onEntityAddedToRepo(ITypedReferenceableInstance typedInstance)
throws AtlasException {
for (EntityChangeListener listener : entityChangeListeners) { for (EntityChangeListener listener : entityChangeListeners) {
listener.onEntityAdded(typedInstance); listener.onEntityAdded(typedInstance);
...@@ -425,5 +427,4 @@ public class DefaultMetadataService implements MetadataService { ...@@ -425,5 +427,4 @@ public class DefaultMetadataService implements MetadataService {
public void unregisterListener(EntityChangeListener listener) { public void unregisterListener(EntityChangeListener listener) {
entityChangeListeners.remove(listener); entityChangeListeners.remove(listener);
} }
}
}
\ No newline at end of file
...@@ -301,4 +301,4 @@ public class MetadataDiscoveryResource { ...@@ -301,4 +301,4 @@ public class MetadataDiscoveryResource {
return response; return response;
} }
} }
} }
\ No newline at end of file
...@@ -200,4 +200,4 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT { ...@@ -200,4 +200,4 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
return createInstance(entityInstance); return createInstance(entityInstance);
} }
} }
\ No newline at end of file
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