Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
adding build logs search functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
mahesh committed Sep 22, 2015
1 parent 874ff94 commit b90c0b2
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 28 deletions.
52 changes: 29 additions & 23 deletions modules/jaggery-apps/appmgt/src/site/themes/default/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ a.btn-action {
.modal-md{
width: 60%;
}
.version-url{
width:41.8%;
}
}
/* use for landing page blocks*/

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand All @@ -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;
}
Expand Down Expand Up @@ -2440,3 +2445,4 @@ th.hide-column-data, td.hide-column-data {
.modal-header button.close-override:focus {
outline:none;
}

Original file line number Diff line number Diff line change
@@ -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();
};
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $('.btn-file :file').on('fileselect', function(event, numFiles, label) {


(function($) {

/* ========================================================================
* loading function
* ======================================================================== */
Expand Down Expand Up @@ -156,7 +156,7 @@ $('.btn-file :file').on('fileselect', function(event, numFiles, label) {
}
});
}

}(jQuery));


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,20 @@ jagg.template("buildDeploy/list", function (inputs, outputs, jagg) { %>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="div-search">
<div class="form-horizontal" role="form">
<div class="form-group">
<label for="log-search" class="col-sm-1 control-label">Search: </label>
<div class="col-sm-4">
<input type="text" class="form-control" id="log-search" placeholder="Enter search text">
</div>
</div>
</div>

</div>
<div class="col-xs-12 col-md-12">
<div class="scroll-container">
<textarea id="build_logs" name="nowrap" cols="30" rows="3" wrap="soft">Retrieving logs.... </textarea>
<div class="scroll-container" id="build_logs">
Retrieving logs....
</div>
</div>
</div>
Expand All @@ -136,6 +147,7 @@ jagg.template("buildDeploy/list", function (inputs, outputs, jagg) { %>
<!-- loading javascript files to the page after page is rendering -->
<script src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile('templates/buildDeploy/list/js/list.js'))%>"></script>
<script src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile('js/daterangepicker/moment.js'))%>"></script>
<script src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile('js/custom/custom-logview.js'))%>"></script>
<!-- end of loading javascript files -->

<% }); %>
<% }); %>

0 comments on commit b90c0b2

Please sign in to comment.