Skip to content

Commit

Permalink
Manual merge for provenance visualization.
Browse files Browse the repository at this point in the history
  • Loading branch information
sluger committed Dec 29, 2014
1 parent 08335d6 commit 12e27dd
Show file tree
Hide file tree
Showing 8 changed files with 2,448 additions and 2,868 deletions.
1 change: 0 additions & 1 deletion refinery/templates/core/data_set.html
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,6 @@ <h3 id="myModalLabel">Launch IGV</h3>
<!-- provenance visualization -->
<script type="text/javascript" src="{{ STATIC_URL }}js/provvis_decl.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/provvis_init.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/provvis_layout_old.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/provvis_layout.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/provvis_render.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/provvis.js"></script>
Expand Down
336 changes: 315 additions & 21 deletions refinery/ui/src/js/provvis.js

Large diffs are not rendered by default.

48 changes: 30 additions & 18 deletions refinery/ui/src/js/provvis_decl.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,30 @@ var provvisDecl = function () {
this.x = 0;
this.y = 0;

/* Layout specific. */
this.l = {

/* Top sort marking [Kahn 1962]. */
ts: {removed: false},

/* Graph attributes. */
width: 0,
depth: 0,
grid: [],

rowBK: {left: -1, right: -1},
bcOrder: -1,
isBlockRoot: false
};

BaseNode.numInstances = (BaseNode.numInstances || 0) + 1;
this.autoId = BaseNode.numInstances;

this.doi = new DoiComponents(this);
this.selected = false;
this.filtered = true;

/* TODO: Group layout specific properties into sub-property. */
};

/* TODO: Add enums for node appearance, eg.: hide, blend, lod0-2 */

/**
* Constructor function for the node data structure.
*
Expand Down Expand Up @@ -187,10 +199,6 @@ var provvisDecl = function () {
this.fileUrl = fileUrl;

this.attributes = d3.map();

this.rowBK = {left: -1, right: -1};
this.bcOrder = -1;
this.isBlockRoot = false;
};

Node.prototype = Object.create(BaseNode.prototype);
Expand Down Expand Up @@ -223,6 +231,8 @@ var provvisDecl = function () {
this.inputs = d3.map();
this.outputs = d3.map();
this.links = d3.map();

this.wfName = "";
};

Analysis.prototype = Object.create(BaseNode.prototype);
Expand All @@ -247,8 +257,6 @@ var provvisDecl = function () {
this.outputs = d3.map();
this.links = d3.map();
this.isOutputAnalysis = false;

/* TODO: Workflow field. */
};

Subanalysis.prototype = Object.create(BaseNode.prototype);
Expand Down Expand Up @@ -303,9 +311,10 @@ var provvisDecl = function () {
* @param color
* @param graph
* @param supportView
* @param cell
* @constructor
*/
var ProvVis = function (parentDiv, zoom, data, url, canvas, nodeTable, rect, margin, width, height, radius, color, graph, supportView) {
var ProvVis = function (parentDiv, zoom, data, url, canvas, nodeTable, rect, margin, width, height, radius, color, graph, supportView, cell) {
this._parentDiv = parentDiv;
this.zoom = zoom;
this._data = data;
Expand All @@ -321,6 +330,7 @@ var provvisDecl = function () {
this.color = color;
this.graph = graph;
this.supportView = supportView;
this.cell = cell;
};

/**
Expand All @@ -329,6 +339,7 @@ var provvisDecl = function () {
* @param dataset
* @param nodes
* @param links
* @param aLinks
* @param iNodes
* @param oNodes
* @param aNodes
Expand All @@ -338,15 +349,13 @@ var provvisDecl = function () {
* @param analysisData
* @param workflowData
* @param nodeData
* @param width
* @param depth
* @param grid
* @constructor
*/
var ProvGraph = function (dataset, nodes, links, iNodes, oNodes, aNodes, saNodes, analysisWorkflowMap, nodeMap, analysisData, workflowData, nodeData, width, depth, grid) {
var ProvGraph = function (dataset, nodes, links, aLinks, iNodes, oNodes, aNodes, saNodes, analysisWorkflowMap, nodeMap, analysisData, workflowData, nodeData) {
this.dataset = dataset;
this.nodes = nodes;
this.links = links;
this.aLinks = aLinks;
this.iNodes = iNodes;
this.oNodes = oNodes;
this.aNodes = aNodes;
Expand All @@ -358,9 +367,12 @@ var provvisDecl = function () {
this.workflowData = workflowData;
this.nodeData = nodeData;

this.width = width;
this.depth = depth;
this.grid = grid;
/* Layout specific. */
this.l = {
width: 0,
depth: 0,
grid: []
};
};

/* */
Expand Down
38 changes: 30 additions & 8 deletions refinery/ui/src/js/provvis_init.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* TODO: Add a "Reset layout" to the toolbar. */

/**
* Module for init.
*/
Expand All @@ -9,6 +7,7 @@ var provvisInit = function () {
var dataset = Object.create(null),
nodes = [],
links = [],
aLinks = [],
iNodes = [],
oNodes = [],
aNodes = [],
Expand Down Expand Up @@ -107,7 +106,7 @@ var provvisInit = function () {
var extractLinks = function () {
var lId = 0;

nodes.forEach(function (n, i) {
nodes.forEach(function (n) {
if (typeof n.uuid !== "undefined") {
if (typeof n.parents !== "undefined") {

Expand Down Expand Up @@ -394,9 +393,14 @@ var provvisInit = function () {
/* Set links for subanalysis. */
saNodes.forEach(function (san) {
links.filter(function (l) {
return l !== null && san.parent.uuid === l.target.analysis && l.target.subanalysis === san.subanalysis;
return l !== null && san.parent.uuid === l.source.analysis && l.source.subanalysis === san.subanalysis;
}).forEach(function (ll) {
san.links.set(ll.autoId, ll);
if (san.parent.uuid === ll.target.analysis) {
san.links.set(ll.autoId, ll);
} else {
/* Set links between two analyses. */
aLinks.push(ll);
}
});
});

Expand All @@ -418,6 +422,10 @@ var provvisInit = function () {
/* Set subanalysis wfUuid. */
san.wfUuid = an.wfUuid;
});

/* Set workflow name. */
var wfObj = workflowData.get(an.wfUuid);
an.wfName = (typeof wfObj === "undefined") ? "dataset" : wfObj.name;
});

aNodes.forEach(function (an) {
Expand All @@ -441,7 +449,7 @@ var provvisInit = function () {
});
});

/* Set links. */
/* Set analysis links. */
aNodes.forEach(function (an) {
an.children.values().forEach(function (san) {
san.links.values().forEach(function (sanl) {
Expand All @@ -465,7 +473,6 @@ var provvisInit = function () {
});
};

/* TODO: Only extract attributes relevant to the filter attributes. */
/**
* Temporarily facet node attribute extraction.
* @param solrResponse Facet filter information on node attributes.
Expand Down Expand Up @@ -547,6 +554,16 @@ var provvisInit = function () {
$("#prov-ctrl-visible-attribute-list-name").find("input").prop("checked", true);
};

/**
* Sets the parent objects for analysis nodes.
* @param graph The provenance graph.
*/
var setAnalysisParent = function (graph) {
graph.aNodes.forEach(function (an) {
an.parent = graph;
});
};

/**
* Main init module function.
* @param data Dataset holding the information for nodes and links.
Expand Down Expand Up @@ -585,7 +602,12 @@ var provvisInit = function () {
createFacetNodeAttributeList(solrResponse);

/* Create graph. */
return new provvisDecl.ProvGraph(dataset, nodes, links, iNodes, oNodes, aNodes, saNodes, analysisWorkflowMap, nodeMap, analysisData, workflowData, nodeData, 0, 0, []);
var graph = new provvisDecl.ProvGraph(dataset, nodes, links, aLinks, iNodes, oNodes, aNodes, saNodes, analysisWorkflowMap, nodeMap, analysisData, workflowData, nodeData);

/* Set parent objects for analysis nodes. */
setAnalysisParent(graph);

return graph;
};

/**
Expand Down

0 comments on commit 12e27dd

Please sign in to comment.