From b90c0b27713d6d18723b014c1c1d14cbb9f2e30c Mon Sep 17 00:00:00 2001 From: mahesh Date: Tue, 22 Sep 2015 15:36:19 +0530 Subject: [PATCH] adding build logs search functionality --- .../src/site/themes/default/css/styles.css | 52 ++++++++++-------- .../default/js/custom/custom-logview.js | 55 +++++++++++++++++++ .../site/themes/default/js/custom/custom.js | 4 +- .../templates/buildDeploy/list/js/list.js | 13 +++++ .../templates/buildDeploy/list/template.jag | 18 +++++- 5 files changed, 114 insertions(+), 28 deletions(-) create mode 100644 modules/jaggery-apps/appmgt/src/site/themes/default/js/custom/custom-logview.js diff --git a/modules/jaggery-apps/appmgt/src/site/themes/default/css/styles.css b/modules/jaggery-apps/appmgt/src/site/themes/default/css/styles.css index dbdde20dd..eb6d4a93f 100644 --- a/modules/jaggery-apps/appmgt/src/site/themes/default/css/styles.css +++ b/modules/jaggery-apps/appmgt/src/site/themes/default/css/styles.css @@ -355,6 +355,9 @@ a.btn-action { .modal-md{ width: 60%; } + .version-url{ + width:41.8%; + } } /* use for landing page blocks*/ @@ -1642,7 +1645,7 @@ a.btn-action { color: #cecece; word-break: break-all; word-wrap: break-word; - border: 1px solid #444; + border: 1px solid #444; background-color:#333; border-radius:0; max-height: 340px; @@ -2043,9 +2046,11 @@ a.btn-action { } .notification-glow { -webkit-animation: glow .5s infinite alternate; + -moz-animation: glow .5s infinite alternate; + animation: glow .5s infinite alternate; } -@-webkit-keyframes glow { +@keyframes glow { to { text-shadow: 0 0 10px red; } @@ -2380,27 +2385,6 @@ th.hide-column-data, td.hide-column-data { color:#999; } -.build-logs-modal .modal-body textarea{ - font-size:11px; - color:#eee; - margin:0px; - background:none; - border:none; - -webkit-border-radius: 0px; - -moz-border-radius: 0px; - border-radius: 0px; -} -.build-logs-modal .modal-body textarea{ - min-width:3200px; - height:300px; - padding:0px; - border: none; - overflow: auto; - outline: none; - -webkit-box-shadow: none; - -moz-box-shadow: none; - box-shadow: none; -} /* build logs model body scroll */ .build-logs-modal .modal-dialog{ overflow-y: initial !important @@ -2409,7 +2393,28 @@ th.hide-column-data, td.hide-column-data { min-height: 300px; max-height:400px; overflow-y: auto; + white-space: pre-line; + margin-top: 20px; +} +#log-search{ + color: #000; } + +.div-search { + padding: 19px 0px 5px; + background-color: #5F5F5F; + margin: -15px; +} + +.highlight { + background-color: #2C81DC; + -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); /* FF3.5+ */ + -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); /* Saf3.0+, Chrome */ + box-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); /* Opera 10.5+, IE 9.0 */ + padding:1px 4px; + margin:0 -4px; +} + .editroles > span.fw-stack{ font-size:0.8em; } @@ -2440,3 +2445,4 @@ th.hide-column-data, td.hide-column-data { .modal-header button.close-override:focus { outline:none; } + diff --git a/modules/jaggery-apps/appmgt/src/site/themes/default/js/custom/custom-logview.js b/modules/jaggery-apps/appmgt/src/site/themes/default/js/custom/custom-logview.js new file mode 100644 index 000000000..8f350ce71 --- /dev/null +++ b/modules/jaggery-apps/appmgt/src/site/themes/default/js/custom/custom-logview.js @@ -0,0 +1,55 @@ +jQuery.fn.highlight = function(pat) { + function innerHighlight(node, pat) { + var skip = 0; + if (node.nodeType == 3) { + var pos = node.data.toUpperCase().indexOf(pat); + if (pos >= 0) { + var spannode = document.createElement('span'); + spannode.className = 'highlight'; + var middlebit = node.splitText(pos); + var endbit = middlebit.splitText(pat.length); + var middleclone = middlebit.cloneNode(true); + spannode.appendChild(middleclone); + middlebit.parentNode.replaceChild(spannode, middlebit); + skip = 1; + } + } + else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) { + for (var i = 0; i < node.childNodes.length; ++i) { + i += innerHighlight(node.childNodes[i], pat); + } + } + return skip; + } + return this.each(function() { + innerHighlight(this, pat.toUpperCase()); + }); +}; + +jQuery.fn.removeHighlight = function() { + function newNormalize(node) { + for (var i = 0, children = node.childNodes, nodeCount = children.length; i < nodeCount; i++) { + var child = children[i]; + if (child.nodeType == 1) { + newNormalize(child); + continue; + } + if (child.nodeType != 3) { continue; } + var next = child.nextSibling; + if (next == null || next.nodeType != 3) { continue; } + var combined_text = child.nodeValue + next.nodeValue; + new_node = node.ownerDocument.createTextNode(combined_text); + node.insertBefore(new_node, child); + node.removeChild(child); + node.removeChild(next); + i--; + nodeCount--; + } + } + + return this.find("span.highlight").each(function() { + var thisParent = this.parentNode; + thisParent.replaceChild(this.firstChild, this); + newNormalize(thisParent); + }).end(); +}; \ No newline at end of file diff --git a/modules/jaggery-apps/appmgt/src/site/themes/default/js/custom/custom.js b/modules/jaggery-apps/appmgt/src/site/themes/default/js/custom/custom.js index 4c04c3e1a..82112055a 100644 --- a/modules/jaggery-apps/appmgt/src/site/themes/default/js/custom/custom.js +++ b/modules/jaggery-apps/appmgt/src/site/themes/default/js/custom/custom.js @@ -33,7 +33,7 @@ $('.btn-file :file').on('fileselect', function(event, numFiles, label) { (function($) { - + /* ======================================================================== * loading function * ======================================================================== */ @@ -156,7 +156,7 @@ $('.btn-file :file').on('fileselect', function(event, numFiles, label) { } }); } - + }(jQuery)); diff --git a/modules/jaggery-apps/appmgt/src/site/themes/default/templates/buildDeploy/list/js/list.js b/modules/jaggery-apps/appmgt/src/site/themes/default/templates/buildDeploy/list/js/list.js index 8a25abc8c..ae8c2e3ff 100644 --- a/modules/jaggery-apps/appmgt/src/site/themes/default/templates/buildDeploy/list/js/list.js +++ b/modules/jaggery-apps/appmgt/src/site/themes/default/templates/buildDeploy/list/js/list.js @@ -9,6 +9,19 @@ var buildCompleted = false; // initialize the page when document is ready $(document).ready(function() { init(); + $('#log-search').bind('keyup change', function(ev) { + // pull in the new value + var searchTerm = $(this).val(); + + // remove any old highlighted terms + $('.scroll-container').removeHighlight(); + + // disable highlighting if empty + if ( searchTerm ) { + // highlight the new term + $('.scroll-container').highlight( searchTerm ); + } + }); }); var init = function() { diff --git a/modules/jaggery-apps/appmgt/src/site/themes/default/templates/buildDeploy/list/template.jag b/modules/jaggery-apps/appmgt/src/site/themes/default/templates/buildDeploy/list/template.jag index 89c3f99c1..c65935a39 100644 --- a/modules/jaggery-apps/appmgt/src/site/themes/default/templates/buildDeploy/list/template.jag +++ b/modules/jaggery-apps/appmgt/src/site/themes/default/templates/buildDeploy/list/template.jag @@ -116,9 +116,20 @@ jagg.template("buildDeploy/list", function (inputs, outputs, jagg) { %>