diff --git a/xCAT-UI/images/ui-icon-comment.png b/xCAT-UI/images/ui-icon-comment.png
new file mode 100644
index 000000000..f3944770c
Binary files /dev/null and b/xCAT-UI/images/ui-icon-comment.png differ
diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js
index 0b76cf286..b7e74ad61 100644
--- a/xCAT-UI/js/nodes/nodes.js
+++ b/xCAT-UI/js/nodes/nodes.js
@@ -1828,7 +1828,10 @@ function loadComments(data) {
// Create comments icon
tipID = node + 'Tip';
- icon = $('');
+ icon = $('
').css({
+ 'width': '18px',
+ 'height': '18px'
+ });
// Create tooltip
tip = createCommentsToolTip(comments);
@@ -1862,7 +1865,7 @@ function createCommentsToolTip(comments) {
var toolTip = $('
');
// Create textarea to hold comments
var txtArea = $('').css({
- 'font-size': '12px',
+ 'font-size': '10px',
'height': '50px',
'width': '200px',
'background-color': '#000',
@@ -1870,13 +1873,26 @@ function createCommentsToolTip(comments) {
'border': '0px'
});
- // Create link to save changes
- var saveLnk = $('Save').css('color', '#58ACFA');
+ // Create links to save and cancel changes
+ var saveLnk = $('Save');
+ saveLnk.css({
+ 'color': '#58ACFA',
+ 'font-size': '10px',
+ 'display' : 'inline-block',
+ 'padding' : '5px'
+ });
saveLnk.hide();
+ var cancelLnk = $('Cancel');
+ cancelLnk.css({
+ 'color': '#58ACFA',
+ 'font-size': '10px',
+ 'display' : 'inline-block',
+ 'padding' : '5px'
+ });
+ cancelLnk.hide();
+
+ // Save changes onclick
saveLnk.bind('click', function(){
- // Hide save link
- $(this).hide();
-
// Get node and comments
var node = $(this).parent().parent().find('span').attr('id').replace('Tip', '');
var comments = $(this).parent().find('textarea').val();
@@ -1894,15 +1910,32 @@ function createCommentsToolTip(comments) {
success: showChtabOutput
});
+
+ // Hide cancel and save links
+ $(this).hide();
+ cancelLnk.hide();
+ });
+
+ // Cancel changes onclick
+ cancelLnk.bind('click', function(){
+ // Get original comments and put it back
+ var orignComments = $(this).parent().find('textarea').text();
+ $(this).parent().find('textarea').val(orignComments);
+
+ // Hide cancel and save links
+ $(this).hide();
+ saveLnk.hide();
});
// Show save link when comments is edited
txtArea.bind('click', function(){
saveLnk.show();
+ cancelLnk.show();
});
toolTip.append(txtArea);
toolTip.append(saveLnk);
+ toolTip.append(cancelLnk);
return toolTip;
}