Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 21848 log viewer highlight and filter v2 #21933

Merged
merged 2 commits into from
Mar 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 8 additions & 118 deletions dotCMS/src/main/webapp/html/portlet/ext/cmsmaintenance/tail_log.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,6 @@

dojo.ready(function(){

if(self != top){
dojo.style(dojo.byId("popMeUp"), "display", "block");
}


<%if(request.getParameter("fileName")!= null){
String selectedFileNameStr = com.dotmarketing.util.UtilMethods.xmlEscape(request.getParameter("fileName")).replace(logPath + File.separator, "");
selectedFileNameStr = selectedFileNameStr.replace("\\", "\\\\");
Expand All @@ -124,74 +119,6 @@

});

function doManageLogs() {

dijit.byId('logman_dia').show();

}

function checkUncheck () {
var x = dijit.byId( "checkAllCkBx" ).checked;
dojo.query( ".taskCheckBox" ).forEach( function ( node ) {
dijit.getEnclosingWidget(node).set("checked", x);
} );
}


/**
* Will search for all the current logs and it will populate the table with those logs details
*/
function getCurrentLogs () {
var xhrArgs = {

url:"/DotAjaxDirector/com.dotmarketing.portlets.cmsmaintenance.ajax.LogConsoleAjaxAction/cmd/getLogs/",

handleAs:"json",
handle:function ( data, ioArgs ) {

if ( data.response == "error" ) {
showDotCMSSystemMessage( data.message, true );
} else {
//If everything its ok lets populate the table with the returned logs details
populateTable( data.logs );
}
}
};
dojo.xhrPost( xhrArgs );
dijit.byId( "checkAllCkBx" ).set('checked',false);
}

/**
* Will enable/disable the selected logs
*/
function enableDisableLogs () {
//Find the list of checked logs details
var selectedLogs = "";
dojo.query( ".taskCheckBox input" ).forEach( function ( node ) {
if ( node.checked ) {
selectedLogs += node.value + ",";
}
} );

var xhrArgs = {

url:"/DotAjaxDirector/com.dotmarketing.portlets.cmsmaintenance.ajax.LogConsoleAjaxAction/cmd/enabledDisabledLogs/selection/" + selectedLogs,

handleAs:"json",
handle:function ( data, ioArgs ) {

if ( data.response == "error" ) {
showDotCMSSystemMessage( data.message, true );
} else {
//If everything its ok lets populate the table with the returned logs details
populateTable( data.logs );
}
}
};
dojo.xhrPost( xhrArgs );
dijit.byId( "checkAllCkBx" ).set('checked',false);
}

/**
* Populate the logs table with a given logs details array
* @param logsData logs details array
Expand Down Expand Up @@ -240,20 +167,6 @@

};

function destroyCheckboxNodes() {
dojo.query(".taskCheckBox").forEach(function (node) {
console.log(dijit.getEnclosingWidget(node));
dijit.getEnclosingWidget(node).destroy();
});
}


dojo.ready(function() {
var dialog = dijit.byId("logman_dia");
dojo.connect(dialog, "onShow", null, getCurrentLogs);
dojo.connect(dialog, "onCancel", null, destroyCheckboxNodes);
});

/**********************/
/* Log Viewer - BEGIN */

Expand All @@ -264,14 +177,15 @@
updateLogViewerData();
})
}

var excludeLogRowsActive = false;

function updateLogViewerData(){

var dataLogSourceElem = document.getElementById('tailingFrame').contentDocument.body;
var dataLogPrintedElem = document.querySelector('.logViewerPrinted');
var keywordLogInput = document.querySelector('#keywordLogFilterInput');
var contentLogSize = 0;
var excludeLogRowsActive = false;

var debounce = (callback, time = 300, interval) => (...args) => {
clearTimeout(interval, interval = setTimeout(() => callback(...args), time));
Expand Down Expand Up @@ -357,43 +271,19 @@
</label>
</div>
<input dojoType="dijit.form.TextBox" id="keywordLogFilterInput" placeholder="<%=com.liferay.portal.language.LanguageUtil.get(pageContext, "Filter")%>" type="text" style="width: 200px">
<button dojoType="dijit.form.Button" onClick="doPopup()" value="popup" name="popup">
<%= com.liferay.portal.language.LanguageUtil.get(pageContext,"popup") %>
</button>
<button dojoType="dijit.form.Button" onclick="location.href='/api/v1/maintenance/_downloadLog/' + document.getElementById('fileName').value" id="downloadLog" value="download" name="download" disabled>
<%= com.liferay.portal.language.LanguageUtil.get(pageContext,"Download") %>
</button>
</div>
</div>
<div class="portlet-toolbar__actions-secondary">
<div id="popMeUp">
<button dojoType="dijit.form.Button" onClick="doManageLogs()" value="popup" name="popup" >
<%= com.liferay.portal.language.LanguageUtil.get(pageContext,"LOG_Manager") %>
</button>
</div>
<button dojoType="dijit.form.Button" onClick="doPopup()" value="popup" name="popup">
<%= com.liferay.portal.language.LanguageUtil.get(pageContext,"popup") %>
</button>
<button dojoType="dijit.form.Button" onclick="location.href='/api/v1/maintenance/_downloadLog/' + document.getElementById('fileName').value" id="downloadLog" value="download" name="download" disabled>
<%= com.liferay.portal.language.LanguageUtil.get(pageContext,"Download") %>
</button>
</div>
</div>

<div id="tailContainer" class="log-files__container" style="display: flex; flex-direction: column;">
<iframe id="tailingFrame" src="/html/blank.jsp" style="display:none" class="log-files__iframe"></iframe>
<div class="logViewerPrinted" style="flex-grow: 1;"></div>
</div>

<div id="logman_dia" dojoType="dijit.Dialog">
<div id="search" title="<%= com.liferay.portal.language.LanguageUtil.get(pageContext, "LOG_activity") %>" ></div>
<div style="width:620px">
<table class="listingTable" id="logsTable" align="center">
<tr id="logsTableHeader">
<th width="5%"><input type="checkbox" dojotype="dijit.form.CheckBox" id="checkAllCkBx" onclick="checkUncheck()" /></th>
<th nowrap="nowrap" width="5%" style="text-align:center;">Status</th>
<th nowrap="nowrap" width="32%" style="text-align:center;">Log Name</th>
<th nowrap="nowrap" width="58%" style="text-align:center;">Log Description</th>
</tr>
</table>
</div>
<div class="buttonRow">
<button dojoType="dijit.form.Button" name="filterButton" onClick="enableDisableLogs()"><%= com.liferay.portal.language.LanguageUtil.get(pageContext, "LOG_button") %></button>
<button dojoType="dijit.form.Button" name="refreshButton" onClick="getCurrentLogs ()">Refresh</button>
</div>
</div>