highlight logs on gui (#176)
This commit is contained in:
@ -667,14 +667,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group mt-3">
|
<div class="form-group mt-3">
|
||||||
<label for="logHere" class="form-label">Log</label>
|
<label for="logHere" class="form-label">Log</label>
|
||||||
<div id="log-container">
|
<div id="log-container"style="height:700px;border:1px solid black;">
|
||||||
<pre id="log-content"></pre>
|
<!-- <pre id="log-content"></pre> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-primary" id="logRefreshButton" value="Refresh">Refresh</button>
|
<button type="button" class="btn btn-primary" id="logRefreshButton" value="Refresh">Refresh</button>
|
||||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
<button type="button" class="btn btn-secondary" id="closeLogModal" data-bs-dismiss="modal">Close</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -1166,9 +1166,9 @@
|
|||||||
<!-- <script src="/static/js/archivetables.js?v=1.05"></script> -->
|
<!-- <script src="/static/js/archivetables.js?v=1.05"></script> -->
|
||||||
<!-- archiveTables split into separate files -->
|
<!-- archiveTables split into separate files -->
|
||||||
<script src="/static/js/tables/archivetable/init.js?v=1.12"></script>
|
<script src="/static/js/tables/archivetable/init.js?v=1.12"></script>
|
||||||
<script src="/static/js/tables/archivetable/functions.js?v=1.10"></script>
|
<script src="/static/js/tables/archivetable/functions.js?v=1.11"></script>
|
||||||
<script src="/static/js/tables/archivetable/modals.js?v=1.07"></script>
|
<script src="/static/js/tables/archivetable/modals.js?v=1.07"></script>
|
||||||
<script src="/static/js/tables/archivetable/handlers.js?v=1.09"></script>
|
<script src="/static/js/tables/archivetable/handlers.js?v=1.11"></script>
|
||||||
|
|
||||||
<!-- Runmanager functionality -->
|
<!-- Runmanager functionality -->
|
||||||
<script src="/static/js/tables/runmanager/init.js?v=1.1"></script>
|
<script src="/static/js/tables/runmanager/init.js?v=1.1"></script>
|
||||||
@ -1178,7 +1178,7 @@
|
|||||||
|
|
||||||
<script src="/static/js/livewebsocket.js?v=1.02"></script>
|
<script src="/static/js/livewebsocket.js?v=1.02"></script>
|
||||||
<script src="/static/js/realtimechart.js?v=1.02"></script>
|
<script src="/static/js/realtimechart.js?v=1.02"></script>
|
||||||
<script src="/static/js/mytables.js?v=1.02"></script>
|
<script src="/static/js/mytables.js?v=1.03"></script>
|
||||||
<script src="/static/js/testlist.js?v=1.01"></script>
|
<script src="/static/js/testlist.js?v=1.01"></script>
|
||||||
<script src="/static/js/ml.js?v=1.02"></script>
|
<script src="/static/js/ml.js?v=1.02"></script>
|
||||||
<script src="/static/js/common.js?v=1.01"></script>
|
<script src="/static/js/common.js?v=1.01"></script>
|
||||||
|
|||||||
@ -90,9 +90,55 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
monaco.languages.register({ id: 'python' });
|
monaco.languages.register({ id: 'python' });
|
||||||
monaco.languages.register({ id: 'json' });
|
monaco.languages.register({ id: 'json' });
|
||||||
|
//Register mylogs language
|
||||||
|
monaco.languages.register({ id: 'mylogs' });
|
||||||
// Register the TOML language
|
// Register the TOML language
|
||||||
|
monaco.languages.setLanguageConfiguration('mylogs', {
|
||||||
|
comments: {
|
||||||
|
lineComment: '//', // Adjust if your logs use a different comment symbol
|
||||||
|
},
|
||||||
|
brackets: [['[', ']'], ['{', '}']], // Array and object brackets
|
||||||
|
autoClosingPairs: [
|
||||||
|
{ open: '{', close: '}', notIn: ['string'] },
|
||||||
|
{ open: '"', close: '"', notIn: ['string', 'comment'] },
|
||||||
|
{ open: "'", close: "'", notIn: ['string', 'comment'] },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
monaco.languages.setMonarchTokensProvider('mylogs', {
|
||||||
|
tokenizer: {
|
||||||
|
root: [
|
||||||
|
[/#.*/, 'comment'], // Comments (if applicable)
|
||||||
|
|
||||||
|
// Timestamps
|
||||||
|
[/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+/, 'timestamp'],
|
||||||
|
|
||||||
|
// Log Levels
|
||||||
|
[/\b(INFO|DEBUG|WARNING|ERROR|CRITICAL)\b/, 'log-level'],
|
||||||
|
|
||||||
|
// Strings
|
||||||
|
[/".*"/, 'string'],
|
||||||
|
[/'.*'/, 'string'],
|
||||||
|
|
||||||
|
// Key-Value Pairs
|
||||||
|
[/[A-Za-z_]+\s*:/, 'key'],
|
||||||
|
[/-?\d+\.\d+/, 'number.float'], // Floating-point
|
||||||
|
[/-?\d+/, 'number.integer'], // Integers
|
||||||
|
[/\btrue\b/, 'boolean.true'],
|
||||||
|
[/\bfalse\b/, 'boolean.false'],
|
||||||
|
|
||||||
|
// Other Words and Symbols
|
||||||
|
[/[A-Za-z_]+/, 'identifier'],
|
||||||
|
[/[ \t\r\n]+/, 'white'],
|
||||||
|
[/[\[\]{}(),]/, 'delimiter'], // Expand if more delimiters exist
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
monaco.languages.register({ id: 'toml' });
|
monaco.languages.register({ id: 'toml' });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Define the TOML language configuration
|
// Define the TOML language configuration
|
||||||
monaco.languages.setLanguageConfiguration('toml', {
|
monaco.languages.setLanguageConfiguration('toml', {
|
||||||
comments: {
|
comments: {
|
||||||
|
|||||||
@ -6,6 +6,7 @@ let editor_diff_arch1
|
|||||||
let editor_diff_arch2
|
let editor_diff_arch2
|
||||||
var archData = null
|
var archData = null
|
||||||
var batchHeaders = []
|
var batchHeaders = []
|
||||||
|
var editorLog = null
|
||||||
|
|
||||||
function refresh_arch_and_callback(row, callback) {
|
function refresh_arch_and_callback(row, callback) {
|
||||||
//console.log("entering refresh")
|
//console.log("entering refresh")
|
||||||
@ -472,13 +473,28 @@ function refresh_logfile() {
|
|||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success:function(response){
|
success:function(response){
|
||||||
|
if (editorLog) {
|
||||||
|
editorLog.dispose();
|
||||||
|
}
|
||||||
if (response.lines.length == 0) {
|
if (response.lines.length == 0) {
|
||||||
$('#log-content').html("no records");
|
value = "no records";
|
||||||
|
// $('#log-content').html("no records");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var escapedLines = response.lines.map(line => escapeHtml(line));
|
//console.log(response.lines)
|
||||||
$('#log-content').html(escapedLines.join('\n'));
|
//var escapedLines = response.lines.map(line => escapeHtml(line));
|
||||||
|
value = response.lines.join('\n')
|
||||||
|
// $('#log-content').html(escapedLines.join('\n'));
|
||||||
}
|
}
|
||||||
|
require(["vs/editor/editor.main"], () => {
|
||||||
|
editorLog = monaco.editor.create(document.getElementById('log-container'), {
|
||||||
|
value: value,
|
||||||
|
language: 'mylogs',
|
||||||
|
theme: 'tomlTheme-dark',
|
||||||
|
automaticLayout: true,
|
||||||
|
readOnly: true
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
var err = eval("(" + xhr.responseText + ")");
|
var err = eval("(" + xhr.responseText + ")");
|
||||||
|
|||||||
@ -265,8 +265,8 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
$('#diff_first').text(record1.name);
|
$('#diff_first').text(record1.name);
|
||||||
$('#diff_second').text(record2.name);
|
$('#diff_second').text(record2.name);
|
||||||
$('#diff_first_id').text(data1.id);
|
$('#diff_first_id').text(data1.id + ' Batch: ' + data1.batch_id);
|
||||||
$('#diff_second_id').text(data2.id);
|
$('#diff_second_id').text(data2.id + ' Batch: ' + data2.batch_id);
|
||||||
|
|
||||||
//monaco
|
//monaco
|
||||||
require(["vs/editor/editor.main"], () => {
|
require(["vs/editor/editor.main"], () => {
|
||||||
@ -358,8 +358,13 @@ $(document).ready(function () {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#closeLogModal').click(function () {
|
||||||
|
editorLog.dispose()
|
||||||
|
});
|
||||||
|
|
||||||
//button to query log
|
//button to query log
|
||||||
$('#logRefreshButton').click(function () {
|
$('#logRefreshButton').click(function () {
|
||||||
|
editorLog.dispose()
|
||||||
refresh_logfile()
|
refresh_logfile()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user