Merge pull request #46 from jerrybai2009/master

add the title for dataset and flow lineage
This commit is contained in:
jerrybai2009 2016-02-29 16:01:30 -08:00
commit a7ca2ce996
4 changed files with 36 additions and 1 deletions

View File

@ -92,7 +92,7 @@ public class Application extends Controller
type = "appworx";
}
return ok(lineage.render(username, type, 0, application, project, flow));
return ok(lineage.render(username, type, 0, application.replace(" ", "."), project, flow));
}
@Security.Authenticated(Secured.class)

View File

@ -35,6 +35,9 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO
private final static String GET_APPLICATION_ID = "SELECT DISTINCT app_id FROM " +
"job_execution_data_lineage WHERE abstracted_object_name = ?";
private final static String GET_FLOW_NAME = "SELECT flow_name FROM " +
"flow WHERE app_id = ? and flow_id = ?";
private final static String GET_JOB = "SELECT ca.app_id, ca.app_code as cluster, je.flow_id, je.job_id, jedl.job_name, " +
"fj.job_path, fj.job_type, jedl.flow_path, jedl.storage_type, jedl.source_target_type, jedl.operation, " +
"max(jedl.job_exec_id) as job_exec_id, FROM_UNIXTIME(jedl.job_start_unixtime) as start_time, " +
@ -135,6 +138,7 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO
}
resultNode.set("nodes", Json.toJson(nodes));
resultNode.set("links", Json.toJson(edges));
resultNode.put("urn", urn);
resultNode.put("message", message);
return resultNode;
}
@ -404,6 +408,7 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO
ObjectNode resultNode = Json.newObject();
List<LineageNode> nodes = new ArrayList<LineageNode>();
List<LineageEdge> edges = new ArrayList<LineageEdge>();
String flowName = null;
Map<Long, Integer> addedJobNodes = new HashMap<Long, Integer>();
Map<Pair, Integer> addedDataNodes = new HashMap<Pair, Integer>();
@ -436,6 +441,20 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO
if (appID != 0)
{
try
{
flowName = getJdbcTemplate().queryForObject(
GET_FLOW_NAME,
new Object[] {appID, flowId},
String.class);
}
catch(EmptyResultDataAccessException e)
{
Logger.error("getFlowLineage get flow name failed, application name = " + application +
" flowId " + Long.toString(flowId));
Logger.error("Exception = " + e.getMessage());
}
Long flowExecId = 0L;
try
{
@ -782,6 +801,7 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO
}
resultNode.set("nodes", Json.toJson(nodes));
resultNode.set("links", Json.toJson(edges));
resultNode.put("flowName", flowName);
return resultNode;
}

View File

@ -14,6 +14,7 @@
<button id="chainselectorbtn" title="select the chains" ng-click="toggleChains()" style="display:none;background-color: transparent;opacity: 0.5;" class="btn pull-left"><i class="fa fa-random"></i></button>
<button id="rotationgraphbtn" title="rotate the graph" style="background-color: transparent;opacity: 0.5;" class="btn pull-left"><i class="fa fa-repeat"></i></button>
<h4 id="title"></h4>
<input id="lineageType" style="display: none;" value=@lineageType>
<input id="lineageID" style="display: none;" value=@lineageID>
<input id="application" style="display: none;" value=@application>

View File

@ -53,6 +53,10 @@ var g_downLevel = 1;
var type = $('#lineageType').val();
var id = $('#lineageID').val();
var application = $('#application').val();
if (application)
{
application = application.replace(/\./g, " ");
}
var project = $('#project').val();
var flow = $('#flow').val();
var url = '';
@ -99,6 +103,11 @@ var g_downLevel = 1;
$.get(url, function(data) {
if (data && data.status == "ok"){
$("#loading").hide();
var titleObj = $('#title');
if (titleObj && data.data && data.data.urn)
{
titleObj.text("Lineage for: " + data.data.urn);
}
renderTables(data.data);
g_currentData = data.data;
setupDagreGraph(data.data, rotation, type);
@ -127,6 +136,11 @@ var g_downLevel = 1;
$.get(url, function(data) {
if (data && data.status == "ok"){
$("#loading").hide();
var titleObj = $('#title');
if (titleObj && data.data && data.data.flowName)
{
titleObj.text("Lineage for: " + application + '/' + project + '/' + data.data.flowName);
}
renderTables(data.data);
g_currentData = data.data;
setupDagreGraph(data.data, rotation, type);