From ac3982353bbdf9fddf92e4677ee2b9003de4b27d Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Thu, 8 Jan 2015 19:08:51 +0000 Subject: improve notification on new data --- html/js/git-deps-graph.js | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'html/js/git-deps-graph.js') diff --git a/html/js/git-deps-graph.js b/html/js/git-deps-graph.js index 05f7265..2561cba 100644 --- a/html/js/git-deps-graph.js +++ b/html/js/git-deps-graph.js @@ -143,16 +143,11 @@ function add_data(data) { new_links += add_link(dep.parent, dep.child); }); - noty_info(data.root.commitish + " resolved as " + data.root.sha1); - if (new_nodes > 0 || new_links > 0) { - if (options.debug) { - noty_debug(new_nodes + " new node(s), " + - new_links + " new link(s)"); - } build_constraints(); - return true; + return [new_nodes, new_links, data.root]; } + return false; } @@ -204,6 +199,8 @@ function draw_graph(commitish) { return; } + new_data_notification(new_data); + path = fg.selectAll(".link") .data(links, function (d) { return d.source + " " + d.target; @@ -224,6 +221,27 @@ function draw_graph(commitish) { }); } +function new_data_notification(new_data) { + var new_nodes = new_data[0]; + var new_links = new_data[1]; + var root = new_data[2]; + + var notification = + '' + + root.commitish + + ' resolved as ' + root.sha1; + + notification += "

" + new_nodes + " new node"; + if (new_nodes != 1) + notification += 's'; + notification += "; " + new_links + " new link"; + if (new_nodes != 1) + notification += 's'; + notification += '

'; + + noty_info(notification); +} + function define_arrow_markers(fg) { // define arrow markers for graph links fg.append('svg:defs').append('svg:marker') @@ -303,7 +321,7 @@ function tip_html(d) { if (d.describe != "") { title.append(" "); var describe = title.children().first(); - describe.addClass("commit-describe").text(d.describe); + describe.addClass("commit-describe commit-ref").text(d.describe); } fragment.find("span.commit-author").text(d.author_name); var date = new Date(d.author_time * 1000); -- cgit