diff options
author | Adam Spiers <git@adamspiers.org> | 2015-01-08 19:08:51 +0000 |
---|---|---|
committer | Adam Spiers <git@adamspiers.org> | 2015-01-08 19:08:51 +0000 |
commit | ac3982353bbdf9fddf92e4677ee2b9003de4b27d (patch) | |
tree | 61ff78569ba2c2cb3a2c9a7dfe9ee7de70d68482 /html/js/git-deps-graph.js | |
parent | 1672cb5fe1519f61a0147175c4f4ab905d908e9f (diff) | |
download | git-deps-ac3982353bbdf9fddf92e4677ee2b9003de4b27d.tar.gz |
improve notification on new data
Diffstat (limited to 'html/js/git-deps-graph.js')
-rw-r--r-- | html/js/git-deps-graph.js | 34 |
1 files changed, 26 insertions, 8 deletions
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 = + '<span class="commit-ref">' + + root.commitish + + '</span> resolved as ' + root.sha1; + + notification += "<p>" + new_nodes + " new node"; + if (new_nodes != 1) + notification += 's'; + notification += "; " + new_links + " new link"; + if (new_nodes != 1) + notification += 's'; + notification += '</p>'; + + 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(" <span />"); 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); |