Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve options in svg graph links #2132

Merged
merged 1 commit into from
May 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions luigi/static/visualiser/js/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Graph = (function() {
name: task.name,
taskId: task.taskId,
status: task.status,
trackingUrl: "#tab=graph&taskId=" + task.taskId,
trackingUrl: this.hashBase + task.taskId,
deps: deps,
params: task.params,
priority: task.priority,
Expand Down Expand Up @@ -125,9 +125,10 @@ Graph = (function() {
}

/* Parses a list of tasks to a graph format */
function createGraph(tasks) {
function createGraph(tasks, hashBase) {
if (tasks.length === 0) return {nodes: [], links: []};

this.hashBase = hashBase;
var nodes = $.map(tasks, nodeFromTask);
var nodeIndex = uniqueIndexByProperty(nodes, "taskId");

Expand Down Expand Up @@ -259,9 +260,9 @@ Graph = (function() {
});
};

DependencyGraph.prototype.updateData = function(taskList) {
DependencyGraph.prototype.updateData = function(taskList, hashBase) {
$('.popover').popover('destroy');
this.graph = createGraph(taskList);
this.graph = createGraph(taskList, hashBase);
bounds = findBounds(this.graph.nodes);
this.renderGraph();
this.svg.attr("height", bounds.y+10);
Expand Down
5 changes: 4 additions & 1 deletion luigi/static/visualiser/js/visualiserApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,10 @@ function visualiserApp(luigi) {
$("#searchError").removeClass();
if(dependencyGraph.length > 0) {
$("#dependencyTitle").text(dependencyGraph[0].display_name);
$("#graphPlaceholder").get(0).graph.updateData(dependencyGraph);
var hashBaseObj = URI.parseQuery(location.hash.replace('#', ''));
delete hashBaseObj.taskId;
var hashBase = '#' + URI.buildQuery(hashBaseObj) + '&taskId=';
$("#graphPlaceholder").get(0).graph.updateData(dependencyGraph, hashBase);
$("#graphContainer").show();
bindGraphEvents();
} else {
Expand Down