Add the command view to the tooltips in the tree, the image side bar and the image view page

This commit is contained in:
Joseph Schorr 2014-01-14 15:19:47 -05:00
parent c72cae954b
commit 6ae9485038
7 changed files with 93 additions and 8 deletions

View file

@ -31,7 +31,7 @@ var DEPTH_WIDTH = 132;
/**
* Based off of http://mbostock.github.io/d3/talk/20111018/tree.html by Mike Bostock (@mbostock)
*/
function ImageHistoryTree(namespace, name, images, formatComment, formatTime) {
function ImageHistoryTree(namespace, name, images, formatComment, formatTime, formatCommand) {
/**
* The namespace of the repo.
*/
@ -57,6 +57,11 @@ function ImageHistoryTree(namespace, name, images, formatComment, formatTime) {
*/
this.formatTime_ = formatTime;
/**
* Method to invoke to format the command for an image.
*/
this.formatCommand_ = formatCommand;
/**
* The current tag (if any).
*/
@ -187,6 +192,8 @@ ImageHistoryTree.prototype.draw = function(container) {
var formatComment = this.formatComment_;
var formatTime = this.formatTime_;
var formatCommand = this.formatCommand_;
var tip = d3.tip()
.attr('class', 'd3-tip')
.offset([-1, 24])
@ -212,8 +219,10 @@ ImageHistoryTree.prototype.draw = function(container) {
if (d.image.comment) {
html += '<span class="comment">' + formatComment(d.image.comment) + '</span>';
}
html += '<span class="created">' + formatTime(d.image.created) + '</span>';
html += '<span class="full-id">' + d.image.id + '</span>';
if (d.image.command && d.image.command.length) {
html += '<span class="command info-line"><i class="fa fa-terminal"></i>' + formatCommand(d.image.command) + '</span>';
}
html += '<span class="created info-line"><i class="fa fa-calendar"></i>' + formatTime(d.image.created) + '</span>';
return html;
})